Mercurial > hg > octave-terminal
changeset 13523:103b7bebb38f
Moved load/save/clear workspace into main menu.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Wed, 20 Jul 2011 10:44:42 +0200 |
parents | 09d9cb7c3014 |
children | 8c143d6d0330 2426dd43c593 |
files | gui/src/MainWindow.cpp gui/src/VariablesDockWidget.cpp gui/src/VariablesDockWidget.h |
diffstat | 3 files changed, 14 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/MainWindow.cpp +++ b/gui/src/MainWindow.cpp @@ -232,6 +232,12 @@ QAction *alignWindowsAction = interfaceMenu->addAction (tr ("Align Windows")); + QMenu *workspaceMenu = menuBar ()->addMenu (tr ("Workspace")); + QAction *loadWorkspaceAction = workspaceMenu->addAction (tr ("Load")); + QAction *saveWorkspaceAction = workspaceMenu->addAction (tr ("Save")); + workspaceMenu->addSeparator (); + QAction *clearWorkspaceAction = workspaceMenu->addAction (tr ("Clear")); + QMenu *communityMenu = menuBar ()->addMenu (tr ("Community")); QAction *reportBugAction = communityMenu->addAction (tr ("Report Bug")); @@ -243,7 +249,7 @@ connect (reportBugAction, SIGNAL (triggered ()), this, SLOT (openBugTrackerPage ())); - setWindowTitle (QString ("Octave GUI (0.0.4)")); + setWindowTitle (QString ("Octave GUI (0.1.1)")); setCentralWidget (m_centralMdiArea); addDockWidget (Qt::LeftDockWidgetArea, m_variablesDockWidget); @@ -257,11 +263,11 @@ SLOT (handleOpenFileRequest (QString))); connect (m_historyDockWidget, SIGNAL (information (QString)), this, SLOT (reportStatusMessage (QString))); - connect (m_variablesDockWidget, SIGNAL (saveWorkspace ()), this, + connect (saveWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleSaveWorkspaceRequest ())); - connect (m_variablesDockWidget, SIGNAL (loadWorkspace ()), this, + connect (loadWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleLoadWorkspaceRequest ())); - connect (m_variablesDockWidget, SIGNAL (clearWorkspace ()), this, + connect (clearWorkspaceAction, SIGNAL (triggered ()), this, SLOT (handleClearWorkspaceRequest ())); openWebPage ("http://www.gnu.org/software/octave/doc/interpreter/");
--- a/gui/src/VariablesDockWidget.cpp +++ b/gui/src/VariablesDockWidget.cpp @@ -31,42 +31,21 @@ void VariablesDockWidget::construct () { + setWindowTitle (tr ("Workspace")); + m_updateSemaphore = new QSemaphore (1); QStringList headerLabels; headerLabels << tr ("Name") << tr ("Type") << tr ("Value"); m_variablesTreeWidget = new QTreeWidget (this); m_variablesTreeWidget->setHeaderHidden (false); m_variablesTreeWidget->setHeaderLabels (headerLabels); + + setWidget (new QWidget (this)); QVBoxLayout *layout = new QVBoxLayout (); - - setWindowTitle (tr ("Workspace")); - setWidget (new QWidget ()); - layout->addWidget (m_variablesTreeWidget); - QWidget *buttonBar = new QWidget (this); - layout->addWidget (buttonBar); - - QHBoxLayout *buttonBarLayout = new QHBoxLayout (); - QPushButton *saveWorkspaceButton = new QPushButton (tr ("Save"), buttonBar); - QPushButton *loadWorkspaceButton = new QPushButton (tr ("Load"), buttonBar); - QPushButton *clearWorkspaceButton = - new QPushButton (tr ("Clear"), buttonBar); - buttonBarLayout->addWidget (saveWorkspaceButton); - buttonBarLayout->addWidget (loadWorkspaceButton); - buttonBarLayout->addWidget (clearWorkspaceButton); - buttonBarLayout->setMargin (2); - buttonBar->setLayout (buttonBarLayout); - layout->setMargin (2); widget ()->setLayout (layout); - connect (saveWorkspaceButton, SIGNAL (clicked ()), this, - SLOT (emitSaveWorkspace ())); - connect (loadWorkspaceButton, SIGNAL (clicked ()), this, - SLOT (emitLoadWorkspace ())); - connect (clearWorkspaceButton, SIGNAL (clicked ()), this, - SLOT (emitClearWorkspace ())); - QTreeWidgetItem *treeWidgetItem = new QTreeWidgetItem (); treeWidgetItem->setData (0, 0, QString (tr ("Local"))); m_variablesTreeWidget->insertTopLevelItem (0, treeWidgetItem); @@ -209,21 +188,3 @@ } } } - -void -VariablesDockWidget::emitSaveWorkspace () -{ - emit saveWorkspace (); -} - -void -VariablesDockWidget::emitLoadWorkspace () -{ - emit loadWorkspace (); -} - -void -VariablesDockWidget::emitClearWorkspace () -{ - emit clearWorkspace (); -}
--- a/gui/src/VariablesDockWidget.h +++ b/gui/src/VariablesDockWidget.h @@ -30,14 +30,6 @@ VariablesDockWidget (QWidget * parent = 0); void setVariablesList (QList < SymbolRecord > symbolTable); - signals:void saveWorkspace (); - void loadWorkspace (); - void clearWorkspace (); - - private slots:void emitSaveWorkspace (); - void emitLoadWorkspace (); - void emitClearWorkspace (); - private: void construct (); void updateTreeEntry (QTreeWidgetItem * treeItem,