Mercurial > octave
annotate libgui/src/set-path-dialog.cc @ 31646:c6d54dd31a7e stable
maint: Use macros to begin/end C++ namespaces.
* BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h,
ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h,
CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h,
ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h,
Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc,
GLCanvas.h, GenericEventNotify.h, KeyMap.cc, KeyMap.h,
ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc,
Menu.h, MenuContainer.h, Object.cc, Object.h, ObjectProxy.cc,
ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc,
PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h,
PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h,
RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc,
SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h,
TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc,
ToolBar.h, ToolBarButton.cc, ToolBarButton.h, annotation-dialog.cc,
annotation-dialog.h, gl-select.cc, gl-select.h, qopengl-functions.h,
qt-graphics-toolkit.cc, qt-graphics-toolkit.h, QTerminal.h,
color-picker.cc, color-picker.h, command-widget.cc, command-widget.h,
community-news.cc, community-news.h, dialog.cc, dialog.h,
documentation-bookmarks.cc, documentation-bookmarks.h,
documentation-dock-widget.cc, documentation-dock-widget.h,
documentation.cc, documentation.h, dw-main-window.cc,
dw-main-window.h, external-editor-interface.cc,
external-editor-interface.h, files-dock-widget.cc,
files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h,
find-files-model.cc, find-files-model.h, graphics-init.cc,
graphics-init.h, gui-settings.cc, gui-settings.h, gui-utils.cc,
gui-utils.h, history-dock-widget.cc, history-dock-widget.h,
interpreter-qobject.cc, interpreter-qobject.h, led-indicator.cc,
led-indicator.h, file-editor-interface.h, file-editor-tab.cc,
file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc,
find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc,
octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h,
main-window.cc, main-window.h, news-reader.cc, news-reader.h,
octave-dock-widget.cc, octave-dock-widget.h, octave-qobject.cc,
octave-qobject.h, qt-application.cc, qt-application.h,
qt-interpreter-events.cc, qt-interpreter-events.h, qt-utils.h,
release-notes.cc, release-notes.h, resource-manager.cc,
resource-manager.h, set-path-dialog.cc, set-path-dialog.h,
set-path-model.cc, set-path-model.h, settings-dialog.cc,
settings-dialog.h, shortcut-manager.cc, shortcut-manager.h,
tab-bar.cc, tab-bar.h, terminal-dock-widget.cc,
terminal-dock-widget.h, variable-editor-model.cc,
variable-editor-model.h, variable-editor.cc, variable-editor.h,
welcome-wizard.cc, welcome-wizard.h, workspace-model.cc,
workspace-model.h, workspace-view.cc, workspace-view.h:
Use new macros to begin/end C++ namespaces.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Dec 2022 14:37:51 -0500 |
parents | 796f54d4ddbf |
children | 431f80aba37a 29d734430e5f |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30432
diff
changeset
|
3 // Copyright (C) 2019-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
25 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
27 # include "config.h" |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
28 #endif |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
29 |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
30 #include <QCheckBox> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
31 #include <QComboBox> |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
32 #include <QDialogButtonBox> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
33 #include <QDirIterator> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
34 #include <QFileDialog> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
35 #include <QFileDialog> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
36 #include <QFileInfo> |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
37 #include <QGridLayout> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
38 #include <QGroupBox> |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
39 #include <QHBoxLayout> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
40 #include <QHeaderView> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
41 #include <QIcon> |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
42 #include <QLabel> |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
43 #include <QLineEdit> |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
44 #include <QListView> |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
45 #include <QMenu> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
46 #include <QPushButton> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
47 #include <QStatusBar> |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
48 #include <QTextStream> |
27412
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
49 #include <QTimer> |
da1f59fe04b3
try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27391
diff
changeset
|
50 #include <QVBoxLayout> |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
51 |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
52 #include "gui-preferences-pd.h" |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
53 #include "octave-qobject.h" |
29560
5b7e721844df
provide QOverload template if it is not in <QtGlobal> (bug #60416)
John W. Eaton <jwe@octave.org>
parents:
29550
diff
changeset
|
54 #include "octave-qtutils.h" |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
55 #include "set-path-dialog.h" |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
56 #include "set-path-model.h" |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
57 |
27391
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
58 #include "ovl.h" |
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
59 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
60 OCTAVE_BEGIN_NAMESPACE(octave) |
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
61 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
62 set_path_dialog::set_path_dialog (QWidget *parent, base_qobject& oct_qobj) |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
63 : QDialog (parent), m_octave_qobj (oct_qobj) |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
64 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
65 setWindowTitle (tr ("Set Path")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
66 |
27310
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
67 set_path_model *model = new set_path_model (this); |
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
68 |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
69 m_info_label = new QLabel (tr ("All changes take effect immediately.")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
70 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
71 m_add_folder_button = new QPushButton (tr ("Add Folder...")); |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
72 |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
73 QMenu *add_dir_menu = new QMenu (); |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
74 m_add_folder_button->setMenu (add_dir_menu); |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
75 add_dir_menu->addAction (tr ("Single Folder"), |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
76 this, &set_path_dialog::add_dir); |
30432
db045364dca9
Fixed typos before string freeze
Torsten Lilge <ttl-octave@mailbox.org>
parents:
30398
diff
changeset
|
77 add_dir_menu->addAction (tr ("Folder With Subfolders"), |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
78 this, &set_path_dialog::add_dir_subdirs); |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
79 |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
80 m_move_to_top_button = new QPushButton (tr ("Move to Top")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
81 m_move_to_bottom_button = new QPushButton (tr ("Move to Bottom")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
82 m_move_up_button = new QPushButton (tr ("Move Up")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
83 m_move_down_button = new QPushButton (tr ("Move Down")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
84 m_remove_button = new QPushButton (tr ("Remove")); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
85 |
27305
d20c31be3160
add a reload button to the gui path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27298
diff
changeset
|
86 m_reload_button = new QPushButton (tr ("Reload")); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
87 m_save_button = new QPushButton (tr ("Save")); |
27310
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
88 |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
89 m_revert_button = new QPushButton (tr ("Revert")); |
27310
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
90 |
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
91 QMenu *revert_menu = new QMenu (); |
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
92 m_revert_button->setMenu (revert_menu); |
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
93 revert_menu->addAction (tr ("Revert Last Change"), |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
94 model, &set_path_model::revert_last); |
27310
3e0269067954
combine all revert actions of load path dialog in one pulldown button
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27308
diff
changeset
|
95 revert_menu->addAction (tr ("Revert All Changes"), |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
96 model, &set_path_model::revert); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
97 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
98 m_save_button->setFocus (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
99 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
100 connect (m_remove_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
101 this, &set_path_dialog::rm_dir); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
102 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
103 connect (m_move_to_top_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
104 this, &set_path_dialog::move_dir_top); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
105 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
106 connect (m_move_to_bottom_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
107 this, &set_path_dialog::move_dir_bottom); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
108 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
109 connect (m_move_up_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
110 this, &set_path_dialog::move_dir_up); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
111 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
112 connect (m_move_down_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
113 this, &set_path_dialog::move_dir_down); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
114 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
115 connect (m_reload_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
116 model, &set_path_model::path_to_model); |
27305
d20c31be3160
add a reload button to the gui path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27298
diff
changeset
|
117 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
118 connect (m_save_button, &QPushButton::clicked, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
119 model, &set_path_model::save); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
120 |
27391
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
121 // Any interpreter_event signal from a set_path_model object is |
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
122 // handled the same as for the parent set_path_dialog object. |
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
123 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
124 connect (model, QOverload<const fcn_callback&>::of (&set_path_model::interpreter_event), |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
125 this, QOverload<const fcn_callback&>::of (&set_path_dialog::interpreter_event)); |
27391
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
126 |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
127 connect (model, QOverload<const meth_callback&>::of (&set_path_model::interpreter_event), |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
128 this, QOverload<const meth_callback&>::of (&set_path_dialog::interpreter_event)); |
27391
a329a41cf341
use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents:
27312
diff
changeset
|
129 |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
130 m_path_list = new QListView (this); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
131 m_path_list->setWordWrap (false); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
132 m_path_list->setModel (model); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
133 m_path_list->setSelectionBehavior (QAbstractItemView::SelectRows); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
134 m_path_list->setSelectionMode (QAbstractItemView::ExtendedSelection); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
135 m_path_list->setAlternatingRowColors (true); |
27305
d20c31be3160
add a reload button to the gui path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27298
diff
changeset
|
136 m_path_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
137 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
138 // layout everything |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
139 QDialogButtonBox *button_box = new QDialogButtonBox (Qt::Horizontal); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
140 button_box->addButton (m_save_button, QDialogButtonBox::ActionRole); |
27305
d20c31be3160
add a reload button to the gui path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27298
diff
changeset
|
141 button_box->addButton (m_reload_button, QDialogButtonBox::ActionRole); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
142 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
143 // add dialog close button |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
144 m_close_button = button_box->addButton (QDialogButtonBox::Close); |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
145 connect (button_box, &QDialogButtonBox::rejected, |
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
146 this, &set_path_dialog::close); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
147 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
148 button_box->addButton (m_revert_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
149 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
150 // path edit options |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
151 QDialogButtonBox *path_edit_layout = new QDialogButtonBox (Qt::Vertical); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
152 path_edit_layout->addButton (m_add_folder_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
153 path_edit_layout->addButton (m_move_to_top_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
154 path_edit_layout->addButton (m_move_up_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
155 path_edit_layout->addButton (m_move_down_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
156 path_edit_layout->addButton (m_move_to_bottom_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
157 path_edit_layout->addButton (m_remove_button, QDialogButtonBox::ActionRole); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
158 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
159 // main layout |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
160 QHBoxLayout *main_hboxlayout = new QHBoxLayout; |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
161 main_hboxlayout->addWidget(path_edit_layout); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
162 main_hboxlayout->addWidget(m_path_list); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
163 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
164 QGridLayout *main_layout = new QGridLayout; |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
165 main_layout->addWidget (m_info_label, 0, 0); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
166 main_layout->addLayout (main_hboxlayout, 1, 0); |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29782
diff
changeset
|
167 main_layout->addWidget (button_box, 2, 0); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
168 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
169 setLayout (main_layout); |
27312
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
170 |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
171 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
172 gui_settings *settings = rmgr.get_settings (); |
27312
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
173 restoreGeometry ( |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
174 settings->value(pd_geometry.key).toByteArray()); |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
175 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
176 |
27306
82ace1225a9c
update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27305
diff
changeset
|
177 void set_path_dialog::update_model (void) |
82ace1225a9c
update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27305
diff
changeset
|
178 { |
82ace1225a9c
update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27305
diff
changeset
|
179 set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); |
82ace1225a9c
update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27305
diff
changeset
|
180 m->path_to_model (); |
82ace1225a9c
update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27305
diff
changeset
|
181 } |
82ace1225a9c
update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27305
diff
changeset
|
182 |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
183 void set_path_dialog::add_dir_common (bool subdirs) |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
184 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
185 QString dir |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
186 = QFileDialog::getExistingDirectory (this, tr ("Open Directory"), |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
187 "", |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
188 (QFileDialog::ShowDirsOnly |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
189 | QFileDialog::DontResolveSymlinks)); |
27307
7a7709bfb5af
path dlg: do not add empty dir when dir selection dialog is canceled
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27306
diff
changeset
|
190 |
7a7709bfb5af
path dlg: do not add empty dir when dir selection dialog is canceled
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27306
diff
changeset
|
191 if (! dir.isEmpty ()) |
7a7709bfb5af
path dlg: do not add empty dir when dir selection dialog is canceled
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27306
diff
changeset
|
192 { |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
193 if (subdirs) |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
194 { |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
195 // Use existing method mofifying load path and updating dialog |
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
196 // instead of adding string and updating load path |
29782
02461b0ccc00
reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents:
29560
diff
changeset
|
197 emit modify_path_signal (QStringList (dir), false, true); |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
198 } |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
199 else |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
200 { |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
201 set_path_model *m |
27935
f1844e33f621
maint: Use Octave coding conventions in libgui/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
202 = static_cast<set_path_model *> (m_path_list->model ()); |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
203 m->add_dir (dir); |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
204 } |
27307
7a7709bfb5af
path dlg: do not add empty dir when dir selection dialog is canceled
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27306
diff
changeset
|
205 } |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
206 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
207 |
27308
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
208 void set_path_dialog::add_dir(void) |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
209 { |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
210 add_dir_common (false); |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
211 } |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
212 |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
213 void set_path_dialog::add_dir_subdirs (void) |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
214 { |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
215 add_dir_common (true); |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
216 } |
401a7cda7c9e
add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27307
diff
changeset
|
217 |
27298
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
218 void set_path_dialog::rm_dir (void) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
219 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
220 set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
221 QItemSelectionModel *selmodel = m_path_list->selectionModel (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
222 QModelIndexList indexlist = selmodel->selectedIndexes(); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
223 m->rm_dir (indexlist); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
224 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
225 selmodel->clearSelection (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
226 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
227 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
228 void set_path_dialog::move_dir_up (void) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
229 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
230 set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
231 QItemSelectionModel *selmodel = m_path_list->selectionModel (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
232 QModelIndexList indexlist = selmodel->selectedIndexes(); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
233 m->move_dir_up (indexlist); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
234 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
235 // Update selection and view |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
236 selmodel->clearSelection (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
237 int min_row = m->rowCount () - 1; |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
238 for (int i = 0; i < indexlist.length (); i++) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
239 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
240 int new_row = std::max (indexlist.at (i).row () - 1, 0); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
241 min_row = std::min (min_row, new_row); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
242 selmodel->select (m->index (new_row), QItemSelectionModel::Select); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
243 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
244 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
245 m_path_list->scrollTo (m->index (min_row)); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
246 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
247 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
248 void set_path_dialog::move_dir_down (void) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
249 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
250 set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
251 QItemSelectionModel *selmodel = m_path_list->selectionModel (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
252 QModelIndexList indexlist = selmodel->selectedIndexes(); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
253 m->move_dir_down (indexlist); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
254 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
255 // Update selection and view |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
256 selmodel->clearSelection (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
257 int max_row = 0; |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
258 for (int i = 0; i < indexlist.length (); i++) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
259 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
260 int new_row = std::min (indexlist.at (i).row () + 1, m->rowCount () - 1); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
261 max_row = std::max (max_row, new_row); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
262 selmodel->select (m->index (new_row), QItemSelectionModel::Select); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
263 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
264 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
265 m_path_list->scrollTo (m->index (max_row)); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
266 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
267 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
268 void set_path_dialog::move_dir_top (void) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
269 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
270 set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
271 QItemSelectionModel *selmodel = m_path_list->selectionModel (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
272 QModelIndexList indexlist = selmodel->selectedIndexes(); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
273 m->move_dir_top (indexlist); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
274 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
275 // Update selection and view |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
276 selmodel->clearSelection (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
277 for (int i = 0; i < indexlist.length (); i++) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
278 selmodel->select (m->index (i), QItemSelectionModel::Select); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
279 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
280 m_path_list->scrollTo (m->index (0)); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
281 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
282 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
283 void set_path_dialog::move_dir_bottom (void) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
284 { |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
285 set_path_model *m = static_cast<set_path_model *> (m_path_list->model ()); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
286 QItemSelectionModel *selmodel = m_path_list->selectionModel (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
287 QModelIndexList indexlist = selmodel->selectedIndexes(); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
288 m->move_dir_bottom (indexlist); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
289 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
290 // Update selection and view |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
291 selmodel->clearSelection (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
292 int row_count = m->rowCount (); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
293 for (int i = 0; i < indexlist.length (); i++) |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
294 selmodel->select (m->index (row_count - 1 - i), |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
295 QItemSelectionModel::Select); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
296 |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
297 m_path_list->scrollTo (m->index (row_count - 1)); |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
298 } |
1805f8586179
new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff
changeset
|
299 |
27312
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
300 void set_path_dialog::save_settings () |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
301 { |
27629
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
302 resource_manager& rmgr = m_octave_qobj.get_resource_manager (); |
8b6e928e0705
in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents:
27620
diff
changeset
|
303 gui_settings *settings = rmgr.get_settings (); |
27560
3fcc650de22f
split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents:
27412
diff
changeset
|
304 settings->setValue (pd_geometry.key, saveGeometry ()); |
27312
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
305 } |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
306 |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
307 void set_path_dialog::closeEvent (QCloseEvent *e) |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
308 { |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
309 save_settings (); |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
310 |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
311 QWidget::closeEvent (e); |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
312 } |
b9a436b0400e
save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27310
diff
changeset
|
313 |
31646
c6d54dd31a7e
maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
314 OCTAVE_END_NAMESPACE(octave) |