annotate libgui/src/set-path-dialog.h @ 27312:b9a436b0400e

save and restore last geometry of load path dialog * gui-preferences.h: define key and emtpy default for path dialog geometry * main-window.cc (prepare_to_exit): save settings of path dialog if the related pointer is valid * set-path-dialog.cc: include gui-preferences.h with new preference key; (set_path_dialog): restore last geometry from preferences file; (save_settings): new method for saving geoemtry and possibly other preferences when the dialog is closed or when octave is about to quit; (closeEvent) reimplement close event for saving settings before closing * set-path-dialog.h: new method save_settings, new protected close event
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 04 Aug 2019 20:53:17 +0200
parents 401a7cda7c9e
children a329a41cf341
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
1 /*
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
2
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
3 Copyright (C) 2019 JunWang
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
4
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
5 This file is part of Octave.
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
6
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
10 (at your option) any later version.
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
11
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
15 GNU General Public License for more details.
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
16
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
19 <https://www.gnu.org/licenses/>.
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
20
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
21 */
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
22 #if ! defined (octave_set_path_dialog_h)
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
23 #define octave_set_path_dialog_h 1
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
24
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
25 #include <QDialog>
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
26 #include <QModelIndex>
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
27 #include <QFileInfo>
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
28
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
29 #include "ovl.h"
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
30
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
31 class QLabel;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
32 class QPushButton;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
33 class QListView;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
34 class QVBoxLayout;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
35 class QHBoxLayout;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
36
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
37 namespace octave
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
38 {
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
39 class set_path_dialog : public QDialog
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
40 {
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
41 Q_OBJECT
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
42
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
43 public:
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
44
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
45 set_path_dialog (QWidget *parent = nullptr);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
46
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
47 virtual ~set_path_dialog (void);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
48
27312
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
49 void save_settings (void);
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
50
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
51 signals:
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
52
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
53 //! Emitted, when the path has to be modified
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
54
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
55 void modify_path_signal (const octave_value_list& dir_list,
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
56 bool rm, bool subdirs);
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
57
27306
82ace1225a9c update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27305
diff changeset
58 public slots:
82ace1225a9c update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27305
diff changeset
59
82ace1225a9c update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27305
diff changeset
60 void 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
61
27312
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
62 protected:
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
63
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
64 void closeEvent (QCloseEvent *e);
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
65
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
66 private slots:
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
67
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
68 void add_dir (void);
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
69 void add_dir_subdirs (void);
27298
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 void rm_dir (void);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
72
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
73 void move_dir_up (void);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
74
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
75 void move_dir_down (void);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
76
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
77 void move_dir_top (void);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
78
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
79 void move_dir_bottom (void);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
80
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
81 private:
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
82
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
83 void add_dir_common (bool subdirs);
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
84
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
85 QLabel *m_info_label;
27305
d20c31be3160 add a reload button to the gui path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27298
diff changeset
86 QPushButton *m_reload_button;
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
87 QPushButton *m_save_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
88 QPushButton *m_close_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
89 QPushButton *m_revert_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
90 QPushButton *m_revert_last_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
91
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
92 QListView *m_path_list;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
93
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
94 QPushButton *m_add_folder_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
95 QPushButton *m_move_to_top_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
96 QPushButton *m_move_to_bottom_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
97 QPushButton *m_move_up_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
98 QPushButton *m_move_down_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
99 QPushButton *m_remove_button;
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
100 };
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
101 }
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
102
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents:
diff changeset
103 #endif