Mercurial > octave
annotate libgui/src/history-dock-widget.cc @ 21193:577e6936e51d
fix enabling filter of history view when clicking into the widget
* history_dock_widget.cc (construct): do not set the focus proxy to the
line edit of the filter
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 04 Feb 2016 22:49:05 +0100 |
parents | 7f568368d247 |
children | 710e700cdd7f |
rev | line source |
---|---|
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
1 /* |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
2 |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19569
diff
changeset
|
3 Copyright (C) 2011-2015 Jacob Dawid |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
4 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
5 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
10 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
15 for more details. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
16 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
20 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 */ |
13495 | 22 |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14814
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14814
diff
changeset
|
24 #include <config.h> |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14814
diff
changeset
|
25 #endif |
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14814
diff
changeset
|
26 |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
27 #include <QApplication> |
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
28 #include <QClipboard> |
15155
9e62d5a3a45e
partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents:
14814
diff
changeset
|
29 #include <QVBoxLayout> |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
30 #include <QMenu> |
17208
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
31 #include <QScrollBar> |
18732
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
32 #include <QDesktopWidget> |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
33 #include <QCompleter> |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
34 #include <QLabel> |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
35 |
15340
9d0cdd49054b
keep history in gui widget at bottom when new items are added
John W. Eaton <jwe@octave.org>
parents:
15318
diff
changeset
|
36 #include "error.h" |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
37 #include "resource-manager.h" |
15340
9d0cdd49054b
keep history in gui widget at bottom when new items are added
John W. Eaton <jwe@octave.org>
parents:
15318
diff
changeset
|
38 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
39 #include "cmd-hist.h" |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
40 |
16460
4d4e7c6f839d
use consistent names for dock-widget files
John W. Eaton <jwe@octave.org>
parents:
16455
diff
changeset
|
41 #include "history-dock-widget.h" |
13495 | 42 |
16447
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16441
diff
changeset
|
43 history_dock_widget::history_dock_widget (QWidget *p) |
16057
c3057d80cf91
Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
15900
diff
changeset
|
44 : octave_dock_widget (p) |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
45 { |
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
46 setObjectName ("HistoryDockWidget"); |
16447
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16441
diff
changeset
|
47 setStatusTip (tr ("Browse and search the command history.")); |
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16441
diff
changeset
|
48 |
16455
38ed6bdd1f7f
move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
49 connect (this, SIGNAL (command_create_script (const QString&)), |
38ed6bdd1f7f
move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
50 p, SLOT (new_file (const QString&))); |
38ed6bdd1f7f
move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
51 |
38ed6bdd1f7f
move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
52 connect (this, SIGNAL (information (const QString&)), |
38ed6bdd1f7f
move signal/slot connections from main window to sub window where possible
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
53 p, SLOT (report_status_message (const QString&))); |
16447
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16441
diff
changeset
|
54 |
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16441
diff
changeset
|
55 connect (this, SIGNAL (command_double_clicked (const QString&)), |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16461
diff
changeset
|
56 p, SLOT (execute_command_in_terminal (const QString&))); |
16447
e3b33a7530bc
improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents:
16441
diff
changeset
|
57 |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
58 construct (); |
13495 | 59 } |
60 | |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
61 void |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
62 history_dock_widget::construct () |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
63 { |
14720
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
64 _history_model = new QStringListModel (); |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
65 _sort_filter_proxy_model.setSourceModel (_history_model); |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
66 _history_list_view = new QListView (this); |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
67 _history_list_view->setModel (&_sort_filter_proxy_model); |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
68 _history_list_view->setAlternatingRowColors (true); |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
69 _history_list_view->setEditTriggers (QAbstractItemView::NoEditTriggers); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
70 _history_list_view->setStatusTip ( |
17935 | 71 tr ("Double-click a command to transfer it to the terminal.")); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
72 _history_list_view->setSelectionMode (QAbstractItemView::ExtendedSelection); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
73 _history_list_view->setContextMenuPolicy (Qt::CustomContextMenu); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
74 connect (_history_list_view, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
75 SIGNAL (customContextMenuRequested (const QPoint &)), this, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
76 SLOT (ctxMenu (const QPoint &))); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
77 |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
78 _filter = new QComboBox (this); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
79 _filter->setToolTip (tr ("Enter text to filter the command history")); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
80 _filter->setEditable (true); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
81 _filter->setMaxCount (MaxFilterHistory); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
82 _filter->setInsertPolicy (QComboBox::NoInsert); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
83 _filter->setSizeAdjustPolicy ( |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
84 QComboBox::AdjustToMinimumContentsLengthWithIcon); |
19846
72fe9df87fe8
improve scalability of gui objects (as discussed in bug #41938)
Torsten <ttl@justmail.de>
parents:
19697
diff
changeset
|
85 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
86 _filter->setSizePolicy (sizePol); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
87 _filter->completer ()->setCaseSensitivity (Qt::CaseSensitive); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
88 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
89 QLabel *filter_label = new QLabel (tr ("Filter")); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
90 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
91 _filter_checkbox = new QCheckBox (); |
13495 | 92 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
93 setWindowIcon (QIcon (":/actions/icons/logo.png")); |
16798
d749c9b588e5
make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents:
16570
diff
changeset
|
94 set_title (tr ("Command History")); |
13506
c70511cf64ee
Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13504
diff
changeset
|
95 setWidget (new QWidget ()); |
13495 | 96 |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
97 _filter_widget = new QWidget (this); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
98 QHBoxLayout *filter_layout = new QHBoxLayout (); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
99 filter_layout->addWidget (filter_label); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
100 filter_layout->addWidget (_filter_checkbox); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
101 filter_layout->addWidget (_filter); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
102 filter_layout->setMargin(0); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
103 _filter_widget->setLayout (filter_layout); |
13495 | 104 |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
105 QVBoxLayout *hist_layout = new QVBoxLayout (); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
106 hist_layout->addWidget (_filter_widget); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
107 hist_layout->addWidget (_history_list_view); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
108 |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
109 hist_layout->setMargin (2); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
110 widget ()->setLayout (hist_layout); |
13545
ffc2e1d1ad5f
History can be filtered with an input search box while typing.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13536
diff
changeset
|
111 |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
112 // Init state of the filter |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
113 QSettings *settings = resource_manager::get_settings (); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
114 |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
115 _filter_shown = settings->value ("history_dock_widget/filter_shown",true).toBool(); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
116 _filter_widget->setVisible (_filter_shown); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
117 |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
118 _filter->addItems (settings->value ("history_dock_widget/mru_list").toStringList ()); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
119 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
120 bool filter_state = |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
121 settings->value ("history_dock_widget/filter_active", false).toBool (); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
122 _filter_checkbox->setChecked (filter_state); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
123 filter_activate (filter_state); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
124 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
125 // Connect signals and slots |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
126 connect (_filter, SIGNAL (editTextChanged (const QString&)), |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
127 &_sort_filter_proxy_model, SLOT (setFilterWildcard (const QString&))); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
128 connect (_filter_checkbox, SIGNAL (toggled (bool)), |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
129 this, SLOT (filter_activate (bool))); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
130 connect (_filter->lineEdit (), SIGNAL (editingFinished ()), |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
131 this, SLOT (update_filter_history ())); |
14720
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
132 |
16057
c3057d80cf91
Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
15900
diff
changeset
|
133 connect (_history_list_view, SIGNAL (doubleClicked (QModelIndex)), |
c3057d80cf91
Created common octave_dock_widget class
Richard Crozier <richard.crozier@yahoo.co.uk>
parents:
15900
diff
changeset
|
134 this, SLOT (handle_double_click (QModelIndex))); |
15552
bbbb89cc338f
make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents:
15447
diff
changeset
|
135 |
18732
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
136 // shrink max. displayed entry size to desktop width |
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
137 QSize screen = QDesktopWidget ().screenGeometry ().size (); |
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
138 int w = screen.width (); |
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
139 QFontMetrics fm = _history_list_view->fontMetrics (); |
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
140 int h = fm.height (); |
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
141 _history_list_view->setGridSize (QSize (w,h)); |
0f9ed79fb206
fix performance issue of history viewer with large history entries (bug #42255)
Torsten <ttl@justmail.de>
parents:
18555
diff
changeset
|
142 _history_list_view->setTextElideMode (Qt::ElideRight); |
13495 | 143 } |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
144 |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
145 history_dock_widget::~history_dock_widget () |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
146 { |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
147 QSettings *settings = resource_manager::get_settings (); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
148 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
149 settings->setValue ("history_dock_widget/filter_active", |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
150 _filter_checkbox->isChecked ()); |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
151 settings->setValue ("history_dock_widget/filter_shown", _filter_shown); |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
152 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
153 QStringList mru; |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
154 for (int i = 0; i < _filter->count (); i++) |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
155 mru.append (_filter->itemText (i)); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
156 settings->setValue ("history_dock_widget/mru_list", mru); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
157 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
158 settings->sync (); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
159 } |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
160 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
161 void |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
162 history_dock_widget::filter_activate (bool state) |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
163 { |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
164 _filter->setEnabled (state); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
165 _sort_filter_proxy_model.setDynamicSortFilter (state); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
166 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
167 if (state) |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
168 _sort_filter_proxy_model.setFilterWildcard (_filter->currentText ()); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
169 else |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
170 _sort_filter_proxy_model.setFilterWildcard (QString ()); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
171 } |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
172 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
173 void |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
174 history_dock_widget::update_filter_history () |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
175 { |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
176 QString text = _filter->currentText (); // get current text |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
177 int index = _filter->findText (text); // and its actual index |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
178 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
179 if (index > -1) |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
180 _filter->removeItem (index); // remove if already existing |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
181 |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
182 _filter->insertItem (0, text); // (re)insert at beginning |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
183 _filter->setCurrentIndex (0); |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
184 } |
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
185 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
186 void history_dock_widget::ctxMenu (const QPoint &xpos) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
187 { |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 QMenu menu (this); |
20392
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
189 |
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
190 QModelIndex index = _history_list_view->indexAt (xpos); |
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
191 |
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
192 if (index.isValid () && index.column () == 0) |
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
193 { |
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
194 menu.addAction (resource_manager::icon ("edit-copy"), |
19908
4e15e8cb16ae
gui: added icons menu items that have icons used elsewhere
John Donoghue
parents:
19861
diff
changeset
|
195 tr ("Copy"), this, SLOT (handle_contextmenu_copy (bool))); |
20392
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
196 menu.addAction (tr ("Evaluate"), this, |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
197 SLOT (handle_contextmenu_evaluate (bool))); |
20392
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
198 menu.addAction (resource_manager::icon ("document-new"), |
19908
4e15e8cb16ae
gui: added icons menu items that have icons used elsewhere
John Donoghue
parents:
19861
diff
changeset
|
199 tr ("Create script"), this, |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
200 SLOT (handle_contextmenu_create_script (bool))); |
20392
a8cc8318da8c
show history context menu only for clicks on entries
Torsten <ttl@justmail.de>
parents:
19908
diff
changeset
|
201 } |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
202 if (_filter_shown) |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
203 menu.addAction (tr ("Hide filter"), this, |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
204 SLOT (handle_contextmenu_filter ())); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
205 else |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
206 menu.addAction (tr ("Show filter"), this, |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
207 SLOT (handle_contextmenu_filter ())); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
208 |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
209 menu.exec (_history_list_view->mapToGlobal (xpos)); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
210 } |
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
211 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
212 void history_dock_widget::handle_contextmenu_copy (bool) |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
213 { |
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
214 QString text; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
215 QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
216 QModelIndexList rows = selectionModel->selectedRows (); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
217 QModelIndexList::iterator it; |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
218 bool prev_valid_row = false; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
219 for (it = rows.begin (); it != rows.end (); it++) |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
220 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
221 if ((*it).isValid ()) |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
222 { |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
223 if (prev_valid_row) |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
224 text += "\n"; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
225 text += (*it).data ().toString (); |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
226 prev_valid_row = true; |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
227 } |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
228 } |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
229 QApplication::clipboard ()->setText (text); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
230 } |
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
231 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
232 void history_dock_widget::handle_contextmenu_evaluate (bool) |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
233 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
234 QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
235 QModelIndexList rows = selectionModel->selectedRows (); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
236 QModelIndexList::iterator it; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
237 for (it = rows.begin () ; it != rows.end (); it++) |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
238 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
239 if ((*it).isValid ()) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
240 emit command_double_clicked ((*it).data ().toString ()); |
15447
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
241 } |
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
242 } |
352349219529
Added multiline copy and execution to command history in IDE (bug #36884)
John Swensen <jpswensen@gmail.com>
parents:
15402
diff
changeset
|
243 |
13536
869c62c15e95
Few minor improvements, added advanced settings for file browser.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13518
diff
changeset
|
244 void |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
245 history_dock_widget::handle_contextmenu_create_script (bool) |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
246 { |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
247 QString text; |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
248 QItemSelectionModel *selectionModel = _history_list_view->selectionModel (); |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
249 QModelIndexList rows = selectionModel->selectedRows (); |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
250 |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
251 bool prev_valid_row = false; |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
252 for (QModelIndexList::iterator it = rows.begin (); it != rows.end (); it++) |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
253 { |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
254 if ((*it).isValid ()) |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
255 { |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
256 if (prev_valid_row) |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
257 text += "\n"; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
258 text += (*it).data ().toString (); |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
259 prev_valid_row = true; |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
260 } |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
261 } |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
262 |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
263 if (text.length () > 0) |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
264 emit command_create_script (text); |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
265 } |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
266 |
20570
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
267 void |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
268 history_dock_widget::handle_contextmenu_filter (void) |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
269 { |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
270 _filter_shown = not _filter_shown; |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
271 _filter_widget->setVisible (_filter_shown); |
734d446560a8
possibility to hide filters in history and workspace view (bug#45428)
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
272 } |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
273 |
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16447
diff
changeset
|
274 void |
14712
5cb54cca8a06
Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14709
diff
changeset
|
275 history_dock_widget::handle_double_click (QModelIndex modelIndex) |
13546
5ef33f99a078
Command get inserted by double clicking in the command history again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13545
diff
changeset
|
276 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
277 emit command_double_clicked (modelIndex.data ().toString ()); |
13546
5ef33f99a078
Command get inserted by double clicking in the command history again.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13545
diff
changeset
|
278 } |
13577
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13549
diff
changeset
|
279 |
e440b3f32f02
Fixed bug with closing subwindows.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13549
diff
changeset
|
280 void |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
281 history_dock_widget::set_history (const QStringList& hist) |
14720
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
282 { |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
283 _history_model->setStringList (hist); |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
284 _history_list_view->scrollToBottom (); |
14720
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
285 } |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
286 |
cecc7da96e2a
Added update events for the command history model and workspace model.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14712
diff
changeset
|
287 void |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
288 history_dock_widget::append_history (const QString& hist_entry) |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
289 { |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
290 QStringList lst = _history_model->stringList (); |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
291 lst.append (hist_entry); |
17208
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
292 |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
293 QScrollBar *scroll_bar = _history_list_view->verticalScrollBar (); |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
294 |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
295 bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1; |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
296 |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
297 _history_model->setStringList (lst); |
17208
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
298 |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
299 // Scroll if slider position at bottom. |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
300 if (at_bottom) |
2527bc7200ee
Only scroll history window if it is positioned at bottom.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16881
diff
changeset
|
301 _history_list_view->scrollToBottom (); |
16431
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
302 } |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
303 |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
304 void |
5982d469f79b
use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents:
16351
diff
changeset
|
305 history_dock_widget::clear_history (void) |
14814
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14812
diff
changeset
|
306 { |
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14812
diff
changeset
|
307 _history_model->setStringList (QStringList ()); |
61c80e9326a8
Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14812
diff
changeset
|
308 } |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
309 |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
310 void |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
311 history_dock_widget::copyClipboard () |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
312 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
313 if (_history_list_view->hasFocus ()) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
314 handle_contextmenu_copy (true); |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19846
diff
changeset
|
315 if (_filter->lineEdit ()->hasFocus () |
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19846
diff
changeset
|
316 && _filter->lineEdit ()->hasSelectedText ()) |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
317 { |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
318 QClipboard *clipboard = QApplication::clipboard (); |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
319 clipboard->setText ( _filter->lineEdit ()->selectedText ()); |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
320 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
321 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
322 |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
323 void |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
324 history_dock_widget::pasteClipboard () |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
325 { |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
326 if (_filter->lineEdit ()->hasFocus ()) |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
327 { |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
328 QClipboard *clipboard = QApplication::clipboard (); |
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
329 QString str = clipboard->text (); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
330 if (str.length () > 0) |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
331 _filter->lineEdit ()->insert (str); |
17254
7fb4461997aa
Adjust history window copy/evaluate and remove carriage returns (bug #39722)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
17208
diff
changeset
|
332 } |
16881
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
333 } |
944ade6e7f66
Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents:
16798
diff
changeset
|
334 |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
335 void |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
336 history_dock_widget::selectAll () |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
337 { |
19563
a402493c0605
provide the same filter for history view as for workspace view
Torsten <ttl@justmail.de>
parents:
18732
diff
changeset
|
338 if (_filter->lineEdit ()->hasFocus ()) |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
339 { |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19846
diff
changeset
|
340 _filter->lineEdit ()->selectAll (); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
341 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
342 if (_history_list_view->hasFocus ()) |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
343 { |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19846
diff
changeset
|
344 _history_list_view->selectAll (); |
18555
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
345 } |
2d5d0d86432e
gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents:
17935
diff
changeset
|
346 } |
20692
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
347 |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
348 void history_dock_widget::handle_visibility (bool visible) |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
349 { |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
350 octave_dock_widget::handle_visibility (visible); |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
351 |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
352 if (visible) |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
353 { |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
354 int filter_state = _filter_checkbox->isChecked (); |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
355 filter_activate (filter_state); |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
356 } |
950c8a092db7
check whether filter is active or not when history widget becomes visible
Torsten <ttl@justmail.de>
parents:
20392
diff
changeset
|
357 } |