GNU Octave 7.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-2022 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
38namespace 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 //! 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
96 QSortFilterProxyModel m_sort_filter_proxy_model;
97
98 //! Stores the current history_model.
99
100 QStringListModel *m_history_model;
101
103 QComboBox *m_filter;
106
107 enum { MaxFilterHistory = 10 };
108 };
109}
110
111#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)
~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)