changeset 14693:c952f1e35e50 gui

Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings. * FileEditorTab: Parameter of setModified was not used properly. * OctaveLink: Exit status was not used, surrounded with Q_UNUSED. * MainWindow: Added prepareQuit slot to always save settings before quiting.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Sun, 27 May 2012 23:42:00 +0200
parents d6d250812c01
children ea11c9d8aa47
files .hgsubstate gui/src/MainWindow.cpp gui/src/MainWindow.h gui/src/backend/OctaveLink.cpp gui/src/editor/FileEditorTab.cpp gui/src/editor/FileEditorTab.h
diffstat 6 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Sun May 27 13:54:03 2012 +0200
+++ b/.hgsubstate	Sun May 27 23:42:00 2012 +0200
@@ -1,2 +1,2 @@
 f9813bce2c06a6130a68db4478d1b16ddadaf276 gnulib
-a81f99b9b77d9a402b92463b41c5fdb82324349a gui/qterminal
+5c51db4e3b1fcce6a05c59af5be78f43ebc24db4 gui/qterminal
--- a/gui/src/MainWindow.cpp	Sun May 27 13:54:03 2012 +0200
+++ b/gui/src/MainWindow.cpp	Sun May 27 23:42:00 2012 +0200
@@ -138,6 +138,12 @@
 }
 
 void
+MainWindow::prepareForQuit ()
+{
+  writeSettings ();
+}
+
+void
 MainWindow::showAboutOctave ()
 {
   QString message =
@@ -168,7 +174,7 @@
   reportStatusMessage (tr ("Saving data and shutting down."));
   writeSettings ();
   m_closing = true;  // inform editor window that whole application is closed
-  OctaveLink::instance ()->terminateOctave();
+  OctaveLink::instance ()->terminateOctave ();
 
   QMainWindow::closeEvent (closeEvent);
 }
@@ -220,7 +226,13 @@
   m_terminal = new QTerminal(this);
   m_terminalDockWidget = new TerminalDockWidget (m_terminal, this);
 
-  //setCentralWidget (new QWidget (this));
+  /*
+  QWidget *dummyWidget = new QWidget ();
+  dummyWidget->setObjectName ("DummyWidget");
+  dummyWidget->setFixedSize (100, 100);
+  dummyWidget->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
+  setCentralWidget (dummyWidget);*/
+  //dummyWidget->hide ();
 
   m_fileEditor = new FileEditor (m_terminal, this);
 
@@ -277,9 +289,9 @@
   showCommandWindowAction->setCheckable (true);
   QAction *showWorkspaceAction = windowMenu->addAction (tr ("Workspace"));
   showWorkspaceAction->setCheckable (true);
-  QAction *showHistoryAction = windowMenu->addAction (tr ("History"));
+  QAction *showHistoryAction = windowMenu->addAction (tr ("Command History"));
   showHistoryAction->setCheckable (true);
-  QAction *showFileBrowserAction = windowMenu->addAction (tr ("File Browser"));
+  QAction *showFileBrowserAction = windowMenu->addAction (tr ("Current Directory"));
   showFileBrowserAction->setCheckable (true);
   QAction *showEditorAction = windowMenu->addAction (tr ("Editor"));
   showEditorAction->setCheckable (true);
@@ -308,6 +320,8 @@
   mainToolBar->addWidget (m_currentDirectoryToolButton);
   mainToolBar->addWidget (m_currentDirectoryUpToolButton);
 
+  connect (qApp, SIGNAL(aboutToQuit ()), this, SLOT (prepareForQuit ()));
+
   connect (settingsAction, SIGNAL (triggered ()), this, SLOT (processSettingsDialogRequest ()));
   connect (exitAction, SIGNAL (triggered ()), this, SLOT (close ()));
   connect (newFileAction, SIGNAL (triggered ()), this, SLOT (newFile ()));
--- a/gui/src/MainWindow.h	Sun May 27 13:54:03 2012 +0200
+++ b/gui/src/MainWindow.h	Sun May 27 23:42:00 2012 +0200
@@ -90,6 +90,7 @@
   void processSettingsDialogRequest ();
   void showAboutOctave ();
   void updateTerminalFont ();
+  void prepareForQuit ();
 
 protected:
   void closeEvent (QCloseEvent * closeEvent);
--- a/gui/src/backend/OctaveLink.cpp	Sun May 27 13:54:03 2012 +0200
+++ b/gui/src/backend/OctaveLink.cpp	Sun May 27 23:42:00 2012 +0200
@@ -30,6 +30,7 @@
 
 void octave_exit_hook (int status)
 {
+  Q_UNUSED (status);
   OctaveLink::instance ()->terminateOctave ();
 }
 
--- a/gui/src/editor/FileEditorTab.cpp	Sun May 27 13:54:03 2012 +0200
+++ b/gui/src/editor/FileEditorTab.cpp	Sun May 27 23:42:00 2012 +0200
@@ -319,7 +319,7 @@
 void
 FileEditorTab::setModified (bool modified)
 {
-  m_editArea->setModified (true);
+  m_editArea->setModified (modified);
 }
 
 bool
--- a/gui/src/editor/FileEditorTab.h	Sun May 27 13:54:03 2012 +0200
+++ b/gui/src/editor/FileEditorTab.h	Sun May 27 23:42:00 2012 +0200
@@ -47,7 +47,7 @@
   void undo ();
   void redo ();
 
-  void setModified (bool modified);
+  void setModified (bool modified = true);
 
   bool openFile();
   void loadFile (QString fileName);