Mercurial > octave
annotate libgui/src/dialog.cc @ 27551:564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
* dialog.h, dialog.cc (QUIWidgetCreator::handle_create_dialog,
QUIWidgetCreator::handle_create_listview,
QUIWidgetCreator::handle_create_inputlayout,
QUIWidgetCreator::handle_create_filedialog):
Move here from base_qobject. Connect finish signals and slots here
instead of in dialog object constructors.
(QUIWidgetCreator::QUIWidgetCreator): Connect create signals and slots
for dialogs here instead of in base_qobject::connect_uiwidget_links
* octave-qobject.h, octave-qobject.cc (base_qobject::base_qobject):
Don't call connect_uiwidget_links.
(base_qobject::connect_uiwidget_links): Delete.
(base_qobject::handle_create_dialog,
base_qobject::handle_create_listview,
base_qobject::handle_create_inputlayout,
base_qobject::handle_create_filedialog): Delete.
* qt-interpreter-events.cc
(qt_interpreter_events::qt_interpreter_events): Call qRegisterMetaType
for QIntList and QFloatList here instead of in
base_qobject::connect_uiwidget_links.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 24 Oct 2019 01:50:58 -0400 |
parents | 5189bfa8ad2a |
children | de5129cb0796 |
rev | line source |
---|---|
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
26096
diff
changeset
|
3 Copyright (C) 2013-2019 John W. Eaton |
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
26096
diff
changeset
|
4 Copyright (C) 2013-2019 Daniel J. Sebald |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 This file is part of Octave. |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24016
diff
changeset
|
8 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24016
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
11 (at your option) any later version. |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 GNU General Public License for more details. |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24016
diff
changeset
|
20 <https://www.gnu.org/licenses/>. |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 */ |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21613
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21213
diff
changeset
|
25 # include "config.h" |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #endif |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
28 #include <QFileInfo> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
29 #include <QListView> |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <QString> |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <QStringList> |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <QStringListModel> |
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 // Could replace most of these with #include <QtGui> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
34 #include <QGridLayout> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
35 #include <QGroupBox> |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 #include <QHBoxLayout> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
37 #include <QLabel> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
38 #include <QMessageBox> |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 #include <QPushButton> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
40 #include <QVBoxLayout> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
41 |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
42 #include "dialog.h" |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
26617
diff
changeset
|
43 #include "resource-manager.h" |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
45 namespace octave |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 { |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
47 QUIWidgetCreator uiwidget_creator; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
48 |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
49 QUIWidgetCreator::QUIWidgetCreator (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
50 : QObject (), m_dialog_result (-1), m_dialog_button (), |
27549
5189bfa8ad2a
eliminate unnecessary use of pointers
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
51 m_string_list (), m_list_index (), m_path_name () |
27551
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
52 { |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
53 connect (this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
54 SIGNAL (create_dialog (const QString&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
55 const QString&, const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
56 const QString&, const QStringList&)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
57 this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
58 SLOT (handle_create_dialog (const QString&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
59 const QString&, const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
60 const QString&, const QStringList&))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
61 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
62 connect (this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
63 SIGNAL (create_listview (const QStringList&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
64 int, int, const QIntList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
65 const QString&, const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
66 const QString&, const QString&)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
67 this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
68 SLOT (handle_create_listview (const QStringList&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
69 int, int, const QIntList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
70 const QString&, const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
71 const QString&, const QString&))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
72 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
73 connect (this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
74 SIGNAL (create_inputlayout (const QStringList&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
75 const QFloatList&, const QFloatList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
76 const QStringList&)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
77 this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
78 SLOT (handle_create_inputlayout (const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
79 const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
80 const QFloatList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
81 const QFloatList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
82 const QStringList&))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
83 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
84 connect (this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
85 SIGNAL (create_filedialog (const QStringList&,const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
86 const QString&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
87 const QString&)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
88 this, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
89 SLOT (handle_create_filedialog (const QStringList&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
90 const QString&, const QString&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
91 const QString&))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
92 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
94 QString QUIWidgetCreator::rm_amp (const QString& text) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
95 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
96 QString text_wo_amp = text; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
97 text_wo_amp.replace (QRegExp ("&(\\w)"), "\\1"); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
98 return text_wo_amp; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
99 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
100 |
27551
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
101 // Create a message dialog with specified string, buttons and decorative |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
102 // text. |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
103 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
104 void QUIWidgetCreator::handle_create_dialog (const QString& message, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
105 const QString& title, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
106 const QString& icon, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
107 const QStringList& button, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
108 const QString& defbutton, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
109 const QStringList& role) |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
110 { |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
111 MessageDialog *message_dialog = new MessageDialog (message, title, icon, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
112 button, defbutton, role); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
113 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
114 connect (message_dialog, SIGNAL (buttonClicked (QAbstractButton *)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
115 this, SLOT (dialog_button_clicked (QAbstractButton *))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
116 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
117 message_dialog->setAttribute (Qt::WA_DeleteOnClose); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
118 message_dialog->show (); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
119 } |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
120 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
121 void QUIWidgetCreator::dialog_button_clicked (QAbstractButton *button) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
122 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
123 // Wait for link thread to go to sleep state. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
124 lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
125 |
25544
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
126 if (button) // button is NULL when dialog is closed |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
127 { |
25544
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
128 // Check for a matching button text while ignoring accelerators because |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
129 // the window manager may have added one in the passed button |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
130 QString text_clean = rm_amp (button->text ()); |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
131 for (int i = 0; i < m_button_list.count (); i++) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
132 { |
25544
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
133 if (rm_amp (m_button_list.at (i)) == text_clean) |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
134 { |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
135 m_dialog_button = m_button_list.at (i); // text w/o extra accelerator |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
136 break; |
15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
Torsten <mttl@mailbox.org>
parents:
25342
diff
changeset
|
137 } |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
138 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
139 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
140 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
141 // The value should always be 1 for the Octave functions. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
142 m_dialog_result = 1; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
144 unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
145 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
146 // Wake up Octave process so that it continues. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
147 wake_all (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
148 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
149 |
27551
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
150 // Create a list dialog with specified list, initially selected, mode, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
151 // view size and decorative text. |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
152 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
153 void QUIWidgetCreator::handle_create_listview (const QStringList& list, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
154 const QString& mode, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
155 int wd, int ht, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
156 const QIntList& initial, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
157 const QString& name, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
158 const QStringList& prompt, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
159 const QString& ok_string, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
160 const QString& cancel_string) |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
161 { |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
162 ListDialog *list_dialog = new ListDialog (list, mode, wd, ht, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
163 initial, name, prompt, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
164 ok_string, cancel_string); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
165 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
166 connect (list_dialog, SIGNAL (finish_selection (const QIntList&, int)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
167 this, SLOT (list_select_finished (const QIntList&, int))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
168 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
169 list_dialog->setAttribute (Qt::WA_DeleteOnClose); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
170 list_dialog->show (); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
171 } |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
172 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
173 void QUIWidgetCreator::list_select_finished (const QIntList& selected, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
174 int button_pressed) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
175 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
176 // Wait for link thread to go to sleep state. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
177 lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
178 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
179 // Store the value so that builtin functions can retrieve. |
27549
5189bfa8ad2a
eliminate unnecessary use of pointers
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
180 m_list_index = selected; |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
181 m_dialog_result = button_pressed; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
183 unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
184 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
185 // Wake up Octave process so that it continues. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
186 wake_all (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
187 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
188 |
27551
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
189 // Create an input dialog with specified prompts and defaults, title and |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
190 // row/column size specifications. |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
191 void QUIWidgetCreator::handle_create_inputlayout (const QStringList& prompt, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
192 const QString& title, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
193 const QFloatList& nr, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
194 const QFloatList& nc, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
195 const QStringList& defaults) |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
196 { |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
197 InputDialog *input_dialog = new InputDialog (prompt, title, nr, nc, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
198 defaults); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
199 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
200 connect (input_dialog, SIGNAL (finish_input (const QStringList&, int)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
201 this, SLOT (input_finished (const QStringList&, int))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
202 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
203 input_dialog->setAttribute (Qt::WA_DeleteOnClose); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
204 input_dialog->show (); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
205 } |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
206 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
207 void QUIWidgetCreator::input_finished (const QStringList& input, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
208 int button_pressed) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
209 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
210 // Wait for link thread to go to sleep state. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
211 lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
212 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
213 // Store the value so that builtin functions can retrieve. |
27549
5189bfa8ad2a
eliminate unnecessary use of pointers
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
214 m_string_list = input; |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
215 m_dialog_result = button_pressed; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
216 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
217 unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
218 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
219 // Wake up Octave process so that it continues. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
220 wake_all (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
221 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
222 |
27551
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
223 void QUIWidgetCreator::handle_create_filedialog (const QStringList& filters, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
224 const QString& title, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
225 const QString& filename, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
226 const QString& dirname, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
227 const QString& multimode) |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
228 { |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
229 FileDialog *file_dialog = new FileDialog (filters, title, filename, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
230 dirname, multimode); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
231 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
232 connect (file_dialog, SIGNAL (finish_input (const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
233 const QString&, int)), |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
234 this, SLOT (filedialog_finished (const QStringList&, |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
235 const QString&, int))); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
236 |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
237 file_dialog->setAttribute (Qt::WA_DeleteOnClose); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
238 file_dialog->show (); |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
239 } |
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
240 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
241 void QUIWidgetCreator::filedialog_finished (const QStringList& files, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
242 const QString& path, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
243 int filterindex) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
244 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
245 // Wait for link thread to go to sleep state. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
246 lock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
247 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
248 // Store the value so that builtin functions can retrieve. |
27549
5189bfa8ad2a
eliminate unnecessary use of pointers
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
249 m_string_list = files; |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
250 m_dialog_result = filterindex; |
27549
5189bfa8ad2a
eliminate unnecessary use of pointers
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
251 m_path_name = path; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
252 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
253 unlock (); |
20091
89d843d6de14
Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
20081
diff
changeset
|
254 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
255 // Wake up Octave process so that it continues. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
256 wake_all (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
257 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
258 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
259 MessageDialog::MessageDialog (const QString& message, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
260 const QString& title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
261 const QString& qsicon, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
262 const QStringList& qsbutton, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
263 const QString& defbutton, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
264 const QStringList& role) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
265 : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
266 message, nullptr, nullptr) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
267 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
268 // Create a NonModal message. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
269 setWindowModality (Qt::NonModal); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
271 // Interpret the icon string, because enumeration QMessageBox::Icon can't |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
272 // easily be made to pass through a signal. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
273 QMessageBox::Icon eicon = QMessageBox::NoIcon; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
274 if (qsicon == "error") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
275 eicon = QMessageBox::Critical; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
276 else if (qsicon == "warn") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
277 eicon = QMessageBox::Warning; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
278 else if (qsicon == "help") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
279 eicon = QMessageBox::Information; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
280 else if (qsicon == "quest") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
281 eicon = QMessageBox::Question; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
282 setIcon (eicon); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
283 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
284 int N = (qsbutton.size () < role.size () ? qsbutton.size () : role.size ()); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
285 if (N == 0) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
286 addButton (QMessageBox::Ok); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
287 else |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
288 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
289 for (int i = 0; i < N; i++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
290 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
291 // Interpret the button role string, because enumeration |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
292 // QMessageBox::ButtonRole can't be made to pass through a signal. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
293 QString srole = role.at (i); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
294 QMessageBox::ButtonRole erole = QMessageBox::InvalidRole; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
295 if (srole == "ResetRole") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
296 erole = QMessageBox::ResetRole; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
297 else if (srole == "YesRole") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
298 erole = QMessageBox::YesRole; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
299 else if (srole == "NoRole") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
300 erole = QMessageBox::NoRole; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
301 else if (srole == "RejectRole") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
302 erole = QMessageBox::RejectRole; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
303 else if (srole == "AcceptRole") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
304 erole = QMessageBox::AcceptRole; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
305 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
306 QPushButton *pbutton = addButton (qsbutton.at (i), erole); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
307 if (qsbutton.at (i) == defbutton) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
308 setDefaultButton (pbutton); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
309 // Make the last button the button pressed when <esc> key activated. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
310 if (i == N-1) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
311 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
312 // FIXME: Why define and then immediately test value? |
16626
4adf3c4bd80b
GUI compilation fixes for MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16582
diff
changeset
|
313 #define ACTIVE_ESCAPE 1 |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
314 #if ACTIVE_ESCAPE |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
315 setEscapeButton (pbutton); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
316 #else |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
317 setEscapeButton (0); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
318 #endif |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
319 #undef ACTIVE_ESCAPE |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
320 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
321 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
322 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
323 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
324 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
325 ListDialog::ListDialog (const QStringList& list, const QString& mode, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
326 int wd, int ht, const QList<int>& initial, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
327 const QString& title, const QStringList& prompt, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
328 const QString& ok_string, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
329 const QString& cancel_string) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
330 : QDialog (), m_model (new QStringListModel (list)) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
331 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
332 QListView *view = new QListView; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
333 view->setModel (m_model); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
334 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
335 if (mode == "single") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
336 view->setSelectionMode (QAbstractItemView::SingleSelection); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
337 else if (mode == "multiple") |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
338 view->setSelectionMode (QAbstractItemView::ExtendedSelection); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
339 else |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
340 view->setSelectionMode (QAbstractItemView::NoSelection); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
341 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
342 selector = view->selectionModel (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
343 int i = 0; |
25342
416856765a55
be more careful with using auto in place of explicit const iterator decls
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
344 for (auto it = initial.begin (); it != initial.end (); it++) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
345 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
346 QModelIndex idx = m_model->index (initial.value (i++) - 1, 0, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
347 QModelIndex ()); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
348 selector->select (idx, QItemSelectionModel::Select); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
349 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
350 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
351 bool fixed_layout = false; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
352 if (wd > 0 && ht > 0) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
353 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
354 view->setFixedSize (wd, ht); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
355 fixed_layout = true; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
356 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
357 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
358 view->setEditTriggers (QAbstractItemView::NoEditTriggers); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
359 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
360 QVBoxLayout *listLayout = new QVBoxLayout; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
361 if (! prompt.isEmpty ()) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
362 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
363 // For now, assume html-like Rich Text. May be incompatible |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
364 // with something down the road, but just testing capability. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
365 QString prompt_string; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
366 for (int j = 0; j < prompt.length (); j++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
367 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
368 if (j > 0) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
369 // FIXME: Why define and then immediately test value? |
16626
4adf3c4bd80b
GUI compilation fixes for MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16582
diff
changeset
|
370 #define RICH_TEXT 1 |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
371 #if RICH_TEXT |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
372 prompt_string.append ("<br>"); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
373 #else |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
374 prompt_string.append ("\n"); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
375 #endif |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
376 prompt_string.append (prompt.at (j)); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
377 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
378 QLabel *plabel = new QLabel (prompt_string); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
379 #if RICH_TEXT |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
380 plabel->setTextFormat (Qt::RichText); |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
381 #endif |
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
382 #undef RICH_TEXT |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
383 listLayout->addWidget (plabel); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
384 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
385 listLayout->addWidget (view); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
386 QPushButton *select_all = new QPushButton (tr ("Select All")); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
387 select_all->setVisible (mode == "multiple"); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
388 listLayout->addWidget (select_all); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
389 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
390 QPushButton *buttonOk = new QPushButton (ok_string); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
391 QPushButton *buttonCancel = new QPushButton (cancel_string); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
392 QHBoxLayout *buttonsLayout = new QHBoxLayout; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
393 buttonsLayout->addStretch (1); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
394 buttonsLayout->addWidget (buttonOk); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
395 buttonsLayout->addWidget (buttonCancel); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
396 buttonOk->setDefault (true); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
397 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
398 QVBoxLayout *mainLayout = new QVBoxLayout; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
399 mainLayout->addLayout (listLayout); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
400 mainLayout->addSpacing (12); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
401 mainLayout->addLayout (buttonsLayout); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
402 setLayout (mainLayout); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
403 if (fixed_layout) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
404 layout ()->setSizeConstraint (QLayout::SetFixedSize); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
405 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
406 // If empty, make blank rather than use default OS behavior. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
407 setWindowTitle (title.isEmpty () ? " " : title); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
408 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
409 connect (select_all, SIGNAL (clicked ()), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
410 view, SLOT (selectAll ())); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
411 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
412 connect (buttonOk, SIGNAL (clicked ()), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
413 this, SLOT (buttonOk_clicked ())); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
414 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
415 connect (buttonCancel, SIGNAL (clicked ()), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
416 this, SLOT (buttonCancel_clicked ())); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
417 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
418 connect (view, SIGNAL (doubleClicked (const QModelIndex&)), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
419 this, SLOT (item_double_clicked (const QModelIndex&))); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
420 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
421 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
422 ListDialog::~ListDialog (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
423 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
424 delete m_model; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
425 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
426 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
427 void ListDialog::buttonOk_clicked (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
428 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
429 // Store information about what button was pressed so that builtin |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
430 // functions can retrieve. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
431 QModelIndexList selected_index = selector->selectedIndexes (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
432 QIntList selected_int; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
433 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
434 for (int i = 0; i < selected_index.size (); i++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
435 selected_int << selected_index.at (i).row () + 1; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
436 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
437 emit finish_selection (selected_int, 1); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
438 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
439 done (QDialog::Accepted); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
440 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
441 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
442 void ListDialog::buttonCancel_clicked (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
443 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
444 // Store information about what button was pressed so that builtin |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
445 // functions can retrieve. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
446 QIntList empty; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
447 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
448 emit finish_selection (empty, 0); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
449 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
450 done (QDialog::Rejected); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
451 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
452 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
453 void ListDialog::reject (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
454 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
455 buttonCancel_clicked (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
456 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
457 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
458 void ListDialog::item_double_clicked (const QModelIndex&) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
459 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
460 buttonOk_clicked (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
461 } |
20505
dd327c0909b0
listdlg: Make appearance and behavior more Matlab compatible (bug #46026)
Mike Miller <mtmiller@octave.org>
parents:
20230
diff
changeset
|
462 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
463 InputDialog::InputDialog (const QStringList& prompt, const QString& title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
464 const QFloatList& nr, const QFloatList& nc, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
465 const QStringList& defaults) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
466 : QDialog () |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
467 { |
24808
abfd4fc1b977
Add boundary tests on QLists associated with Qt inputdlg() routine (bug #53209).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24718
diff
changeset
|
468 |
16626
4adf3c4bd80b
GUI compilation fixes for MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16582
diff
changeset
|
469 #define LINE_EDIT_FOLLOWS_PROMPT 0 |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
470 |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
471 #if LINE_EDIT_FOLLOWS_PROMPT |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
472 // Prompt on left followed by input on right. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
473 QGridLayout *promptInputLayout = new QGridLayout; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
474 #else |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
475 // Prompt aligned above input. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
476 QVBoxLayout *promptInputLayout = new QVBoxLayout; |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
477 #endif |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
478 int N_gridrows = prompt.size (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
479 for (int i = 0; i < N_gridrows; i++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
480 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
481 QLabel *label = new QLabel (prompt.at (i)); |
24808
abfd4fc1b977
Add boundary tests on QLists associated with Qt inputdlg() routine (bug #53209).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24718
diff
changeset
|
482 QLineEdit *line_edit = new QLineEdit (); |
abfd4fc1b977
Add boundary tests on QLists associated with Qt inputdlg() routine (bug #53209).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24718
diff
changeset
|
483 if (i < defaults.size ()) |
abfd4fc1b977
Add boundary tests on QLists associated with Qt inputdlg() routine (bug #53209).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24718
diff
changeset
|
484 line_edit->setText (defaults.at (i)); |
abfd4fc1b977
Add boundary tests on QLists associated with Qt inputdlg() routine (bug #53209).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24718
diff
changeset
|
485 if (i < nr.size () && nr.at (i) > 0) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
486 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
487 QSize qsize = line_edit->sizeHint (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
488 int intval = qsize.height () * nr.at (i); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
489 line_edit->setFixedHeight (intval); |
24808
abfd4fc1b977
Add boundary tests on QLists associated with Qt inputdlg() routine (bug #53209).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
24718
diff
changeset
|
490 if (i < nc.size () && nc.at (i) > 0) |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
491 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
492 intval = qsize.height () * nc.at (i) / 2; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
493 line_edit->setFixedWidth (intval); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
494 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
495 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
496 input_line << line_edit; |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
497 #if LINE_EDIT_FOLLOWS_PROMPT |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
498 promptInputLayout->addWidget (label, i + 1, 0); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
499 promptInputLayout->addWidget (line_edit, i + 1, 1); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
500 #else |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
501 promptInputLayout->addWidget (label); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
502 promptInputLayout->addWidget (line_edit); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
503 #endif |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
504 } |
16551
6ae555fc8c43
Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16550
diff
changeset
|
505 #undef LINE_EDIT_FOLLOWS_PROMPT |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
506 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
507 QPushButton *buttonOk = new QPushButton ("OK"); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
508 QPushButton *buttonCancel = new QPushButton ("Cancel"); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
509 QHBoxLayout *buttonsLayout = new QHBoxLayout; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
510 buttonsLayout->addStretch (1); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
511 buttonsLayout->addWidget (buttonOk); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
512 buttonsLayout->addWidget (buttonCancel); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
513 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
514 QVBoxLayout *mainLayout = new QVBoxLayout; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
515 mainLayout->addLayout (promptInputLayout); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
516 mainLayout->addSpacing (12); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
517 mainLayout->addLayout (buttonsLayout); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
518 setLayout (mainLayout); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
519 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
520 // If empty, make blank rather than use default OS behavior. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
521 setWindowTitle (title.isEmpty () ? " " : title); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
522 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
523 connect (buttonOk, SIGNAL (clicked ()), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
524 this, SLOT (buttonOk_clicked ())); |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
525 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
526 connect (buttonCancel, SIGNAL (clicked ()), |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
527 this, SLOT (buttonCancel_clicked ())); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
528 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
529 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
530 void InputDialog::buttonOk_clicked (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
531 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
532 // Store information about what button was pressed so that builtin |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
533 // functions can retrieve. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
534 QStringList string_result; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
535 for (int i = 0; i < input_line.size (); i++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
536 string_result << input_line.at (i)->text (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
537 emit finish_input (string_result, 1); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
538 done (QDialog::Accepted); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
539 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
540 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
541 void InputDialog::buttonCancel_clicked (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
542 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
543 // Store information about what button was pressed so that builtin |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
544 // functions can retrieve. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
545 QStringList empty; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
546 emit finish_input (empty, 0); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
547 done (QDialog::Rejected); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
548 } |
16512
7f2395651a1c
dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
549 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
550 void InputDialog::reject (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
551 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
552 buttonCancel_clicked (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
553 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
554 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
555 FileDialog::FileDialog (const QStringList& name_filters, const QString& title, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
556 const QString& filename, const QString& dirname, |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
557 const QString& multimode) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
558 : QFileDialog () |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
559 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
560 // Create a NonModal message. |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
561 setWindowModality (Qt::NonModal); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
562 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
563 setWindowTitle (title.isEmpty () ? " " : title); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
564 setDirectory (dirname); |
26617
98afb8bbd1f6
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
565 |
26096
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25952
diff
changeset
|
566 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved. |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25952
diff
changeset
|
567 if (! resource_manager::get_settings ()->value ("use_native_file_dialogs", |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25952
diff
changeset
|
568 true).toBool ()) |
1002b49ce7b3
Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents:
25952
diff
changeset
|
569 setOption(QFileDialog::DontUseNativeDialog); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
570 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
571 if (multimode == "on") // uigetfile multiselect=on |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
572 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
573 setFileMode (QFileDialog::ExistingFiles); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
574 setAcceptMode (QFileDialog::AcceptOpen); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
575 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
576 else if (multimode == "create") // uiputfile |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
577 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
578 setFileMode (QFileDialog::AnyFile); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
579 setAcceptMode (QFileDialog::AcceptSave); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
580 setOption (QFileDialog::DontConfirmOverwrite, false); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
581 setConfirmOverwrite (true); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
582 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
583 else if (multimode == "dir") // uigetdir |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
584 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
585 setFileMode (QFileDialog::Directory); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
586 setOption (QFileDialog::ShowDirsOnly, true); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
587 setOption (QFileDialog::HideNameFilterDetails, true); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
588 setAcceptMode (QFileDialog::AcceptOpen); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
589 } |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
590 else // uigetfile multiselect=off |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
591 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
592 setFileMode (QFileDialog::ExistingFile); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
593 setAcceptMode (QFileDialog::AcceptOpen); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
594 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
595 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
596 setNameFilters (name_filters); |
16581
fa4a035e0cf4
Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents:
16580
diff
changeset
|
597 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
598 selectFile (filename); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17400
diff
changeset
|
599 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
600 connect (this, SIGNAL (accepted ()), this, SLOT (acceptSelection ())); |
27551
564bba235594
move some dialog slot functions from octave-qobject.cc to dialog.cc
John W. Eaton <jwe@octave.org>
parents:
27549
diff
changeset
|
601 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
602 connect (this, SIGNAL (rejected ()), this, SLOT (rejectSelection ())); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
603 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
604 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
605 void FileDialog::rejectSelection (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
606 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
607 QStringList empty; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
608 emit finish_input (empty, "", 0); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
609 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
610 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
611 void FileDialog::acceptSelection (void) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
612 { |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
613 QStringList string_result; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
614 QString path; |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
615 int idx = 1; |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
616 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
617 string_result = selectedFiles (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
618 |
25951 | 619 if (testOption (QFileDialog::ShowDirsOnly) && string_result.size () > 0) |
620 path = string_result[0]; | |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
621 else |
25951 | 622 path = directory ().absolutePath (); |
18607
40dce9423baa
uigetdir: return correct path name (Bug #42004)
John Donoghue <john.donoghue@ieee.org>
parents:
18405
diff
changeset
|
623 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
624 // Matlab expects just the filename, whereas the file dialog gave us |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
625 // full path names, so fix it. |
16580
adc150db1809
style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents:
16579
diff
changeset
|
626 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
627 for (int i = 0; i < string_result.size (); i++) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
628 string_result[i] = QFileInfo (string_result[i]).fileName (); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
629 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
630 // if not showing only dirs, add end slash for the path component |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
631 if (testOption (QFileDialog::ShowDirsOnly) == false) |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
632 path += '/'; |
18404
6ebd37faae5f
Add path separator to end of uigetfile path (Bug #41367)
John Donoghue <john.donoghue@ieee.org>
parents:
17790
diff
changeset
|
633 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
634 // convert to native slashes |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
635 path = QDir::toNativeSeparators (path); |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
636 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
637 QStringList name_filters = nameFilters (); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
638 idx = name_filters.indexOf (selectedNameFilter ()) + 1; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17400
diff
changeset
|
639 |
24718
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
640 // send the selected info |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
641 emit finish_input (string_result, path, idx); |
ea1c88bd4430
move more GUI classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24586
diff
changeset
|
642 } |
16579
7f8db1942dc0
Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents:
16565
diff
changeset
|
643 } |