annotate libgui/src/main-window.cc @ 20005:f7846f0ea6db

GUI: enable workspace update when debugging (Bug #44455) * libgui/src/main-window.cc (main_window::construct_octave_qt_link): add debug parameter to set_workspace * libgui/src/octave-qt-link.cc, libgui/src/octave-qt-link.h (octave_qt_link::do_set_workspace): add debug variable, check top_level AND debug flag for redraw (octave_qt_link::do_set_workspace): add debug variable to emit set_work_space_signal * libgui/src/workspace-model.cc, libgui/src/workspace-model.h (workspace_model::set_workspace): add debug flag to function * libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h (octave_link::set_workspace): send debug flag in do_set_workspace (octave_link::do_set_workspace): add debug flag
author John Donoghue
date Fri, 20 Mar 2015 08:44:20 -0400
parents 857a8f018f53
children 643de08e524c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19676
diff changeset
3 Copyright (C) 2013-2015 John W. Eaton
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19676
diff changeset
4 Copyright (C) 2011-2015 Jacob Dawid
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
22 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
24 #ifdef HAVE_CONFIG_H
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
25 #include <config.h>
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
26 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
27
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
28 #include <QKeySequence>
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
29 #include <QApplication>
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
30 #include <QLabel>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 #include <QMenuBar>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 #include <QMenu>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QAction>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34 #include <QSettings>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
35 #include <QStyle>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
36 #include <QToolBar>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
37 #include <QDesktopServices>
16391
a695ee2dc17e * main-window.cc: Include <QDesktopWidget>
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
38 #include <QDesktopWidget>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39 #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
40 #include <QMessageBox>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
41 #include <QIcon>
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
42 #include <QTextStream>
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
43 #include <QThread>
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
44 #include <QDateTime>
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
45 #include <QDebug>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
46
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
47 #include <utility>
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
48
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
49 #ifdef HAVE_QSCINTILLA
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
50 #include "file-editor.h"
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
51 #endif
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
52 #include "main-window.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
53 #include "settings-dialog.h"
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
54 #include "shortcut-manager.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
55
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
56 #include "Array.h"
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
57 #include "cmd-edit.h"
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
58 #include "url-transfer.h"
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
59
19928
67cb2f421255 restore include statement removed in changeset c7c50030e76c
John W. Eaton <jwe@octave.org>
parents: 19917
diff changeset
60 #include "builtin-defun-decls.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
61 #include "defaults.h"
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
62 #include "symtab.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
63 #include "version.h"
18318
770c525a1a2b Warn when saving/running a script whose name is not a valid identifier.
Julien Bect <julien.bect@supelec.fr>
parents: 18309
diff changeset
64 #include "utils.h"
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
65
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
66 static file_editor_interface *
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
67 create_default_editor (QWidget *p)
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
68 {
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
69 #ifdef HAVE_QSCINTILLA
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
70 return new file_editor (p);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
71 #else
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
72 return 0;
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
73 #endif
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
74 }
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
75
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
76 main_window::main_window (QWidget *p, bool start_gui)
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
77 : QMainWindow (p),
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
78 _workspace_model (start_gui ? new workspace_model () : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
79 status_bar (start_gui ? new QStatusBar () : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
80 command_window (start_gui ? new terminal_dock_widget (this) : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
81 history_window (start_gui ? new history_dock_widget (this) : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
82 file_browser_window (start_gui ? new files_dock_widget (this) : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
83 doc_browser_window (start_gui ? new documentation_dock_widget (this) : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
84 editor_window (start_gui ? create_default_editor (this) : 0),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
85 workspace_window (start_gui ? new workspace_view (this) : 0),
19666
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
86 _settings_dlg (0),
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
87 find_files_dlg (0),
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
88 release_notes_window (0),
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
89 community_news_window (0),
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
90 _octave_qt_link (0),
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
91 _clipboard (QApplication::clipboard ()),
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
92 _cmd_queue (QList<octave_cmd *> ()), // no command pending
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
93 _cmd_processing (1),
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
94 _cmd_queue_mutex (),
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
95 _dbg_queue (new QStringList ()), // no debug pending
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
96 _dbg_processing (1),
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
97 _dbg_queue_mutex (),
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
98 _prevent_readline_conflicts (true),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
99 _suppress_dbg_location (true),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
100 _start_gui (start_gui)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
101 {
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
102 QSettings *settings = resource_manager::get_settings ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
103
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
104 bool connect_to_web = true;
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
105 QDateTime last_checked;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
106 int serial = 0;
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
107 _active_dock = 0;
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
108
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
109 if (settings)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
110 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
111 connect_to_web
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
112 = settings->value ("news/allow_web_connection", true).toBool ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
113
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
114 last_checked
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
115 = settings->value ("news/last_time_checked", QDateTime ()).toDateTime ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
116
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
117 serial = settings->value ("news/last_news_item", 0).toInt ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
118 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
119
17982
7c48493d98e1 Use currentDateTime instead of currentDateTimeUtc for Qt compatibility
Mike Miller <mtmiller@ieee.org>
parents: 17954
diff changeset
120 QDateTime current = QDateTime::currentDateTime ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
121 QDateTime one_day_ago = current.addDays (-1);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
122
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
123 if (start_gui && connect_to_web
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
124 && (! last_checked.isValid () || one_day_ago > last_checked))
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
125 load_and_display_community_news (serial);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
126
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
127 // 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
128 construct ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
129 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
130
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
131 main_window::~main_window (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
132 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
133 // Destroy the terminal first so that STDERR stream is redirected back
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
134 // to its original pipe to capture error messages at exit.
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16479
diff changeset
135
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
136 delete editor_window; // first one for dialogs of modified editor-tabs
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16479
diff changeset
137 delete command_window;
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
138 delete workspace_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
139 delete doc_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
140 delete file_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
141 delete history_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
142 delete status_bar;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
143 delete _workspace_model;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
144 if (find_files_dlg)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
145 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
146 delete find_files_dlg;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
147 find_files_dlg = 0;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
148 }
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
149 if (release_notes_window)
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
150 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
151 delete release_notes_window;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
152 release_notes_window = 0;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
153 }
19666
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
154 if (_settings_dlg)
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
155 {
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
156 delete _settings_dlg;
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
157 _settings_dlg = 0;
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
158 }
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
159 if (community_news_window)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
160 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
161 delete community_news_window;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
162 community_news_window = 0;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
163 }
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
164 delete _octave_qt_link;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
165 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
166
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
167 // catch focus changes and determine the active dock widget
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
168 void
19459
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
169 main_window::focus_changed (QWidget *, QWidget *new_widget)
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
170 {
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
171 octave_dock_widget* dock = 0;
19459
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
172 QWidget *w_new = new_widget; // get a copy of new focus widget
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
173 QWidget *start = w_new; // Save it as start of our search
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
174 int count = 0; // fallback to prevent endless loop
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
175
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
176 while (w_new && w_new != _main_tool_bar && count < 100)
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
177 {
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
178 dock = qobject_cast <octave_dock_widget *> (w_new);
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
179 if (dock)
19459
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
180 break; // it is a QDockWidget ==> exit loop
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
181
19623
4fe86a372f10 Fix compilation error when building without QScintilla
Mike Miller <mtmiller@ieee.org>
parents: 19619
diff changeset
182 #ifdef HAVE_QSCINTILLA
19567
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
183 if (qobject_cast <octave_qscintilla *> (w_new))
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
184 {
19773
3fa35defe495 Adjust spacing of static_cast<> calls to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19748
diff changeset
185 dock = static_cast<octave_dock_widget *> (editor_window);
19567
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
186 break; // it is the editor window ==> exit loop
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
187 }
19623
4fe86a372f10 Fix compilation error when building without QScintilla
Mike Miller <mtmiller@ieee.org>
parents: 19619
diff changeset
188 #endif
19567
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
189
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
190 w_new = qobject_cast <QWidget *> (w_new->previousInFocusChain ());
19459
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
191 if (w_new == start)
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
192 break; // we have arrived where we began ==> exit loop
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
193
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19456
diff changeset
194 count++;
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
195 }
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
196
19567
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
197 // editor needs extra handling
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
198 octave_dock_widget *edit_dock_widget =
19773
3fa35defe495 Adjust spacing of static_cast<> calls to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19748
diff changeset
199 static_cast<octave_dock_widget *> (editor_window);
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
200 // if new dock has focus, emit signal and store active focus
19567
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
201 // except editor changes to a dialog (dock=0)
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19471
diff changeset
202 if ((dock || _active_dock != edit_dock_widget) && (dock != _active_dock))
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
203 {
19460
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19459
diff changeset
204 // signal to all dock widgets for updating the style
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
205 emit active_dock_changed (_active_dock, dock);
19460
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19459
diff changeset
206
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19459
diff changeset
207 if (edit_dock_widget == dock)
19463
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
208 emit editor_focus_changed (true);
19460
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19459
diff changeset
209 else if (edit_dock_widget == _active_dock)
19463
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
210 emit editor_focus_changed (false);
19460
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19459
diff changeset
211
19456
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
212 _active_dock = dock;
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
213 }
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
214 }
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19445
diff changeset
215
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
216 bool
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
217 main_window::command_window_has_focus (void) const
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
218 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
219 return command_window->has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
220 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
221
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
222 void
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
223 main_window::focus_command_window (void)
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
224 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
225 command_window->focus ();
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
226 }
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
227
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
228 void
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16451
diff changeset
229 main_window::new_file (const QString& commands)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
230 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
231 emit new_file_signal (commands);
14875
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
232 }
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
233
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
234 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
235 main_window::open_file (const QString& file_name)
14875
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
236 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
237 emit open_file_signal (file_name);
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
238 }
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
239
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
240 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
241 main_window::report_status_message (const QString& statusMessage)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
242 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
243 status_bar->showMessage (statusMessage, 1000);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
244 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
245
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
246 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
247 main_window::handle_save_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
248 {
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
249 QString file =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
250 QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".", 0, 0,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
251 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
252
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
253 if (! file.isEmpty ())
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
254 octave_link::post_event (this, &main_window::save_workspace_callback,
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
255 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
256 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
257
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
258 void
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
259 main_window::handle_load_workspace_request (const QString& file_arg)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
260 {
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
261 QString file = file_arg;
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
262
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
263 if (file.isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
264 file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".", 0, 0,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
265 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
266
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
267 if (! file.isEmpty ())
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
268 octave_link::post_event (this, &main_window::load_workspace_callback,
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
269 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
270 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
271
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
272 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
273 main_window::handle_clear_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
274 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
275 octave_link::post_event (this, &main_window::clear_workspace_callback);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
276 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
277
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
278 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
279 main_window::handle_rename_variable_request (const QString& old_name,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
280 const QString& new_name)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
281
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
282 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
283 name_pair names (old_name.toStdString (), new_name.toStdString ());
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
284
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
285 octave_link::post_event (this, &main_window::rename_variable_callback,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
286 names);
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
287 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
288
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
289 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
290 main_window::handle_undo_request (void)
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
291 {
19980
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19973
diff changeset
292 if (command_window_has_focus ())
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19973
diff changeset
293 octave_link::post_event (this, &main_window::command_window_undo_callback);
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19973
diff changeset
294 else
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19973
diff changeset
295 emit undo_signal ();
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
296 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
297
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
298 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
299 main_window::handle_clear_command_window_request (void)
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
300 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
301 octave_link::post_event (this, &main_window::clear_command_window_callback);
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
302 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
303
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
304 void
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
305 main_window::handle_clear_history_request (void)
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
306 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
307 octave_link::post_event (this, &main_window::clear_history_callback);
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
308 }
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
309
18155
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
310 bool
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
311 main_window::focus_console_after_command ()
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
312 {
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
313 QSettings *settings = resource_manager::get_settings ();
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
314 return settings->value ("terminal/focus_after_command",false).toBool ();
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
315 }
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
316
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
317 void
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
318 main_window::execute_command_in_terminal (const QString& command)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
319 {
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
320 octave_cmd_exec *cmd = new octave_cmd_exec (command);
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
321 queue_command (cmd);
18155
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
322 if (focus_console_after_command ())
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
323 focus_command_window ();
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
324 }
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
325
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
326 void
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
327 main_window::run_file_in_terminal (const QFileInfo& info)
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
328 {
17331
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
329 octave_link::post_event (this, &main_window::run_file_callback, info);
18155
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
330 if (focus_console_after_command ())
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
331 focus_command_window ();
17331
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
332 }
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
333
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
334 void
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
335 main_window::run_file_callback (const QFileInfo& info)
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
336 {
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
337 octave_cmd_eval *cmd = new octave_cmd_eval (info);
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
338 queue_command (cmd);
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
339 }
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
340
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
341 void
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
342 main_window::queue_command (octave_cmd* cmd)
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
343 {
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
344 _cmd_queue_mutex.lock ();
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
345 _cmd_queue.append (cmd); // queue command and type
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
346 _cmd_queue_mutex.unlock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
347
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
348 if (_cmd_processing.tryAcquire ()) // if callback not processing, post event
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
349 octave_link::post_event (this, &main_window::execute_command_callback);
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
350 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
351
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
352 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
353 main_window::handle_new_figure_request (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
354 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
355 octave_link::post_event (this, &main_window::new_figure_callback);
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
356 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
357
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
358 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
359 main_window::open_online_documentation_page (void)
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
360 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
361 QDesktopServices::openUrl (QUrl ("http://octave.org/doc/interpreter"));
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
362 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
363
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
364 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
365 main_window::display_release_notes (void)
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
366 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
367 if (! release_notes_window)
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
368 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
369 std::string news_file = Voct_etc_dir + "/NEWS";
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
370
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
371 QString news;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
372
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
373 QFile *file = new QFile (QString::fromStdString (news_file));
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
374 if (file->open (QFile::ReadOnly))
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
375 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
376 QTextStream *stream = new QTextStream (file);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
377 news = stream->readAll ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
378 if (! news.isEmpty ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
379 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
380 news.prepend ("<pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
381 news.append ("</pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
382 }
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
383 else
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
384 news = (tr ("The release notes file '%1' is empty.")
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
385 . arg (QString::fromStdString (news_file)));
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
386 }
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
387 else
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
388 news = (tr ("The release notes file '%1' cannot be read.")
17771
7690c3477da1 if NEWS file is missing, include expected file name in release notes message
John W. Eaton <jwe@octave.org>
parents: 17764
diff changeset
389 . arg (QString::fromStdString (news_file)));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
390
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
391
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
392 release_notes_window = new QWidget;
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
393
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
394 QTextBrowser *browser = new QTextBrowser (release_notes_window);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
395 browser->setText (news);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
396
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
397 QVBoxLayout *vlayout = new QVBoxLayout;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
398 vlayout->addWidget (browser);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
399
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
400 release_notes_window->setLayout (vlayout);
17936
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
401 release_notes_window->setWindowTitle (tr ("Octave Release Notes"));
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
402
17890
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
403 browser->document()->adjustSize ();
18874
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
404
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
405 // center the window on the screen where octave is running
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
406 QDesktopWidget *m_desktop = QApplication::desktop ();
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
407 int screen = m_desktop->screenNumber (this); // screen of the main window
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
408 QRect screen_geo = m_desktop->availableGeometry (screen);
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
409 int win_x = screen_geo.width (); // width of the screen
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
410 int win_y = screen_geo.height (); // height of the screen
19973
10e48c1fef56 Make Release Notes window larger so that no horizontal scrollbar is required.
Rik <rik@octave.org>
parents: 19943
diff changeset
411 int reln_x = std::min (620, win_x-80); // desired width of release notes
18874
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
412 int reln_y = std::min (640, win_y-80); // desired height of release notes
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
413 release_notes_window->resize (reln_x, reln_y); // set size
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18873
diff changeset
414 release_notes_window->move (20, 0); // move to the top left corner
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
415 }
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
416
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
417 if (! release_notes_window->isVisible ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
418 release_notes_window->show ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
419 else if (release_notes_window->isMinimized ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
420 release_notes_window->showNormal ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
421
18002
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
422 release_notes_window->setWindowIcon (QIcon (_release_notes_icon));
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
423
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
424 release_notes_window->raise ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
425 release_notes_window->activateWindow ();
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
426 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
427
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
428 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
429 news_reader::process (void)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
430 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
431 QString html_text;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
432
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
433 if (connect_to_web)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
434 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
435 // Run this part in a separate thread so Octave can continue to
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
436 // run while we wait for the page to load. Then emit the signal
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
437 // to display it when we have the page contents.
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
438
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
439 QString url = base_url + "/" + page;
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
440 std::ostringstream buf;
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
441 url_transfer octave_dot_org (url.toStdString (), buf);
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
442
18287
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
443 if (octave_dot_org.is_valid ())
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
444 {
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
445 Array<std::string> param;
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
446 octave_dot_org.http_get (param);
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
447
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
448 if (octave_dot_org.good ())
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
449 html_text = QString::fromStdString (buf.str ());
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
450 }
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
451
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
452 if (html_text.contains ("this-is-the-gnu-octave-community-news-page"))
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
453 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
454 if (serial >= 0)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
455 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
456 QSettings *settings = resource_manager::get_settings ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
457
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
458 if (settings)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
459 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
460 settings->setValue ("news/last_time_checked",
17982
7c48493d98e1 Use currentDateTime instead of currentDateTimeUtc for Qt compatibility
Mike Miller <mtmiller@ieee.org>
parents: 17954
diff changeset
461 QDateTime::currentDateTime ());
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
462
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
463 settings->sync ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
464 }
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
465
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
466 QString tag ("community-news-page-serial=");
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
467
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
468 int b = html_text.indexOf (tag);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
469
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
470 if (b)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
471 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
472 b += tag.length ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
473
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
474 int e = html_text.indexOf ("\n", b);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
475
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
476 QString tmp = html_text.mid (b, e-b);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
477
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
478 int curr_page_serial = tmp.toInt ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
479
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
480 if (curr_page_serial > serial)
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
481 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
482 if (settings)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
483 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
484 settings->setValue ("news/last_news_item",
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
485 curr_page_serial);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
486
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
487 settings->sync ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
488 }
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
489 }
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
490 else
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
491 return;
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
492 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
493 else
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
494 return;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
495 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
496 }
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
497 else
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
498 html_text = QString
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
499 (tr ("<html>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
500 "<body>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
501 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
502 "Octave's community news source seems to be unavailable.\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
503 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
504 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
505 "For the latest news, please check\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
506 "<a href=\"http://octave.org/community-news.html\">http://octave.org/community-news.html</a>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
507 "when you have a connection to the web (link opens in an external browser).\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
508 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
509 "<p>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
510 "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
511 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
512 "</body>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
513 "</html>\n");
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
514 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
515 else
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
516 html_text = QString
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
517 (tr ("<html>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
518 "<body>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
519 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
520 "Connecting to the web to display the latest Octave Community news has been disabled.\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
521 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
522 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
523 "For the latest news, please check\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
524 "<a href=\"http://octave.org/community-news.html\">http://octave.org/community-news.html</a>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
525 "when you have a connection to the web (link opens in an external browser)\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
526 "or enable web connections for news in Octave's network settings dialog.\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
527 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
528 "<p>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
529 "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
530 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
531 "</body>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
532 "</html>\n");
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
533
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
534 emit display_news_signal (html_text);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
535
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
536 emit finished ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
537 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
538
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
539 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
540 main_window::load_and_display_community_news (int serial)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
541 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
542 QSettings *settings = resource_manager::get_settings ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
543
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
544 bool connect_to_web
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
545 = (settings
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
546 ? settings->value ("news/allow_web_connection", true).toBool ()
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
547 : true);
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
548
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
549 QString base_url = "http://octave.org";
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
550 QString page = "community-news.html";
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
551
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
552 QThread *worker_thread = new QThread;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
553
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
554 news_reader *reader = new news_reader (base_url, page, serial,
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
555 connect_to_web);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
556
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
557 reader->moveToThread (worker_thread);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
558
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
559 connect (reader, SIGNAL (display_news_signal (const QString&)),
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
560 this, SLOT (display_community_news (const QString&)));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
561
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
562 connect (worker_thread, SIGNAL (started (void)),
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
563 reader, SLOT (process ()));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
564
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
565 connect (reader, SIGNAL (finished (void)), worker_thread, SLOT (quit ()));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
566
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
567 connect (reader, SIGNAL (finished (void)), reader, SLOT (deleteLater ()));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
568
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
569 connect (worker_thread, SIGNAL (finished (void)),
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
570 worker_thread, SLOT (deleteLater ()));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
571
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
572 worker_thread->start ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
573 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
574
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
575 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
576 main_window::display_community_news (const QString& news)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
577 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
578 if (! community_news_window)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
579 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
580 community_news_window = new QWidget;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
581
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
582 QTextBrowser *browser = new QTextBrowser (community_news_window);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
583
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
584 browser->setHtml (news);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
585 browser->setObjectName ("OctaveNews");
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
586 browser->setOpenExternalLinks (true);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
587
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
588 QVBoxLayout *vlayout = new QVBoxLayout;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
589
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
590 vlayout->addWidget (browser);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
591
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
592 community_news_window->setLayout (vlayout);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
593 community_news_window->setWindowTitle (tr ("Octave Community News"));
18873
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
594
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
595 // center the window on the screen where octave is running
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
596 QDesktopWidget *m_desktop = QApplication::desktop ();
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
597 int screen = m_desktop->screenNumber (this); // screen of the main window
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
598 QRect screen_geo = m_desktop->availableGeometry (screen);
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
599 int win_x = screen_geo.width (); // width of the screen
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
600 int win_y = screen_geo.height (); // height of the screen
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
601 int news_x = std::min (640, win_x-80); // desired width of news window
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
602 int news_y = std::min (480, win_y-80); // desired height of news window
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18867
diff changeset
603 community_news_window->resize (news_x, news_y); // set size and center
17948
73f46593a51c Center the Octave Community News window only when constructed (bug #40618)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 17947
diff changeset
604 community_news_window->move ((win_x - community_news_window->width ())/2,
73f46593a51c Center the Octave Community News window only when constructed (bug #40618)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 17947
diff changeset
605 (win_y - community_news_window->height ())/2);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
606 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
607
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
608 if (! community_news_window->isVisible ())
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
609 community_news_window->show ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
610 else if (community_news_window->isMinimized ())
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
611 community_news_window->showNormal ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
612
18002
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
613 // same icon as release notes
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
614 community_news_window->setWindowIcon (QIcon (_release_notes_icon));
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
615
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
616 community_news_window->raise ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
617 community_news_window->activateWindow ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
618 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
619
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
620 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
621 main_window::open_bug_tracker_page (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
622 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
623 QDesktopServices::openUrl (QUrl ("http://octave.org/bugs.html"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
624 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
625
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
626 void
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
627 main_window::open_octave_packages_page (void)
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
628 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
629 QDesktopServices::openUrl (QUrl ("http://octave.org/packages.html"));
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
630 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
631
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
632 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
633 main_window::open_agora_page (void)
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
634 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
635 QDesktopServices::openUrl (QUrl ("http://agora.octave.org"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
636 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
637
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
638 void
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
639 main_window::open_contribute_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
640 {
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
641 QDesktopServices::openUrl (QUrl ("http://octave.org/donate.html"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
642 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
643
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
644 void
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
645 main_window::open_developer_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
646 {
17576
387ecd448b30 main-windows.cc: Fixed typo in open_developer_page URL
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17510
diff changeset
647 QDesktopServices::openUrl (QUrl ("http://octave.org/get-involved.html"));
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
648 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
649
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
650 void
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17674
diff changeset
651 main_window::process_settings_dialog_request (const QString& desired_tab)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
652 {
19666
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
653 if (_settings_dlg) // _settings_dlg is a guarded pointer!
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
654 { // here the dialog is still open and called once again
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
655 if (! desired_tab.isEmpty ())
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
656 _settings_dlg->show_tab (desired_tab);
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
657 return;
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
658 }
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
659
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
660 _settings_dlg = new settings_dialog (this, desired_tab);
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
661
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
662 connect (_settings_dlg, SIGNAL (apply_new_settings ()),
19665
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
663 this, SLOT (request_reload_settings ()));
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
664
19666
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
665 _settings_dlg->setModal (false);
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
666 _settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19665
diff changeset
667 _settings_dlg->show ();
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
668 }
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
669
19665
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
670 void
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
671 main_window::request_reload_settings ()
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
672 {
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
673 QSettings *settings = resource_manager::get_settings ();
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
674
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
675 if (settings)
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
676 emit settings_changed (settings);
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19623
diff changeset
677 }
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
678
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
679 void
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
680 main_window::notice_settings (const QSettings *settings)
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
681 {
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
682 // QSettings pointer is checked before emitting.
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14996
diff changeset
683
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
684 // the widget's icons (when floating)
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
685 QString icon_set
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
686 = settings->value ("DockWidgets/widget_icon_set", "NONE").toString ();
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
687
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
688 static struct
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
689 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
690 QString name;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
691 QString path;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
692 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
693
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
694 widget_icon_data[] =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
695 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
696 // array of possible icon sets (name, path (complete for NONE))
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
697 // the first entry here is the default!
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
698 {"NONE", ":/actions/icons/logo.png"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
699 {"GRAPHIC", ":/actions/icons/graphic_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
700 {"LETTER", ":/actions/icons/letter_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
701 {"", ""} // end marker has empty name
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
702 };
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
703
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
704 int count = 0;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
705 int icon_set_found = 0; // default
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
706
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
707 while (!widget_icon_data[count].name.isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
708 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
709 // while not end of data
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
710 if (widget_icon_data[count].name == icon_set)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
711 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
712 // data of desired icon set found
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
713 icon_set_found = count;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
714 break;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
715 }
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
716 count++;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
717 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
718
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
719 QString icon;
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
720 foreach (octave_dock_widget *widget, dock_widget_list ())
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
721 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
722 QString name = widget->objectName ();
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
723 if (! name.isEmpty ())
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
724 { // if children has a name
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
725 icon = widget_icon_data[icon_set_found].path; // prefix or octave-logo
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
726 if (widget_icon_data[icon_set_found].name != "NONE")
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
727 icon = icon + name + ".png"; // add widget name and ext.
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
728 widget->setWindowIcon (QIcon (icon));
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
729 }
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
730 }
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
731 if (widget_icon_data[icon_set_found].name != "NONE")
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
732 _release_notes_icon = widget_icon_data[icon_set_found].path
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
733 + "ReleaseWidget.png";
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
734 else
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
735 _release_notes_icon = ":/actions/icons/logo.png";
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
736
19881
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
737 int icon_size_settings = settings->value ("toolbar_icon_size",0).toInt ();
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
738 QStyle *st = style ();
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
739 int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
740
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
741 if (icon_size_settings == 1)
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
742 icon_size = st->pixelMetric (QStyle::PM_LargeIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
743 else if (icon_size_settings == -1)
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
744 icon_size = st->pixelMetric (QStyle::PM_SmallIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19880
diff changeset
745
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
746 _main_tool_bar->setIconSize (QSize (icon_size,icon_size));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
747
18767
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18751
diff changeset
748 if (settings->value ("show_status_bar",true).toBool ())
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18751
diff changeset
749 status_bar->show ();
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18751
diff changeset
750 else
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18751
diff changeset
751 status_bar->hide ();
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18751
diff changeset
752
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
753 _prevent_readline_conflicts =
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
754 settings->value ("shortcuts/prevent_readline_conflicts", true).toBool ();
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
755
19619
f9a944b9e1cb provide a user preference for printing the debug location in the terminal
Torsten <ttl@justmail.de>
parents: 19606
diff changeset
756 _suppress_dbg_location =
f9a944b9e1cb provide a user preference for printing the debug location in the terminal
Torsten <ttl@justmail.de>
parents: 19606
diff changeset
757 ! settings->value ("terminal/print_debug_location", false).toBool ();
f9a944b9e1cb provide a user preference for printing the debug location in the terminal
Torsten <ttl@justmail.de>
parents: 19606
diff changeset
758
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
759 resource_manager::update_network_settings ();
19917
b403780efe90 make sure shortcuts are active in editor after settings dialog (bug #44397)
Torsten <ttl@justmail.de>
parents: 19902
diff changeset
760
b403780efe90 make sure shortcuts are active in editor after settings dialog (bug #44397)
Torsten <ttl@justmail.de>
parents: 19902
diff changeset
761 emit active_dock_changed (0, _active_dock); // update dock widget styles
19942
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19934
diff changeset
762
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19934
diff changeset
763 configure_shortcuts ();
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19934
diff changeset
764 set_global_shortcuts (_active_dock == command_window);
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19934
diff changeset
765 set_global_edit_shortcuts (_active_dock == editor_window);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
766 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
767
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
768 void
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
769 main_window::confirm_shutdown_octave (void)
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
770 {
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
771 bool closenow = true;
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
772
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
773 if (_start_gui)
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
774 {
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
775 QSettings *settings = resource_manager::get_settings ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
776
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
777 if (settings->value ("prompt_to_exit", false).toBool ())
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
778 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
779 int ans = QMessageBox::question (this, tr ("Octave"),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
780 tr ("Are you sure you want to exit Octave?"),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
781 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
782
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
783 if (ans != QMessageBox::Ok)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
784 closenow = false;
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
785 }
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
786
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
787 #ifdef HAVE_QSCINTILLA
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
788 if (closenow)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
789 closenow = editor_window->check_closing ();
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
790 #endif
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
791 }
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
792
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
793 _octave_qt_link->shutdown_confirmation (closenow);
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
794
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
795 // Awake the worker thread so that it continues shutting down (or not).
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
796 _octave_qt_link->waitcondition.wakeAll ();
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
797 }
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
798
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
799 void
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
800 main_window::prepare_to_exit (void)
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
801 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
802 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
803 }
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
804
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
805 void
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
806 main_window::exit_app (int status)
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
807 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
808 qApp->exit (status);
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
809 }
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
810
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
811 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
812 main_window::reset_windows (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
813 {
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
814 QSettings *settings = resource_manager::get_default_settings ();
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
815
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
816 set_window_layout (settings);
18116
a829f40933a8 fix minimized main window after resetting window layout (bug #40832)
Torsten <ttl@justmail.de>
parents: 18034
diff changeset
817 showNormal (); // make sure main window is not minimized
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
818 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
819
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
820 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
821 main_window::change_directory (const QString& dir)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
822 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
823 // Remove existing entry, if any, then add new directory at top and
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
824 // mark it as the current directory. Finally, update the file list
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
825 // widget.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
826
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
827 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
828
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
829 if (index >= 0)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
830 _current_directory_combo_box->removeItem (index);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
831
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
832 _current_directory_combo_box->insertItem (0, dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
833 _current_directory_combo_box->setCurrentIndex (0);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
834 }
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
835
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
836 void
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
837 main_window::browse_for_directory (void)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
838 {
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
839 QString dir
18000
b1271fc57779 use same string for tool tip and dialog box for searching new directory in gui
Torsten <ttl@justmail.de>
parents: 17997
diff changeset
840 = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), 0,
18812
6e2b1de8348e only show directories in dialog box for setting new octave directory
Torsten <ttl@justmail.de>
parents: 18606
diff changeset
841 QFileDialog::ShowDirsOnly |
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
842 QFileDialog::DontUseNativeDialog);
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
843
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
844 set_current_working_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
845
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
846 // FIXME: on Windows systems, the command window freezes after the
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
847 // previous actions. Forcing the focus appears to unstick it.
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
848
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
849 focus_command_window ();
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
850 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
851
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
852 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
853 main_window::set_current_working_directory (const QString& dir)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
854 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
855 // Change to dir if it is an existing directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
856
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
857 QString xdir = dir.isEmpty () ? "." : dir;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
858
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
859 QFileInfo fileInfo (xdir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
860
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
861 if (fileInfo.exists () && fileInfo.isDir ())
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
862 octave_link::post_event (this, &main_window::change_directory_callback,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
863 xdir.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
864 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
865
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
866 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
867 main_window::change_directory_up (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
868 {
16526
01541f7321f7 correctly track directory for cd ..
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
869 set_current_working_directory ("..");
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
870 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
871
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
872 // Slot that is called if return is pressed in the line edit of the
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
873 // combobox to change to a new directory or a directory that is already
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
874 // in the drop down list.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
875
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
876 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
877 main_window::accept_directory_line_edit (void)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
878 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
879 // Get new directory name, and change to it if it is new. Otherwise,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
880 // the combo box will triggers the "activated" signal to change to the
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
881 // directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
882
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
883 QString dir = _current_directory_combo_box->currentText ();
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
884
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
885 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
886
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
887 if (index < 0)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
888 set_current_working_directory (dir);
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
889 }
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
890
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
891 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
892 main_window::handle_enter_debugger (void)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
893 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
894 setWindowTitle ("Octave (Debugging)");
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
895
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
896 _debug_continue->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
897 _debug_step_into->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
898 _debug_step_over->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
899 _debug_step_out->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
900 _debug_quit->setEnabled (true);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
901
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
902 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
903 editor_window->handle_enter_debug_mode ();
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
904 #endif
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
905 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
906
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
907 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
908 main_window::handle_exit_debugger (void)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
909 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
910 setWindowTitle ("Octave");
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
911
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
912 _debug_continue->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
913 _debug_step_into->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
914 _debug_step_over->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
915 _debug_step_out->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
916 _debug_quit->setEnabled (false);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
917
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
918 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
919 editor_window->handle_exit_debug_mode ();
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
920 #endif
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
921 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
922
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
923 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
924 main_window::debug_continue (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
925 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
926 queue_debug ("cont");
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
927 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
928
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
929 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
930 main_window::debug_step_into (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
931 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
932 queue_debug ("in");
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
933 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
934
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
935 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
936 main_window::debug_step_over (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
937 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
938 queue_debug ("step");
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
939 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
940
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
941 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
942 main_window::debug_step_out (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
943 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
944 queue_debug ("out");
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
945 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
946
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
947 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
948 main_window::debug_quit (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
949 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
950 queue_debug ("quit");
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
951 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
952
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
953 void
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
954 main_window::handle_insert_debugger_pointer_request (const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
955 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
956 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
957 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
958
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
959 emit insert_debugger_pointer_signal (file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
960
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
961 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
962 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
963 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
964
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
965 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
966 main_window::handle_delete_debugger_pointer_request (const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
967 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
968 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
969 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
970
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
971 emit delete_debugger_pointer_signal (file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
972
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
973 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
974 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
975 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
976
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
977 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
978 main_window::handle_update_breakpoint_marker_request (bool insert,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
979 const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
980 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
981 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
982 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
983
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
984 emit update_breakpoint_marker_signal (insert, file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
985
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
986 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
987 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
988 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
989
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
990 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
991 main_window::show_about_octave (void)
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
992 {
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
993 std::string message
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
994 = octave_name_version_copyright_copying_warranty_and_bugs (true);
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
995
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
996 QMessageBox::about (this, tr ("About Octave"),
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
997 QString::fromStdString (message));
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
998 }
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
999
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
1000 void
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1001 main_window::closeEvent (QCloseEvent *e)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1002 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
1003 e->ignore ();
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
1004 octave_cmd_exec *cmd = new octave_cmd_exec ("exit");
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
1005 queue_command (cmd);
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
1006 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1007
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1008 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1009 main_window::read_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1010 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1011 QSettings *settings = resource_manager::get_settings ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1012
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1013 if (!settings)
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1014 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1015 qDebug ("Error: QSettings pointer from resource manager is NULL.");
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1016 return;
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1017 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1018
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1019 set_window_layout (settings);
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1020
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1021 // restore the list of the last directories
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1022 QStringList curr_dirs
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1023 = settings->value ("MainWindow/current_directory_list").toStringList ();
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1024 for (int i=0; i < curr_dirs.size (); i++)
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1025 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1026 _current_directory_combo_box->addItem (curr_dirs.at (i));
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1027 }
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1028 emit settings_changed (settings);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1029 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1030
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1031 void
19337
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19336
diff changeset
1032 main_window::init_terminal_size (void)
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19336
diff changeset
1033 {
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19336
diff changeset
1034 emit init_terminal_size_signal ();
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19336
diff changeset
1035 }
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19336
diff changeset
1036
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19336
diff changeset
1037 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1038 main_window::set_window_layout (QSettings *settings)
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1039 {
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1040 #if ! defined (Q_OS_WIN32)
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1041 restoreState (settings->value ("MainWindow/windowState").toByteArray ());
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1042 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1043 #endif
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
1044
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1045 // Restore the geometry of all dock-widgets
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1046 foreach (octave_dock_widget *widget, dock_widget_list ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1047 {
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1048 QString name = widget->objectName ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1049
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1050 if (! name.isEmpty ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1051 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
1052 bool floating = settings->value
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
1053 ("DockWidgets/" + name + "Floating", false).toBool ();
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1054 bool visible = settings->value
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1055 ("DockWidgets/" + name + "Visible", true).toBool ();
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1056
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1057 // If floating, make window from widget.
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1058 if (floating)
16818
caf3d2a45da0 clean up some code for undocking and docking widgets
Torsten <ttl@justmail.de>
parents: 16811
diff changeset
1059 widget->make_window ();
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1060 else if (! widget->parent ()) // should not be floating but is
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1061 widget->make_widget (false); // no docking, just reparent
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1062 #if ! defined (Q_OS_WIN32)
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1063 // restore geometry
17686
65544374c1cf restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents: 17676
diff changeset
1064 QVariant val = settings->value ("DockWidgets/" + name);
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1065 widget->restoreGeometry (val.toByteArray ());
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1066 #endif
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1067 // make widget visible if desired
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
1068 if (floating && visible) // floating and visible
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1069 {
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1070 if (settings->value ("DockWidgets/" + widget->objectName () + "_minimized").toBool ())
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1071 widget->showMinimized ();
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1072 else
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1073 widget->setVisible (true);
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1074 }
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
1075 else
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1076 {
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1077 widget->make_widget ();
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1078 widget->setVisible (visible); // not floating -> show
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1079 }
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1080 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1081 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1082
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1083 #if defined (Q_OS_WIN32)
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1084 restoreState (settings->value ("MainWindow/windowState").toByteArray ());
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1085 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1086 #endif
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1087
17995
ea1db0ede4ce make sure Octave is displayed in a global menu bar, not another widget name
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1088 show ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1089 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1090
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1091 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1092 main_window::write_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1093 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1094 QSettings *settings = resource_manager::get_settings ();
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1095 if (!settings)
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1096 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1097 qDebug ("Error: QSettings pointer from resource manager is NULL.");
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1098 return;
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1099 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1100
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
1101 settings->setValue ("MainWindow/geometry", saveGeometry ());
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
1102 settings->setValue ("MainWindow/windowState", saveState ());
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1103 // write the list of recent used directories
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1104 QStringList curr_dirs;
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1105 for (int i=0; i<_current_directory_combo_box->count (); i++)
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1106 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1107 curr_dirs.append (_current_directory_combo_box->itemText (i));
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1108 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1109 settings->setValue ("MainWindow/current_directory_list", curr_dirs);
14694
ea11c9d8aa47 Calling qApp->quit () via QMetaObject::invoke caused a segfault, now exits cleanly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14693
diff changeset
1110 settings->sync ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1111 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1112
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1113
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1114 // Connecting the signals emitted when the visibility of a widget changes.
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1115 // This has to be done after the window is shown (see octave-gui.cc)
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1116 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1117 main_window::connect_visibility_changed (void)
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1118 {
17617
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1119 foreach (octave_dock_widget *widget, dock_widget_list ())
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1120 widget->connect_visibility_changed ();
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1121
19623
4fe86a372f10 Fix compilation error when building without QScintilla
Mike Miller <mtmiller@ieee.org>
parents: 19619
diff changeset
1122 #ifdef HAVE_QSCINTILLA
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1123 editor_window->enable_menu_shortcuts (false);
19623
4fe86a372f10 Fix compilation error when building without QScintilla
Mike Miller <mtmiller@ieee.org>
parents: 19619
diff changeset
1124 #endif
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1125 }
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1126
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1127 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1128 main_window::copyClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1129 {
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1130 if (_current_directory_combo_box->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1131 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1132 QLineEdit * edit = _current_directory_combo_box->lineEdit ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1133 if (edit && edit->hasSelectedText ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1134 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1135 QClipboard *clipboard = QApplication::clipboard ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1136 clipboard->setText (edit->selectedText ());
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1137 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1138 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1139 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1140 emit copyClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1141 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1142
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1143 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1144 main_window::pasteClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1145 {
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1146 if (_current_directory_combo_box->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1147 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1148 QLineEdit * edit = _current_directory_combo_box->lineEdit ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1149 QClipboard *clipboard = QApplication::clipboard ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1150 QString str = clipboard->text ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1151 if (edit && str.length () > 0)
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1152 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1153 edit->insert (str);
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1154 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1155 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1156 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1157 emit pasteClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1158 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1159
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1160 void
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1161 main_window::selectAll (void)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1162 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1163 if (_current_directory_combo_box->hasFocus ())
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1164 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1165 QLineEdit * edit = _current_directory_combo_box->lineEdit ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1166 if (edit)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1167 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1168 edit->selectAll ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1169 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1170 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1171 else
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1172 emit selectAll_signal ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1173 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1174
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1175
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1176 // Connect the signals emitted when the Octave thread wants to create
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1177 // a dialog box of some sort. Perhaps a better place for this would be
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1178 // as part of the QUIWidgetCreator class. However, mainWindow currently
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1179 // is not a global variable and not accessible for connecting.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1180
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1181 void
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1182 main_window::connect_uiwidget_links (void)
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1183 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1184 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1185 SIGNAL (create_dialog (const QString&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1186 const QString&, const QStringList&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1187 const QString&, const QStringList&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1188 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1189 SLOT (handle_create_dialog (const QString&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1190 const QString&, const QStringList&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1191 const QString&, const QStringList&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1192
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1193 // Register QIntList so that list of ints may be part of a signal.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1194 qRegisterMetaType<QIntList> ("QIntList");
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1195 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1196 SIGNAL (create_listview (const QStringList&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1197 int, int, const QIntList&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1198 const QString&, const QStringList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1199 const QString&, const QString&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1200 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1201 SLOT (handle_create_listview (const QStringList&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1202 int, int, const QIntList&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1203 const QString&, const QStringList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1204 const QString&, const QString&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1205
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1206 // Register QFloatList so that list of floats may be part of a signal.
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1207 qRegisterMetaType<QFloatList> ("QFloatList");
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1208 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1209 SIGNAL (create_inputlayout (const QStringList&, const QString&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1210 const QFloatList&, const QFloatList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1211 const QStringList&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1212 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1213 SLOT (handle_create_inputlayout (const QStringList&, const QString&,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1214 const QFloatList&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1215 const QFloatList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1216 const QStringList&)));
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1217
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1218 connect (&uiwidget_creator,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1219 SIGNAL (create_filedialog (const QStringList &,const QString&,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1220 const QString&, const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1221 const QString&)),
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1222 this,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1223 SLOT (handle_create_filedialog (const QStringList &, const QString&,
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1224 const QString&, const QString&,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1225 const QString&)));
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1226 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1227
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1228 // Create a message dialog with specified string, buttons and decorative
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1229 // text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1230
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1231 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1232 main_window::handle_create_dialog (const QString& message,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1233 const QString& title,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1234 const QString& icon,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1235 const QStringList& button,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1236 const QString& defbutton,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1237 const QStringList& role)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1238 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1239 MessageDialog *message_dialog = new MessageDialog (message, title, icon,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1240 button, defbutton, role);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1241 message_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1242 message_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1243 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1244
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1245 // Create a list dialog with specified list, initially selected, mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1246 // view size and decorative text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1247
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1248 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1249 main_window::handle_create_listview (const QStringList& list,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1250 const QString& mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1251 int wd, int ht,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1252 const QIntList& initial,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1253 const QString& name,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1254 const QStringList& prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1255 const QString& ok_string,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1256 const QString& cancel_string)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1257 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1258 ListDialog *list_dialog = new ListDialog (list, mode, wd, ht,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1259 initial, name, prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1260 ok_string, cancel_string);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1261
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1262 list_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1263 list_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1264 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1265
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1266 // Create an input dialog with specified prompts and defaults, title and
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1267 // row/column size specifications.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1268 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1269 main_window::handle_create_inputlayout (const QStringList& prompt,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1270 const QString& title,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1271 const QFloatList& nr,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1272 const QFloatList& nc,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1273 const QStringList& defaults)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1274 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1275 InputDialog *input_dialog = new InputDialog (prompt, title, nr, nc,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1276 defaults);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1277
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1278 input_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1279 input_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1280 }
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1281
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1282 void
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1283 main_window::handle_create_filedialog (const QStringList& filters,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1284 const QString& title,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1285 const QString& filename,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1286 const QString& dirname,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1287 const QString& multimode)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1288 {
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1289 FileDialog *file_dialog = new FileDialog (filters, title, filename,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1290 dirname, multimode);
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1291
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1292 file_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1293 file_dialog->show ();
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1294 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1295
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1296 // Main subroutine of the constructor
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1297 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1298 main_window::construct (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1299 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
1300 _closing = false; // flag for editor files when closed
16445
3f8d3fc907af store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
1301
15607
c9c79d4a0a00 Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15591
diff changeset
1302 // Create and set the central widget. QMainWindow takes ownership of
c9c79d4a0a00 Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15591
diff changeset
1303 // the widget (pointer) so there is no need to delete the object upon
c9c79d4a0a00 Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15591
diff changeset
1304 // destroying this main_window.
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1305
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
1306 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
1307 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
1308 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
1309 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
1310 dummyWidget->hide ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
1311 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
1312
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1313 connect_uiwidget_links ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1314
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1315 construct_octave_qt_link ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1316
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1317 if (_start_gui)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1318 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1319 setWindowIcon (QIcon (":/actions/icons/logo.png"));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1320
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1321 workspace_window->setModel (_workspace_model);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1322 connect (_workspace_model, SIGNAL (model_changed (void)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1323 workspace_window, SLOT (handle_model_changed (void)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1324
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1325 construct_menu_bar ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1326
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1327 construct_tool_bar ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1328
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1329 connect (qApp, SIGNAL (aboutToQuit ()),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1330 this, SLOT (prepare_to_exit ()));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1331
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1332 connect (qApp, SIGNAL (focusChanged (QWidget*, QWidget*)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1333 this, SLOT(focus_changed (QWidget*, QWidget*)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1334
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1335 connect (this, SIGNAL (settings_changed (const QSettings *)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1336 this, SLOT (notice_settings (const QSettings *)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1337
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1338 connect (this, SIGNAL (editor_focus_changed (bool)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1339 this, SLOT (set_global_edit_shortcuts (bool)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1340
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1341 connect (this, SIGNAL (editor_focus_changed (bool)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1342 editor_window, SLOT (enable_menu_shortcuts (bool)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1343
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1344 connect (file_browser_window, SIGNAL (load_file_signal (const QString&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1345 this, SLOT (handle_load_workspace_request (const QString&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1346
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1347 connect (file_browser_window, SIGNAL (find_files_signal (const QString&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1348 this, SLOT (find_files (const QString&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1349
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1350 setWindowTitle ("Octave");
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1351
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1352 setDockOptions (QMainWindow::AnimatedDocks
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1353 | QMainWindow::AllowNestedDocks
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1354 | QMainWindow::AllowTabbedDocks);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1355
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1356 addDockWidget (Qt::RightDockWidgetArea, command_window);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1357 addDockWidget (Qt::RightDockWidgetArea, doc_browser_window);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1358 tabifyDockWidget (command_window, doc_browser_window);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1359
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1360 #ifdef HAVE_QSCINTILLA
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1361 addDockWidget (Qt::RightDockWidgetArea, editor_window);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1362 tabifyDockWidget (command_window, editor_window);
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1363 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1364
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1365 addDockWidget (Qt::LeftDockWidgetArea, file_browser_window);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1366 addDockWidget (Qt::LeftDockWidgetArea, workspace_window);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1367 addDockWidget (Qt::LeftDockWidgetArea, history_window);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1368
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1369 int win_x = QApplication::desktop ()->width ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1370 int win_y = QApplication::desktop ()->height ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1371
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1372 if (win_x > 960)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1373 win_x = 960;
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1374
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1375 if (win_y > 720)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1376 win_y = 720;
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1377
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1378 setGeometry (0, 0, win_x, win_y);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1379
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1380 setStatusBar (status_bar);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1381
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1382 #ifdef HAVE_QSCINTILLA
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1383 connect (this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1384 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1385 editor_window,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1386 SLOT (handle_insert_debugger_pointer_request (const QString&, int)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1387
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1388 connect (this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1389 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1390 editor_window,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1391 SLOT (handle_delete_debugger_pointer_request (const QString&, int)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1392
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1393 connect (this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1394 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1395 editor_window,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1396 SLOT (handle_update_breakpoint_marker_request (bool,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1397 const QString&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1398 int)));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1399 #endif
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1400
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1401 octave_link::post_event (this, &main_window::resize_command_window_callback);
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1402
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1403 configure_shortcuts ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1404 }
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1405 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1406
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1407
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1408 void
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1409 main_window::handle_octave_ready ()
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1410 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1411 // actions after the startup files are executed
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1412 QSettings *settings = resource_manager::get_settings ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1413
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1414 QDir startup_dir = QDir (); // current octave dir after startup
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1415
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1416 if (settings)
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1417 {
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1418 if (settings->value ("restore_octave_dir").toBool ())
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1419 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1420 // restore last dir from previous session
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1421 QStringList curr_dirs
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1422 = settings->value ("MainWindow/current_directory_list").toStringList ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1423 startup_dir = QDir (curr_dirs.at (0)); // last dir in previous session
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1424 }
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1425 else if (! settings->value ("octave_startup_dir").toString ().isEmpty ())
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1426 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1427 // do not restore but there is a startup dir configured
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1428 startup_dir = QDir (settings->value ("octave_startup_dir").toString ());
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1429 }
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1430 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1431
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1432 if (! startup_dir.exists ())
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1433 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1434 // the configured startup dir does not exist, take actual one
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1435 startup_dir = QDir ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1436 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1437
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1438 set_current_working_directory (startup_dir.absolutePath ());
18867
6504a1932637 auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents: 18862
diff changeset
1439
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1440 if (editor_window)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1441 {
18867
6504a1932637 auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents: 18862
diff changeset
1442 #ifdef HAVE_QSCINTILLA
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1443 // Octave ready, determine whether to create an empty script.
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1444 // This can not be done when the editor is created because all functions
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1445 // must be known for the lexer's auto completion informations
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1446 editor_window->empty_script (true, false);
18867
6504a1932637 auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents: 18862
diff changeset
1447 #endif
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1448 }
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1449
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1450 if (_start_gui)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1451 focus_command_window (); // make sure that the command window has focus
18979
d2100cb2331a make sure the command has focus at startup
Torsten <ttl@justmail.de>
parents: 18978
diff changeset
1452
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1453 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1454
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1455
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1456 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1457 main_window::construct_octave_qt_link (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1458 {
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1459 _octave_qt_link = new octave_qt_link (this);
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1460
19748
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
1461 connect (_octave_qt_link, SIGNAL (exit_app_signal (int)),
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19736
diff changeset
1462 this, SLOT (exit_app (int)));
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
1463
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1464 connect (_octave_qt_link, SIGNAL (confirm_shutdown_signal ()),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1465 this, SLOT (confirm_shutdown_octave ()));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1466
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1467 if (_start_gui)
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1468 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1469 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1470 SIGNAL (set_workspace_signal
20005
f7846f0ea6db GUI: enable workspace update when debugging (Bug #44455)
John Donoghue
parents: 19984
diff changeset
1471 (bool, bool, const QString&, const QStringList&,
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1472 const QStringList&, const QStringList&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1473 const QStringList&, const QIntList&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1474 _workspace_model,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1475 SLOT (set_workspace
20005
f7846f0ea6db GUI: enable workspace update when debugging (Bug #44455)
John Donoghue
parents: 19984
diff changeset
1476 (bool, bool, const QString&, const QStringList&,
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1477 const QStringList&, const QStringList&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1478 const QStringList&, const QIntList&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1479
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1480 connect (_octave_qt_link, SIGNAL (clear_workspace_signal ()),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1481 _workspace_model, SLOT (clear_workspace ()));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1482
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1483 connect (_octave_qt_link, SIGNAL (change_directory_signal (QString)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1484 this, SLOT (change_directory (QString)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1485 connect (_octave_qt_link, SIGNAL (change_directory_signal (QString)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1486 file_browser_window, SLOT (update_octave_directory (QString)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1487 connect (_octave_qt_link, SIGNAL (change_directory_signal (QString)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1488 editor_window, SLOT (update_octave_directory (QString)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1489
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1490 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1491 SIGNAL (execute_command_in_terminal_signal (QString)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1492 this, SLOT (execute_command_in_terminal (QString)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1493
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1494 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1495 SIGNAL (set_history_signal (const QStringList&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1496 history_window, SLOT (set_history (const QStringList&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1497
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1498 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1499 SIGNAL (append_history_signal (const QString&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1500 history_window, SLOT (append_history (const QString&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1501
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1502 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1503 SIGNAL (clear_history_signal (void)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1504 history_window, SLOT (clear_history (void)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1505
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1506 connect (_octave_qt_link, SIGNAL (enter_debugger_signal ()),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1507 this, SLOT (handle_enter_debugger ()));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1508
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1509 connect (_octave_qt_link, SIGNAL (exit_debugger_signal ()),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1510 this, SLOT (handle_exit_debugger ()));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1511
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1512 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1513 SIGNAL (show_preferences_signal (void)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1514 this, SLOT (process_settings_dialog_request ()));
17010
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1515
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1516 #ifdef HAVE_QSCINTILLA
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1517 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1518 SIGNAL (edit_file_signal (const QString&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1519 editor_window,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1520 SLOT (handle_edit_file_request (const QString&)));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1521 #endif
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1522
19984
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1523 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1524 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1525 this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1526 SLOT (handle_insert_debugger_pointer_request (const QString&, int)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1527
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1528 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1529 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1530 this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1531 SLOT (handle_delete_debugger_pointer_request (const QString&, int)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1532
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1533 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1534 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1535 this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1536 SLOT (handle_update_breakpoint_marker_request (bool, const QString&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1537 int)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1538
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1539 connect (_octave_qt_link,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1540 SIGNAL (show_doc_signal (const QString &)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1541 this, SLOT (handle_show_doc (const QString &)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1542
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1543 connect (_workspace_model,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1544 SIGNAL (rename_variable (const QString&, const QString&)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1545 this,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1546 SLOT (handle_rename_variable_request (const QString&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1547 const QString&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1548
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1549 connect (command_window, SIGNAL (interrupt_signal (void)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1550 _octave_qt_link, SLOT (terminal_interrupt (void)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19980
diff changeset
1551 }
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
1552
16432
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
1553 _octave_qt_link->execute_interpreter ();
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
1554
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
1555 octave_link::connect_link (_octave_qt_link);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1556 }
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1557
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1558 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1559 main_window::construct_menu_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1560 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1561 QMenuBar *menu_bar = menuBar ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1562
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1563 construct_file_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1564
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1565 construct_edit_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1566
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1567 construct_debug_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1568
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1569 construct_window_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1570
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1571 construct_help_menu (menu_bar);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1572
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1573 construct_news_menu (menu_bar);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1574 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1575
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1576 QAction*
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1577 main_window::add_action (QMenu *menu, const QIcon &icon, const QString &text,
18744
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1578 const char *member, const QWidget *receiver)
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1579 {
18744
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1580 QAction *a;
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1581
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1582 if (receiver)
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1583 a = menu->addAction (icon, text, receiver, member);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1584 else
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1585 a = menu->addAction (icon, text, this, member);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1586
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1587 addAction (a); // important for shortcut context
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1588 a->setShortcutContext (Qt::ApplicationShortcut);
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1589 return a;
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1590 }
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1591
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1592 void
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1593 main_window::enable_menu_shortcuts (bool enable)
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1594 {
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1595 QHash<QMenu*, QStringList>::const_iterator i = _hash_menu_text.constBegin();
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1596
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
1597 while (i != _hash_menu_text.constEnd())
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
1598 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
1599 i.key ()->setTitle (i.value ().at (! enable));
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
1600 ++i;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
1601 }
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1602 }
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1603
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1604 QMenu*
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1605 main_window::m_add_menu (QMenuBar *p, QString name)
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1606 {
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1607 QMenu *menu = p->addMenu (name);
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1608
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1609 QString base_name = name; // get a copy
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1610 // replace intended '&' ("&&") by a temp. string
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1611 base_name.replace ("&&","___octave_amp_replacement___");
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1612 // remove single '&' (shortcut)
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1613 base_name.remove ("&");
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1614 // restore intended '&'
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1615 base_name.replace ("___octave_amp_replacement___","&&");
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1616
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1617 // remember names with and without shortcut
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1618 _hash_menu_text[menu] = QStringList () << name << base_name;
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1619
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1620 return menu;
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1621 }
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1622
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1623 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1624 main_window::construct_file_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1625 {
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1626 QMenu *file_menu = m_add_menu (p, tr ("&File"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1627
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1628 construct_new_menu (file_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1629
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1630 _open_action
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1631 = file_menu->addAction (resource_manager::icon ("document-open"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1632 tr ("Open..."));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1633 _open_action->setShortcutContext (Qt::ApplicationShortcut);
19214
a748865bfafb improve some menu texts and tool tips (bug #43200)
Torsten <ttl@justmail.de>
parents: 18979
diff changeset
1634 _open_action->setToolTip (tr ("Open an existing file in editor"));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1635
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1636 #ifdef HAVE_QSCINTILLA
18699
777281eeb3d4 add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents: 18673
diff changeset
1637 editor_window->insert_new_open_actions (_new_script_action,
777281eeb3d4 add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents: 18673
diff changeset
1638 _new_function_action,
777281eeb3d4 add all editor actions to the shortcut manager and fix their shortcut context
Torsten <ttl@justmail.de>
parents: 18673
diff changeset
1639 _open_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1640
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1641 file_menu->addMenu (editor_window->get_mru_menu ());
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1642 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1643
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1644 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1645
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1646 _load_workspace_action
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
1647 = file_menu->addAction (tr ("Load Workspace..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1648
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1649 _save_workspace_action
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
1650 = file_menu->addAction (tr ("Save Workspace As..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1651
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1652 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1653
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1654 _preferences_action
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1655 = file_menu->addAction (resource_manager::icon ("preferences-system"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1656 tr ("Preferences..."));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1657
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1658 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1659
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1660 _exit_action = file_menu->addAction (tr ("Exit"));
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1661 _exit_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1662
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1663 connect (_preferences_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1664 this, SLOT (process_settings_dialog_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1665
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1666 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1667 connect (_open_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1668 editor_window, SLOT (request_open_file ()));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1669 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1670
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1671 connect (_load_workspace_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1672 this, SLOT (handle_load_workspace_request ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1673
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1674 connect (_save_workspace_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1675 this, SLOT (handle_save_workspace_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1676
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1677 connect (_exit_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1678 this, SLOT (close ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1679 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1680
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1681 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1682 main_window::construct_new_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1683 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1684 QMenu *new_menu = p->addMenu (tr ("New"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1685
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1686 _new_script_action
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1687 = new_menu->addAction (resource_manager::icon ("document-new"),
18345
dfc6ef6ac455 some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents: 18318
diff changeset
1688 tr ("New Script"));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1689 _new_script_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1690
19214
a748865bfafb improve some menu texts and tool tips (bug #43200)
Torsten <ttl@justmail.de>
parents: 18979
diff changeset
1691 _new_function_action = new_menu->addAction (tr ("New Function..."));
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
1692 _new_function_action->setEnabled (true);
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
1693 _new_function_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1694
19214
a748865bfafb improve some menu texts and tool tips (bug #43200)
Torsten <ttl@justmail.de>
parents: 18979
diff changeset
1695 _new_figure_action = new_menu->addAction (tr ("New Figure"));
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1696 _new_figure_action->setEnabled (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1697
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1698 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1699 connect (_new_script_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1700 editor_window, SLOT (request_new_script ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1701
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
1702 connect (_new_function_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1703 editor_window, SLOT (request_new_function ()));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1704 #endif
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1705
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1706 connect (_new_figure_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1707 this, SLOT (handle_new_figure_request ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1708 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1709
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1710 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1711 main_window::construct_edit_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1712 {
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1713 QMenu *edit_menu = m_add_menu (p, tr ("&Edit"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1714
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1715 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1716
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1717 _undo_action
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1718 = edit_menu->addAction (resource_manager::icon ("edit-undo"), tr ("Undo"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1719
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1720 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1721
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1722 _copy_action
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1723 = edit_menu->addAction (resource_manager::icon ("edit-copy"),
16649
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
1724 tr ("Copy"), this, SLOT (copyClipboard ()));
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1725
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1726 _paste_action
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1727 = edit_menu->addAction (resource_manager::icon ("edit-paste"),
16649
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
1728 tr ("Paste"), this, SLOT (pasteClipboard ()));
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1729
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1730 _select_all_action
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1731 = edit_menu->addAction (tr ("Select All"), this, SLOT (selectAll ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1732
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1733 _clear_clipboard_action
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1734 = edit_menu->addAction (tr ("Clear Clipboard"), this,
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1735 SLOT (clear_clipboard ()));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1736
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1737 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1738
19943
4e15e8cb16ae gui: added icons menu items that have icons used elsewhere
John Donoghue
parents: 19942
diff changeset
1739 _find_files_action
4e15e8cb16ae gui: added icons menu items that have icons used elsewhere
John Donoghue
parents: 19942
diff changeset
1740 = edit_menu->addAction (resource_manager::icon ("edit-find"),
4e15e8cb16ae gui: added icons menu items that have icons used elsewhere
John Donoghue
parents: 19942
diff changeset
1741 tr ("Find Files..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1742
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1743 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1744
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1745 _clear_command_window_action
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1746 = edit_menu->addAction (tr ("Clear Command Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1747
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1748 _clear_command_history_action
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1749 = edit_menu->addAction (tr ("Clear Command History"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1750
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1751 _clear_workspace_action
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1752 = edit_menu->addAction (tr ("Clear Workspace"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1753
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1754 connect (_find_files_action, SIGNAL (triggered ()),
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1755 this, SLOT (find_files ()));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1756
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1757 connect (_clear_command_window_action, SIGNAL (triggered ()),
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1758 this, SLOT (handle_clear_command_window_request ()));
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1759
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1760 connect (_clear_command_history_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1761 this, SLOT (handle_clear_history_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1762
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1763 connect (_clear_workspace_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1764 this, SLOT (handle_clear_workspace_request ()));
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1765
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1766 connect (_clipboard, SIGNAL (changed (QClipboard::Mode)),
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1767 this, SLOT (clipboard_has_changed (QClipboard::Mode)));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1768 clipboard_has_changed (QClipboard::Clipboard);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1769 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1770
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1771 QAction *
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1772 main_window::construct_debug_menu_item (const char *icon, const QString& item,
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1773 const char *member)
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1774 {
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1775 QAction *action = add_action (_debug_menu,
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1776 resource_manager::icon (QString (icon)),
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1777 item, member);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1778
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1779 action->setEnabled (false);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1780
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1781 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1782 editor_window->debug_menu ()->addAction (action);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1783 editor_window->toolbar ()->addAction (action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1784 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1785
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1786 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1787 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1788
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1789 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1790 main_window::construct_debug_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1791 {
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1792 _debug_menu = m_add_menu (p, tr ("De&bug"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1793
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1794 _debug_step_over = construct_debug_menu_item (
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1795 "db-step", tr ("Step"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1796 SLOT (debug_step_over ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1797
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1798 _debug_step_into = construct_debug_menu_item (
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1799 "db-step-in", tr ("Step In"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1800 SLOT (debug_step_into ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1801
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1802 _debug_step_out = construct_debug_menu_item (
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1803 "db-step-out", tr ("Step Out"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1804 SLOT (debug_step_out ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1805
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1806 _debug_continue = construct_debug_menu_item (
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1807 "db-cont", tr ("Continue"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1808 SLOT (debug_continue ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1809
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1810 _debug_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1811 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1812 editor_window->debug_menu ()->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1813 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1814
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1815 _debug_quit = construct_debug_menu_item (
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1816 "db-stop", tr ("Quit Debug Mode"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1817 SLOT (debug_quit ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1818 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1819
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1820 QAction *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1821 main_window::construct_window_menu_item (QMenu *p, const QString& item,
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1822 bool checkable, QWidget *widget)
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1823 {
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1824 QAction *action = p->addAction (QIcon (), item);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1825
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1826 addAction (action); // important for shortcut context
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1827 action->setCheckable (checkable);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1828 action->setShortcutContext (Qt::ApplicationShortcut);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1829
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1830 if (widget) // might be zero for editor_window
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1831 {
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1832 if (checkable)
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1833 {
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1834 // action for visibilty of dock widget
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1835 connect (action, SIGNAL (toggled (bool)),
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1836 widget, SLOT (setVisible (bool)));
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1837
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1838 connect (widget, SIGNAL (active_changed (bool)),
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
1839 action, SLOT (setChecked (bool)));
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1840 }
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1841 else
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1842 {
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1843 // action for focus of dock widget
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1844 connect (action, SIGNAL (triggered ()), widget, SLOT (focus ()));
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1845 }
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1846 }
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1847
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1848 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1849 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1850
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1851 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1852 main_window::construct_window_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1853 {
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1854 QMenu *window_menu = m_add_menu (p, tr ("&Window"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1855
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1856 _show_command_window_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1857 (window_menu, tr ("Show Command Window"), true, command_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1858
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1859 _show_history_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1860 (window_menu, tr ("Show Command History"), true, history_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1861
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1862 _show_file_browser_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1863 (window_menu, tr ("Show File Browser"), true, file_browser_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1864
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1865 _show_workspace_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1866 (window_menu, tr ("Show Workspace"), true, workspace_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1867
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1868 _show_editor_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1869 (window_menu, tr ("Show Editor"), true, editor_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1870
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1871 _show_documentation_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1872 (window_menu, tr ("Show Documentation"), true, doc_browser_window);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1873
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1874 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1875
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1876 _command_window_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1877 (window_menu, tr ("Command Window"), false, command_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1878
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1879 _history_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1880 (window_menu, tr ("Command History"), false, history_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1881
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1882 _file_browser_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1883 (window_menu, tr ("File Browser"), false, file_browser_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1884
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1885 _workspace_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1886 (window_menu, tr ("Workspace"), false, workspace_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1887
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1888 _editor_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1889 (window_menu, tr ("Editor"), false, editor_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1890
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1891 _documentation_action = construct_window_menu_item
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1892 (window_menu, tr ("Documentation"), false, doc_browser_window);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1893
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1894 window_menu->addSeparator ();
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1895
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1896 _reset_windows_action = add_action (window_menu, QIcon (),
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
1897 tr ("Reset Default Window Layout"), SLOT (reset_windows ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1898 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1899
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1900 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1901 main_window::construct_help_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1902 {
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1903 QMenu *help_menu = m_add_menu (p, tr ("&Help"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1904
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1905 construct_documentation_menu (help_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1906
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1907 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1908
18744
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1909 _report_bug_action = add_action (help_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1910 tr ("Report Bug"), SLOT (open_bug_tracker_page ()));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1911
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1912 _octave_packages_action = add_action (help_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1913 tr ("Octave Packages"), SLOT (open_octave_packages_page ()));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1914
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1915 _agora_action = add_action (help_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1916 tr ("Share Code"), SLOT (open_agora_page ()));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1917
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1918 _contribute_action = add_action (help_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1919 tr ("Contribute to Octave"), SLOT (open_contribute_page ()));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1920
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1921 _developer_action = add_action (help_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1922 tr ("Octave Developer Resources"), SLOT (open_developer_page ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1923
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1924 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1925
18744
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1926 _about_octave_action = add_action (help_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1927 tr ("About Octave"), SLOT (show_about_octave ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1928 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1929
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1930 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1931 main_window::construct_documentation_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1932 {
18744
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1933 QMenu *doc_menu = p->addMenu (tr ("Documentation"));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1934
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1935 _ondisk_doc_action = add_action (doc_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1936 tr ("On Disk"), SLOT (focus ()), doc_browser_window);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1937
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1938 _online_doc_action = add_action (doc_menu, QIcon (),
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
1939 tr ("Online"), SLOT (open_online_documentation_page ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1940 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1941
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1942 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1943 main_window::construct_news_menu (QMenuBar *p)
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1944 {
18978
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18874
diff changeset
1945 QMenu *news_menu = m_add_menu (p, tr ("&News"));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1946
18745
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
1947 _release_notes_action = add_action (news_menu, QIcon (),
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
1948 tr ("Release Notes"), SLOT (display_release_notes ()));
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
1949
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
1950 _current_news_action = add_action (news_menu, QIcon (),
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
1951 tr ("Community News"), SLOT (load_and_display_community_news ()));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1952 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1953
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1954 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1955 main_window::construct_tool_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1956 {
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1957 _main_tool_bar = addToolBar ("Main");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1958
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1959 _main_tool_bar->setObjectName ("MainToolBar");
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1960 _main_tool_bar->addAction (_new_script_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1961 _main_tool_bar->addAction (_open_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1962
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1963 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1964
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1965 _main_tool_bar->addAction (_copy_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1966 _main_tool_bar->addAction (_paste_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1967 _main_tool_bar->addAction (_undo_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1968
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1969 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1970
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1971 _current_directory_combo_box = new QComboBox (this);
19880
72fe9df87fe8 improve scalability of gui objects (as discussed in bug #41938)
Torsten <ttl@justmail.de>
parents: 19837
diff changeset
1972 QFontMetrics fm = _current_directory_combo_box->fontMetrics ();
72fe9df87fe8 improve scalability of gui objects (as discussed in bug #41938)
Torsten <ttl@justmail.de>
parents: 19837
diff changeset
1973 _current_directory_combo_box->setFixedWidth (48*fm.averageCharWidth ());
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1974 _current_directory_combo_box->setEditable (true);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1975 _current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1976 _current_directory_combo_box->setToolTip (tr ("Enter directory name"));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1977 _current_directory_combo_box->setMaxVisibleItems (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1978 current_directory_max_visible);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1979 _current_directory_combo_box->setMaxCount (current_directory_max_count);
19880
72fe9df87fe8 improve scalability of gui objects (as discussed in bug #41938)
Torsten <ttl@justmail.de>
parents: 19837
diff changeset
1980 QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1981 _current_directory_combo_box->setSizePolicy (sizePol);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1982
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1983 // addWidget takes ownership of the objects so there is no
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1984 // need to delete these upon destroying this main_window.
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1985 _main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1986 _main_tool_bar->addWidget (_current_directory_combo_box);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1987 QAction *current_dir_up = _main_tool_bar->addAction (
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1988 resource_manager::icon ("go-up"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1989 tr ("One directory up"));
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1990 QAction *current_dir_search = _main_tool_bar->addAction (
19934
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19928
diff changeset
1991 resource_manager::icon ("folder"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1992 tr ("Browse directories"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1993
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1994 connect (_current_directory_combo_box, SIGNAL (activated (QString)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1995 this, SLOT (set_current_working_directory (QString)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1996
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1997 connect (_current_directory_combo_box->lineEdit (), SIGNAL (returnPressed ()),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1998 this, SLOT (accept_directory_line_edit ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1999
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2000 connect (current_dir_search, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2001 this, SLOT (browse_for_directory ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2002
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2003 connect (current_dir_up, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2004 this, SLOT (change_directory_up ()));
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2005
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2006 connect (_undo_action, SIGNAL (triggered ()),
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2007 this, SLOT (handle_undo_request ()));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2008 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2009
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2010 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2011 main_window::save_workspace_callback (const std::string& file)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2012 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2013 Fsave (ovl (file));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2014 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2015
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2016 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2017 main_window::load_workspace_callback (const std::string& file)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2018 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2019 Fload (ovl (file));
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
2020
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
2021 octave_link::set_workspace (true, symbol_table::workspace_info ());
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2022 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2023
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2024 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2025 main_window::clear_workspace_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2026 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2027 Fclear ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2028 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2029
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2030 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2031 main_window::rename_variable_callback (const main_window::name_pair& names)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2032 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2033 /* bool status = */ symbol_table::rename (names.first, names.second);
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2034
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2035 // if (status)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2036 octave_link::set_workspace (true, symbol_table::workspace_info ());
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2037
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2038 // else
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2039 // ; // we need an octave_link action that runs a GUI error option.
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2040 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2041
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2042 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2043 main_window::command_window_undo_callback (void)
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2044 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2045 command_editor::undo ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2046 command_editor::redisplay ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2047 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2048
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2049 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2050 main_window::clear_command_window_callback (void)
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2051 {
19736
c048358da712 also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents: 19733
diff changeset
2052 command_editor::kill_full_line ();
19733
2e9f17872f36 Clear the command window safely (bug #44015)
Mike Miller <mtmiller@ieee.org>
parents: 19731
diff changeset
2053 command_editor::clear_screen ();
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2054 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2055
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2056 void
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2057 main_window::resize_command_window_callback (void)
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2058 {
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2059 command_editor::resize_terminal ();
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2060 }
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2061
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2062 void
19336
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2063 main_window::set_screen_size_callback (const int_pair& sz)
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2064 {
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2065 command_editor::set_screen_size (sz.first, sz.second);
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2066 }
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2067
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2068 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2069 main_window::clear_history_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2070 {
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
2071 Fhistory (ovl ("-c"));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2072 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2073
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2074 void
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2075 main_window::execute_command_callback ()
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
2076 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2077 bool repost = false; // flag for reposting event for this callback
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
2078
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2079 if (! _cmd_queue.isEmpty ()) // list can not be empty here, just to make sure
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2080 {
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2081 _cmd_queue_mutex.lock (); // critical path
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2082
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2083 octave_cmd *cmd = _cmd_queue.takeFirst ();
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2084
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2085 if (_cmd_queue.isEmpty ())
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2086 _cmd_processing.release (); // cmd queue empty, processing will stop
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2087 else
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2088 repost = true; // not empty, repost at end
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2089 _cmd_queue_mutex.unlock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2090
19807
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2091 cmd->execute ();
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2092
034bcac0b61c use of C++ API for running a file (bug #42307)
Torsten <ttl@justmail.de>
parents: 19773
diff changeset
2093 delete cmd;
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2094 }
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2095
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2096 if (repost) // queue not empty, so repost event for further processing
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2097 octave_link::post_event (this, &main_window::execute_command_callback);
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2098
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2099 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2100
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2101 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2102 main_window::new_figure_callback (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2103 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2104 Fbuiltin (ovl ("figure"));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2105 Fdrawnow ();
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2106 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2107
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2108 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2109 main_window::change_directory_callback (const std::string& directory)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2110 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2111 Fcd (ovl (directory));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2112 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2113
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2114 // The next callbacks are invoked by GUI buttons. Those buttons
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
2115 // should only be active when we are doing debugging, which means that
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
2116 // Octave is waiting for input in get_debug_input. Calling
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
2117 // command_editor::interrupt will force readline to return even if it
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
2118 // has not read any input, and then get_debug_input will return,
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
2119 // allowing the evaluator to continue and execute the next statement.
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
2120
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2121 void
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2122 main_window::queue_debug (QString debug_cmd)
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2123 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2124 _dbg_queue_mutex.lock ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2125 _dbg_queue->append (debug_cmd); // queue command
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2126 _dbg_queue_mutex.unlock ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2127
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2128 if (_dbg_processing.tryAcquire ()) // if callback not processing, post event
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2129 octave_link::post_event (this, &main_window::execute_debug_callback);
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2130 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2131
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2132 void
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2133 main_window::execute_debug_callback ()
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2134 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2135 bool repost = false; // flag for reposting event for this callback
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2136
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2137 if (!_dbg_queue->isEmpty ()) // list can not be empty here, just to make sure
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2138 {
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2139 _dbg_queue_mutex.lock (); // critical path
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2140 QString debug = _dbg_queue->takeFirst ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2141 if (_dbg_queue->isEmpty ())
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2142 _dbg_processing.release (); // cmd queue empty, processing will stop
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2143 else
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2144 repost = true; // not empty, repost at end
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2145 _dbg_queue_mutex.unlock ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2146
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2147 if (debug == "step")
19413
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2148 {
19889
a59c5a16c9ab Rename db_next_breakpoint_quiet to internal function.
Rik <rik@octave.org>
parents: 19881
diff changeset
2149 F__db_next_breakpoint_quiet__ (ovl (_suppress_dbg_location));
19413
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2150 Fdbstep ();
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2151 }
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2152 else if (debug == "cont")
19413
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2153 {
19889
a59c5a16c9ab Rename db_next_breakpoint_quiet to internal function.
Rik <rik@octave.org>
parents: 19881
diff changeset
2154 F__db_next_breakpoint_quiet__ (ovl (_suppress_dbg_location));
19413
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2155 Fdbcont ();
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2156 }
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2157 else if (debug == "quit")
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2158 Fdbquit ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2159 else
19413
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2160 {
19889
a59c5a16c9ab Rename db_next_breakpoint_quiet to internal function.
Rik <rik@octave.org>
parents: 19881
diff changeset
2161 F__db_next_breakpoint_quiet__ (ovl (_suppress_dbg_location));
19413
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2162 Fdbstep (ovl (debug.toStdString ()));
c1ce43276b86 avoid printing debug location in cmd window when using GUI to step
John W. Eaton <jwe@octave.org>
parents: 19337
diff changeset
2163 }
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2164
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2165 command_editor::interrupt (true);
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2166 }
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2167
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2168 if (repost) // queue not empty, so repost event for further processing
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2169 octave_link::post_event (this, &main_window::execute_debug_callback);
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2170
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2171 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2172
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2173 void
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2174 main_window::find_files (const QString &start_dir)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2175 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2176
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2177 if (! find_files_dlg)
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2178 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2179 find_files_dlg = new find_files_dialog (this);
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2180
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2181 connect (find_files_dlg, SIGNAL (finished (int)),
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2182 this, SLOT (find_files_finished (int)));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2183
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2184 connect (find_files_dlg, SIGNAL (dir_selected (const QString &)),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2185 file_browser_window,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2186 SLOT (set_current_directory (const QString&)));
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2187
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2188 connect (find_files_dlg, SIGNAL (file_selected (const QString &)),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2189 this, SLOT (open_file (const QString &)));
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2190
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2191 find_files_dlg->setWindowModality (Qt::NonModal);
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2192 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2193
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2194 if (! find_files_dlg->isVisible ())
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2195 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2196 find_files_dlg->show ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2197 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2198
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2199 find_files_dlg->set_search_dir (start_dir);
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2200
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2201 find_files_dlg->activateWindow ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2202
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2203 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2204
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2205 void
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2206 main_window::find_files_finished (int)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2207 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2208
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2209 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2210
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2211 void
19463
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2212 main_window::set_global_edit_shortcuts (bool editor_has_focus)
18718
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2213 {
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2214 // this slot is called when editor gets/loses focus
19463
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2215 if (editor_has_focus)
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2216 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2217 // disable shortcuts that are also provided by the editor itself
18718
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2218 QKeySequence no_key = QKeySequence ();
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2219 _copy_action->setShortcut (no_key);
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2220 _paste_action->setShortcut (no_key);
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2221 _undo_action->setShortcut (no_key);
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2222 _select_all_action->setShortcut (no_key);
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2223 }
19463
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2224 else
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2225 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2226 // editor loses focus, set the global shortcuts
19463
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2227 shortcut_manager::set_shortcut (_copy_action, "main_edit:copy");
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2228 shortcut_manager::set_shortcut (_paste_action, "main_edit:paste");
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2229 shortcut_manager::set_shortcut (_undo_action, "main_edit:undo");
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2230 shortcut_manager::set_shortcut (_select_all_action, "main_edit:select_all");
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2231 }
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2232
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2233 // dis-/enable global menu depending on editor's focus
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19460
diff changeset
2234 enable_menu_shortcuts (! editor_has_focus);
18718
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2235 }
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2236
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2237 void
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2238 main_window::configure_shortcuts ()
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2239 {
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2240 // file menu
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2241 shortcut_manager::set_shortcut (_open_action, "main_file:open_file");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2242 shortcut_manager::set_shortcut (_new_script_action, "main_file:new_file");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2243 shortcut_manager::set_shortcut (_new_function_action, "main_file:new_function");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2244 shortcut_manager::set_shortcut (_new_function_action, "main_file:new_figure");
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2245 shortcut_manager::set_shortcut (_load_workspace_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2246 "main_file:load_workspace");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2247 shortcut_manager::set_shortcut (_save_workspace_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2248 "main_file:save_workspace");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2249 shortcut_manager::set_shortcut (_preferences_action, "main_file:preferences");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2250 shortcut_manager::set_shortcut (_exit_action,"main_file:exit");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2251
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2252 // edit menu
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2253 shortcut_manager::set_shortcut (_copy_action, "main_edit:copy");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2254 shortcut_manager::set_shortcut (_paste_action, "main_edit:paste");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2255 shortcut_manager::set_shortcut (_undo_action, "main_edit:undo");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2256 shortcut_manager::set_shortcut (_select_all_action, "main_edit:select_all");
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2257 shortcut_manager::set_shortcut (_clear_clipboard_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2258 "main_edit:clear_clipboard");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2259 shortcut_manager::set_shortcut (_find_files_action, "main_edit:find_in_files");
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2260 shortcut_manager::set_shortcut (_clear_command_history_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2261 "main_edit:clear_history");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2262 shortcut_manager::set_shortcut (_clear_command_window_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2263 "main_edit:clear_command_window");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2264 shortcut_manager::set_shortcut (_clear_workspace_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2265 "main_edit:clear_workspace");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2266
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2267 // debug menu
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2268 shortcut_manager::set_shortcut (_debug_step_over, "main_debug:step_over");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2269 shortcut_manager::set_shortcut (_debug_step_into, "main_debug:step_into");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2270 shortcut_manager::set_shortcut (_debug_step_out, "main_debug:step_out");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2271 shortcut_manager::set_shortcut (_debug_continue, "main_debug:continue");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2272 shortcut_manager::set_shortcut (_debug_quit, "main_debug:quit");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2273
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2274 // window menu
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2275 shortcut_manager::set_shortcut (_show_command_window_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2276 "main_window:show_command");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2277 shortcut_manager::set_shortcut (_show_history_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2278 "main_window:show_history");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2279 shortcut_manager::set_shortcut (_show_workspace_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2280 "main_window:show_workspace");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2281 shortcut_manager::set_shortcut (_show_file_browser_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2282 "main_window:show_file_browser");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2283 shortcut_manager::set_shortcut (_show_editor_action, "main_window:show_editor");
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2284 shortcut_manager::set_shortcut (_show_documentation_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2285 "main_window:show_doc");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2286 shortcut_manager::set_shortcut (_command_window_action, "main_window:command");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2287 shortcut_manager::set_shortcut (_history_action, "main_window:history");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2288 shortcut_manager::set_shortcut (_workspace_action, "main_window:workspace");
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2289 shortcut_manager::set_shortcut (_file_browser_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2290 "main_window:file_browser");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2291 shortcut_manager::set_shortcut (_editor_action, "main_window:editor");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2292 shortcut_manager::set_shortcut (_documentation_action, "main_window:doc");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2293 shortcut_manager::set_shortcut (_reset_windows_action, "main_window:reset");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2294
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2295 // help menu
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2296 shortcut_manager::set_shortcut (_ondisk_doc_action, "main_help:ondisk_doc");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2297 shortcut_manager::set_shortcut (_online_doc_action, "main_help:online_doc");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2298 shortcut_manager::set_shortcut (_report_bug_action, "main_help:report_bug");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2299 shortcut_manager::set_shortcut (_octave_packages_action, "main_help:packages");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2300 shortcut_manager::set_shortcut (_agora_action, "main_help:agora");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2301 shortcut_manager::set_shortcut (_contribute_action, "main_help:contribute");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2302 shortcut_manager::set_shortcut (_developer_action, "main_help:developer");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2303 shortcut_manager::set_shortcut (_about_octave_action, "main_help:about");
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2304
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2305 // news menu
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2306 shortcut_manager::set_shortcut (_release_notes_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2307 "main_news:release_notes");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2308 shortcut_manager::set_shortcut (_current_news_action,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2309 "main_news:community_news");
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2310 }
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2311
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2312 void
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2313 main_window::set_global_shortcuts (bool set_shortcuts)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2314 {
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2315 // this slot is called when the terminal gets/loses focus
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2316
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2317 // return if the user don't want to use readline shortcuts
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2318 if (! _prevent_readline_conflicts)
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2319 return;
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2320
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2321 if (set_shortcuts)
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2322 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2323 // terminal loses focus: set the global shortcuts
18751
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18745
diff changeset
2324 configure_shortcuts ();
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2325 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2326 else
19895
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2327 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19889
diff changeset
2328 // terminal gets focus: disable some shortcuts
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2329 QKeySequence no_key = QKeySequence ();
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2330
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2331 // file menu
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2332 _open_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2333 _new_script_action->setShortcut (no_key);
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
2334 _new_function_action->setShortcut (no_key);
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2335 _new_function_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2336 _load_workspace_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2337 _save_workspace_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2338 _preferences_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2339 _exit_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2340
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2341 // edit menu
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2342 _select_all_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2343 _clear_clipboard_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2344 _find_files_action->setShortcut (no_key);
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2345 _clear_command_history_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2346 _clear_command_window_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2347 _clear_workspace_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2348
18741
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
2349 // window menu
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18738
diff changeset
2350 _reset_windows_action->setShortcut (no_key);
18744
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2351
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2352 // help menu
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2353 _ondisk_doc_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2354 _online_doc_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2355 _report_bug_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2356 _octave_packages_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2357 _agora_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2358 _contribute_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2359 _developer_action->setShortcut (no_key);
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18742
diff changeset
2360 _about_octave_action->setShortcut (no_key);
18745
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
2361
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
2362 // news menu
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
2363 _release_notes_action->setShortcut (no_key);
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18744
diff changeset
2364 _current_news_action->setShortcut (no_key);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2365 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2366 }
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2367
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2368 void
19336
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2369 main_window::set_screen_size (int ht, int wd)
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2370 {
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2371 octave_link::post_event (this, &main_window::set_screen_size_callback,
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2372 int_pair (ht, wd));
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2373 }
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2374
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19214
diff changeset
2375 void
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2376 main_window::handle_show_doc (const QString& file)
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2377 {
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2378 doc_browser_window->setVisible (true);
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2379 emit show_doc_signal (file);
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2380 }
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2381
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2382 void
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2383 main_window::clipboard_has_changed (QClipboard::Mode cp_mode)
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2384 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2385 if (cp_mode == QClipboard::Clipboard)
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2386 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2387 if (_clipboard->text ().isEmpty ())
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2388 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2389 _paste_action->setEnabled (false);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2390 _clear_clipboard_action->setEnabled (false);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2391 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2392 else
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2393 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2394 _paste_action->setEnabled (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2395 _clear_clipboard_action->setEnabled (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2396 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2397 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2398 }
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2399
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2400 void
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2401 main_window::clear_clipboard ()
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2402 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2403 _clipboard->clear (QClipboard::Clipboard);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2404 }
18673
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2405