GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
history-dock-widget.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2018 Jacob Dawid
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_history_dock_widget_h)
24 #define octave_history_dock_widget_h 1
25 
26 #include <QLineEdit>
27 #include <QListView>
28 #include <QSortFilterProxyModel>
29 #include <QStringListModel>
30 #include <QComboBox>
31 #include <QCheckBox>
32 
33 #include "octave-dock-widget.h"
34 
35 namespace octave
36 {
38  {
39  Q_OBJECT
40 
41  public:
42 
43  history_dock_widget (QWidget *parent = nullptr);
44 
45  ~history_dock_widget (void) = default;
46 
47  public slots:
48 
49  void set_history (const QStringList& hist);
50  void append_history (const QString& hist_entry);
51  void clear_history (void);
52  void save_settings (void);
53 
54  signals:
55 
56  void information (const QString& message);
57 
58  //! Signal emitted, whenever the user double-clicked a command in the
59  //! history.
60 
61  void command_double_clicked (const QString& command);
62 
63  //! Signale emitted, whenever the user selects commands and chooses
64  //! "Create script" from the popup menu.
65 
66  void command_create_script (const QString& commands);
67 
68  private slots:
69 
70  void update_filter_history (void);
71  void filter_activate (bool enable);
72 
73  void ctxMenu (const QPoint& pos);
74  void handle_double_click (QModelIndex modelIndex);
75  void handle_contextmenu_copy (bool flag);
76  void handle_contextmenu_evaluate (bool flag);
77  void handle_contextmenu_create_script (bool flag);
78  void handle_contextmenu_filter (void);
79 
80  void copyClipboard (void);
81  void pasteClipboard (void);
82  void selectAll (void);
83 
84  virtual void handle_visibility (bool visible);
85 
86  private:
87 
88  void construct (void);
89 
90  QListView *m_history_list_view;
91  QSortFilterProxyModel m_sort_filter_proxy_model;
92 
93  //! Stores the current history_model.
94 
95  QStringListModel *m_history_model;
96 
97  QCheckBox *m_filter_checkbox;
98  QComboBox *m_filter;
101 
102  enum { MaxFilterHistory = 10 };
103  };
104 }
105 
106 #endif
void handle_contextmenu_evaluate(bool flag)
void command_create_script(const QString &commands)
Signale emitted, whenever the user selects commands and chooses "Create script" from the popup menu...
void information(const QString &message)
virtual void handle_visibility(bool visible)
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any simply delete all the lines from the buffer before leaving the editor When invoked with no edit the previously executed command
Definition: oct-hist.cc:587
void command_double_clicked(const QString &command)
Signal emitted, whenever the user double-clicked a command in the history.
void message(const char *name, const char *fmt,...)
Definition: error.cc:435
QSortFilterProxyModel m_sort_filter_proxy_model
history_dock_widget(QWidget *parent=nullptr)
void handle_double_click(QModelIndex modelIndex)
void ctxMenu(const QPoint &pos)
void set_history(const QStringList &hist)
void append_history(const QString &hist_entry)
QStringListModel * m_history_model
Stores the current history_model.
void handle_contextmenu_create_script(bool flag)
~history_dock_widget(void)=default
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any commands
Definition: oct-hist.cc:587