# HG changeset patch # User Jacob Dawid # Date 1312217496 -7200 # Node ID e440b3f32f023b37cdd9a03b3b2bee62c497d9d1 # Parent 11fcb70949450f5125aa96d8519900bbfcb0d826 Fixed bug with closing subwindows. diff -r 11fcb7094945 -r e440b3f32f02 gui/src/FilesDockWidget.cpp --- a/gui/src/FilesDockWidget.cpp Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/FilesDockWidget.cpp Mon Aug 01 18:51:36 2011 +0200 @@ -97,6 +97,8 @@ QCompleter * completer = new QCompleter (m_fileSystemModel, this); m_currentDirectory->setCompleter (completer); + + connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handleVisibilityChanged(bool))); } void @@ -180,3 +182,17 @@ //if (settings.value ("showHiddenFiles").toBool ()) // TODO: React on option for hidden files. } + +void +FilesDockWidget::handleVisibilityChanged (bool visible) +{ + if (visible) + emit activeChanged (true); +} + +void +FilesDockWidget::closeEvent (QCloseEvent *event) +{ + emit activeChanged (false); + QDockWidget::closeEvent (event); +} diff -r 11fcb7094945 -r e440b3f32f02 gui/src/FilesDockWidget.h --- a/gui/src/FilesDockWidget.h Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/FilesDockWidget.h Mon Aug 01 18:51:36 2011 +0200 @@ -65,10 +65,17 @@ /** Tells the widget to notice settings that are probably new. */ void noticeSettings (); + void handleVisibilityChanged (bool visible); signals: void openFile (QString fileName); + /** Custom signal that tells if a user has clicke away that dock widget. */ + void activeChanged (bool active); + +protected: + void closeEvent (QCloseEvent *event); + private: // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc diff -r 11fcb7094945 -r e440b3f32f02 gui/src/HistoryDockWidget.cpp --- a/gui/src/HistoryDockWidget.cpp Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/HistoryDockWidget.cpp Mon Aug 01 18:51:36 2011 +0200 @@ -49,6 +49,7 @@ connect (m_filterLineEdit, SIGNAL (textEdited (QString)), &m_sortFilterProxyModel, SLOT (setFilterWildcard(QString))); connect (m_historyListView, SIGNAL (doubleClicked (QModelIndex)), this, SLOT (handleDoubleClick (QModelIndex))); + connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handleVisibilityChanged(bool))); } void @@ -62,3 +63,17 @@ { emit commandDoubleClicked (modelIndex.data().toString()); } + +void +HistoryDockWidget::handleVisibilityChanged (bool visible) +{ + if (visible) + emit activeChanged (true); +} + +void +HistoryDockWidget::closeEvent (QCloseEvent *event) +{ + emit activeChanged (false); + QDockWidget::closeEvent (event); +} diff -r 11fcb7094945 -r e440b3f32f02 gui/src/HistoryDockWidget.h --- a/gui/src/HistoryDockWidget.h Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/HistoryDockWidget.h Mon Aug 01 18:51:36 2011 +0200 @@ -35,11 +35,15 @@ public slots: /** Tells the widget to notice settings that are probably new. */ void noticeSettings (); + void handleVisibilityChanged (bool visible); signals: void information (QString message); void commandDoubleClicked (QString command); - + /** Custom signal that tells if a user has clicke away that dock widget. */ + void activeChanged (bool active); +protected: + void closeEvent (QCloseEvent *event); private slots: void handleDoubleClick (QModelIndex modelIndex); diff -r 11fcb7094945 -r e440b3f32f02 gui/src/MainWindow.cpp --- a/gui/src/MainWindow.cpp Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/MainWindow.cpp Mon Aug 01 18:51:36 2011 +0200 @@ -28,7 +28,7 @@ #include "SettingsDialog.h" #include "cmd-edit.h" -#define VERSION_STRING "Octave GUI (0.7.2)" +#define VERSION_STRING "Octave GUI (0.7.3)" MainWindow::MainWindow (QWidget * parent):QMainWindow (parent) { @@ -350,14 +350,12 @@ connect (aboutOctaveAction, SIGNAL (triggered ()), this, SLOT (showAboutOctave ())); connect (aboutQt, SIGNAL (triggered ()), this, SLOT (showAboutQt ())); - // TODO: Visibility cannot be taken as a signal, because it will be emitted even then - // the dock widget is tabbed or minimized. connect (showWorkspaceAction, SIGNAL (toggled (bool)), m_variablesDockWidget, SLOT (setShown (bool))); - //connect (m_variablesDockWidget, SIGNAL (visibilityChanged (bool)), showWorkspaceAction, SLOT (setChecked (bool))); + connect (m_variablesDockWidget, SIGNAL (activeChanged (bool)), showWorkspaceAction, SLOT (setChecked (bool))); connect (showHistoryAction, SIGNAL (toggled (bool)), m_historyDockWidget, SLOT (setShown (bool))); - //connect (m_historyDockWidget, SIGNAL (visibilityChanged (bool)), showHistoryAction, SLOT (setChecked (bool))); + connect (m_historyDockWidget, SIGNAL (activeChanged (bool)), showHistoryAction, SLOT (setChecked (bool))); connect (showFileBrowserAction, SIGNAL (toggled (bool)), m_filesDockWidget, SLOT (setShown (bool))); - //connect (m_filesDockWidget, SIGNAL (visibilityChanged (bool)), showFileBrowserAction, SLOT (setChecked (bool))); + connect (m_filesDockWidget, SIGNAL (activeChanged (bool)), showFileBrowserAction, SLOT (setChecked (bool))); connect (this, SIGNAL (settingsChanged ()), m_variablesDockWidget, SLOT (noticeSettings ())); connect (this, SIGNAL (settingsChanged ()), m_historyDockWidget, SLOT (noticeSettings ())); diff -r 11fcb7094945 -r e440b3f32f02 gui/src/VariablesDockWidget.cpp --- a/gui/src/VariablesDockWidget.cpp Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/VariablesDockWidget.cpp Mon Aug 01 18:51:36 2011 +0200 @@ -67,6 +67,8 @@ m_variablesTreeWidget->expandAll (); m_variablesTreeWidget->setAlternatingRowColors (true); m_variablesTreeWidget->setAnimated (true); + + connect (this, SIGNAL (visibilityChanged(bool)), this, SLOT(handleVisibilityChanged(bool))); } void @@ -203,3 +205,17 @@ QList < SymbolRecord > symbolTable = OctaveLink::instance ()->copyCurrentSymbolTable (); setVariablesList (symbolTable); } + +void +VariablesDockWidget::handleVisibilityChanged (bool visible) +{ + if (visible) + emit activeChanged (true); +} + +void +VariablesDockWidget::closeEvent (QCloseEvent *event) +{ + emit activeChanged (false); + QDockWidget::closeEvent (event); +} diff -r 11fcb7094945 -r e440b3f32f02 gui/src/VariablesDockWidget.h --- a/gui/src/VariablesDockWidget.h Mon Aug 01 18:10:33 2011 +0200 +++ b/gui/src/VariablesDockWidget.h Mon Aug 01 18:51:36 2011 +0200 @@ -35,7 +35,12 @@ /** Tells the widget to notice settings that are probably new. */ void noticeSettings (); void fetchSymbolTable (); - + void handleVisibilityChanged (bool visible); +signals: + /** Custom signal that tells if a user has clicke away that dock widget. */ + void activeChanged (bool active); +protected: + void closeEvent (QCloseEvent *event); private: void construct (); void updateTreeEntry (QTreeWidgetItem * treeItem,