annotate libgui/src/history-dock-widget.h @ 23457:21baad6b35c4

maint: Use C++11 nullptr rather than 0 or NULL when possible. * FigureWindow.h, Logger.cc, Menu.cc, MouseModeActionGroup.h, Object.h, ObjectFactory.cc, ObjectProxy.h, color-picker.h, documentation-dock-widget.h, files-dock-widget.h, find-files-dialog.h, history-dock-widget.h, file-editor-tab.cc, file-editor.cc, file-editor.h, find-dialog.h, main-window.cc, main-window.h, octave-dock-widget.h, parser.cc, parser.h, webinfo.h, resource-manager.cc, shortcut-manager.cc, shortcut-manager.h, terminal-dock-widget.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.h, workspace-view.h, __magick_read__.cc, call-stack.cc, call-stack.h, cdisplay.c, display.cc, dlmread.cc, dynamic-ld.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, input.h, interpreter.cc, interpreter.h, ls-hdf5.cc, mex.cc, mxarray.in.h, oct-errno.in.cc, oct-fstrm.cc, oct-iostrm.h, oct-procbuf.cc, oct-stdstrm.h, oct-stream.cc, oct-stream.h, octave-link.cc, pager.cc, pr-output.cc, profiler.h, qz.cc, sighandlers.cc, strfns.cc, symtab.cc, symtab.h, typecast.cc, urlwrite.cc, variables.cc, __eigs__.cc, __init_fltk__.cc, __ode15__.cc, colamd.cc, ov-base-int.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-builtin.cc, ov-class.cc, ov-classdef.cc, ov-complex.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, octave.cc, octave.h, bp-table.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, lex.h, pt-arg-list.cc, pt-arg-list.h, pt-array-list.h, pt-cell.h, pt-classdef.h, pt-colon.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.h, pt-idx.h, pt-jit.cc, pt-jit.h, pt-loop.h, pt-mat.h, pt-select.h, pt.h, CSparse.cc, dSparse.cc, DASPK.cc, DASRT.cc, DASSL.cc, oct-fftw.cc, oct-rand.cc, oct-spparms.cc, child-list.cc, file-ops.cc, mach-info.cc, oct-env.cc, oct-time.cc, cmd-edit.cc, cmd-hist.cc, oct-locbuf.cc, oct-shlib.cc, pathsearch.cc, singleton-cleanup.cc, unwind-prot.h, url-transfer.cc: Use C++11 nullptr rather than 0 or NULL when possible.
author Rik <rik@octave.org>
date Fri, 28 Apr 2017 13:19:12 -0700
parents c9fab0bc983e
children 9107bae20480
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 2011-2017 Jacob Dawid
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
10 (at your option) any later version.
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22411
diff changeset
15 GNU General Public License for more details.
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
22
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
23 #if ! defined (octave_history_dock_widget_h)
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
24 #define octave_history_dock_widget_h 1
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
25
13545
ffc2e1d1ad5f History can be filtered with an input search box while typing.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
26 #include <QLineEdit>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
27 #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
28 #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
29 #include <QStringListModel>
19563
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
30 #include <QComboBox>
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
31 #include <QCheckBox>
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
32
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents: 15552
diff changeset
33 #include "octave-dock-widget.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34
16057
c3057d80cf91 Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents: 15552
diff changeset
35 class history_dock_widget : public octave_dock_widget
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
36 {
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15300
diff changeset
37 Q_OBJECT
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
38
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
39 public:
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
40
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23433
diff changeset
41 history_dock_widget (QWidget *parent = nullptr);
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
42 ~history_dock_widget (void) = default;
14720
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
43
13536
869c62c15e95 Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13518
diff changeset
44 public slots:
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
45
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
46 void set_history (const QStringList& hist);
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
47 void append_history (const QString& hist_entry);
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16350
diff changeset
48 void clear_history (void);
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 21203
diff changeset
49 void save_settings (void);
13546
5ef33f99a078 Command get inserted by double clicking in the command history again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13545
diff changeset
50
13517
86adc9c4ec4b History deactivated.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13506
diff changeset
51 signals:
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
52
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
53 void information (const QString& message);
14863
3ff18e21c742 Added a few comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14814
diff changeset
54
3ff18e21c742 Added a few comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14814
diff changeset
55 /** Emitted, whenever the user double-clicked a command in the history. */
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15204
diff changeset
56 void command_double_clicked (const QString& command);
14863
3ff18e21c742 Added a few comments.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14814
diff changeset
57
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16447
diff changeset
58 /** Emitted whenever the user selects command and chooses Create
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16447
diff changeset
59 script from popupmenu. */
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16447
diff changeset
60 void command_create_script (const QString& commands);
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16447
diff changeset
61
13546
5ef33f99a078 Command get inserted by double clicking in the command history again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13545
diff changeset
62 private slots:
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
63
19563
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
64 void update_filter_history ();
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
65 void filter_activate (bool enable);
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
66
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
67 void handle_double_click (QModelIndex modelIndex);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
68 void handle_contextmenu_copy (bool flag);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
69 void handle_contextmenu_evaluate (bool flag);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17744
diff changeset
70 void handle_contextmenu_create_script (bool flag);
20570
734d446560a8 possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents: 19697
diff changeset
71 void handle_contextmenu_filter (void);
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23220
diff changeset
72 void ctxMenu (const QPoint& pos);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
73
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16461
diff changeset
74 void copyClipboard ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16461
diff changeset
75 void pasteClipboard ();
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 17790
diff changeset
76 void selectAll ();
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16461
diff changeset
77
20692
950c8a092db7 check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents: 19697
diff changeset
78 virtual void handle_visibility (bool visible);
950c8a092db7 check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents: 19697
diff changeset
79
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
80 private:
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
81
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
82 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
83 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
84 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
85
cecc7da96e2a Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
86 /** 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
87 QStringListModel *_history_model;
19563
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
88
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
89 QCheckBox *_filter_checkbox;
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
90 QComboBox *_filter;
20570
734d446560a8 possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents: 19697
diff changeset
91 QWidget *_filter_widget;
734d446560a8 possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents: 19697
diff changeset
92 bool _filter_shown;
19563
a402493c0605 provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents: 18555
diff changeset
93 enum { MaxFilterHistory = 10 };
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
94 };
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
95
20945
9d9270e2f98f eliminate comments after preprocessor conditionals
John W. Eaton <jwe@octave.org>
parents: 20697
diff changeset
96 #endif