annotate libgui/src/main-window.cc @ 18738:908523bd79b4 gui-release

use shortcut manager for the debug menu * main-window.cc (add_action): new function for adding actions to menus and setting Qt::ApplicationShortcut to the actions; (construct_debug_menu_item): do not set shortcuts but the slot here; (construct_debug_menu): update calls to construct_debug_menu_item; (set_global_shortcuts): set the shortcut for the actions and the settings key * main-window.h: new function add_action, changed paramters of construct_debug_menu_item * shortcut-manager.cc (do_init_data): init the shortcuts for the debug menus
author Torsten <ttl@justmail.de>
date Mon, 28 Apr 2014 22:48:28 +0200
parents 86eca5d178a6
children f31fde98c872
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
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16446
diff changeset
3 Copyright (C) 2013 John W. Eaton
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17686
diff changeset
4 Copyright (C) 2011-2013 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
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents: 18437
diff changeset
56 #include "__init_qt__.h"
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents: 18437
diff changeset
57
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 "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
59 #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
60 #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
61
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
62 #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
63 #include "defaults.h"
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
64 #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
65 #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
66 #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
67
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
68 static file_editor_interface *
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
69 create_default_editor (QWidget *p)
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
70 {
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
71 #ifdef HAVE_QSCINTILLA
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
72 return new file_editor (p);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
73 #else
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
74 return 0;
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
75 #endif
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
76 }
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
77
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
78 main_window::main_window (QWidget *p)
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
79 : QMainWindow (p),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
80 _workspace_model (new workspace_model ()),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
81 status_bar (new QStatusBar ()),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
82 command_window (new terminal_dock_widget (this)),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
83 history_window (new history_dock_widget (this)),
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
84 file_browser_window (new files_dock_widget (this)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
85 doc_browser_window (new documentation_dock_widget (this)),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
86 editor_window (create_default_editor (this)),
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
87 workspace_window (new workspace_view (this)),
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
88 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
89 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
90 community_news_window (0),
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
91 _octave_qt_link (0),
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
92 _clipboard (QApplication::clipboard ()),
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
93 _cmd_queue (new QStringList ()), // no command pending
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
94 _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
95 _cmd_queue_mutex (),
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
96 _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
97 _dbg_processing (1),
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
98 _dbg_queue_mutex ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
99 {
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
100 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
101
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
102 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
103 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
104 int serial = 0;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
105
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
106 if (settings)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
107 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
108 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
109 = 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
110
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
111 last_checked
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
112 = 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
113
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
114 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
115 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
116
17982
7c48493d98e1 Use currentDateTime instead of currentDateTimeUtc for Qt compatibility
Mike Miller <mtmiller@ieee.org>
parents: 17954
diff changeset
117 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
118 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
119
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
120 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
121 && (! 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
122 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
123
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
124 // 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
125 construct ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
126 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
127
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
128 main_window::~main_window (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
129 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
130 // 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
131 // 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
132
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
133 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
134 delete command_window;
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
135 delete workspace_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
136 delete doc_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
137 delete file_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
138 delete history_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
139 delete status_bar;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
140 delete _workspace_model;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
141 if (find_files_dlg)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
142 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
143 delete find_files_dlg;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
144 find_files_dlg = 0;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
145 }
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
146 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
147 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
148 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
149 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
150 }
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
151 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
152 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
153 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
154 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
155 }
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
156 delete _octave_qt_link;
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
157 delete _cmd_queue;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
158 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
159
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
160 bool
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
161 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
162 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
163 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
164 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
165
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
166 void
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
167 main_window::focus_command_window (void)
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
168 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
169 command_window->focus ();
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
170 }
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
171
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
172 void
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16451
diff changeset
173 main_window::new_file (const QString& commands)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
174 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
175 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
176 }
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
177
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
178 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
179 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
180 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
181 emit open_file_signal (file_name);
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
182 }
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
183
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
184 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
185 main_window::report_status_message (const QString& statusMessage)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
186 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
187 status_bar->showMessage (statusMessage, 1000);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
188 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
189
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
190 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
191 main_window::handle_save_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
192 {
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
193 QString file =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
194 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
195 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
196
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
197 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
198 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
199 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
200 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
201
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
202 void
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
203 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
204 {
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
205 QString file = file_arg;
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
206
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
207 if (file.isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
208 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
209 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
210
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
211 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
212 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
213 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
214 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
215
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
216 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
217 main_window::handle_clear_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
218 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
219 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
220 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
221
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
222 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
223 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
224 const QString& new_name)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
225
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
226 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
227 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
228
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
229 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
230 names);
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
231 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
232
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
233 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
234 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
235 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
236 octave_link::post_event (this, &main_window::command_window_undo_callback);
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
237 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
238
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
239 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
240 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
241 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
242 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
243 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
244
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
245 void
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
246 main_window::handle_clear_history_request (void)
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
247 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
248 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
249 }
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
250
18155
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
251 bool
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
252 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
253 {
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
254 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
255 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
256 }
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
257
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
258 void
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
259 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
260 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
261 queue_command (command);
18155
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18116
diff changeset
262 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
263 focus_command_window ();
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
264 }
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
265
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
266 void
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
267 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
268 {
18275
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
269 QString file_name = info.canonicalFilePath ();
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
270 QString command = "run \"" + file_name + "\"";
18275
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
271
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
272 QString function_name = info.fileName ();
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
273 function_name.chop (info.suffix ().length () + 1);
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
274
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
275 if (! valid_identifier (function_name.toStdString ()))
18275
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
276 {
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
277 int ans = QMessageBox::question (0, tr ("Octave"),
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
278 tr ("The file %1\n"
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
279 "can not be executed because its name\n"
770c525a1a2b Warn when saving/running a script whose name is not a valid identifier.
Julien Bect <julien.bect@supelec.fr>
parents: 18309
diff changeset
280 "is not a valid identifier.\n\n"
18275
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
281 "Do you want to execute\n%2\n"
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
282 "instead?").
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
283 arg (file_name).arg (command),
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
284 QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
285
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
286 if (ans == QMessageBox::Yes)
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
287 execute_command_in_terminal (command);
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
288
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
289 return;
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
290 }
3a26bb54655e warn when saving or executing a file with spaces in its name (bug #41136)
Torsten <ttl@justmail.de>
parents: 18269
diff changeset
291
17331
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
292 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
293 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
294 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
295 }
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
296
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
297 void
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
298 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
299 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
300 QString dir = info.absolutePath ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
301 QString function_name = info.fileName ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
302 function_name.chop (info.suffix ().length () + 1);
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
303 if (octave_qt_link::file_in_path (info.absoluteFilePath ().toStdString (),
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
304 dir.toStdString ()))
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
305 queue_command (function_name);
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
306 }
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
307
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
308 void
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
309 main_window::queue_command (QString command)
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
310 {
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
311 _cmd_queue_mutex.lock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
312 _cmd_queue->append (command); // queue command
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
313 _cmd_queue_mutex.unlock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
314
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
315 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
316 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
317 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
318
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
319 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
320 main_window::handle_new_figure_request (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
321 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
322 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
323 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
324
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
325 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
326 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
327 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
328 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
329 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
330
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
331 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
332 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
333 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
334 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
335 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
336 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
337
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
338 QString news;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
339
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
340 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
341 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
342 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
343 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
344 news = stream->readAll ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
345 if (! news.isEmpty ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
346 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
347 news.prepend ("<pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
348 news.append ("</pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
349 }
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
350 else
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
351 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
352 . 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
353 }
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
354 else
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
355 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
356 . 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
357
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
358
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
359 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
360
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
361 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
362 browser->setText (news);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
363
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
364 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
365 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
366
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
367 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
368 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
369
17890
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
370 browser->document()->adjustSize ();
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
371 QSize doc_size = browser->document()->size().toSize ();
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
372 doc_size.rwidth () += 45;
17936
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
373 int h = QApplication::desktop ()->height ();
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
374 if (h > 800)
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
375 h = 800;
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
376 doc_size.rheight () = h;
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
377
17890
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
378 release_notes_window->resize (doc_size);
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
379 }
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
380
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
381 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
382 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
383 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
384 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
385
18002
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
386 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
387
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
388 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
389 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
390 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
391
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
392 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
393 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
394 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
395 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
396
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
397 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
398 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
399 // 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
400 // 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
401 // 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
402
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
403 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
404 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
405 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
406
18287
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
407 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
408 {
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
409 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
410 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
411
9a43d8d6e29e avoid startup crash if curl library is not available (bug #41067)
John W. Eaton <jwe@octave.org>
parents: 18261
diff changeset
412 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
413 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
414 }
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
415
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
416 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
417 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
418 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
419 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
420 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
421
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
422 if (settings)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
423 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
424 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
425 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
426
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
427 settings->sync ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
428 }
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
429
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
430 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
431
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
432 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
433
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
434 if (b)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
435 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
436 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
437
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
438 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
439
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
440 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
441
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
442 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
443
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
444 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
445 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
446 if (settings)
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
447 {
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
448 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
449 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
450
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
451 settings->sync ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
452 }
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
453 }
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
454 else
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
455 return;
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
456 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
457 else
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
458 return;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
459 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
460 }
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
461 else
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
462 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
463 (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
464 "<body>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
465 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
466 "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
467 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
468 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
469 "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
470 "<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
471 "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
472 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
473 "<p>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
474 "<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
475 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
476 "</body>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
477 "</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
478 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
479 else
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
480 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
481 (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
482 "<body>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
483 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
484 "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
485 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
486 "<p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
487 "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
488 "<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
489 "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
490 "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
491 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
492 "<p>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
493 "<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
494 "</p>\n"
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
495 "</body>\n"
18251
0b5f669f5b03 fix some translation issues (bug #41159)
Torsten <ttl@justmail.de>
parents: 18250
diff changeset
496 "</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
497
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
498 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
499
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
500 emit finished ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
501 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
502
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
503 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
504 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
505 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
506 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
507
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
508 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
509 = (settings
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
510 ? 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
511 : true);
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
512
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
513 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
514 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
515
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
516 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
517
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
518 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
519 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
520
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
521 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
522
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
523 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
524 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
525
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
526 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
527 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
528
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
529 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
530
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
531 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
532
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
533 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
534 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
535
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
536 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
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::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
541 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
542 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
543 {
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
544 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
545
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
546 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
547
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
548 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
549 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
550 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
551
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
552 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
553
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
554 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
555
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
556 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
557 community_news_window->setWindowTitle (tr ("Octave Community News"));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
558 community_news_window->resize (640, 480);
17948
73f46593a51c Center the Octave Community News window only when constructed (bug #40618)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 17947
diff changeset
559 int win_x = QApplication::desktop ()->width ();
73f46593a51c Center the Octave Community News window only when constructed (bug #40618)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 17947
diff changeset
560 int win_y = QApplication::desktop ()->height ();
73f46593a51c Center the Octave Community News window only when constructed (bug #40618)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 17947
diff changeset
561 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
562 (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
563 }
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 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
566 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
567 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
568 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
569
18002
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
570 // same icon as release notes
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
571 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
572
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
573 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
574 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
575 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
576
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
577 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
578 main_window::open_bug_tracker_page (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
579 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
580 QDesktopServices::openUrl (QUrl ("http://octave.org/bugs.html"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
581 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
582
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
583 void
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
584 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
585 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
586 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
587 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
588
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
589 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
590 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
591 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
592 QDesktopServices::openUrl (QUrl ("http://agora.octave.org"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
593 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
594
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
595 void
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
596 main_window::open_contribute_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
597 {
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
598 QDesktopServices::openUrl (QUrl ("http://octave.org/donate.html"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
599 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
600
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
601 void
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
602 main_window::open_developer_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
603 {
17576
387ecd448b30 main-windows.cc: Fixed typo in open_developer_page URL
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17510
diff changeset
604 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
605 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
606
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
607 void
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17674
diff changeset
608 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
609 {
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17674
diff changeset
610 settings_dialog *settingsDialog = new settings_dialog (this, desired_tab);
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
611 int change_settings = settingsDialog->exec ();
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
612 if (change_settings == QDialog::Accepted)
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
613 {
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
614 settingsDialog->write_changed_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
615 QSettings *settings = resource_manager::get_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
616 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
617 emit settings_changed (settings);
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
618 }
14586
8e9823066dad Fixed bug with not correctly syncing settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14308
diff changeset
619 delete settingsDialog;
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
620 }
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
621
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
622
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
623 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
624 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
625 {
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
626 // 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
627
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
628 // 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
629 QString icon_set
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
630 = 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
631
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
632 static struct
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
633 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
634 QString name;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
635 QString path;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
636 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
637
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
638 widget_icon_data[] =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
639 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
640 // 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
641 // 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
642 {"NONE", ":/actions/icons/logo.png"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
643 {"GRAPHIC", ":/actions/icons/graphic_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
644 {"LETTER", ":/actions/icons/letter_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
645 {"", ""} // end marker has empty name
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
646 };
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
647
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
648 int count = 0;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
649 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
650
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
651 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
652 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
653 // while not end of data
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
654 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
655 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
656 // 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
657 icon_set_found = count;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
658 break;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
659 }
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
660 count++;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
661 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
662
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
663 QString icon;
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
664 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
665 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
666 QString name = widget->objectName ();
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
667 if (! name.isEmpty ())
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
668 { // if children has a name
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
669 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
670 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
671 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
672 widget->setWindowIcon (QIcon (icon));
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
673 }
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
674 }
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
675 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
676 _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
677 + "ReleaseWidget.png";
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
678 else
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
679 _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
680
17988
d62570cfbab9 reduce default icon size to 16 pixel for larger working areas in the widgets
Torsten <ttl@justmail.de>
parents: 17982
diff changeset
681 int icon_size = settings->value ("toolbar_icon_size",16).toInt ();
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
682 _main_tool_bar->setIconSize (QSize (icon_size,icon_size));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
683
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
684 set_global_shortcuts (true);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
685 set_global_shortcuts (command_window_has_focus ());
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
686
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
687 resource_manager::update_network_settings ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
688 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
689
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
690
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
691 void
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
692 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
693 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
694 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
695 }
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
696
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
697 void
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
698 main_window::exit (int status)
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
699 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
700 qApp->exit (status);
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
701 }
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
702
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
703 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
704 main_window::reset_windows (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
705 {
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
706 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
707
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
708 set_window_layout (settings);
18116
a829f40933a8 fix minimized main window after resetting window layout (bug #40832)
Torsten <ttl@justmail.de>
parents: 18034
diff changeset
709 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
710 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
711
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
712 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
713 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
714 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
715 // 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
716 // 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
717 // widget.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
718
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
719 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
720
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
721 if (index >= 0)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
722 _current_directory_combo_box->removeItem (index);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
723
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
724 _current_directory_combo_box->insertItem (0, dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
725 _current_directory_combo_box->setCurrentIndex (0);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
726
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16497
diff changeset
727 file_browser_window->update_octave_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
728 }
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
729
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
730 void
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
731 main_window::browse_for_directory (void)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
732 {
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
733 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
734 = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), 0,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
735 QFileDialog::DontUseNativeDialog);
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
736
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
737 set_current_working_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
738
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
739 // 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
740 // 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
741
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
742 focus_command_window ();
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
743 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
744
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
745 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
746 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
747 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
748 // 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
749
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
750 QString xdir = dir.isEmpty () ? "." : dir;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
751
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
752 QFileInfo fileInfo (xdir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
753
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
754 if (fileInfo.exists () && fileInfo.isDir ())
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
755 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
756 xdir.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
757 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
758
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
759 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
760 main_window::change_directory_up (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
761 {
16526
01541f7321f7 correctly track directory for cd ..
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
762 set_current_working_directory ("..");
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
763 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
764
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
765 // 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
766 // 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
767 // in the drop down list.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
768
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
769 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
770 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
771 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
772 // 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
773 // 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
774 // directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
775
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
776 QString dir = _current_directory_combo_box->currentText ();
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
777
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
778 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
779
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
780 if (index < 0)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
781 set_current_working_directory (dir);
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
782 }
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
783
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
784 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
785 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
786 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
787 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
788
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
789 _debug_continue->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
790 _debug_step_into->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
791 _debug_step_over->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
792 _debug_step_out->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
793 _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
794
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
795 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
796 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
797 #endif
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
798 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
799
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
800 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
801 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
802 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
803 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
804
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
805 _debug_continue->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
806 _debug_step_into->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
807 _debug_step_over->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
808 _debug_step_out->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
809 _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
810
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
811 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
812 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
813 #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
814 }
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
815
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
816 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
817 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
818 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
819 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
820 }
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
821
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
822 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
823 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
824 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
825 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
826 }
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
827
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
828 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
829 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
830 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
831 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
832 }
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
833
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
834 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
835 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
836 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
837 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
838 }
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
839
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
840 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
841 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
842 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
843 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
844 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
845
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
846 void
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
847 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
848 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
849 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
850 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
851
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
852 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
853
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
854 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
855 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
856 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
857
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
858 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
859 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
860 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
861 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
862 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
863
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
864 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
865
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
866 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
867 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
868 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
869
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
870 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
871 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
872 const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
873 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
874 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
875 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
876
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
877 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
878
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
879 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
880 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
881 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
882
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
883 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
884 main_window::show_about_octave (void)
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
885 {
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
886 std::string message
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
887 = octave_name_version_copyright_copying_warranty_and_bugs (true);
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
888
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
889 QMessageBox::about (this, tr ("About Octave"),
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
890 QString::fromStdString (message));
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
891 }
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
892
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
893 void
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
894 main_window::closeEvent (QCloseEvent *e)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
895 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
896 e->ignore ();
18673
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
897 if (confirm_exit_octave())
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
898 octave_link::post_event (this, &main_window::exit_callback);
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
899 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
900
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
901 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
902 main_window::read_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
903 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
904 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
905
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
906 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
907 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
908 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
909 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
910 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
911
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
912 set_window_layout (settings);
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
913
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
914 // 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
915 QStringList curr_dirs
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
916 = 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
917 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
918 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
919 _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
920 }
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
921 emit settings_changed (settings);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
922 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
923
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
924 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
925 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
926 {
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
927 #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
928 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
929 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
930 #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
931
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
932 // 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
933 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
934 {
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
935 QString name = widget->objectName ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
936
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
937 if (! name.isEmpty ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
938 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
939 bool floating = settings->value
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
940 ("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
941 bool visible = settings->value
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
942 ("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
943
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
944 // 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
945 if (floating)
16818
caf3d2a45da0 clean up some code for undocking and docking widgets
Torsten <ttl@justmail.de>
parents: 16811
diff changeset
946 widget->make_window ();
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
947 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
948 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
949 #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
950 // restore geometry
17686
65544374c1cf restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents: 17676
diff changeset
951 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
952 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
953 #endif
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
954 // 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
955 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
956 {
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
957 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
958 widget->showMinimized ();
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
959 else
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
960 widget->setVisible (true);
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
961 }
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
962 else
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
963 {
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
964 widget->make_widget ();
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
965 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
966 }
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
967 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
968 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
969
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
970 #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
971 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
972 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
973 #endif
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
974
17995
ea1db0ede4ce make sure Octave is displayed in a global menu bar, not another widget name
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
975 show ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
976 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
977
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
978 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
979 main_window::write_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
980 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
981 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
982 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
983 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
984 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
985 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
986 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
987
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
988 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
989 settings->setValue ("MainWindow/windowState", saveState ());
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
990 // 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
991 QStringList curr_dirs;
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
992 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
993 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
994 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
995 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
996 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
997 settings->sync ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
998 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
999
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1000
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1001 // 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
1002 // 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
1003 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1004 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
1005 {
17617
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1006 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
1007 widget->connect_visibility_changed ();
18399
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1008
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1009 // Main window completely shown, determine whether to create an empty script
2ea741d22554 create empty script when editor becomes visible without open files (bug #41347)
Torsten <ttl@justmail.de>
parents: 18345
diff changeset
1010 editor_window->empty_script (true, false);
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1011 }
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1012
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1013 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1014 main_window::copyClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1015 {
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1016 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
1017 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1018 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
1019 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
1020 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1021 QClipboard *clipboard = QApplication::clipboard ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1022 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
1023 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1024 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1025 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1026 emit copyClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1027 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1028
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1029 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1030 main_window::pasteClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1031 {
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1032 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
1033 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1034 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
1035 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
1036 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
1037 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
1038 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1039 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
1040 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1041 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1042 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1043 emit pasteClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1044 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1045
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1046 void
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1047 main_window::selectAll (void)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1048 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1049 if (_current_directory_combo_box->hasFocus ())
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1050 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1051 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
1052 if (edit)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1053 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1054 edit->selectAll ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1055 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1056 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1057 else
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1058 emit selectAll_signal ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1059 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1060
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1061
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1062 // 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
1063 // 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
1064 // 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
1065 // 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
1066
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1067 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1068 main_window::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
1069 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1070 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
1071 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
1072 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
1073 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
1074 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1075 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
1076 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
1077 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
1078
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1079 // 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
1080 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
1081 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
1082 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
1083 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
1084 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
1085 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
1086 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1087 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
1088 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
1089 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
1090 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
1091
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1092 // 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
1093 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
1094 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
1095 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
1096 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
1097 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
1098 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1099 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
1100 const QFloatList&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1101 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
1102 const QStringList&)));
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1103
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1104 connect (&uiwidget_creator,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1105 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
1106 const QString&, const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1107 const QString&)),
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1108 this,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1109 SLOT (handle_create_filedialog (const QStringList &, const QString&,
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1110 const QString&, const QString&,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1111 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
1112 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1113
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1114 // 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
1115 // text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1116
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1117 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1118 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
1119 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
1120 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
1121 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
1122 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
1123 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
1124 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1125 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
1126 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
1127 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
1128 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
1129 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1130
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1131 // 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
1132 // 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
1133
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1134 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1135 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
1136 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
1137 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
1138 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
1139 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
1140 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
1141 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
1142 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
1143 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1144 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
1145 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
1146 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
1147
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1148 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
1149 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
1150 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1151
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1152 // 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
1153 // 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
1154 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1155 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
1156 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
1157 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
1158 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
1159 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
1160 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1161 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
1162 defaults);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1163
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1164 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
1165 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
1166 }
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1167
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1168 void
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1169 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
1170 const QString& title,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1171 const QString& filename,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1172 const QString& dirname,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1173 const QString& multimode)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1174 {
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1175 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
1176 dirname, multimode);
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1177
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1178 file_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1179 file_dialog->show ();
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1180 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1181
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1182 // Main subroutine of the constructor
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1183 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1184 main_window::construct (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1185 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
1186 _closing = false; // flag for editor files when closed
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1187 setWindowIcon (QIcon (":/actions/icons/logo.png"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1188
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1189 workspace_window->setModel (_workspace_model);
16572
17941fedd4ce Change workspace row height to font height.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16570
diff changeset
1190 connect (_workspace_model, SIGNAL (model_changed (void)),
17941fedd4ce Change workspace row height to font height.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16570
diff changeset
1191 workspace_window, SLOT (handle_model_changed (void)));
16445
3f8d3fc907af store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
1192
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
1193 // 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
1194 // 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
1195 // destroying this main_window.
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1196
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
1197 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
1198 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
1199 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
1200 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
1201 dummyWidget->hide ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
1202 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
1203
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1204 construct_menu_bar ();
14812
9d9eb9bac65e Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14804
diff changeset
1205
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1206 construct_tool_bar ();
14812
9d9eb9bac65e Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14804
diff changeset
1207
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1208 construct_warning_bar ();
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1209
16497
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
1210 connect (qApp, SIGNAL (aboutToQuit ()),
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
1211 this, SLOT (prepare_to_exit ()));
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
1212
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1213 connect (this, SIGNAL (settings_changed (const QSettings *)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1214 this, SLOT (notice_settings (const QSettings *)));
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
1215
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1216 connect (file_browser_window, SIGNAL (load_file_signal (const QString&)),
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1217 this, SLOT (handle_load_workspace_request (const QString&)));
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1218
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16672
diff changeset
1219 connect (file_browser_window, SIGNAL (find_files_signal (const QString&)),
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16672
diff changeset
1220 this, SLOT (find_files (const QString&)));
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16672
diff changeset
1221
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1222 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
1223
14601
772ce0204b3f Removed version number and "Octave GUI"-labelling.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14599
diff changeset
1224 setWindowTitle ("Octave");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1225
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1226 setDockOptions (QMainWindow::AnimatedDocks
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1227 | QMainWindow::AllowNestedDocks
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1228 | QMainWindow::AllowTabbedDocks);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1229
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1230 addDockWidget (Qt::RightDockWidgetArea, command_window);
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
1231 addDockWidget (Qt::RightDockWidgetArea, doc_browser_window);
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
1232 tabifyDockWidget (command_window, doc_browser_window);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1233
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1234 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1235 addDockWidget (Qt::RightDockWidgetArea, editor_window);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1236 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
1237 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1238
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16449
diff changeset
1239 addDockWidget (Qt::LeftDockWidgetArea, file_browser_window);
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1240 addDockWidget (Qt::LeftDockWidgetArea, workspace_window);
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1241 addDockWidget (Qt::LeftDockWidgetArea, history_window);
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1242
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1243 int win_x = QApplication::desktop ()->width ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1244 int win_y = QApplication::desktop ()->height ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1245
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1246 if (win_x > 960)
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1247 win_x = 960;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1248
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1249 if (win_y > 720)
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1250 win_y = 720;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1251
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1252 setGeometry (0, 0, win_x, win_y);
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
1253
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1254 setStatusBar (status_bar);
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
1255
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1256 construct_octave_qt_link ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1257
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1258 #ifdef HAVE_QSCINTILLA
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1259 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1260 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1261 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1262 SLOT (handle_insert_debugger_pointer_request (const QString&, int)));
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1263
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1264 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1265 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1266 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1267 SLOT (handle_delete_debugger_pointer_request (const QString&, int)));
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1268
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1269 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1270 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1271 editor_window,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1272 SLOT (handle_update_breakpoint_marker_request (bool,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1273 const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1274 int)));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1275 #endif
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1276
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1277 octave_link::post_event (this, &main_window::resize_command_window_callback);
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1278
18498
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents: 18437
diff changeset
1279 install___init_qt___functions ();
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents: 18437
diff changeset
1280
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents: 18437
diff changeset
1281 Fregister_graphics_toolkit (ovl ("qt"));
2e7cad6f180c Initial integration of QtHandles.
John W. Eaton <jwe@octave.org>
parents: 18437
diff changeset
1282
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1283 set_global_shortcuts (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1284 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1285
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1286
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1287 void
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1288 main_window::handle_octave_ready ()
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1289 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1290 // 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
1291 QSettings *settings = resource_manager::get_settings ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1292
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1293 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
1294
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1295 if (settings->value ("restore_octave_dir").toBool ())
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1296 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1297 // restore last dir from previous session
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1298 QStringList curr_dirs
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1299 = settings->value ("MainWindow/current_directory_list").toStringList ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1300 startup_dir = QDir (curr_dirs.at (0)); // last dir in previous session
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1301 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1302 else if (! settings->value ("octave_startup_dir").toString ().isEmpty ())
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1303 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1304 // do not restore but there is a startup dir configured
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1305 startup_dir = QDir (settings->value ("octave_startup_dir").toString ());
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1306 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1307
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1308 if (! startup_dir.exists ())
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1309 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1310 // 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
1311 startup_dir = QDir ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1312 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1313
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1314 set_current_working_directory (startup_dir.absolutePath ());
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1315 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1316
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1317
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1318 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1319 main_window::construct_octave_qt_link (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1320 {
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1321 _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
1322
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1323 connect (_octave_qt_link, SIGNAL (exit_signal (int)),
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1324 this, SLOT (exit (int)));
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
1325
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1326 connect (_octave_qt_link,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1327 SIGNAL (set_workspace_signal
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1328 (bool, const QString&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1329 const QStringList&, const QStringList&,
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
1330 const QStringList&, const QIntList&)),
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1331 _workspace_model,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1332 SLOT (set_workspace
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1333 (bool, const QString&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1334 const QStringList&, const QStringList&,
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
1335 const QStringList&, const QIntList&)));
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1336
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1337 connect (_octave_qt_link, SIGNAL (clear_workspace_signal ()),
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1338 _workspace_model, SLOT (clear_workspace ()));
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1339
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1340 connect (_octave_qt_link, SIGNAL (change_directory_signal (QString)),
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1341 this, SLOT (change_directory (QString)));
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1342
16423
04c4dd7fd3ce use signal for octave_link::update_dbstop_marker
John W. Eaton <jwe@octave.org>
parents: 16421
diff changeset
1343 connect (_octave_qt_link,
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1344 SIGNAL (execute_command_in_terminal_signal (QString)),
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1345 this, SLOT (execute_command_in_terminal (QString)));
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1346
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1347 connect (_octave_qt_link,
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1348 SIGNAL (set_history_signal (const QStringList&)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1349 history_window, SLOT (set_history (const QStringList&)));
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1350
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1351 connect (_octave_qt_link,
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1352 SIGNAL (append_history_signal (const QString&)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1353 history_window, SLOT (append_history (const QString&)));
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1354
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1355 connect (_octave_qt_link,
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1356 SIGNAL (clear_history_signal (void)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1357 history_window, SLOT (clear_history (void)));
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1358
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1359 connect (_octave_qt_link, SIGNAL (enter_debugger_signal ()),
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1360 this, SLOT (handle_enter_debugger ()));
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1361
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1362 connect (_octave_qt_link, SIGNAL (exit_debugger_signal ()),
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1363 this, SLOT (handle_exit_debugger ()));
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1364
17010
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1365 connect (_octave_qt_link,
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1366 SIGNAL (show_preferences_signal (void)),
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1367 this, SLOT (process_settings_dialog_request ()));
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1368
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1369 #ifdef HAVE_QSCINTILLA
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1370 connect (_octave_qt_link,
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1371 SIGNAL (edit_file_signal (const QString&)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1372 editor_window,
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1373 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
1374 #endif
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1375
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1376 connect (_octave_qt_link,
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1377 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1378 this,
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1379 SLOT (handle_insert_debugger_pointer_request (const QString&, int)));
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1380
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1381 connect (_octave_qt_link,
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1382 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1383 this,
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1384 SLOT (handle_delete_debugger_pointer_request (const QString&, int)));
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
1385
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1386 connect (_octave_qt_link,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1387 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1388 this,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1389 SLOT (handle_update_breakpoint_marker_request (bool, const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1390 int)));
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1391
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
1392 connect (_octave_qt_link,
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1393 SIGNAL (show_doc_signal (const QString &)),
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1394 this, SLOT (handle_show_doc (const QString &)));
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1395
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1396 connect (_workspace_model,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1397 SIGNAL (rename_variable (const QString&, const QString&)),
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1398 this,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1399 SLOT (handle_rename_variable_request (const QString&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1400 const QString&)));
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1401
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
1402 connect (command_window, SIGNAL (interrupt_signal (void)),
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
1403 _octave_qt_link, SLOT (terminal_interrupt (void)));
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
1404
16432
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
1405 _octave_qt_link->execute_interpreter ();
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
1406
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
1407 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
1408 }
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1409
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1410 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1411 main_window::construct_menu_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1412 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1413 QMenuBar *menu_bar = menuBar ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1414
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1415 construct_file_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1416
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1417 construct_edit_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1418
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1419 construct_debug_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1420
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1421 construct_window_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1422
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1423 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
1424
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1425 construct_news_menu (menu_bar);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1426 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1427
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1428 QAction*
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1429 main_window::add_action (QMenu *menu, const QIcon &icon, const QString &text,
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1430 const char *member)
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1431 {
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1432 QAction *a = menu->addAction (icon, text, this, member);
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1433 addAction (a); // important for shortcut context
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1434 a->setShortcutContext (Qt::ApplicationShortcut);
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1435 return a;
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1436 }
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1437
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1438 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1439 main_window::construct_file_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1440 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1441 QMenu *file_menu = p->addMenu (tr ("&File"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1442
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1443 construct_new_menu (file_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1444
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1445 _open_action
18261
09ef57c61b3b update some icnons of the gui
Torsten <ttl@justmail.de>
parents: 18257
diff changeset
1446 = file_menu->addAction (QIcon (":/actions/icons/folder_documents.png"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1447 tr ("Open..."));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1448 _open_action->setShortcutContext (Qt::ApplicationShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1449
18709
c199304dfb2a handling qscintilla internal shortcuts and commands depending on qsci version
Torsten <ttl@justmail.de>
parents: 18699
diff changeset
1450 #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
1451 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
1452 _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
1453 _open_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1454
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1455 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
1456 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1457
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1458 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1459
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1460 _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
1461 = file_menu->addAction (tr ("Load Workspace..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1462
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1463 _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
1464 = 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
1465
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1466 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1467
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1468 _preferences_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1469 = file_menu->addAction (QIcon (":/actions/icons/configure.png"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1470 tr ("Preferences..."));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1471
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1472 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1473
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1474 _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
1475 _exit_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1476
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1477 connect (_preferences_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1478 this, SLOT (process_settings_dialog_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1479
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1480 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1481 connect (_open_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1482 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
1483 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1484
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1485 connect (_load_workspace_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1486 this, SLOT (handle_load_workspace_request ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1487
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1488 connect (_save_workspace_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1489 this, SLOT (handle_save_workspace_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1490
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1491 connect (_exit_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1492 this, SLOT (close ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1493 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1494
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1495 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1496 main_window::construct_new_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1497 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1498 QMenu *new_menu = p->addMenu (tr ("New"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1499
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1500 _new_script_action
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1501 = new_menu->addAction (QIcon (":/actions/icons/filenew.png"),
18345
dfc6ef6ac455 some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents: 18318
diff changeset
1502 tr ("New Script"));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1503 _new_script_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1504
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
1505 _new_function_action = new_menu->addAction (tr ("Function..."));
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
1506 _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
1507 _new_function_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1508
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1509 _new_figure_action = new_menu->addAction (tr ("Figure"));
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1510 _new_figure_action->setEnabled (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1511
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1512 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1513 connect (_new_script_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1514 editor_window, SLOT (request_new_script ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1515
17901
2c241092b47b use edit.m for creating a new function with the gui (bug #40502)
Torsten <ttl@justmail.de>
parents: 17899
diff changeset
1516 connect (_new_function_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1517 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
1518 #endif
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1519
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1520 connect (_new_figure_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1521 this, SLOT (handle_new_figure_request ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1522 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1523
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1524 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1525 main_window::construct_edit_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1526 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1527 QMenu *edit_menu = p->addMenu (tr ("&Edit"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1528
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1529 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1530
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1531 _undo_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1532 = edit_menu->addAction (QIcon (":/actions/icons/undo.png"), tr ("Undo"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1533
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1534 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1535
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1536 _copy_action
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1537 = edit_menu->addAction (QIcon (":/actions/icons/editcopy.png"),
16649
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
1538 tr ("Copy"), this, SLOT (copyClipboard ()));
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1539
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1540 _paste_action
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1541 = edit_menu->addAction (QIcon (":/actions/icons/editpaste.png"),
16649
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
1542 tr ("Paste"), this, SLOT (pasteClipboard ()));
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1543
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1544 _select_all_action
18568
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1545 = edit_menu->addAction (tr ("Select All"), this, SLOT (selectAll ()));
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1546
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1547 _clear_clipboard_action
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1548 = edit_menu->addAction (tr ("Clear Clipboard"), this,
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1549 SLOT (clear_clipboard ()));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1550
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1551 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1552
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1553 _find_files_action = edit_menu->addAction (tr ("Find Files..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1554
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1555 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1556
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1557 _clear_command_window_action
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1558 = edit_menu->addAction (tr ("Clear Command Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1559
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1560 _clear_command_history_action
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1561 = 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
1562
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1563 _clear_workspace_action
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1564 = edit_menu->addAction (tr ("Clear Workspace"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1565
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1566 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
1567 this, SLOT (find_files ()));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1568
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1569 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
1570 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
1571
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1572 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
1573 this, SLOT (handle_clear_history_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1574
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
1575 connect (_clear_workspace_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1576 this, SLOT (handle_clear_workspace_request ()));
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1577
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1578 connect (_clipboard, SIGNAL (changed (QClipboard::Mode)),
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1579 this, SLOT (clipboard_has_changed (QClipboard::Mode)));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1580 clipboard_has_changed (QClipboard::Clipboard);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1581 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1582
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1583 QAction *
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1584 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
1585 const char *member)
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1586 {
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1587 QAction *action = add_action (_debug_menu, QIcon (icon), item, member);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1588
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1589 action->setEnabled (false);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1590
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1591 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1592 editor_window->debug_menu ()->addAction (action);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1593 editor_window->toolbar ()->addAction (action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1594 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1595
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1596 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1597 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1598
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1599 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1600 main_window::construct_debug_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1601 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1602 _debug_menu = p->addMenu (tr ("De&bug"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1603
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1604 _debug_step_over = construct_debug_menu_item
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1605 (":/actions/icons/db_step.png", tr ("Step"),
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1606 SLOT (debug_step_over ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1607
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1608 _debug_step_into = construct_debug_menu_item
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1609 (":/actions/icons/db_step_in.png", tr ("Step In"),
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1610 SLOT (debug_step_into ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1611
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1612 _debug_step_out = construct_debug_menu_item
17935
752f6b358754 Tweak GUI strings for conformity.
Rik <rik@octave.org>
parents: 17929
diff changeset
1613 (":/actions/icons/db_step_out.png", tr ("Step Out"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1614 SLOT (debug_step_out ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1615
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1616 _debug_continue = construct_debug_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1617 (":/actions/icons/db_cont.png", tr ("Continue"),
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1618 SLOT (debug_continue ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1619
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1620 _debug_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1621 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1622 editor_window->debug_menu ()->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1623 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1624
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1625 _debug_quit = construct_debug_menu_item
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1626 (":/actions/icons/db_stop.png", tr ("Quit Debug Mode"),
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
1627 SLOT (debug_quit ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1628 }
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 QAction *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1631 main_window::construct_window_menu_item (QMenu *p, const QString& item,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1632 bool checkable,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1633 const QKeySequence& key)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1634 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1635 QAction *action = p->addAction (item);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1636
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1637 action->setCheckable (checkable);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1638 action->setShortcut (key);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1639 action->setShortcutContext (Qt::ApplicationShortcut);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1640
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1641 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1642 }
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 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1645 main_window::construct_window_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1646 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1647 QMenu *window_menu = p->addMenu (tr ("&Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1648
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1649 QKeySequence ctrl = Qt::ControlModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1650 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
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 QAction *show_command_window_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1653 (window_menu,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1654 tr ("Show Command Window"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1655 ctrl_shift + Qt::Key_0);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1656
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1657 QAction *show_history_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1658 (window_menu, tr ("Show Command History"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1659 true, ctrl_shift + Qt::Key_1);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1660
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1661 QAction *show_file_browser_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1662 (window_menu, tr ("Show File Browser"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1663 true, ctrl_shift + Qt::Key_2);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1664
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1665 QAction *show_workspace_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1666 (window_menu, tr ("Show Workspace"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1667 ctrl_shift + Qt::Key_3);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1668
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1669 QAction *show_editor_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1670 (window_menu, tr ("Show Editor"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1671 ctrl_shift + Qt::Key_4);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1672
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1673 QAction *show_documentation_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1674 (window_menu, tr ("Show Documentation"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1675 true, ctrl_shift + Qt::Key_5);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1676
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1677 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1678
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1679 QAction *command_window_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1680 (window_menu, tr ("Command Window"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1681 ctrl + Qt::Key_0);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1682
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1683 QAction *history_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1684 (window_menu, tr ("Command History"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1685 ctrl + Qt::Key_1);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1686
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1687 QAction *file_browser_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1688 (window_menu, tr ("File Browser"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1689 ctrl + Qt::Key_2);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1690
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1691 QAction *workspace_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1692 (window_menu, tr ("Workspace"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1693 ctrl + Qt::Key_3);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1694
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1695 QAction *editor_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1696 (window_menu, tr ("Editor"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1697 ctrl + Qt::Key_4);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1698
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1699 QAction *documentation_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1700 (window_menu, tr ("Documentation"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1701 ctrl + Qt::Key_5);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1702
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1703 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1704
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1705 QAction *reset_windows_action
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1706 = window_menu->addAction (tr ("Reset Default Window Layout"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1707
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1708 connect (show_command_window_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1709 command_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1710
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1711 connect (command_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1712 show_command_window_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1713
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1714 connect (show_workspace_action, SIGNAL (toggled (bool)),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1715 workspace_window, SLOT (setVisible (bool)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1716
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1717 connect (workspace_window, SIGNAL (active_changed (bool)),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1718 show_workspace_action, SLOT (setChecked (bool)));
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 connect (show_history_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1721 history_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1722
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1723 connect (history_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1724 show_history_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1725
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1726 connect (show_file_browser_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1727 file_browser_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1728
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1729 connect (file_browser_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1730 show_file_browser_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1731
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1732 #ifdef HAVE_QSCINTILLA
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1733 connect (show_editor_action, SIGNAL (toggled (bool)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1734 editor_window, SLOT (setVisible (bool)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1735
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1736 connect (editor_window, SIGNAL (active_changed (bool)),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1737 show_editor_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1738 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1739
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1740 connect (show_documentation_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1741 doc_browser_window, SLOT (setVisible (bool)));
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 connect (doc_browser_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1744 show_documentation_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1745
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1746 connect (command_window_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1747 command_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1748
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1749 connect (workspace_action, SIGNAL (triggered ()),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1750 workspace_window, SLOT (focus ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1751
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1752 connect (history_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1753 history_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1754
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1755 connect (file_browser_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1756 file_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1757
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1758 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1759 connect (editor_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1760 editor_window, SLOT (focus ()));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1761 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1762
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1763 connect (documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1764 doc_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1765
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1766 connect (reset_windows_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1767 this, SLOT (reset_windows ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1768 }
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 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1771 main_window::construct_help_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1772 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1773 QMenu *help_menu = p->addMenu (tr ("&Help"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1774
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1775 construct_documentation_menu (help_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1776
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1777 help_menu->addSeparator ();
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 QAction *report_bug_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1780 = help_menu->addAction (tr ("Report Bug"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1781
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1782 QAction *octave_packages_action
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1783 = help_menu->addAction (tr ("Octave Packages"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1784
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1785 QAction *agora_action
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1786 = help_menu->addAction (tr ("Share Code"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1787
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1788 QAction *contribute_action
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1789 = help_menu->addAction (tr ("Contribute to Octave"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1790
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1791 QAction *developer_action
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1792 = help_menu->addAction (tr ("Octave Developer Resources"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1793
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1794 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1795
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1796 QAction *about_octave_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1797 = help_menu->addAction (tr ("About Octave"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1798
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1799 connect (report_bug_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1800 this, SLOT (open_bug_tracker_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1801
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1802 connect (octave_packages_action, SIGNAL (triggered ()),
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1803 this, SLOT (open_octave_packages_page ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1804
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1805 connect (agora_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1806 this, SLOT (open_agora_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1807
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1808 connect (contribute_action, SIGNAL (triggered ()),
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1809 this, SLOT (open_contribute_page ()));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1810
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1811 connect (developer_action, SIGNAL (triggered ()),
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1812 this, SLOT (open_developer_page ()));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1813
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1814 connect (about_octave_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1815 this, SLOT (show_about_octave ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1816 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1817
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1818 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1819 main_window::construct_documentation_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1820 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1821 QMenu *documentation_menu = p->addMenu (tr ("Documentation"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1822
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1823 QAction *ondisk_documentation_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1824 = documentation_menu->addAction (tr ("On Disk"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1825
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1826 QAction *online_documentation_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1827 = documentation_menu->addAction (tr ("Online"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1828
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1829 connect (ondisk_documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1830 doc_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1831
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1832 connect (online_documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1833 this, SLOT (open_online_documentation_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1834 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1835
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1836 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1837 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
1838 {
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1839 QMenu *news_menu = p->addMenu (tr ("&News"));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1840
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1841 QAction *release_notes_action
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1842 = news_menu->addAction (tr ("Release Notes"));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1843
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1844 QAction *current_news_action
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1845 = news_menu->addAction (tr ("Community News"));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1846
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1847 connect (release_notes_action, SIGNAL (triggered ()),
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1848 this, SLOT (display_release_notes ()));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1849
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1850 connect (current_news_action, SIGNAL (triggered ()),
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
1851 this, 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
1852 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1853
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1854 void
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1855 main_window::construct_warning_bar (void)
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1856 {
18031
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1857 QSettings *settings = resource_manager::get_settings ();
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1858
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1859 if (settings
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1860 && settings->value ("General/hide_new_gui_warning", false).toBool ())
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1861 {
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1862 construct_gui_info_button ();
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1863
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1864 return;
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1865 }
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1866
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1867 _warning_bar = new QDockWidget (this);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1868 _warning_bar->setAttribute (Qt::WA_DeleteOnClose);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1869
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1870 QFrame *box = new QFrame (_warning_bar);
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1871
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1872 QLabel *icon = new QLabel (box);
18026
50bce63dbb04 add fallback for theme warning icon
John W. Eaton <jwe@octave.org>
parents: 18024
diff changeset
1873 QIcon warning_icon
50bce63dbb04 add fallback for theme warning icon
John W. Eaton <jwe@octave.org>
parents: 18024
diff changeset
1874 = QIcon::fromTheme ("dialog-warning",
50bce63dbb04 add fallback for theme warning icon
John W. Eaton <jwe@octave.org>
parents: 18024
diff changeset
1875 QIcon (":/actions/icons/warning.png"));
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1876 QPixmap icon_pixmap = warning_icon.pixmap (QSize (32, 32));
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1877 icon->setPixmap (icon_pixmap);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1878
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1879 QTextBrowser *msg = new QTextBrowser (box);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1880 msg->setOpenExternalLinks (true);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1881 msg->setText
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1882 (tr ("<strong>You are using a release candidate of Octave's experimental GUI.</strong> "
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1883 "Octave is under continuous improvement and the GUI will be the "
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1884 "default interface for the 4.0 release. For more information, "
18208
1c1236fd179a fix menu name of release notes in warning bar of exp. gui (bug #41078)
Torsten <ttl@justmail.de>
parents: 18197
diff changeset
1885 "select the \"Release Notes\" item in the \"News\" menu of the GUI, "
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1886 "or visit <a href=\"http://octave.org\">http://octave.org</a>."));
18032
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1887
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1888 msg->setStyleSheet ("background-color: #ffd97f; color: black; margin 4px;");
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1889 msg->setMinimumWidth (100);
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1890 msg->setMinimumHeight (60);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1891 msg->setMaximumHeight (80);
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1892 msg->setSizePolicy (QSizePolicy (QSizePolicy::Expanding,
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1893 QSizePolicy::Minimum));
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1894
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1895 QPushButton *info_button = new QPushButton (tr ("More Info"), box);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1896 QPushButton *hide_button = new QPushButton (tr ("Hide"), box);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1897
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1898 connect (info_button, SIGNAL (clicked ()),
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1899 this, SLOT (show_gui_info ()));
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1900
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1901 connect (hide_button, SIGNAL (clicked ()),
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1902 this, SLOT (hide_warning_bar ()));
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1903
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1904 QVBoxLayout *button_layout = new QVBoxLayout;
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1905
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1906 button_layout->addWidget (info_button);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1907 button_layout->addWidget (hide_button);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1908
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1909 QHBoxLayout *icon_and_message = new QHBoxLayout;
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1910
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1911 icon_and_message->addWidget (icon);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1912 icon_and_message->addSpacing (10);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1913 icon_and_message->addWidget (msg);
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1914 icon_and_message->addSpacing (10);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1915 icon_and_message->addLayout (button_layout);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1916
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1917 icon_and_message->setAlignment (hide_button, Qt::AlignTop);
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1918
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1919 box->setFrameStyle (QFrame::Box);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1920 box->setLineWidth (2);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1921 box->setMaximumWidth (1000);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1922 box->adjustSize ();
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1923 box->setLayout (icon_and_message);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1924
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1925 _warning_bar->setFeatures (QDockWidget::NoDockWidgetFeatures);
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1926 _warning_bar->setObjectName ("WarningToolBar");
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1927 _warning_bar->setWidget (box);
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1928
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1929 setCorner (Qt::TopLeftCorner, Qt::TopDockWidgetArea);
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1930 setCorner (Qt::TopRightCorner, Qt::TopDockWidgetArea);
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1931
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1932 addDockWidget (Qt::TopDockWidgetArea, _warning_bar);
18024
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1933 };
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1934
989ff97a7e8c provide warning about experimental GUI
John W. Eaton <jwe@octave.org>
parents: 18002
diff changeset
1935 void
18031
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1936 main_window::construct_gui_info_button (void)
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1937 {
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1938 QIcon warning_icon
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1939 = QIcon::fromTheme ("dialog-warning",
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1940 QIcon (":/actions/icons/warning.png"));
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1941
18031
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1942 _gui_info_button
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1943 = new QPushButton (warning_icon, tr ("Experimental GUI Info"));
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1944
18031
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1945 _main_tool_bar->addWidget (_gui_info_button);
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1946
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1947 connect (_gui_info_button, SIGNAL (clicked ()),
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1948 this, SLOT (show_gui_info ()));
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1949 }
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1950
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1951 void
18031
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1952 main_window::hide_warning_bar (void)
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1953 {
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1954 QSettings *settings = resource_manager::get_settings ();
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1955
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1956 if (settings)
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1957 {
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1958 settings->setValue ("General/hide_new_gui_warning", true);
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1959
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1960 settings->sync ();
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1961 }
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1962
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1963 removeDockWidget (_warning_bar);
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1964
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1965 construct_gui_info_button ();
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1966 }
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1967
8695fa048226 make hiding of gui warning bar persistent
John W. Eaton <jwe@octave.org>
parents: 18029
diff changeset
1968 void
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1969 main_window::show_gui_info (void)
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1970 {
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
1971 QString gui_info
18197
a65934d0dc35 fix translating the info on the experimental gui (bug #41081)
Felipe G. Nievinski <fgnievinski@gmail.com>
parents: 18173
diff changeset
1972 ( QObject::tr ("<p><strong>A Note about Octave's New GUI</strong></p>"
18032
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1973 "<p>One of the biggest new features for Octave 3.8 is a graphical "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1974 "user interface. It is the one thing that users have requested "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1975 "most often over the last few years and now it is almost ready. "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1976 "But because it is not quite as polished as we would like, we "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1977 "have decided to wait until the 4.0.x release series before "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1978 "making the GUI the default interface.</p>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1979 "<p>Given the length of time and the number of bug fixes and "
18173
1939b7de8f9a fix grammar in GUI info window
John W. Eaton <jwe@octave.org>
parents: 18116
diff changeset
1980 "improvements since the last major release, we also "
18032
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1981 "decided against delaying the release of all these new "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1982 "improvements any longer just to perfect the GUI. So please "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1983 "enjoy the 3.8 release of Octave and the preview of the new GUI. "
18034
8bc09600f0ed Correct spelling in cset 482cc05b4f99.
Rik <rik@octave.org>
parents: 18032
diff changeset
1984 "We believe it is working reasonably well, but we also know that "
18032
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1985 "there are some obvious rough spots and many things that could be "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1986 "improved.</p>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1987 "<p><strong>We Need Your Help</strong></p>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1988 "<p>There are many ways that you can help us fix the remaining "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1989 "problems, complete the GUI, and improve the overall user "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1990 "experience for both novices and experts alike (links will open "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1991 "an external browser):</p>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1992 "<p><ul><li>If you are a skilled software developer, you can "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1993 "help by contributing your time to help "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1994 "<a href=\"http://octave.org/get-involved.html\">develop "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1995 "Octave</a>.</li>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1996 "<li>If Octave does not work properly, you are encouraged to "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1997 "<a href=\"http://octave.org/bugs.html\">report problems </a> "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1998 "that you find.</li>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
1999 "<li>Whether you are a user or developer, you can "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2000 "<a href=\"http://octave.org/donate.html\">help to fund the "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2001 "project</a>. "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2002 "Octave development takes a lot of time and expertise. "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2003 "Your contributions help to ensure that Octave will continue "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2004 "to improve.</li></ul></p>"
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2005 "<p>We hope you find Octave to be useful. Please help us make "
482cc05b4f99 update gui info text and corresponding NEWS entry
John W. Eaton <jwe@octave.org>
parents: 18031
diff changeset
2006 "it even better for the future!</p>"));
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2007
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2008 QMessageBox gui_info_dialog (QMessageBox::Warning,
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2009 tr ("Experimental GUI Info"),
18606
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2010 QString (gui_info.length (),' '), QMessageBox::Close);
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2011 QGridLayout *box_layout
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2012 = qobject_cast<QGridLayout *>(gui_info_dialog.layout());
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2013 if (box_layout)
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2014 {
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2015 QTextEdit *text = new QTextEdit(gui_info);
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2016 text->setReadOnly(true);
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2017 box_layout->addWidget(text, 0, 1);
fe1cdc40579c info on experimental gui is displayed with vertical scroll bar (bug #41840)
Torsten <ttl@justmail.de>
parents: 18435
diff changeset
2018 }
18029
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2019 gui_info_dialog.exec ();
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2020 }
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2021
2ef2043a0601 allow GUI warning bar to be hidden
John W. Eaton <jwe@octave.org>
parents: 18026
diff changeset
2022 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2023 main_window::construct_tool_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2024 {
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2025 _main_tool_bar = addToolBar ("Main");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2026
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2027 _main_tool_bar->setObjectName ("MainToolBar");
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2028 _main_tool_bar->addAction (_new_script_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2029 _main_tool_bar->addAction (_open_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2030
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2031 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2032
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2033 _main_tool_bar->addAction (_copy_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2034 _main_tool_bar->addAction (_paste_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2035 _main_tool_bar->addAction (_undo_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2036
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2037 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2038
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2039 _current_directory_combo_box = new QComboBox (this);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2040 _current_directory_combo_box->setFixedWidth (current_directory_width);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2041 _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
2042 _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
2043 _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
2044 _current_directory_combo_box->setMaxVisibleItems (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2045 current_directory_max_visible);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2046 _current_directory_combo_box->setMaxCount (current_directory_max_count);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2047 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2048 _current_directory_combo_box->setSizePolicy (sizePol);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2049
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2050 // 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
2051 // need to delete these upon destroying this main_window.
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2052 _main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2053 _main_tool_bar->addWidget (_current_directory_combo_box);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2054 QAction *current_dir_up = _main_tool_bar->addAction (
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2055 QIcon (":/actions/icons/up.png"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2056 tr ("One directory up"));
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2057 QAction *current_dir_search = _main_tool_bar->addAction (
18261
09ef57c61b3b update some icnons of the gui
Torsten <ttl@justmail.de>
parents: 18257
diff changeset
2058 QIcon (":/actions/icons/folder.png"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2059 tr ("Browse directories"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2060
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2061 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
2062 this, SLOT (set_current_working_directory (QString)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2063
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2064 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
2065 this, SLOT (accept_directory_line_edit ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2066
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2067 connect (current_dir_search, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2068 this, SLOT (browse_for_directory ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2069
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
2070 connect (current_dir_up, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2071 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
2072
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2073 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
2074 this, SLOT (handle_undo_request ()));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2075 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2076
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2077 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2078 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
2079 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2080 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
2081 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2082
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2083 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2084 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
2085 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2086 Fload (ovl (file));
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
2087
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
2088 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
2089 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2090
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2091 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2092 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
2093 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2094 Fclear ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2095 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2096
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2097 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2098 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
2099 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2100 /* 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
2101
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2102 // if (status)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2103 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
2104
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2105 // else
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2106 // ; // 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
2107 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2108
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2109 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2110 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
2111 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2112 command_editor::undo ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2113 command_editor::redisplay ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2114 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2115
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2116 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2117 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
2118 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2119 Fclc ();
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2120 command_editor::interrupt (true);
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2121 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2122
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2123 void
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2124 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
2125 {
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2126 command_editor::resize_terminal ();
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2127 }
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2128
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2129 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2130 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
2131 {
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
2132 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
2133 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2134
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2135 void
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2136 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
2137 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2138 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
2139
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2140 if (!_cmd_queue->isEmpty ()) // list can not be empty here, just to make sure
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2141 {
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2142 std::string pending_input = command_editor::get_current_line ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2143 command_editor::set_initial_input (pending_input);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
2144
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2145 _cmd_queue_mutex.lock (); // critical path
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2146 std::string command = _cmd_queue->takeFirst ().toStdString ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2147 if (_cmd_queue->isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2148 _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
2149 else
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2150 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
2151 _cmd_queue_mutex.unlock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2152
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2153 command_editor::replace_line (command);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
2154
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2155 command_editor::redisplay ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2156 // We are executing inside the command editor event loop. Force
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2157 // the current line to be returned for processing.
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2158 command_editor::interrupt ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2159 }
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2160
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
2161 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
2162 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
2163
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2164 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2165
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2166 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2167 main_window::new_figure_callback (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2168 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2169 Fbuiltin (ovl ("figure"));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2170 Fdrawnow ();
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2171 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2172
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2173 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2174 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
2175 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2176 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
2177 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2178
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2179 // 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
2180 // 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
2181 // 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
2182 // 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
2183 // 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
2184 // 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
2185
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2186 void
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2187 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
2188 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2189 _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
2190 _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
2191 _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
2192
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2193 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
2194 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
2195 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2196
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2197 void
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2198 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
2199 {
18250
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2200 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
2201
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2202 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
2203 {
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2204 _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
2205 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
2206 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
2207 _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
2208 else
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2209 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
2210 _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
2211
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2212 if (debug == "step")
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2213 Fdbstep ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2214 else if (debug == "cont")
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2215 Fdbcont ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2216 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
2217 Fdbquit ();
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2218 else
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2219 Fdbstep (ovl (debug.toStdString ()));
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2220
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2221 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
2222 }
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2223
0da2e7051778 synchronize gui's debug actions with the octave core thread (bug #41139)
Torsten <ttl@justmail.de>
parents: 18208
diff changeset
2224 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
2225 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
2226
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2227 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2228
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2229 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2230 main_window::exit_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2231 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2232 Fquit ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2233 }
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2234
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2235 void
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2236 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
2237 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2238
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2239 if (! find_files_dlg)
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2240 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2241 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
2242
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2243 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
2244 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
2245
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2246 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
2247 file_browser_window,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2248 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
2249
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2250 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
2251 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
2252
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2253 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
2254 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2255
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2256 if (! find_files_dlg->isVisible ())
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2257 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2258 find_files_dlg->show ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2259 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2260
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2261 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
2262
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2263 find_files_dlg->activateWindow ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2264
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2265 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2266
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2267 void
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2268 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
2269 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2270
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2271 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2272
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2273 void
18718
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2274 main_window::set_global_edit_shortcuts (bool enable)
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2275 {
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2276 if (enable)
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2277 {
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2278 shortcut_manager::set_shortcut (_copy_action, "main_edit:copy");
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2279 shortcut_manager::set_shortcut (_paste_action, "main_edit:paste");
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2280 shortcut_manager::set_shortcut (_undo_action, "main_edit:undo");
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2281 shortcut_manager::set_shortcut (_select_all_action, "main_edit:select_all");
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2282 }
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2283 else
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2284 {
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2285 QKeySequence no_key = QKeySequence ();
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2286 _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
2287 _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
2288 _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
2289 _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
2290 }
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2291 }
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2292
86eca5d178a6 disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents: 18709
diff changeset
2293 void
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2294 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
2295 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2296 if (set_shortcuts)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2297 {
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
2298
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2299 // file menu
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2300 shortcut_manager::set_shortcut (_open_action, "main_file:open_file");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2301 shortcut_manager::set_shortcut (_new_script_action, "main_file:new_file");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2302 shortcut_manager::set_shortcut (_new_function_action, "main_file:new_function");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2303 shortcut_manager::set_shortcut (_new_function_action, "main_file:new_figure");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2304 shortcut_manager::set_shortcut (_load_workspace_action, "main_file:load_workspace");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2305 shortcut_manager::set_shortcut (_save_workspace_action, "main_file:save_workspace");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2306 shortcut_manager::set_shortcut (_preferences_action, "main_file:preferences");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2307 shortcut_manager::set_shortcut (_exit_action,"main_file:exit");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2308
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2309 // edit menu
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2310 shortcut_manager::set_shortcut (_copy_action, "main_edit:copy");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2311 shortcut_manager::set_shortcut (_paste_action, "main_edit:paste");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2312 shortcut_manager::set_shortcut (_undo_action, "main_edit:undo");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2313 shortcut_manager::set_shortcut (_select_all_action, "main_edit:select_all");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2314 shortcut_manager::set_shortcut (_clear_clipboard_action, "main_edit:clear_clipboard");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2315 shortcut_manager::set_shortcut (_find_files_action, "main_edit:find_in_files");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2316 shortcut_manager::set_shortcut (_clear_command_history_action, "main_edit:clear_history");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2317 shortcut_manager::set_shortcut (_clear_command_window_action, "main_edit:clear_command_window");
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2318 shortcut_manager::set_shortcut (_clear_workspace_action, "main_edit:clear_workspace");
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2319
18738
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
2320 // debug menu
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
2321 shortcut_manager::set_shortcut (_debug_step_over, "main_debug:step_over");
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
2322 shortcut_manager::set_shortcut (_debug_step_into, "main_debug:step_into");
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
2323 shortcut_manager::set_shortcut (_debug_step_out, "main_debug:step_out");
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
2324 shortcut_manager::set_shortcut (_debug_continue, "main_debug:continue");
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18718
diff changeset
2325 shortcut_manager::set_shortcut (_debug_quit, "main_debug:quit");
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2326 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2327 else
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2328 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2329
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2330 QKeySequence no_key = QKeySequence ();
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2331
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2332 // file menu
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2333 _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
2334 _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
2335 _new_function_action->setShortcut (no_key);
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2336 _new_function_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2337 _load_workspace_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2338 _save_workspace_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2339 _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
2340 _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
2341
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2342 // edit menu
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2343 //_copy_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2344 //_paste_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2345 //_undo_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2346 _select_all_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2347 _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
2348 _find_files_action->setShortcut (no_key);
18645
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2349 _clear_command_history_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2350 _clear_command_window_action->setShortcut (no_key);
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18609
diff changeset
2351 _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
2352
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2353 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2354
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2355 }
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
2356
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2357 void
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2358 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
2359 {
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2360 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
2361 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
2362 }
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2363
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2364 void
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2365 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
2366 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2367 if (cp_mode == QClipboard::Clipboard)
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2368 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2369 if (_clipboard->text ().isEmpty ())
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2370 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2371 _paste_action->setEnabled (false);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2372 _clear_clipboard_action->setEnabled (false);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2373 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2374 else
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2375 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2376 _paste_action->setEnabled (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2377 _clear_clipboard_action->setEnabled (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2378 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2379 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2380 }
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
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::clear_clipboard ()
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 _clipboard->clear (QClipboard::Clipboard);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2386 }
18673
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2387
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2388 bool
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2389 main_window::confirm_exit_octave ()
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2390 {
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2391 bool closenow = true;
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2392
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2393 QSettings *settings = resource_manager::get_settings ();
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2394
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2395 if (settings->value ("prompt_to_exit", false ).toBool())
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2396 {
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2397 int ans = QMessageBox::question (this, tr ("Octave"),
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2398 tr ("Are you sure you want to exit Octave?"),
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2399 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2400
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2401 if (ans != QMessageBox::Ok)
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2402 closenow = false;
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2403
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2404 }
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2405 return closenow;
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2406 }
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2407
7cb98e81ecd1 GUI: Prompt to exit Octave option (Bug #41080)
John Donoghue <john.donoghue@ieee.org>
parents: 18645
diff changeset
2408