Mercurial > hg > octave-lyh
annotate gui/src/MainWindow.h @ 13674:c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sun, 25 Sep 2011 10:52:42 +0200 |
parents | 347dfbea2c8a |
children | 3a2b09503fed |
rev | line source |
---|---|
13504
13e3d60aff2d
Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13501
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:
13657
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
13501 | 3 * |
4 * This program is free software: you can redistribute it and/or modify | |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13657
diff
changeset
|
5 * it under the terms of the GNU Affero General Public License as |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13657
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:
13657
diff
changeset
|
7 * License, or (at your option) any later version. |
13501 | 8 * |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13657
diff
changeset
|
12 * GNU Affero General Public License for more details. |
13501 | 13 * |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13657
diff
changeset
|
14 * You should have received a copy of the GNU Affero General Public License |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13657
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
13501 | 16 */ |
17 | |
18 #ifndef MAINWINDOW_H | |
19 #define MAINWINDOW_H | |
20 | |
21 #include <QtGui/QMainWindow> | |
22 #include <QThread> | |
23 #include <QTabWidget> | |
24 #include <QMdiArea> | |
25 #include <QStatusBar> | |
26 #include <QToolBar> | |
27 #include <QQueue> | |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
28 #include <Qsci/qsciapis.h> |
13626
cc90c62ada21
Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13614
diff
changeset
|
29 #include <QMdiSubWindow> |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
30 #include "ResourceManager.h" |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
31 #include "TerminalView.h" |
13501 | 32 #include "OctaveLink.h" |
33 #include "VariablesDockWidget.h" | |
34 #include "HistoryDockWidget.h" | |
35 #include "FilesDockWidget.h" | |
36 #include "BrowserWidget.h" | |
37 #include "IRCWidget.h" | |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
38 #include "lexer/lexeroctavegui.h" |
13501 | 39 |
13614
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
40 class NonClosableMdiSubWindow : public QMdiSubWindow |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
41 { |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
42 Q_OBJECT |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
43 public: |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
44 explicit NonClosableMdiSubWindow (QWidget *parent = 0) |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
45 : QMdiSubWindow (parent) { } |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
46 virtual ~NonClosableMdiSubWindow () { } |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
47 protected: |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
48 void closeEvent (QCloseEvent *closeEvent) |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
49 { |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
50 closeEvent->ignore (); |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
51 } |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
52 }; |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
53 |
13501 | 54 /** |
55 * \class MainWindow | |
56 * | |
57 * Represents the main window. | |
58 */ | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
59 class MainWindow:public QMainWindow |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
60 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
61 Q_OBJECT public: |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
62 MainWindow (QWidget * parent = 0); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
63 ~MainWindow (); |
13501 | 64 |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
65 TerminalView *terminalView () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
66 { |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
67 return m_terminalView; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
68 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
69 VariablesDockWidget *variablesDockWidget () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
70 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
71 return m_variablesDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
72 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
73 HistoryDockWidget *historyDockWidget () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
74 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
75 return m_historyDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
76 } |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
77 FilesDockWidget *filesDockWidget () |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
78 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
79 return m_filesDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
80 } |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
81 bool isCloseApplication () |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
82 { |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
83 return m_closeApplication; |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
84 } |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
85 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13533
diff
changeset
|
86 signals: |
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13533
diff
changeset
|
87 void settingsChanged (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
88 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13533
diff
changeset
|
89 public slots: |
13532
fd87d6f7e185
Dock windows are now selectable form the menus.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13530
diff
changeset
|
90 void handleOpenFileRequest (QString fileName); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
91 void reportStatusMessage (QString statusMessage); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
92 void openWebPage (QString url); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
93 void handleSaveWorkspaceRequest (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
94 void handleLoadWorkspaceRequest (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
95 void handleClearWorkspaceRequest (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
96 void handleCommandDoubleClicked (QString command); |
13611
7f6f339761f9
Chat Window changes logo on new messages.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13562
diff
changeset
|
97 void handleUnreadMessages (bool yes); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
98 void alignMdiWindows (); |
13530
8c7390b78911
gui-editor: open new editor window via interface menu
ttl <ttl@justmail.de>
parents:
13528
diff
changeset
|
99 void openEditor (); |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
100 void openEditorFile (QString fileName); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
101 void openBugTrackerPage (); |
13533
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
102 void openAgoraPage (); |
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
103 void openOctaveForgePage (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
104 void processSettingsDialogRequest (); |
13548
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
105 void showAboutOctave (); |
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
106 void showAboutQt (); |
13501 | 107 |
108 protected: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
109 void closeEvent (QCloseEvent * closeEvent); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
110 void readSettings (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
111 void writeSettings (); |
13501 | 112 |
113 private: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
114 void construct (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
115 void establishOctaveLink (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
116 QMdiArea *m_centralMdiArea; |
13501 | 117 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
118 // Mdi sub windows. |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
119 TerminalView *m_terminalView; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
120 BrowserWidget *m_documentationWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
121 IRCWidget *m_ircWidget; |
13501 | 122 |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
123 NonClosableMdiSubWindow *m_terminalViewSubWindow; |
13614
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
124 NonClosableMdiSubWindow *m_documentationWidgetSubWindow; |
5cb93c6d8aab
Important subwindows are not closable now. A close button is still displayed, which seems to be q Qt bug.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13611
diff
changeset
|
125 NonClosableMdiSubWindow *m_ircWidgetSubWindow; |
13501 | 126 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
127 // Dock widgets. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
128 VariablesDockWidget *m_variablesDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
129 HistoryDockWidget *m_historyDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
130 FilesDockWidget *m_filesDockWidget; |
13501 | 131 |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
132 // Editor's lexer |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
133 LexerOctaveGui *m_lexer; |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
134 QsciAPIs *m_lexerAPI; |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
135 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
136 // Toolbars. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
137 QStatusBar *m_statusBar; |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
138 |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
139 // Flag for closing whole application |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
140 bool m_closeApplication; |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
141 |
13501 | 142 }; |
143 | |
144 #endif // MAINWINDOW_H |