Mercurial > hg > octave-lyh
annotate gui/src/files-dockwidget.h @ 14803:625be3eb27c5 gui
Current directories now synchronize on top, in the file browser and the cwd in octave.
* files-dockwidget: Refactored method names and redundand code. Added new signal that get emitted whenever the displayed directory changes.
* main-window: Added new slot to react on directory changes. Informing the file browser of a directory change now.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Tue, 26 Jun 2012 10:54:39 +0200 |
parents | 5cb54cca8a06 |
children | 3ff18e21c742 |
rev | line source |
---|---|
13504
13e3d60aff2d
Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13495
diff
changeset
|
1 /* OctaveGUI - A graphical user interface for Octave |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com) |
13495 | 3 * |
4 * This program is free software: you can redistribute it and/or modify | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
5 * it under the terms of the GNU General Public License as |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
6 * published by the Free Software Foundation, either version 3 of the |
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
7 * License, or (at your option) any later version. |
13495 | 8 * |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
12 * GNU General Public License for more details. |
13495 | 13 * |
14290
faece6b2ab90
Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13674
diff
changeset
|
14 * You should have received a copy of the GNU General Public License |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13577
diff
changeset
|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
13495 | 16 */ |
17 | |
18 #ifndef FILESDOCKWIDGET_H | |
19 #define FILESDOCKWIDGET_H | |
20 | |
21 #include <QListView> | |
22 #include <QDate> | |
23 #include <QObject> | |
24 #include <QWidget> | |
25 #include <QListWidget> | |
26 #include <QFileSystemModel> | |
27 #include <QToolBar> | |
28 #include <QToolButton> | |
29 #include <QVBoxLayout> | |
30 #include <QAction> | |
31 #include <QTreeView> | |
32 | |
33 #include <QDockWidget> | |
34 #include <QLineEdit> | |
35 | |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
36 class files_dock_widget : public QDockWidget |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
37 { |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
38 Q_OBJECT |
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
39 public: |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
40 files_dock_widget (QWidget *parent = 0); |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
41 |
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
42 public slots: |
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
43 /** Slot for handling a change in directory via double click. */ |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
44 void item_double_clicked (const QModelIndex & index); |
13495 | 45 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
46 /** Slot for handling the up-directory button in the toolbar. */ |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
47 void do_up_directory (); |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
48 void set_current_directory (QString currentDirectory); |
14803
625be3eb27c5
Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
49 void handle_directory_entered (); |
625be3eb27c5
Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
50 void display_directory (QString directory); |
13495 | 51 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
52 /** Tells the widget to notice settings that are probably new. */ |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
53 void notice_settings (); |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
54 void handle_visibility_changed (bool visible); |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
55 |
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13506
diff
changeset
|
56 signals: |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
57 void open_file (QString fileName); |
14803
625be3eb27c5
Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
58 void displayed_directory_changed (QString directory); |
13495 | 59 |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
60 /** Custom signal that tells if a user has clicke away that dock widget. */ |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
61 void active_changed (bool active); |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
62 |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
63 protected: |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
64 void closeEvent (QCloseEvent *event); |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
65 |
13495 | 66 private: |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
67 // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc |
13495 | 68 |
14803
625be3eb27c5
Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
69 QString _last_current_directory; |
625be3eb27c5
Current directories now synchronize on top, in the file browser and the cwd in octave.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
70 |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
71 /** Toolbar for file and directory manipulation. */ |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
72 QToolBar * _navigation_tool_bar; |
13495 | 73 |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
74 /** Variables for the up-directory action. */ |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
75 QIcon _directory_icon; |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
76 QAction * _directory_up_action; |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
77 QToolButton * _up_directory_button; |
13495 | 78 |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
79 /** The file system model. */ |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
80 QFileSystemModel *_file_system_model; |
13495 | 81 |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
82 /** The file system view. */ |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
83 QTreeView * _file_tree_view; |
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
84 QLineEdit * _current_directory; |
13495 | 85 }; |
86 | |
87 #endif // FILESDOCKWIDGET_H |