annotate gui/src/main-window.cc @ 14719: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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: 13666
diff changeset
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
3 *
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
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: 14289
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: 13666
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: 13666
diff changeset
7 * License, or (at your option) any later version.
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
8 *
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
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: 14289
diff changeset
12 * GNU General Public License for more details.
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
13 *
14290
faece6b2ab90 Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14289
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: 13666
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
16 */
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
17
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
18 #include <QMenuBar>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
19 #include <QMenu>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
20 #include <QAction>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
21 #include <QSettings>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
22 #include <QStyle>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
23 #include <QToolBar>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
24 #include <QDesktopServices>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
25 #include <QFileDialog>
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: 13620
diff changeset
26 #include <QMessageBox>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
27 #include <QIcon>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
28
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
29 #include "main-window.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
30 #include "file-editor.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
31 #include "settings-dialog.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
33 main_window::main_window (QWidget * parent):QMainWindow (parent)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
34 {
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
35 // We have to set up all our windows, before we finally launch octave.
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
36 construct ();
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
37 _octave_qt_event_listener = new octave_qt_event_listener ();
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
38 octave_link::instance ()->register_event_listener (_octave_qt_event_listener);
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
39
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
40 connect (_octave_qt_event_listener,
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
41 SIGNAL (current_directory_changed(QString)),
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
42 this,
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
43 SLOT (update_current_working_directory(QString)));
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
44
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
45 octave_link::instance ()->launch_octave();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
46 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
47
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
48 main_window::~main_window ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
49 {
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
50 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
51
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
52 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
53 main_window::new_file ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
54 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
55 _file_editor->request_new_file ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
56 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
58 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
59 main_window::open_file ()
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
60 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
61 _file_editor->request_open_file ();
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
62 }
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
63
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
64 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
65 main_window::report_status_message (QString statusMessage)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
66 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
67 _status_bar->showMessage (statusMessage, 1000);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
68 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
69
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
70 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
71 main_window::handle_save_workspace_request ()
13506
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 QString selectedFile =
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
74 QFileDialog::getSaveFileName (this, tr ("Save Workspace"),
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
75 resource_manager::instance ()->get_home_path ());
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
76 _terminal->sendText (QString ("save \'%1\'\n").arg (selectedFile));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
77 _terminal->setFocus ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
78 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
79
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
80 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
81 main_window::handle_load_workspace_request ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
82 {
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
83 QString selectedFile =
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
84 QFileDialog::getOpenFileName (this, tr ("Load Workspace"),
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
85 resource_manager::instance ()->get_home_path ());
14682
9ea75ea686b5 Allowing nested dock widgets and fixed small bug in loading a workspace.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
86 if (!selectedFile.isEmpty ())
9ea75ea686b5 Allowing nested dock widgets and fixed small bug in loading a workspace.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
87 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
88 _terminal->sendText (QString ("load \'%1\'\n").arg (selectedFile));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
89 _terminal->setFocus ();
14682
9ea75ea686b5 Allowing nested dock widgets and fixed small bug in loading a workspace.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
90 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
91 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
92
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
93 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
94 main_window::handle_clear_workspace_request ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
95 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
96 _terminal->sendText ("clear\n");
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
97 _terminal->setFocus ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
98 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
99
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
100 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
101 main_window::handle_command_double_clicked (QString command)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
102 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
103 _terminal->sendText(command);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
104 _terminal->setFocus ();
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
105 }
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
106
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
107 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
108 main_window::open_bug_tracker_page ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
109 {
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13534
diff changeset
110 QDesktopServices::openUrl (QUrl ("http://savannah.gnu.org/bugs/?group=octave"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
111 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
112
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
113 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
114 main_window::open_agora_page ()
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
115 {
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13534
diff changeset
116 QDesktopServices::openUrl (QUrl ("http://agora.panocha.org.mx/"));
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
117 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
118
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
119 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
120 main_window::open_octave_forge_page ()
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
121 {
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13534
diff changeset
122 QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
123 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
124
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
125 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
126 main_window::process_settings_dialog_request ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
127 {
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
128 settings_dialog *settingsDialog = new settings_dialog (this);
14586
8e9823066dad Fixed bug with not correctly syncing settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14308
diff changeset
129 settingsDialog->exec ();
8e9823066dad Fixed bug with not correctly syncing settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14308
diff changeset
130 delete settingsDialog;
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
131 emit settings_changed ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
132 resource_manager::instance ()->update_network_settings ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
133 notice_settings();
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
134 }
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
135
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
136 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
137 main_window::notice_settings ()
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
138 {
14695
55f88d2236b6 Added copy and paste context menu for the terminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14694
diff changeset
139 // Set terminal font:
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
140 QSettings *settings = resource_manager::instance ()->get_settings ();
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
141 QFont font = QFont();
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
142 font.setFamily(settings->value("terminal/fontName").toString());
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
143 font.setPointSize(settings->value("terminal/fontSize").toInt ());
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
144 _terminal->setTerminalFont(font);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
145 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
146
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
147 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
148 main_window::prepare_for_quit ()
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
149 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
150 write_settings ();
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
151 }
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
152
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
153 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
154 main_window::reset_windows ()
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
155 {
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
156 // TODO: Implement.
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
157 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
158
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
159 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
160 main_window::update_current_working_directory (QString directory)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
161 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
162 if (_current_directory_combo_box->count () > 31)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
163 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
164 _current_directory_combo_box->removeItem (0);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
165 }
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
166 _current_directory_combo_box->addItem (directory);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
167 int index = _current_directory_combo_box->findText (directory);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
168 _current_directory_combo_box->setCurrentIndex (index);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
169 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
170
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
171 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
172 main_window::change_current_working_directory ()
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
173 {
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
174 QString selectedDirectory =
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
175 QFileDialog::getExistingDirectory(this, tr ("Set working direcotry"));
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
176
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
177 if (!selectedDirectory.isEmpty ())
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
178 {
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
179 octave_link::instance ()
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
180 ->request_working_directory_change (selectedDirectory.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
181 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
182 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
183
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
184 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
185 main_window::change_current_working_directory (QString directory)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
186 {
14718
3df7ef0080c7 Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14716
diff changeset
187 octave_link::instance ()->request_working_directory_change (directory.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
188 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
189
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
190 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
191 main_window::current_working_directory_up ()
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
192 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
193 _terminal->sendText ("cd ..\n");
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
194 _terminal->setFocus ();
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
195 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
196
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
197 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
198 main_window::show_about_octave ()
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
199 {
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
200 QString message =
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
201 "GNU Octave\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
202 "Copyright (C) 2009 John W. Eaton and others.\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
203 "This is free software; see the source code for copying conditions."
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
204 "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
205 "FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
206 "\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
207 "Octave was configured for \"x86_64-pc-linux-gnu\".\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
208 "\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
209 "Additional information about Octave is available at http://www.octave.org.\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
210 "\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
211 "Please contribute if you find this software useful."
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
212 "For more information, visit http://www.octave.org/help-wanted.html\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
213 "\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
214 "Report bugs to <bug@octave.org> (but first, please read"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
215 "http://www.octave.org/bugs.html to learn how to write a helpful report).\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
216 "\n"
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
217 "For information about changes from previous versions, type `news'.\n";
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
218
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
219 QMessageBox::about (this, tr ("About Octave"), message);
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
220 }
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
221
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
222 void
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
223 main_window::closeEvent (QCloseEvent * closeEvent)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
224 {
14714
4ff6c21c18c4 Solved crash on close by ignoring close event and instead executing exit in the terminal.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
225 closeEvent->ignore ();
14718
3df7ef0080c7 Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14716
diff changeset
226 octave_link::instance ()->request_octave_exit ();
3df7ef0080c7 Added event based processing and implement exit and change directory event.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14716
diff changeset
227 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
228
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
229 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
230 main_window::read_settings ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
231 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
232 QSettings *settings = resource_manager::instance ()->get_settings ();
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
233 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
234 restoreState (settings->value ("MainWindow/windowState").toByteArray ());
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
235 emit settings_changed ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
236 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
237
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
238 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
239 main_window::write_settings ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
240 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
241 QSettings *settings = resource_manager::instance ()->get_settings ();
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
242 settings->setValue ("MainWindow/geometry", saveGeometry ());
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
243 settings->setValue ("MainWindow/windowState", saveState ());
14694
ea11c9d8aa47 Calling qApp->quit () via QMetaObject::invoke caused a segfault, now exits cleanly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14693
diff changeset
244 settings->sync ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
245 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
246
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
247 void
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
248 main_window::construct ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
249 {
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
250 QStyle *style = QApplication::style ();
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
251 // TODO: Check this.
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
252 _closing = false; // flag for editor files when closed
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
253 setWindowIcon (resource_manager::instance ()->get_icon (resource_manager::octave));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
254
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
255 // Setup dockable widgets and the status bar.
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
256 _workspace_view = new workspace_view (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
257 _workspace_view->setStatusTip (tr ("View the variables in the active workspace."));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
258 _history_dock_widget = new history_dock_widget (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
259 _history_dock_widget->setStatusTip (tr ("Browse and search the command history."));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
260 _files_dock_widget = new files_dock_widget (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
261 _files_dock_widget->setStatusTip (tr ("Browse your files."));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
262 _status_bar = new QStatusBar (this);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
263
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
264 _current_directory_combo_box = new QComboBox (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
265 _current_directory_combo_box->setFixedWidth (300);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
266 _current_directory_combo_box->setEditable (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
267 _current_directory_combo_box->setInsertPolicy (QComboBox::InsertAtTop);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
268 _current_directory_combo_box->setMaxVisibleItems (14);
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
269
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
270 _current_directory_tool_button = new QToolButton (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
271 _current_directory_tool_button->setIcon (style->standardIcon (QStyle::SP_DirOpenIcon));
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
272
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
273 _current_directory_up_tool_button = new QToolButton (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
274 _current_directory_up_tool_button->setIcon (style->standardIcon (QStyle::SP_FileDialogToParent));
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
275
13550
cd66481d55b0 Added close button to file editor, assorted subwindows after importance.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13549
diff changeset
276 // Octave Terminal subwindow.
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
277 _terminal = new QTerminal (this);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
278 _terminal->setObjectName ("OctaveTerminal");
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
279 _terminal_dock_widget = new terminal_dock_widget (_terminal, this);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
280
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
281 QWidget *dummyWidget = new QWidget ();
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
282 dummyWidget->setObjectName ("CentralDummyWidget");
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
283 dummyWidget->resize (10, 10);
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
284 dummyWidget->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
285 dummyWidget->hide ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
286 setCentralWidget (dummyWidget);
14692
d6d250812c01 Made the terminal window dockable, too. Now the whole interface is fully dockable.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14690
diff changeset
287
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
288 _file_editor = new file_editor (_terminal, this);
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
289
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
290 QMenu *file_menu = menuBar ()->addMenu (tr ("&File"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
291 QAction *new_file_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
292 = file_menu->addAction (QIcon::fromTheme ("document-new",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
293 style->standardIcon (QStyle::SP_FileIcon)), tr ("New File"));
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
294
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
295 QAction *open_file_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
296 = file_menu->addAction (QIcon::fromTheme ("document-open",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
297 style->standardIcon (QStyle::SP_FileIcon)), tr ("Open File"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
298
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
299 QAction *settings_action = file_menu->addAction (tr ("Settings"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
300 file_menu->addSeparator ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
301 QAction *exit_action = file_menu->addAction (tr ("Exit"));
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
302
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
303 QMenu *edit_menu = menuBar ()->addMenu (tr ("&Edit"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
304 QAction *cut_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
305 = edit_menu->addAction (QIcon::fromTheme ("edit-cut",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
306 style->standardIcon (QStyle::SP_FileIcon)), tr ("Cut"));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
307 cut_action->setShortcut (QKeySequence::Cut);
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
308
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
309 QAction *copy_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
310 = edit_menu->addAction (QIcon::fromTheme ("edit-copy",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
311 style->standardIcon (QStyle::SP_FileIcon)), tr ("Copy"));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
312 copy_action->setShortcut (QKeySequence::Copy);
13532
fd87d6f7e185 Dock windows are now selectable form the menus.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13531
diff changeset
313
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
314 QAction *paste_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
315 = edit_menu->addAction (QIcon::fromTheme ("edit-paste",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
316 style->standardIcon (QStyle::SP_FileIcon)), tr ("Paste"));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
317 paste_action->setShortcut (QKeySequence::Paste);
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
318
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
319 QAction *undo_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
320 = edit_menu->addAction (QIcon::fromTheme ("edit-undo",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
321 style->standardIcon (QStyle::SP_FileIcon)), tr ("Undo"));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
322 undo_action->setShortcut (QKeySequence::Undo);
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
323
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
324 QAction *redo_action
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
325 = edit_menu->addAction (QIcon::fromTheme ("edit-redo",
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
326 style->standardIcon (QStyle::SP_FileIcon)), tr ("Redo"));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
327 redo_action->setShortcut (QKeySequence::Redo);
13532
fd87d6f7e185 Dock windows are now selectable form the menus.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13531
diff changeset
328
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
329 //QMenu *debugMenu = menuBar ()->addMenu (tr ("De&bug"));
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
330 //QMenu *parallelMenu = menuBar ()->addMenu (tr ("&Parallel"));
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
331
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
332 QMenu * desktop_menu = menuBar ()->addMenu (tr ("&Desktop"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
333 QAction * load_workspace_action = desktop_menu->addAction (tr ("Load workspace"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
334 QAction * save_workspace_action = desktop_menu->addAction (tr ("Save workspace"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
335 QAction * clear_workspace_action = desktop_menu->addAction (tr ("Clear workspace"));
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
336
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
337 // Window menu
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
338 QMenu * window_menu = menuBar ()->addMenu (tr ("&Window"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
339 QAction * show_command_window_action = window_menu->addAction (tr ("Command Window"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
340 show_command_window_action->setCheckable (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
341 QAction * show_workspace_action = window_menu->addAction (tr ("Workspace"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
342 show_workspace_action->setCheckable (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
343 QAction * show_history_action = window_menu->addAction (tr ("Command History"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
344 show_history_action->setCheckable (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
345 QAction * show_file_browser_action = window_menu->addAction (tr ("Current Directory"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
346 show_file_browser_action->setCheckable (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
347 QAction * show_editor_action = window_menu->addAction (tr ("Editor"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
348 show_editor_action->setCheckable (true);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
349 window_menu->addSeparator ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
350 QAction * reset_windows_action = window_menu->addAction (tr ("Reset Windows"));
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
351
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
352 // Help menu
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
353 QMenu * help_menu = menuBar ()->addMenu (tr ("&Help"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
354 QAction * report_bug_action = help_menu->addAction (tr ("Report Bug"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
355 QAction * agora_action = help_menu->addAction (tr ("Visit Agora"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
356 QAction * octave_forge_action = help_menu->addAction (tr ("Visit Octave Forge"));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
357 help_menu->addSeparator ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
358 QAction * about_octave_action = help_menu->addAction (tr ("About Octave"));
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
359
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
360 // Toolbars
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
361 QToolBar *main_tool_bar = addToolBar ("Main");
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
362 main_tool_bar->addAction (new_file_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
363 main_tool_bar->addAction (open_file_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
364 main_tool_bar->addSeparator ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
365 main_tool_bar->addAction (cut_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
366 main_tool_bar->addAction (copy_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
367 main_tool_bar->addAction (paste_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
368 main_tool_bar->addAction (undo_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
369 main_tool_bar->addAction (redo_action);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
370 main_tool_bar->addSeparator ();
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
371 main_tool_bar->addWidget (new QLabel (tr ("Current Directory:")));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
372 main_tool_bar->addWidget (_current_directory_combo_box);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
373 main_tool_bar->addWidget (_current_directory_tool_button);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
374 main_tool_bar->addWidget (_current_directory_up_tool_button);
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
375
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
376 connect (qApp, SIGNAL (aboutToQuit ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
377 this, SLOT (prepare_for_quit ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
378 connect (settings_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
379 this, SLOT (process_settings_dialog_request ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
380 connect (exit_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
381 this, SLOT (close ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
382 connect (new_file_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
383 this, SLOT (new_file ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
384 connect (open_file_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
385 this, SLOT (open_file ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
386 connect (report_bug_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
387 this, SLOT (open_bug_tracker_page ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
388 connect (agora_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
389 this, SLOT (open_agora_page ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
390 connect (octave_forge_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
391 this, SLOT (open_octave_forge_page ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
392 connect (about_octave_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
393 this, SLOT (show_about_octave ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
394 connect (show_command_window_action, SIGNAL (toggled (bool)),
14716
572a707408b2 Patched qterminal for MacOS. Changed Qt3 compatibility slot to Qt4 slot.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14714
diff changeset
395 _terminal_dock_widget, SLOT (setVisible (bool)));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
396 connect (_terminal_dock_widget, SIGNAL (active_changed (bool)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
397 show_command_window_action, SLOT (setChecked (bool)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
398 connect (show_workspace_action, SIGNAL (toggled (bool)),
14716
572a707408b2 Patched qterminal for MacOS. Changed Qt3 compatibility slot to Qt4 slot.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14714
diff changeset
399 _workspace_view, SLOT (setVisible (bool)));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
400 connect (_workspace_view, SIGNAL (active_changed (bool)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
401 show_workspace_action, SLOT (setChecked (bool)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
402 connect (show_history_action, SIGNAL (toggled (bool)),
14716
572a707408b2 Patched qterminal for MacOS. Changed Qt3 compatibility slot to Qt4 slot.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14714
diff changeset
403 _history_dock_widget, SLOT (setVisible (bool)));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
404 connect (_history_dock_widget, SIGNAL (active_changed (bool)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
405 show_history_action, SLOT (setChecked (bool)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
406 connect (show_file_browser_action, SIGNAL (toggled (bool)),
14716
572a707408b2 Patched qterminal for MacOS. Changed Qt3 compatibility slot to Qt4 slot.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14714
diff changeset
407 _files_dock_widget, SLOT (setVisible (bool)));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
408 connect (_files_dock_widget, SIGNAL (active_changed (bool)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
409 show_file_browser_action, SLOT (setChecked (bool)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
410 connect (show_editor_action, SIGNAL (toggled (bool)),
14716
572a707408b2 Patched qterminal for MacOS. Changed Qt3 compatibility slot to Qt4 slot.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14714
diff changeset
411 _file_editor, SLOT (setVisible (bool)));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
412 connect (_file_editor, SIGNAL (active_changed (bool)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
413 show_editor_action, SLOT (setChecked (bool)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
414 connect (reset_windows_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
415 this, SLOT (reset_windows ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
416 connect (this, SIGNAL (settings_changed ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
417 _files_dock_widget, SLOT (notice_settings ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
418 connect (this, SIGNAL (settings_changed ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
419 this, SLOT (notice_settings ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
420 connect (_files_dock_widget, SIGNAL (open_file (QString)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
421 _file_editor, SLOT (request_open_file (QString)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
422 connect (_history_dock_widget, SIGNAL (information (QString)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
423 this, SLOT (report_status_message (QString)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
424 connect (_history_dock_widget, SIGNAL (command_double_clicked (QString)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
425 this, SLOT (handle_command_double_clicked (QString)));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
426 connect (save_workspace_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
427 this, SLOT (handle_save_workspace_request ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
428 connect (load_workspace_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
429 this, SLOT (handle_load_workspace_request ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
430 connect (clear_workspace_action, SIGNAL (triggered ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
431 this, SLOT (handle_clear_workspace_request ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
432 connect (_current_directory_tool_button, SIGNAL (clicked ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
433 this, SLOT (change_current_working_directory ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
434 connect (_current_directory_up_tool_button, SIGNAL (clicked ()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
435 this, SLOT (current_working_directory_up()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
436 connect (copy_action, SIGNAL (triggered()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
437 _terminal, SLOT (copyClipboard ()));
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
438 connect (paste_action, SIGNAL (triggered()),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
439 _terminal, SLOT (pasteClipboard ()));
14719
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
440 // connect (octave_link::instance (), SIGNAL (working_directory_changed (QString)),
89c64340e9ab Extended event based communication model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14718
diff changeset
441 // this, SLOT (update_current_working_directory (QString)));
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
442 connect (_current_directory_combo_box, SIGNAL (activated (QString)),
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
443 this, SLOT (change_current_working_directory (QString)));
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
444
14601
772ce0204b3f Removed version number and "Octave GUI"-labelling.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14599
diff changeset
445 setWindowTitle ("Octave");
14682
9ea75ea686b5 Allowing nested dock widgets and fixed small bug in loading a workspace.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14681
diff changeset
446 setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks);
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
447 addDockWidget (Qt::LeftDockWidgetArea, _workspace_view);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
448 addDockWidget (Qt::LeftDockWidgetArea, _history_dock_widget);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
449 addDockWidget (Qt::RightDockWidgetArea, _files_dock_widget);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
450 addDockWidget (Qt::RightDockWidgetArea, _file_editor);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
451 addDockWidget (Qt::BottomDockWidgetArea, _terminal_dock_widget);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
452 setStatusBar (_status_bar);
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
453 read_settings ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
454 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
455