Mercurial > hg > octave-nkf
comparison libgui/src/files-dock-widget.h @ 16499:facf00ce97d3
gui: configurable synchronization between file browser and octave directory
* default-qt-settings: all settings of the file browser are now located
in its section, new setting sync_octave_directory
* files-dock-widget.cc(constructor): make QToolBar and QAction variables local,
add two buttons for syncing from octave to file browser and vice versa,
change status-tips into tool-tips
* files-dock-widget.cc(set_current_directory):
do not emit signal displayed_directory_changed (would change octave dir)
* files-dock-widget.cc(do_sync_octave_directory): new function for manually
setting the octave dir to the one in the file browser
* files-dock-widget.cc(do_sync_browser_directory): new function for manually
setting the file browser to the octave directory
* files-dock-widget.cc(update_octave_directory): new function called from the
main-window when the octave directory has changed
* files-doc-widget.cc(display_directory): new second parameter (bool, default is
true) determining whether the signal with the new displayed directory should
be emitted if synchronizing is enabled
* files-dock-widget.cc(notice-settings): read new setting, enalbe or disable the
sync buttons and set file browser to octave directory depending on setting
* files-dock-widget.h: removed QToolBar and QAction variibles, new varaibles for
storing the actual octave directory and whether syncing is desired or not, new
functions (do_sync_octave_directory, do_sync_browser_directory,
update_octave_directory), function display_directory with second parameter
(bool, default true)
* libgui/src/icons/ok.png,libgui/src/icons/reload.png: new icons for the toolbar
* main-window.cc(change_directory): call new function update_octave_directory
instead of display_directory
* main-window.cc(construct-window-menu): rename "Current Directory" into
"File Browser"
* libgui/src/module.mk: new files icons/ok.png and icons/reload.png
* settings-dialog.cc(constructor,write_changed_settings): all files-dock-widgets
settings in a section, new setting sync_octave_directory
* settings-dialog.ui: new setting sync_octave_directory
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 11 Apr 2013 19:01:55 +0200 |
parents | 605d7f0ee0d8 |
children | c1ff738d606d |
comparison
equal
deleted
inserted
replaced
16498:605d7f0ee0d8 | 16499:facf00ce97d3 |
---|---|
59 void item_double_clicked (const QModelIndex & index); | 59 void item_double_clicked (const QModelIndex & index); |
60 | 60 |
61 /** Slot for handling the up-directory button in the toolbar. */ | 61 /** Slot for handling the up-directory button in the toolbar. */ |
62 void change_directory_up (); | 62 void change_directory_up (); |
63 | 63 |
64 /** Slot for handling the sync octave directory button in the toolbar. */ | |
65 void do_sync_octave_directory (); | |
66 | |
67 /** Slot for handling the sync browser directory button in the toolbar. */ | |
68 void do_sync_browser_directory (); | |
69 | |
64 /** Sets the current directory being displayed. */ | 70 /** Sets the current directory being displayed. */ |
65 void set_current_directory (const QString& dir); | 71 void set_current_directory (const QString& dir); |
66 | 72 |
67 /** Accepts user input a the line edit for the current directory. */ | 73 /** Accepts user input a the line edit for the current directory. */ |
68 void accept_directory_line_edit (); | 74 void accept_directory_line_edit (); |
69 | 75 |
70 void display_directory (const QString& dir); | 76 /** set the internal variable that holds the actual octave variable **/ |
77 void update_octave_directory (const QString& dir); | |
71 | 78 |
72 /** Tells the widget to react on changed settings. */ | 79 /** Tells the widget to react on changed settings. */ |
73 void notice_settings (const QSettings *settings); | 80 void notice_settings (const QSettings *settings); |
74 | 81 |
75 signals: | 82 signals: |
82 | 89 |
83 private: | 90 private: |
84 | 91 |
85 // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc | 92 // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc |
86 | 93 |
87 /** Toolbar for file and directory manipulation. */ | 94 /** set a new directory or open a file **/ |
88 QToolBar * _navigation_tool_bar; | 95 void display_directory (const QString& dir, bool set_octave_dir = true); |
89 | 96 |
90 /** Variables for the up-directory action. */ | 97 /** Variables for the actions **/ |
91 QIcon _directory_icon; | 98 QAction * _sync_octave_directory_action; |
92 QAction * _directory_up_action; | 99 QAction * _sync_browser_directory_action; |
93 QToolButton * _up_directory_button; | |
94 | 100 |
95 /** The file system model. */ | 101 /** The file system model. */ |
96 QFileSystemModel *_file_system_model; | 102 QFileSystemModel *_file_system_model; |
97 | 103 |
98 /** The file system view. */ | 104 /** The file system view. */ |
99 QTreeView * _file_tree_view; | 105 QTreeView * _file_tree_view; |
100 QComboBox * _current_directory; | 106 QComboBox * _current_directory; |
101 | 107 |
108 /** Internal variables **/ | |
109 bool _sync_octave_dir; // flag if syncing with octave | |
110 QString _octave_dir; // the actual octave dir | |
111 | |
102 enum { MaxMRUDirs = 10 }; | 112 enum { MaxMRUDirs = 10 }; |
103 }; | 113 }; |
104 | 114 |
105 #endif // FILESDOCKWIDGET_H | 115 #endif // FILESDOCKWIDGET_H |