annotate gui/src/history-dockwidget.h @ 14863:3ff18e21c742 gui

Added a few comments. * files-dockwidget.h: Added comments. * history-dockwidget.h: Added comments.
author Jacob Dawid <jacob.dawid@gmail.com>
date Mon, 16 Jul 2012 16:42:25 -0400
parents 61c80e9326a8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13504
13e3d60aff2d Replaced Quint with OctaveGUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13501
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)
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
3 *
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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: 13678
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.
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
8 *
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
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: 13678
diff changeset
12 * GNU General Public License for more details.
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
13 *
14290
faece6b2ab90 Corrected license headers in all files to GPL.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13678
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/>.
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
16 */
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
17
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
18 #ifndef HISTORYDOCKWIDGET_H
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
19 #define HISTORYDOCKWIDGET_H
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
20
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
21 #include <QDockWidget>
13545
ffc2e1d1ad5f History can be filtered with an input search box while typing.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
22 #include <QLineEdit>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23 #include <QListView>
13545
ffc2e1d1ad5f History can be filtered with an input search box while typing.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
24 #include <QSortFilterProxyModel>
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
25 #include <QStringListModel>
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
26 #include <QTimer>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
27
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
28 #include "octave-link.h"
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
29 #include "octave-event-observer.h"
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
30
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
31 class history_dock_widget : public QDockWidget, public octave_event_observer
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
32 {
13517
86adc9c4ec4b History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13506
diff changeset
33 Q_OBJECT
86adc9c4ec4b History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13506
diff changeset
34 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
35 history_dock_widget (QWidget *parent = 0);
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
36
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
37 void event_accepted (octave_event *e);
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
38 void event_reject (octave_event *e);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
40 public slots:
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
41 void handle_visibility_changed (bool visible);
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
42 void request_history_model_update ();
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14720
diff changeset
43 void reset_model ();
13546
5ef33f99a078 Command get inserted by double clicking in the command history again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13545
diff changeset
44
13517
86adc9c4ec4b History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13506
diff changeset
45 signals:
86adc9c4ec4b History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13506
diff changeset
46 void information (QString message);
14863
3ff18e21c742 Added a few comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14814
diff changeset
47
3ff18e21c742 Added a few comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14814
diff changeset
48 /** Emitted, whenever the user double-clicked a command in the history. */
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
49 void command_double_clicked (QString command);
14863
3ff18e21c742 Added a few comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14814
diff changeset
50
13677
f27573828e92 Properly implemented shutdown of callback thread.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13674
diff changeset
51 /** Custom signal that tells if a user has clicked away that dock widget. */
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
52 void active_changed (bool active);
13577
e440b3f32f02 Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13547
diff changeset
53 protected:
e440b3f32f02 Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13547
diff changeset
54 void closeEvent (QCloseEvent *event);
13546
5ef33f99a078 Command get inserted by double clicking in the command history again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13545
diff changeset
55 private slots:
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
56 void handle_double_click (QModelIndex modelIndex);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
58 private:
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
59 void construct ();
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
60 QListView *_history_list_view;
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
61 QLineEdit *_filter_line_edit;
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
62 QSortFilterProxyModel _sort_filter_proxy_model;
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
63
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
64 /** Stores the current history_model. */
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
65 QStringListModel *_history_model;
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
66
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
67 QTimer _update_history_model_timer;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
68 };
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
69
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
70 #endif // HISTORYDOCKWIDGET_H