Mercurial > hg > octave-nkf
comparison libgui/src/files-dockwidget.h @ 16450:3207f1d62e74
improve encapsulation of file browser window object
* files-dockwidget.h, files-dockwidget.cc
(files_dock_widget::files_dock_widget): Use new local variable
container for clarity. Set status tip.
(files_dock_widget::connect_visibility_changed,
files_dock_widget::focus, files_dock_widget::handle_visibility):
New functions.
* main-window.h, main-window.cc (main_window::file_browser_window):
Rename from _files_dock_widget. Change all uses.
(main_window::main_window): Initialize it here.
(main_window::focus_current_directory,
main_window::handle_current_directory_visible): Delete.
(main_window::connect_visibility_changed): Call
file_browser_window->connect_visibility_changed.
(main_window::construct): Don't create _files_dock_widget here.
Connect file_browser_action::triggered to
file_browser_window::focus instead of
main_window::focus_current_directory.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 06 Apr 2013 19:08:14 -0400 |
parents | 919796a440c6 |
children |
comparison
equal
deleted
inserted
replaced
16449:c129a8b73d25 | 16450:3207f1d62e74 |
---|---|
44 \brief Dock widget to display files in the current directory. | 44 \brief Dock widget to display files in the current directory. |
45 */ | 45 */ |
46 class files_dock_widget : public octave_dock_widget | 46 class files_dock_widget : public octave_dock_widget |
47 { | 47 { |
48 Q_OBJECT | 48 Q_OBJECT |
49 public: | 49 |
50 /** Constructs a new files_dock_widget. */ | 50 public: |
51 | |
51 files_dock_widget (QWidget *parent = 0); | 52 files_dock_widget (QWidget *parent = 0); |
53 | |
52 ~files_dock_widget (); | 54 ~files_dock_widget (); |
55 | |
56 void connect_visibility_changed (void); | |
53 | 57 |
54 public slots: | 58 public slots: |
55 | 59 |
56 /** Slot for handling a change in directory via double click. */ | 60 /** Slot for handling a change in directory via double click. */ |
57 void item_double_clicked (const QModelIndex & index); | 61 void item_double_clicked (const QModelIndex & index); |
67 | 71 |
68 void display_directory (const QString& dir); | 72 void display_directory (const QString& dir); |
69 | 73 |
70 /** Tells the widget to react on changed settings. */ | 74 /** Tells the widget to react on changed settings. */ |
71 void notice_settings (const QSettings *settings); | 75 void notice_settings (const QSettings *settings); |
76 | |
77 void focus (void); | |
78 | |
79 void handle_visibility (bool visible); | |
72 | 80 |
73 signals: | 81 signals: |
74 /** Emitted, whenever the user requested to open a file. */ | 82 /** Emitted, whenever the user requested to open a file. */ |
75 void open_file (const QString& fileName); | 83 void open_file (const QString& fileName); |
76 | 84 |