Mercurial > octave-nkf
comparison gui/src/octave-adapter/octave-link.h @ 14721:ec76264adca9 gui
Removed last bits of Qt from octave_link.
* main-window: Made subclass from octave_event_observer.
* octave-event-listener: Added new listener method to interface.
* octave-link: Removed last bits of Qt.
* octave-qt-event-listener: Implemented new listener method.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Mon, 04 Jun 2012 22:03:18 +0200 |
parents | cecc7da96e2a |
children | 7784625acf66 |
comparison
equal
deleted
inserted
replaced
14720:cecc7da96e2a | 14721:ec76264adca9 |
---|---|
51 #include "octave/sysdep.h" | 51 #include "octave/sysdep.h" |
52 #include "octave/ov.h" | 52 #include "octave/ov.h" |
53 #include "octave/unwind-prot.h" | 53 #include "octave/unwind-prot.h" |
54 #include "octave/utils.h" | 54 #include "octave/utils.h" |
55 #include "octave/variables.h" | 55 #include "octave/variables.h" |
56 #include "oct-mutex.h" | |
56 | 57 |
57 // Standard includes | 58 // Standard includes |
58 #include <iostream> | 59 #include <iostream> |
59 #include <string> | 60 #include <string> |
60 #include <vector> | 61 #include <vector> |
61 #include <readline/readline.h> | 62 #include <readline/readline.h> |
62 #include <queue> | 63 #include <queue> |
63 | |
64 // Qt includes | |
65 #include <QSemaphore> | |
66 | 64 |
67 #include "workspace-model.h" | 65 #include "workspace-model.h" |
68 #include "octave-main-thread.h" | 66 #include "octave-main-thread.h" |
69 #include "octave-event.h" | 67 #include "octave-event.h" |
70 #include "octave-event-observer.h" | 68 #include "octave-event-observer.h" |
81 */ | 79 */ |
82 class octave_link : public octave_event_observer | 80 class octave_link : public octave_event_observer |
83 { | 81 { |
84 public: | 82 public: |
85 /** Provides a way to access the unique octave_link object. */ | 83 /** Provides a way to access the unique octave_link object. */ |
86 static octave_link * | 84 static octave_link * instance () { return &_singleton; } |
87 instance () { return &_singleton; } | |
88 | 85 |
89 /** Starts octave. */ | 86 /** Starts octave. */ |
90 void launch_octave (); | 87 void launch_octave (); |
91 void register_event_listener (octave_event_listener *oel); | 88 void register_event_listener (octave_event_listener *oel); |
92 | 89 |
94 void process_events (); | 91 void process_events (); |
95 void post_event (octave_event *e); | 92 void post_event (octave_event *e); |
96 void event_accepted (octave_event *e); | 93 void event_accepted (octave_event *e); |
97 void event_reject (octave_event *e); | 94 void event_reject (octave_event *e); |
98 | 95 |
99 void request_working_directory_change (std::string directory); | 96 void about_to_exit (); |
100 void request_octave_exit (); | |
101 | |
102 private: | 97 private: |
103 /** Singleton. */ | 98 /** Singleton. */ |
104 octave_link (); | 99 octave_link (); |
105 ~octave_link (); | 100 ~octave_link (); |
106 | 101 |
108 | 103 |
109 /** Thread running octave_main. */ | 104 /** Thread running octave_main. */ |
110 octave_main_thread *_octave_main_thread; | 105 octave_main_thread *_octave_main_thread; |
111 | 106 |
112 /** Semaphore to lock access to the event queue. */ | 107 /** Semaphore to lock access to the event queue. */ |
113 QSemaphore *_event_queue_semaphore; | 108 octave_mutex *_event_queue_mutex; |
114 | 109 |
115 /** Buffer for queueing events until they will be processed. */ | 110 /** Buffer for queueing events until they will be processed. */ |
116 std::queue <octave_event *> _event_queue; | 111 std::queue <octave_event *> _event_queue; |
117 | 112 |
118 /** Stores the last known current working directory of octave. */ | 113 /** Stores the last known current working directory of octave. */ |