Mercurial > hg > octave-nkf
annotate gui/src/MainWindow.h @ 14318:df86157a4912 gui
Re-enable MSVC/Win32 compilation.
* gui/src/MainWindow.h: Include <QCloseEvent>.
* gui/src/msvc.pri: New file
* gui/src/src.pro: Use it.
* .hgsubstate: Update to current tip of qirc and qterminal repos.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Thu, 02 Feb 2012 22:32:30 +0000 |
parents | 3b6177bd63b0 |
children | fa52c6e84ae0 |
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 | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14269
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:
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 | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14269
diff
changeset
|
12 * GNU General Public License for more details. |
13501 | 13 * |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14269
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:
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> |
14318
df86157a4912
Re-enable MSVC/Win32 compilation.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
14308
diff
changeset
|
30 #include <QCloseEvent> |
13537
a43ecce77eec
Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
31 #include "ResourceManager.h" |
13501 | 32 #include "OctaveLink.h" |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13680
diff
changeset
|
33 #include "WorkspaceView.h" |
13501 | 34 #include "HistoryDockWidget.h" |
35 #include "FilesDockWidget.h" | |
36 #include "BrowserWidget.h" | |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
37 #include "lexer/lexeroctavegui.h" |
14255
5dcfb705ce12
GUI: Bundled the new qterminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13869
diff
changeset
|
38 #include "QTerminal.h" |
14269
4a6867289e24
Removed the old IRC Client code and replaced it by qirc.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14255
diff
changeset
|
39 #include "QIRCWidget.h" |
13501 | 40 |
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
|
41 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
|
42 { |
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 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
|
44 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
|
45 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
|
46 : 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
|
47 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
|
48 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
|
49 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
|
50 { |
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 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
|
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 }; |
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
|
54 |
13501 | 55 /** |
56 * \class MainWindow | |
57 * | |
58 * Represents the main window. | |
59 */ | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
60 class MainWindow:public QMainWindow |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
61 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
62 Q_OBJECT public: |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
63 MainWindow (QWidget * parent = 0); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
64 ~MainWindow (); |
13501 | 65 |
14255
5dcfb705ce12
GUI: Bundled the new qterminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13869
diff
changeset
|
66 QTerminal *terminalView () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
67 { |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
68 return m_terminalView; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
69 } |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13680
diff
changeset
|
70 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
71 HistoryDockWidget *historyDockWidget () |
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 return m_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 FilesDockWidget *filesDockWidget () |
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 return m_filesDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
78 } |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
79 bool isCloseApplication () |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
80 { |
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
81 return m_closeApplication; |
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 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13533
diff
changeset
|
84 signals: |
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13533
diff
changeset
|
85 void settingsChanged (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
86 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13533
diff
changeset
|
87 public slots: |
13532
fd87d6f7e185
Dock windows are now selectable form the menus.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13530
diff
changeset
|
88 void handleOpenFileRequest (QString fileName); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
89 void reportStatusMessage (QString statusMessage); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
90 void openWebPage (QString url); |
14308
3b6177bd63b0
Removed chat and chat settings, instead made a separate menu entry in the community menu.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14290
diff
changeset
|
91 void openChat (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
92 void handleSaveWorkspaceRequest (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
93 void handleLoadWorkspaceRequest (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
94 void handleClearWorkspaceRequest (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
95 void handleCommandDoubleClicked (QString command); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
96 void alignMdiWindows (); |
13530
8c7390b78911
gui-editor: open new editor window via interface menu
ttl <ttl@justmail.de>
parents:
13528
diff
changeset
|
97 void openEditor (); |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
98 void openEditorFile (QString fileName); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
99 void openBugTrackerPage (); |
13533
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
100 void openAgoraPage (); |
edaf8e72070e
Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13532
diff
changeset
|
101 void openOctaveForgePage (); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
102 void processSettingsDialogRequest (); |
13548
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
103 void showAboutOctave (); |
5c2ea445e100
Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13541
diff
changeset
|
104 void showAboutQt (); |
13501 | 105 |
106 protected: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
107 void closeEvent (QCloseEvent * closeEvent); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
108 void readSettings (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
109 void writeSettings (); |
13501 | 110 |
111 private: | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
112 void construct (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
113 void establishOctaveLink (); |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
114 QMdiArea *m_centralMdiArea; |
13501 | 115 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
116 // Mdi sub windows. |
14255
5dcfb705ce12
GUI: Bundled the new qterminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13869
diff
changeset
|
117 QTerminal *m_terminalView; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
118 BrowserWidget *m_documentationWidget; |
14269
4a6867289e24
Removed the old IRC Client code and replaced it by qirc.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14255
diff
changeset
|
119 QIRCWidget *m_ircWidget; |
13501 | 120 |
13648
da69cec2459f
Renamed OctaveTerminal to TerminalView.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13626
diff
changeset
|
121 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
|
122 NonClosableMdiSubWindow *m_documentationWidgetSubWindow; |
13501 | 123 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
124 // Dock widgets. |
13683
25dc40d24a44
Renamed VariablesDockWidget to WorkspaceView and optimized memory footprint for 30%.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13680
diff
changeset
|
125 WorkspaceView *m_workspaceView; |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
126 HistoryDockWidget *m_historyDockWidget; |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
127 FilesDockWidget *m_filesDockWidget; |
13501 | 128 |
13558
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
129 // Editor's lexer |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
130 LexerOctaveGui *m_lexer; |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
131 QsciAPIs *m_lexerAPI; |
248b897d9f36
editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents:
13548
diff
changeset
|
132 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
133 // Toolbars. |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
134 QStatusBar *m_statusBar; |
13562
a89aa9e05e19
editor: menu bar, run editor file in octave
ttl <ttl@justmail.de>
parents:
13558
diff
changeset
|
135 |
13657
347dfbea2c8a
modified editor files can be saved when main window is closed
ttl <ttl@justmail.de>
parents:
13648
diff
changeset
|
136 // 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
|
137 bool m_closeApplication; |
13501 | 138 }; |
139 | |
140 #endif // MAINWINDOW_H |