diff 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
line wrap: on
line diff
--- a/libgui/src/files-dock-widget.h
+++ b/libgui/src/files-dock-widget.h
@@ -61,13 +61,20 @@
   /** Slot for handling the up-directory button in the toolbar. */
   void change_directory_up ();
 
+  /** Slot for handling the sync octave directory button in the toolbar. */
+  void do_sync_octave_directory ();
+
+  /** Slot for handling the sync browser directory button in the toolbar. */
+  void do_sync_browser_directory ();
+
   /** Sets the current directory being displayed. */
   void set_current_directory (const QString& dir);
 
   /** Accepts user input a the line edit for the current directory. */
   void accept_directory_line_edit ();
 
-  void display_directory (const QString& dir);
+  /** set the internal variable that holds the actual octave variable **/
+  void update_octave_directory (const QString& dir);
 
   /** Tells the widget to react on changed settings. */
   void notice_settings (const QSettings *settings);
@@ -84,13 +91,12 @@
 
   // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc
 
-  /** Toolbar for file and directory manipulation. */
-  QToolBar *        _navigation_tool_bar;
+  /** set a new directory or open a file **/
+  void display_directory (const QString& dir, bool set_octave_dir = true);
 
-  /** Variables for the up-directory action. */
-  QIcon             _directory_icon;
-  QAction *         _directory_up_action;
-  QToolButton *     _up_directory_button;
+  /** Variables for the actions **/
+  QAction *         _sync_octave_directory_action;
+  QAction *         _sync_browser_directory_action;
 
   /** The file system model. */
   QFileSystemModel *_file_system_model;
@@ -99,6 +105,10 @@
   QTreeView *       _file_tree_view;
   QComboBox *       _current_directory;
 
+  /** Internal variables **/
+  bool              _sync_octave_dir;    // flag if syncing with octave
+  QString           _octave_dir;         // the actual octave dir
+
   enum { MaxMRUDirs = 10 };
 };