diff libgui/src/main-window.cc @ 18031:8695fa048226 stable

make hiding of gui warning bar persistent * main-window.h, main-window.cc (main_window::construct_gui_info_button): New function. (main_window::hide_warning_bar): Use it to make gui info button. (main_window::construct_warning_bar): Likewise. Check preferences and display gui info button if warning bar is hidden.
author John W. Eaton <jwe@octave.org>
date Fri, 29 Nov 2013 12:42:13 -0500
parents 2ef2043a0601
children 482cc05b4f99
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Thu Nov 28 17:02:59 2013 -0800
+++ b/libgui/src/main-window.cc	Fri Nov 29 12:42:13 2013 -0500
@@ -1775,6 +1775,16 @@
 void
 main_window::construct_warning_bar (void)
 {
+  QSettings *settings = resource_manager::get_settings ();
+
+  if (settings
+      && settings->value ("General/hide_new_gui_warning", false).toBool ())
+    {
+      construct_gui_info_button ();
+
+      return;
+    }
+
   _warning_bar = new QDockWidget (this);
   _warning_bar->setAttribute (Qt::WA_DeleteOnClose);
 
@@ -1843,24 +1853,39 @@
 };
 
 void
-main_window::hide_warning_bar (void)
+main_window::construct_gui_info_button (void)
 {
-  removeDockWidget (_warning_bar);
-
   QIcon warning_icon
     = QIcon::fromTheme ("dialog-warning",
                         QIcon (":/actions/icons/warning.png"));
 
-  _warning_bar_info_button
+  _gui_info_button
     = new QPushButton (warning_icon, tr ("Experimental GUI Info"));
 
-  _main_tool_bar->addWidget (_warning_bar_info_button);
-
-  connect (_warning_bar_info_button, SIGNAL (clicked ()),
+  _main_tool_bar->addWidget (_gui_info_button);
+
+  connect (_gui_info_button, SIGNAL (clicked ()),
            this, SLOT (show_gui_info ()));
 }
 
 void
+main_window::hide_warning_bar (void)
+{
+  QSettings *settings = resource_manager::get_settings ();
+
+  if (settings)
+    {
+      settings->setValue ("General/hide_new_gui_warning", true);
+
+      settings->sync ();
+    }
+
+  removeDockWidget (_warning_bar);
+
+  construct_gui_info_button ();
+}
+
+void
 main_window::show_gui_info (void)
 {
   QString gui_info