GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
history-dock-widget.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2013 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifndef HISTORYDOCKWIDGET_H
24 #define HISTORYDOCKWIDGET_H
25 
26 #include <QLineEdit>
27 #include <QListView>
28 #include <QSortFilterProxyModel>
29 #include <QStringListModel>
30 #include "octave-dock-widget.h"
31 
33 {
34  Q_OBJECT
35 
36 public:
37 
38  history_dock_widget (QWidget *parent = 0);
39 
40 public slots:
41 
42  void set_history (const QStringList& hist);
43  void append_history (const QString& hist_entry);
44  void clear_history (void);
45 
46 signals:
47 
48  void information (const QString& message);
49 
50  /** Emitted, whenever the user double-clicked a command in the history. */
51  void command_double_clicked (const QString& command);
52 
53  /** Emitted whenever the user selects command and chooses Create
54  script from popupmenu. */
55  void command_create_script (const QString& commands);
56 
57 private slots:
58 
59  void handle_double_click (QModelIndex modelIndex);
60  void handle_contextmenu_copy (bool flag);
61  void handle_contextmenu_evaluate (bool flag);
62  void handle_contextmenu_create_script (bool flag);
63  void ctxMenu (const QPoint &pos);
64 
65  void copyClipboard ();
66  void pasteClipboard ();
67 
68 private:
69 
70  void construct ();
71  QListView *_history_list_view;
72  QLineEdit *_filter_line_edit;
73  QSortFilterProxyModel _sort_filter_proxy_model;
74 
75  /** Stores the current history_model. */
76  QStringListModel *_history_model;
77 };
78 
79 #endif // HISTORYDOCKWIDGET_H