changeset 16455:38ed6bdd1f7f

move signal/slot connections from main window to sub window where possible * main-window.cc (main_window::construct): Move the following signal/slot connections to their respective sub-windows. main_window::settings_changed to _file_editor::notice_settings. main_window::settings_changed to command_window::notice_settings. main_window::settings_changed to file_browser_window::notice_settings. file_browser_window::open_file to main_window::open_file. file_browser_window::displayed_directory_changed to main_window::set_current_working_directory. main_window::relay_command_signal to command_window::relay_command. history_window::command_create_script to main_window::new_file.
author John W. Eaton <jwe@octave.org>
date Sun, 07 Apr 2013 04:29:10 -0400
parents 246d25c8761b
children 203efbbcea63
files libgui/src/files-dockwidget.cc libgui/src/history-dockwidget.cc libgui/src/m-editor/file-editor.cc libgui/src/main-window.cc libgui/src/terminal-dockwidget.cc
diffstat 5 files changed, 20 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/files-dockwidget.cc	Sun Apr 07 04:14:31 2013 -0400
+++ b/libgui/src/files-dockwidget.cc	Sun Apr 07 04:29:10 2013 -0400
@@ -47,6 +47,12 @@
 
   setWidget (container);
 
+  connect (this, SIGNAL (open_file (const QString&)),
+           parent (), SLOT (open_file (const QString&)));
+
+  connect (this, SIGNAL (displayed_directory_changed (const QString&)),
+           parent (), SLOT (set_current_working_directory (const QString&)));
+
   // Create a toolbar
   _navigation_tool_bar = new QToolBar ("", container);
   _navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea);
--- a/libgui/src/history-dockwidget.cc	Sun Apr 07 04:14:31 2013 -0400
+++ b/libgui/src/history-dockwidget.cc	Sun Apr 07 04:29:10 2013 -0400
@@ -41,8 +41,11 @@
   setObjectName ("HistoryDockWidget");
   setStatusTip (tr ("Browse and search the command history."));
 
-  connect (this, SIGNAL (information (QString)),
-           p, SLOT (report_status_message (QString)));
+  connect (this, SIGNAL (command_create_script (const QString&)),
+           p, SLOT (new_file (const QString&)));
+
+  connect (this, SIGNAL (information (const QString&)),
+           p, SLOT (report_status_message (const QString&)));
 
   connect (this, SIGNAL (command_double_clicked (const QString&)),
            p, SLOT (handle_command_double_clicked (const QString&)));
--- a/libgui/src/m-editor/file-editor.cc	Sun Apr 07 04:14:31 2013 -0400
+++ b/libgui/src/m-editor/file-editor.cc	Sun Apr 07 04:29:10 2013 -0400
@@ -801,6 +801,9 @@
   editor_widget->setLayout (vbox_layout);
   setWidget (editor_widget);
 
+  connect (parent (), SIGNAL (settings_changed (const QSettings *)),
+           this, SLOT (notice_settings (const QSettings *)));
+
   connect (new_action,
            SIGNAL (triggered ()), this, SLOT (request_new_file ()));
   connect (open_action,
--- a/libgui/src/main-window.cc	Sun Apr 07 04:14:31 2013 -0400
+++ b/libgui/src/main-window.cc	Sun Apr 07 04:29:10 2013 -0400
@@ -609,32 +609,9 @@
   connect (qApp, SIGNAL (aboutToQuit ()),
            this, SLOT (prepare_for_quit ()));
 
-#ifdef HAVE_QSCINTILLA
-  connect (this, SIGNAL (settings_changed (const QSettings *)),
-           _file_editor, SLOT (notice_settings (const QSettings *)));
-#endif
-
-  connect (this, SIGNAL (settings_changed (const QSettings *)),
-           command_window, SLOT (notice_settings (const QSettings *)));
-
-  connect (this, SIGNAL (settings_changed (const QSettings *)),
-           file_browser_window, SLOT (notice_settings (const QSettings *)));
-
   connect (this, SIGNAL (settings_changed (const QSettings *)),
            this, SLOT (notice_settings (const QSettings *)));
 
-  connect (file_browser_window, SIGNAL (open_file (QString)),
-           this, SLOT (open_file (QString)));
-
-  connect (file_browser_window, SIGNAL (displayed_directory_changed(QString)),
-           this, SLOT (set_current_working_directory(QString)));
-
-  connect (this, SIGNAL (relay_command_signal (const QString&)),
-           command_window, SLOT (relay_command (const QString&)));
-
-  connect (history_window, SIGNAL (command_create_script (const QString&)),
-           this, SLOT (new_file (const QString&)));
-
   setWindowTitle ("Octave");
 
   setDockOptions (QMainWindow::AnimatedDocks
--- a/libgui/src/terminal-dockwidget.cc	Sun Apr 07 04:14:31 2013 -0400
+++ b/libgui/src/terminal-dockwidget.cc	Sun Apr 07 04:29:10 2013 -0400
@@ -38,9 +38,15 @@
   setWindowTitle (tr ("Command Window"));
   setWidget (&terminal);
 
+  connect (parent (), SIGNAL (settings_changed (const QSettings *)),
+           this, SLOT (notice_settings (const QSettings *)));
+
   connect (this, SIGNAL (visibilityChanged (bool)),
            this, SLOT (handle_visibility (bool)));
 
+  connect (parent (), SIGNAL (relay_command_signal (const QString&)),
+           this, SLOT (relay_command (const QString&)));
+
   // topLevelChanged is emitted when floating property changes (floating
   // = true)
   connect (this, SIGNAL (topLevelChanged (bool)),