# HG changeset patch # User Torsten # Date 1359480256 -3600 # Node ID 47a4c92924a70ae18d2481dc62b52b41b922b6f3 # Parent f75ffcc82acbbd7e0c769b7f674b793da98eb8ff 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 () diff -r f75ffcc82acb -r 47a4c92924a7 libgui/src/main-window.cc --- 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 ())); diff -r f75ffcc82acb -r 47a4c92924a7 libgui/src/main-window.h --- 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); diff -r f75ffcc82acb -r 47a4c92924a7 libgui/src/octave-gui.cc --- 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 (); } }