Mercurial > octave-nkf
annotate libgui/src/octave-qt-link.cc @ 17790:86c6ae5f969e
Use GNU style coding conventions for code in libgui/
* libgui/qterminal/libqterminal/QTerminal.h, libgui/src/color-picker.cc,
libgui/src/color-picker.h, libgui/src/dialog.cc, libgui/src/dialog.h,
libgui/src/documentation-dock-widget.cc, libgui/src/files-dock-widget.cc,
libgui/src/files-dock-widget.h, libgui/src/find-files-dialog.cc,
libgui/src/find-files-dialog.h, libgui/src/find-files-model.cc,
libgui/src/find-files-model.h, libgui/src/history-dock-widget.cc,
libgui/src/history-dock-widget.h, libgui/src/m-editor/file-editor-interface.h,
libgui/src/m-editor/file-editor-tab.cc, libgui/src/m-editor/file-editor-tab.h,
libgui/src/m-editor/file-editor.cc, libgui/src/m-editor/find-dialog.cc,
libgui/src/m-editor/find-dialog.h, libgui/src/m-editor/octave-qscintilla.cc,
libgui/src/main-window.cc, libgui/src/main-window.h,
libgui/src/news-dock-widget.h, libgui/src/octave-dock-widget.cc,
libgui/src/octave-dock-widget.h, libgui/src/octave-gui.cc,
libgui/src/octave-qt-link.cc, libgui/src/octave-qt-link.h,
libgui/src/qtinfo/parser.cc, libgui/src/qtinfo/parser.h,
libgui/src/qtinfo/webinfo.cc, libgui/src/qtinfo/webinfo.h,
libgui/src/resource-manager.cc, libgui/src/settings-dialog.cc,
libgui/src/settings-dialog.h, libgui/src/terminal-dock-widget.cc,
libgui/src/welcome-wizard.cc, libgui/src/workspace-model.cc,
libgui/src/workspace-model.h, libgui/src/workspace-view.cc,
libgui/src/workspace-view.h:
Use GNU style coding conventions for code in libgui/
author | Rik <rik@octave.org> |
---|---|
date | Tue, 29 Oct 2013 09:54:40 -0700 |
parents | d63878346099 |
children | 86e8dbccf7c7 |
rev | line source |
---|---|
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 Copyright (C) 2013 John W. Eaton |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17029
diff
changeset
|
4 Copyright (C) 2011-2013 Jacob Dawid |
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17029
diff
changeset
|
5 Copyright (C) 2011-2013 John P. Swensen |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 This file is part of Octave. |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 Octave is free software; you can redistribute it and/or modify it |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 under the terms of the GNU General Public License as published by the |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 Free Software Foundation; either version 3 of the License, or (at your |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 option) any later version. |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but WITHOUT |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 for more details. |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 along with Octave; see the file COPYING. If not, see |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 <http://www.gnu.org/licenses/>. |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 */ |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #ifdef HAVE_CONFIG_H |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #include <config.h> |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #endif |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
29 #include <QStringList> |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
30 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
31 #include "str-vec.h" |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
32 #include "dialog.h" |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
33 #include "error.h" |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
34 #include "workspace-element.h" |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
35 #include "builtin-defun-decls.h" |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
36 #include "load-path.h" |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
37 #include "oct-env.h" |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
38 #include "utils.h" |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
39 |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 #include "octave-qt-link.h" |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 |
16485
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
42 octave_qt_link::octave_qt_link (octave_main_thread *mt) |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
43 : octave_link (), main_thread (mt) |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
44 { } |
16479
7a71ea0b7ae9
eliminate event listener class
John W. Eaton <jwe@octave.org>
parents:
16468
diff
changeset
|
45 |
16485
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
46 octave_qt_link::~octave_qt_link (void) { } |
16432
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
47 |
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
48 void |
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
49 octave_qt_link::execute_interpreter (void) |
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
50 { |
fe4cd846c3e7
separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents:
16431
diff
changeset
|
51 main_thread->execute_interpreter (); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
54 bool |
16485
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
55 octave_qt_link::do_exit (int status) |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
56 { |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
57 emit exit_signal (status); |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
58 |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
59 return true; |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
60 } |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
61 |
8b783661e03f
improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents:
16479
diff
changeset
|
62 bool |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
63 octave_qt_link::do_edit_file (const std::string& file) |
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
64 { |
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
65 emit edit_file_signal (QString::fromStdString (file)); |
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
66 |
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
67 return true; |
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
68 } |
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16438
diff
changeset
|
69 |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
70 int |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
71 octave_qt_link::do_message_dialog (const std::string& dlg, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
72 const std::string& msg, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
73 const std::string& title) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
74 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
75 uiwidget_creator.signal_dialog (QString::fromStdString (msg), |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
76 QString::fromStdString (title), |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
77 QString::fromStdString (dlg), |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
78 QStringList (), QString (), |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
79 QStringList ()); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
80 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
81 // Wait while the user is responding to message box. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
82 uiwidget_creator.wait (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
83 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
84 // The GUI has sent a signal and the process has been awakened. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
85 return uiwidget_creator.get_dialog_result (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
86 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
87 |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
88 std::string |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
89 octave_qt_link::do_question_dialog (const std::string& msg, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
90 const std::string& title, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
91 const std::string& btn1, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
92 const std::string& btn2, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
93 const std::string& btn3, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
94 const std::string& btndef) |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
95 { |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
96 QStringList btn; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
97 QStringList role; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
98 role << "AcceptRole" << "AcceptRole" << "AcceptRole"; |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
99 btn << QString::fromStdString (btn1); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
100 if (btn2 == "") |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
101 role.removeAt (0); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
102 else |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
103 btn << QString::fromStdString (btn2); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
104 btn << QString::fromStdString (btn3); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
105 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
106 uiwidget_creator.signal_dialog (QString::fromStdString (msg), |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
107 QString::fromStdString (title), |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
108 "quest", |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
109 btn, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
110 QString::fromStdString (btndef), |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
111 role); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
112 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
113 // Wait while the user is responding to message box. |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
114 uiwidget_creator.wait (); |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
115 |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
116 // The GUI has sent a signal and the process has been awakened. |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
117 return uiwidget_creator.get_dialog_button ().toStdString (); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
118 } |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
119 |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
120 static QStringList |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
121 make_qstring_list (const std::list<std::string>& lst) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
122 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
123 QStringList retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
124 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
125 for (std::list<std::string>::const_iterator it = lst.begin (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
126 it != lst.end (); it++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
127 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
128 retval.append (QString::fromStdString (*it)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
129 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
130 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
131 return retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
132 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
133 |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
134 static QStringList |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
135 make_filter_list (const octave_link::filter_list& lst) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
136 { |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
137 QStringList retval; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
138 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
139 // We have pairs of data, first being the list of extensions |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
140 // exta;exb;extc etc second the name to use as filter name |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
141 // (optional). Qt wants a a list of filters in the format of |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
142 // 'FilterName (space separated exts)'. |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
143 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
144 for (octave_link::filter_list::const_iterator it = lst.begin (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
145 it != lst.end (); it++) |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
146 { |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
147 QString ext = QString::fromStdString (it->first); |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
148 QString name = QString::fromStdString (it->second); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
149 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
150 // Strip out extensions from name and replace ';' with spaces in |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
151 // list. |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
152 |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
153 name.replace (QRegExp ("\\(.*\\)"), ""); |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
154 ext.replace (";", " "); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
155 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
156 if (name.length () == 0) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
157 { |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
158 // No name field. Build one from the extensions. |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
159 name = ext.toUpper () + " Files"; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
160 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
161 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
162 retval.append (name + " (" + ext + ")"); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
163 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
164 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
165 return retval; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
166 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
167 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
168 std::pair<std::list<int>, int> |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
169 octave_qt_link::do_list_dialog (const std::list<std::string>& list, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
170 const std::string& mode, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
171 int width, int height, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
172 const std::list<int>& initial, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
173 const std::string& name, |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
174 const std::list<std::string>& prompt, |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
175 const std::string& ok_string, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
176 const std::string& cancel_string) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
177 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
178 uiwidget_creator.signal_listview (make_qstring_list (list), |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
179 QString::fromStdString (mode), |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
180 width, height, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
181 QList<int>::fromStdList (initial), |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
182 QString::fromStdString (name), |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
183 make_qstring_list (prompt), |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
184 QString::fromStdString (ok_string), |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
185 QString::fromStdString (cancel_string)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
186 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
187 // Wait while the user is responding to message box. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
188 uiwidget_creator.wait (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
189 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
190 // The GUI has sent a signal and the process has been awakened. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
191 const QIntList *selected = uiwidget_creator.get_list_index (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
192 int ok = uiwidget_creator.get_dialog_result (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
193 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
194 return std::pair<std::list<int>, int> (selected->toStdList (), ok); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
195 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
196 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
197 std::list<std::string> |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
198 octave_qt_link::do_input_dialog (const std::list<std::string>& prompt, |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
199 const std::string& title, |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
200 const std::list<float>& nr, |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
201 const std::list<float>& nc, |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
202 const std::list<std::string>& defaults) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
203 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
204 std::list<std::string> retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
205 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
206 uiwidget_creator.signal_inputlayout (make_qstring_list (prompt), |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
207 QString::fromStdString (title), |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
208 QFloatList::fromStdList (nr), |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16547
diff
changeset
|
209 QFloatList::fromStdList (nc), |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
210 make_qstring_list (defaults)); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
211 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
212 // Wait while the user is responding to message box. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
213 uiwidget_creator.wait (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
214 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
215 // The GUI has sent a signal and the process has been awakened. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
216 const QStringList *inputLine = uiwidget_creator.get_string_list (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
217 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
218 for (QStringList::const_iterator it = inputLine->begin (); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
219 it != inputLine->end (); it++) |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
220 { |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
221 retval.push_back (it->toStdString ()); |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
222 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
223 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
224 return retval; |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
225 } |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
16502
diff
changeset
|
226 |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
227 std::list<std::string> |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
228 octave_qt_link::do_file_dialog (const filter_list& filter, |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
229 const std::string& title, |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
230 const std::string& filename, |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
231 const std::string& dirname, |
16581
fa4a035e0cf4
Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16580
diff
changeset
|
232 const std::string& multimode) |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
233 { |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
234 std::list<std::string> retval; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
235 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
236 uiwidget_creator.signal_filedialog (make_filter_list (filter), |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
237 QString::fromStdString (title), |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
238 QString::fromStdString (filename), |
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
239 QString::fromStdString (dirname), |
16581
fa4a035e0cf4
Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16580
diff
changeset
|
240 QString::fromStdString (multimode)); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
241 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
242 // Wait while the user is responding to dialog. |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
243 uiwidget_creator.wait (); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
244 |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
245 // Add all the file dialog results to a string list. |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
246 const QStringList *inputLine = uiwidget_creator.get_string_list (); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
247 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
248 for (QStringList::const_iterator it = inputLine->begin (); |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
249 it != inputLine->end (); it++) |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
250 retval.push_back (it->toStdString ()); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
251 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
252 retval.push_back (uiwidget_creator.get_dialog_path ()->toStdString ()); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
253 retval.push_back ((QString ("%1").arg ( |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
254 uiwidget_creator.get_dialog_result ())).toStdString ()); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
255 |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
256 return retval; |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
257 } |
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16570
diff
changeset
|
258 |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
259 int |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
260 octave_qt_link::do_debug_cd_or_addpath_error (const std::string& file, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
261 const std::string& dir, |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
262 bool addpath_option) |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
263 { |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
264 int retval = -1; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
265 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
266 QString qdir = QString::fromStdString (dir); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
267 QString qfile = QString::fromStdString (file); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
268 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
269 QString msg |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
270 = (addpath_option |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
271 ? tr ("The file %1 does not exist in the load path. To debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
272 : tr ("The file %1 is shadowed by a file with the same name in the load path. To debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir)); |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
273 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
274 QString title = tr ("Change Directory or Add Directory to Load Path"); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
275 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
276 QString cd_txt = tr ("Change Directory"); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
277 QString addpath_txt = tr ("Add Directory to Load Path"); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
278 QString cancel_txt = tr ("Cancel"); |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
279 |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
280 QStringList btn; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
281 QStringList role; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
282 btn << cd_txt; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
283 role << "AcceptRole"; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
284 if (addpath_option) |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
285 { |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
286 btn << addpath_txt; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
287 role << "AcceptRole"; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
288 } |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
289 btn << cancel_txt; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
290 role << "AcceptRole"; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
291 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
292 uiwidget_creator.signal_dialog (msg, title, "quest", btn, cancel_txt, role); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
293 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
294 // Wait while the user is responding to message box. |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
295 uiwidget_creator.wait (); |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
296 |
16565
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
297 QString result = uiwidget_creator.get_dialog_button (); |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
298 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
299 if (result == cd_txt) |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
300 retval = 1; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
301 else if (result == addpath_txt) |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
302 retval = 2; |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
303 |
e4b94abfeb96
use generic dialog for cd or addpath question
John W. Eaton <jwe@octave.org>
parents:
16551
diff
changeset
|
304 return retval; |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
305 } |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16528
diff
changeset
|
306 |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
307 void |
16437
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
308 octave_qt_link::do_change_directory (const std::string& dir) |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
309 { |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
310 emit change_directory_signal (QString::fromStdString (dir)); |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
311 } |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
312 |
919796a440c6
use signal for changing directory
John W. Eaton <jwe@octave.org>
parents:
16432
diff
changeset
|
313 void |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
314 octave_qt_link::do_execute_command_in_terminal (const std::string& command) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
315 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
316 emit execute_command_in_terminal_signal (QString::fromStdString (command)); |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
317 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
318 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16565
diff
changeset
|
319 void |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
320 octave_qt_link::do_set_workspace (bool top_level, |
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
321 const std::list<workspace_element>& ws) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
322 { |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
323 QString scopes; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
324 QStringList symbols; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
325 QStringList class_names; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
326 QStringList dimensions; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
327 QStringList values; |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
328 |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
329 for (std::list<workspace_element>::const_iterator it = ws.begin (); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
330 it != ws.end (); it++) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
331 { |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
332 scopes.append (it->scope ()); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
333 symbols.append (QString::fromStdString (it->symbol ())); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
334 class_names.append (QString::fromStdString (it->class_name ())); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
335 dimensions.append (QString::fromStdString (it->dimension ())); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
336 values.append (QString::fromStdString (it->value ())); |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
337 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
338 |
16502
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
339 emit set_workspace_signal (top_level, scopes, symbols, class_names, |
45ae1038ee89
allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents:
16485
diff
changeset
|
340 dimensions, values); |
16468
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
341 } |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
342 |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
343 void |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
344 octave_qt_link::do_clear_workspace (void) |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
345 { |
0f143f68078d
use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents:
16443
diff
changeset
|
346 emit clear_workspace_signal (); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
347 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
348 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
349 void |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
350 octave_qt_link::do_set_history (const string_vector& hist) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
351 { |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
352 QStringList qt_hist; |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
353 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
354 for (octave_idx_type i = 0; i < hist.length (); i++) |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
355 qt_hist.append (QString::fromStdString (hist[i])); |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
356 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
357 emit set_history_signal (qt_hist); |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
358 } |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
359 |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
360 void |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
361 octave_qt_link::do_append_history (const std::string& hist_entry) |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
362 { |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
363 emit append_history_signal (QString::fromStdString (hist_entry)); |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
364 } |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
365 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
366 void |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
367 octave_qt_link::do_clear_history (void) |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
368 { |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16426
diff
changeset
|
369 emit clear_history_signal (); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
370 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
371 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
372 void |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
373 octave_qt_link::do_pre_input_event (void) |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
374 { |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
375 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
376 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
377 void |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
378 octave_qt_link::do_post_input_event (void) |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
379 { |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
380 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
381 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
382 void |
16419
16bfbf9136d3
avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
383 octave_qt_link::do_enter_debugger_event (const std::string& file, int line) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
384 { |
16419
16bfbf9136d3
avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
385 do_insert_debugger_pointer (file, line); |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
386 |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
387 emit enter_debugger_signal (); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
388 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
389 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
390 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
391 octave_qt_link::do_execute_in_debugger_event (const std::string& file, int line) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
392 { |
16419
16bfbf9136d3
avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
393 do_delete_debugger_pointer (file, line); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
394 } |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
395 |
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
396 void |
16438
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
397 octave_qt_link::do_exit_debugger_event (void) |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
398 { |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
399 emit 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
|
400 } |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
401 |
a971d8bdaadc
use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents:
16437
diff
changeset
|
402 void |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
403 octave_qt_link::do_update_breakpoint (bool insert, |
16419
16bfbf9136d3
avoid creating unnecessary octave_value objects for octave_link calls
John W. Eaton <jwe@octave.org>
parents:
16415
diff
changeset
|
404 const std::string& file, int line) |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
405 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
406 emit update_breakpoint_marker_signal (insert, QString::fromStdString (file), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
407 line); |
16415
70032fc70bee
move octave-link and octave-event-listener classes to libinterp
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
408 } |
16426
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
409 |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
410 void |
16528
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
411 octave_qt_link::do_set_default_prompts (std::string& ps1, std::string& ps2, |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
412 std::string& ps4) |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
413 { |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
414 ps1 = ">> "; |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
415 ps2 = ""; |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
416 ps4 = ""; |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
417 } |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
418 |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
419 |
9bc1f8278966
allow GUI to customize prompts at startup
John W. Eaton <jwe@octave.org>
parents:
16512
diff
changeset
|
420 void |
16426
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
421 octave_qt_link::do_insert_debugger_pointer (const std::string& file, int line) |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
422 { |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
423 emit insert_debugger_pointer_signal (QString::fromStdString (file), line); |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
424 } |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
425 |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
426 void |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
427 octave_qt_link::do_delete_debugger_pointer (const std::string& file, int line) |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
428 { |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
429 emit delete_debugger_pointer_signal (QString::fromStdString (file), line); |
203976ae18d1
use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents:
16424
diff
changeset
|
430 } |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
431 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
432 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
433 bool |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
434 octave_qt_link::file_in_path (const std::string& file, const std::string& dir) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
435 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
436 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
437 bool ok = false; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
438 bool addpath_option = true; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
439 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
440 std::string curr_dir = octave_env::get_current_directory (); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
441 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
442 if (same_file (curr_dir, dir)) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
443 ok = true; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
444 else |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
445 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
446 bool dir_in_load_path = load_path::contains_canonical (dir); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
447 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
448 std::string base_file = octave_env::base_pathname (file); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
449 std::string lp_file = load_path::find_file (base_file); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
450 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
451 if (dir_in_load_path) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
452 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
453 if (same_file (lp_file, file)) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
454 ok = true; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
455 } |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
456 else |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
457 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
458 // File directory is not in path. Is the file in the path in |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
459 // the current directory? If so, then changing the current |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
460 // directory will be needed. Adding directory to path is |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
461 // not enough because the file in the current directory would |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
462 // still be found. |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
463 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
464 if (same_file (lp_file, base_file)) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
465 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
466 if (same_file (curr_dir, dir)) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
467 ok = true; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
468 else |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
469 addpath_option = false; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
470 } |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
471 } |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
472 } |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
473 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
474 if (! ok) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
475 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
476 int action = debug_cd_or_addpath_error (file, dir, addpath_option); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
477 switch (action) |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
478 { |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
479 case 1: |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
480 Fcd (ovl (dir)); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
481 ok = true; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
482 break; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
483 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
484 case 2: |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
485 load_path::prepend (dir); |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
486 ok = true; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
487 break; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
488 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
489 default: |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
490 break; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
491 } |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
492 } |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
493 |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
494 return ok; |
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16581
diff
changeset
|
495 } |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
496 |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
497 void |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
498 octave_qt_link::do_show_preferences () |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
499 { |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
500 emit show_preferences_signal (); |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
501 } |
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
502 |
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
|
503 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
|
504 octave_qt_link::do_show_doc (const std::string& 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
|
505 { |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
17010
diff
changeset
|
506 emit show_doc_signal (QString::fromStdString (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
|
507 } |
17010
c50ee84842a9
Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents:
16658
diff
changeset
|
508 |
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
|
509 |