diff gui/src/main-window.cc @ 14804:a565c560e654 gui

Replaced a lot of terminal interaction with events: Clearing, loading and saving workspace, running a file. Default location for saving a new file is now the current working directory. Fixed bad settings with a fresh installation of the GUI by providing a file with default settings and installing it when appropriate. * default-settings: New file containing the default settings. * file-editor-tab: Subclassed event observer and added code to send a run event. * main-window: Sending workspace events instead of using the terminal. * octave-event: Added new event types. * octave-link: Added getter for the current working directory. * octave-gui: Adjusted code, so the default settings can be loaded. * resource-manager: Added code to handle the logic with a default settings file.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 26 Jun 2012 15:27:10 +0200
parents 625be3eb27c5
children 9d9eb9bac65e
line wrap: on
line diff
--- a/gui/src/main-window.cc	Tue Jun 26 10:54:39 2012 +0200
+++ b/gui/src/main-window.cc	Tue Jun 26 15:27:10 2012 +0200
@@ -78,8 +78,9 @@
   QString selectedFile =
       QFileDialog::getSaveFileName (this, tr ("Save Workspace"),
                                     resource_manager::instance ()->get_home_path ());
-  _terminal->sendText (QString ("save \'%1\'\n").arg (selectedFile));
-  _terminal->setFocus ();
+  octave_link::instance ()
+      ->post_event (new octave_save_workspace_event (*this,
+        selectedFile.toStdString()));
 }
 
 void
@@ -90,16 +91,17 @@
                                     resource_manager::instance ()->get_home_path ());
   if (!selectedFile.isEmpty ())
     {
-      _terminal->sendText (QString ("load \'%1\'\n").arg (selectedFile));
-      _terminal->setFocus ();
+      octave_link::instance ()
+          ->post_event (new octave_load_workspace_event (*this,
+            selectedFile.toStdString()));
     }
 }
 
 void
 main_window::handle_clear_workspace_request ()
 {
-  _terminal->sendText ("clear\n");
-  _terminal->setFocus ();
+  octave_link::instance ()
+      ->post_event (new octave_clear_workspace_event (*this));
 }
 
 void