changeset 15987:47a4c92924a7

gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4) * main-window.h: declaration of new function connect_visibility_changed () * main-window.cc (connect_visibility_changed): new function for connecting the signales emitted when the visibility of a widget changes; this function must be called after the main window is shown * main-window.cc (construct): do not connect the signals here * octave-gui.cc (octave_start_gui): call connect_visibility_changed () just before calling application.exec ()
author Torsten <ttl@justmail.de>
date Tue, 29 Jan 2013 18:24:16 +0100
parents f75ffcc82acb
children 38348a6c3db0 696e82182eba
files libgui/src/main-window.cc libgui/src/main-window.h libgui/src/octave-gui.cc
diffstat 3 files changed, 27 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc	Sun Jan 27 12:29:00 2013 +0100
+++ b/libgui/src/main-window.cc	Tue Jan 29 18:24:16 2013 +0100
@@ -616,6 +616,30 @@
   settings->sync ();
 }
 
+
+// Connecting the signals emitted when the visibility of a widget changes.
+// This has to be done after the window is shown (see octave-gui.cc)
+void
+main_window::connect_visibility_changed ()
+{
+  connect (_terminal_dock_widget, SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_command_window_visible (bool)));
+  connect (_workspace_view,       SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_workspace_visible (bool)));
+  connect (_history_dock_widget,  SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_command_history_visible (bool)));
+  connect (_files_dock_widget,    SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_current_directory_visible (bool)));
+#ifdef HAVE_QSCINTILLA
+  connect (_file_editor,          SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_editor_visible (bool)));
+#endif
+  connect (_documentation_dock_widget,  SIGNAL (visibilityChanged (bool)),
+           this,                  SLOT (handle_documentation_visible (bool)));
+}
+
+
+// Main subroutine of the constructor
 void
 main_window::construct ()
 {
@@ -992,20 +1016,6 @@
            this,                        SLOT (focus_editor ()));
   connect (documentation_action,        SIGNAL (triggered ()),
            this,                        SLOT (focus_documentation ()));
-  connect (_terminal_dock_widget,       SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_command_window_visible (bool)));
-  connect (_workspace_view,             SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_workspace_visible (bool)));
-  connect (_history_dock_widget,        SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_command_history_visible (bool)));
-  connect (_files_dock_widget,          SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_current_directory_visible (bool)));
-#ifdef HAVE_QSCINTILLA
-  connect (_file_editor,                SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_editor_visible (bool)));
-#endif
-  connect (_documentation_dock_widget,  SIGNAL (visibilityChanged (bool)),
-           this,                        SLOT (handle_documentation_visible (bool)));
 
   connect (reset_windows_action,        SIGNAL (triggered ()),
            this,                        SLOT   (reset_windows ()));
--- a/libgui/src/main-window.h	Sun Jan 27 12:29:00 2013 +0100
+++ b/libgui/src/main-window.h	Tue Jan 29 18:24:16 2013 +0100
@@ -123,6 +123,7 @@
 
   void read_settings ();
   void write_settings ();
+  void connect_visibility_changed ();
 
 protected:
   void closeEvent (QCloseEvent * closeEvent);
--- a/libgui/src/octave-gui.cc	Sun Jan 27 12:29:00 2013 +0100
+++ b/libgui/src/octave-gui.cc	Tue Jan 29 18:24:16 2013 +0100
@@ -109,7 +109,8 @@
                                // but before showing
           w.show ();
           w.focus_command_window ();
-
+          w.connect_visibility_changed (); // connect signals for changes in
+                                           // visibility not before w is shown
           return application.exec ();
         }
     }