GNU Octave  6.2.0
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-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_history_dock_widget_h)
27 #define octave_history_dock_widget_h 1
28 
29 #include <QCheckBox>
30 #include <QComboBox>
31 #include <QLineEdit>
32 #include <QListView>
33 #include <QSortFilterProxyModel>
34 #include <QStringListModel>
35 
36 #include "octave-dock-widget.h"
37 
38 namespace octave
39 {
40  class base_qobject;
41 
43  {
44  Q_OBJECT
45 
46  public:
47 
48  history_dock_widget (QWidget *parent, base_qobject& oct_qobj);
49 
50  ~history_dock_widget (void) = default;
51 
52  signals:
53 
54  void information (const QString& message);
55 
56  //! Signal emitted whenever the user double-clicks a command in the
57  //! history.
58 
59  void command_double_clicked (const QString& command);
60 
61  //! Signal emitted whenever the user selects commands and chooses
62  //! "Create script" from the popup menu.
63 
64  void command_create_script (const QString& commands);
65 
66  public slots:
67 
68  void set_history (const QStringList& hist);
69  void append_history (const QString& hist_entry);
70  void clear_history (void);
71  void save_settings (void);
72  void notice_settings (const gui_settings *);
73 
74  private slots:
75 
76  void update_filter_history (void);
77  void filter_activate (bool enable);
78 
79  void ctxMenu (const QPoint& pos);
80  void handle_double_click (QModelIndex modelIndex);
81  void handle_contextmenu_copy (bool flag);
82  void handle_contextmenu_evaluate (bool flag);
83  void handle_contextmenu_create_script (bool flag);
84  void handle_contextmenu_filter (void);
85 
86  void copyClipboard (void);
87  void pasteClipboard (void);
88  void selectAll (void);
89 
90  virtual void handle_visibility (bool visible);
91 
92  private:
93 
94  void construct (void);
95 
96  QListView *m_history_list_view;
97  QSortFilterProxyModel m_sort_filter_proxy_model;
98 
99  //! Stores the current history_model.
100 
101  QStringListModel *m_history_model;
102 
103  QCheckBox *m_filter_checkbox;
104  QComboBox *m_filter;
107 
108  enum { MaxFilterHistory = 10 };
109  };
110 }
111 
112 #endif
Base class for Octave interfaces that use Qt.
void append_history(const QString &hist_entry)
void ctxMenu(const QPoint &pos)
void set_history(const QStringList &hist)
history_dock_widget(QWidget *parent, base_qobject &oct_qobj)
void handle_contextmenu_create_script(bool flag)
void notice_settings(const gui_settings *)
void handle_contextmenu_evaluate(bool flag)
void information(const QString &message)
~history_dock_widget(void)=default
void command_double_clicked(const QString &command)
Signal emitted whenever the user double-clicks a command in the history.
void command_create_script(const QString &commands)
Signal emitted whenever the user selects commands and chooses "Create script" from the popup menu.
QStringListModel * m_history_model
Stores the current history_model.
void handle_double_click(QModelIndex modelIndex)
QSortFilterProxyModel m_sort_filter_proxy_model
virtual void handle_visibility(bool visible)
void message(const char *name, const char *fmt,...)
Definition: error.cc:936