diff gui/src/main-window.cc @ 14767:89c64340e9ab gui

Extended event based communication model. * octave-event-listener.h: New interface for event listeners. * octave-qt-event-listener: Implementation ov event listener for Qt. * main-window: Added event listener and connected signals. * octave-event-observer.h: Renamed ignore-method and added comments. * octave-event.h: Removed type information and added process method instead. * octave-link: Removed QObject subclassing. * src.pro: Added new files to project. * workspace-model: Removed QTimer, since it not in a Qt event loop anymore. * workspace-view: Added QTimer from the model temporarily.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Mon, 04 Jun 2012 16:08:44 +0200
parents 3df7ef0080c7
children ec76264adca9
line wrap: on
line diff
--- a/gui/src/main-window.cc
+++ b/gui/src/main-window.cc
@@ -34,6 +34,14 @@
 {
   // We have to set up all our windows, before we finally launch octave.
   construct ();
+  _octave_qt_event_listener = new octave_qt_event_listener ();
+  octave_link::instance ()->register_event_listener (_octave_qt_event_listener);
+
+  connect (_octave_qt_event_listener,
+           SIGNAL (current_directory_changed(QString)),
+           this,
+           SLOT (update_current_working_directory(QString)));
+
   octave_link::instance ()->launch_octave();
 }
 
@@ -168,8 +176,8 @@
 
   if (!selectedDirectory.isEmpty ())
     {
-      _terminal->sendText (QString ("cd \'%1\'\n").arg (selectedDirectory));
-      _terminal->setFocus ();
+      octave_link::instance ()
+          ->request_working_directory_change (selectedDirectory.toStdString ());
     }
 }
 
@@ -429,8 +437,8 @@
            _terminal,                   SLOT   (copyClipboard ()));
   connect (paste_action,                SIGNAL (triggered()),
            _terminal,                   SLOT   (pasteClipboard ()));
-  connect (octave_link::instance (),    SIGNAL (working_directory_changed (QString)),
-           this,                        SLOT (update_current_working_directory (QString)));
+//  connect (octave_link::instance (),    SIGNAL (working_directory_changed (QString)),
+//           this,                        SLOT (update_current_working_directory (QString)));
   connect (_current_directory_combo_box, SIGNAL (activated (QString)),
            this,                        SLOT (change_current_working_directory (QString)));