Mercurial > octave-nkf
annotate gui/src/backend/OctaveCallbackThread.cpp @ 14599:97cb9286919c gui
Cleaned up code.
* .hgsub: Removed IRC Widget.
* gui.pro: Removed dependency on IRC Widget and removed files.
* class FileEditorMdiSubWindow: Renamed to FileEditor. File editor windows are now independent windows, thus removed the extra close button.
* MainWindow: Removed MDI Area and replaced it with the terminal instead.
* BrowserWidget: Removed browser widget.
* SettingsDialog: Rearranged settings for the editor, removed tab for shortcuts.
* OctaveCallbackThread: Raised update intervals from 0,5s to 1s.
* OctaveLink: Replaced signals names for triggering updates on the symbol table.
* WorkspaceView: Adjusted connect statements to fit the new signal names.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Mon, 07 May 2012 00:53:54 +0200 |
parents | faece6b2ab90 |
children |
rev | line source |
---|---|
13543
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
13543
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
3 * |
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
4 * This program is free software: you can redistribute it and/or modify |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13683
diff
changeset
|
5 * it under the terms of the GNU General Public License as |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
7 * License, or (at your option) any later version. |
13543
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
8 * |
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
9 * This program is distributed in the hope that it will be useful, |
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13683
diff
changeset
|
12 * GNU General Public License for more details. |
13543
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
13 * |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13683
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13543
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
13543
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
16 */ |
8d529f8103dc
Separated backend files to folder.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
17 |
13540
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
18 #include "OctaveCallbackThread.h" |
13541
b48ac9ad8de0
Highly improved separation of model and view classes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13540
diff
changeset
|
19 #include "MainWindow.h" |
13540
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
20 |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
21 OctaveCallbackThread::OctaveCallbackThread (QObject * parent) |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
22 : QThread (parent) |
13540
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
23 { |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
24 m_runningSemaphore = new QSemaphore(1); |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
25 m_running = true; |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
26 } |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
27 |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
28 void |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
29 OctaveCallbackThread::halt () |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
30 { |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
31 m_runningSemaphore->acquire (); |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
32 m_running = false; |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
33 m_runningSemaphore->release (); |
13540
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
34 } |
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
35 |
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
36 void |
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
37 OctaveCallbackThread::run () |
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
38 { |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
39 bool running = true; |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
40 while (running) |
13540
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
41 { |
14599
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
42 OctaveLink::instance ()->triggerUpdateSymbolTable (); |
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
43 OctaveLink::instance ()->triggerUpdateHistoryModel (); |
97cb9286919c
Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
44 usleep (1000000); |
13677
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
45 |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
46 m_runningSemaphore->acquire (); |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
47 running = m_running; |
f27573828e92
Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
48 m_runningSemaphore->release (); |
13540
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
49 } |
0dbf8681cd08
Seperated classes into own files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
50 } |