GNU Octave  8.1.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-2023 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 
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  //! Signal emitted whenever the user double-clicks a command in the
55  //! history.
56 
57  void command_double_clicked (const QString& command);
58 
59  //! Signal emitted whenever the user selects commands and chooses
60  //! "Create script" from the popup menu.
61 
62  void command_create_script (const QString& commands);
63 
64 public slots:
65 
66  void set_history (const QStringList& hist);
67  void append_history (const QString& hist_entry);
68  void clear_history (void);
69  void save_settings (void);
70  void notice_settings (const gui_settings *);
71 
72 private slots:
73 
74  void update_filter_history (void);
75  void filter_activate (bool enable);
76 
77  void ctxMenu (const QPoint& pos);
78  void handle_double_click (QModelIndex modelIndex);
79  void handle_contextmenu_copy (bool flag);
80  void handle_contextmenu_evaluate (bool flag);
81  void handle_contextmenu_create_script (bool flag);
82  void handle_contextmenu_filter (void);
83 
84  void copyClipboard (void);
85  void pasteClipboard (void);
86  void selectAll (void);
87 
88  virtual void handle_visibility (bool visible);
89 
90 private:
91 
92  void construct (void);
93  void set_filter_focus (bool focus);
94 
95  QListView *m_history_list_view;
96  QSortFilterProxyModel m_sort_filter_proxy_model;
97 
98  //! Stores the current history_model.
99 
100  QStringListModel *m_history_model;
101 
102  QCheckBox *m_filter_checkbox;
103  QComboBox *m_filter;
106 
107  enum { MaxFilterHistory = 10 };
108 };
109 
111 
112 #endif
OCTAVE_END_NAMESPACE(octave)
Base class for Octave interfaces that use Qt.
void handle_contextmenu_evaluate(bool flag)
QStringListModel * m_history_model
Stores the current history_model.
void set_history(const QStringList &hist)
history_dock_widget(QWidget *parent, base_qobject &oct_qobj)
void handle_contextmenu_filter(void)
void ctxMenu(const QPoint &pos)
void set_filter_focus(bool focus)
void handle_contextmenu_create_script(bool flag)
QSortFilterProxyModel m_sort_filter_proxy_model
void command_double_clicked(const QString &command)
Signal emitted whenever the user double-clicks a command in the history.
void append_history(const QString &hist_entry)
void filter_activate(bool enable)
void command_create_script(const QString &commands)
Signal emitted whenever the user selects commands and chooses "Create script" from the popup menu.
void handle_contextmenu_copy(bool flag)
QListView * m_history_list_view
virtual void handle_visibility(bool visible)
void notice_settings(const gui_settings *)
void handle_double_click(QModelIndex modelIndex)
~history_dock_widget(void)=default
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn