Mercurial > octave
annotate libgui/src/documentation.cc @ 25985:49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
* documentation.cc (documentation_browser::wheelEvent): reimplement
mouse wheel event and, in case of active control modifier, call own
zooming function which are keeping track of the zoom level
* documentation.h: new protected method for reimplemented wheel event
author | Torsten <mttl@mailbox.org> |
---|---|
date | Tue, 30 Oct 2018 22:50:40 +0100 |
parents | a7cc5b7a3d22 |
children | 390d59717711 |
rev | line source |
---|---|
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
1 /* |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
2 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
3 Copyright (C) 2018 Torsten <mttl@maibox.org> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
4 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
6 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
10 (at your option) any later version. |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
11 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
15 GNU General Public License for more details. |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
16 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
20 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
21 */ |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
22 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
24 # include "config.h" |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
25 #endif |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
26 |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
27 #include "defaults.h" |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
28 #include "file-ops.h" |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
29 #include "oct-env.h" |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
30 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
31 #include <QApplication> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
32 #include <QCompleter> |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
33 #include <QDir> |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
34 #include <QFile> |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
35 #include <QFileInfo> |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
36 #include <QHelpContentWidget> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
37 #include <QHelpIndexWidget> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
38 #include <QHelpSearchEngine> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
39 #include <QHelpSearchQueryWidget> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
40 #include <QHelpSearchResultWidget> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
41 #include <QLabel> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
42 #include <QLineEdit> |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
43 #include <QMessageBox> |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
44 #include <QTabWidget> |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
45 #include <QToolButton> |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
46 #include <QVBoxLayout> |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
47 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
48 #include "documentation.h" |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
49 #include "resource-manager.h" |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
50 #include "shortcut-manager.h" |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
51 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
52 namespace octave |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
53 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
54 // The documentation splitter, which is the main widget |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
55 // of the doc dock widget |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
56 documentation::documentation (QWidget *p) |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
57 : QSplitter (Qt::Horizontal, p), |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
58 m_show_shortcut (new QShortcut (p)), |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
59 m_findnext_shortcut (new QShortcut (p)), |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
60 m_findprev_shortcut (new QShortcut (p)), |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
61 m_zoom_in_shortcut (new QShortcut (p)), |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
62 m_zoom_out_shortcut (new QShortcut (p)), |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
63 m_zoom_normal_shortcut (new QShortcut (p)) |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
64 { |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
65 // Get original collection |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
66 QString collection = getenv ("OCTAVE_QTHELP_COLLECTION"); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
67 if (collection.isEmpty ()) |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
68 collection = QString::fromStdString (config::oct_doc_dir () |
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
69 + sys::file_ops::dir_sep_str () |
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
70 + "octave_interpreter.qhc"); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
71 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
72 // Setup the help engine with the original collection, use a writable copy |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
73 // of the original collection and load the help data |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
74 m_help_engine = new QHelpEngine (collection, this); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
75 |
25101
29641449ca90
use qt routines for determining users tmp directory (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25094
diff
changeset
|
76 QString tmpdir = QDir::tempPath(); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
77 m_collection |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25258
diff
changeset
|
78 = QString::fromStdString (sys::tempnam (tmpdir.toStdString (), |
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25258
diff
changeset
|
79 "oct-qhelp-")); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
80 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
81 if (m_help_engine->copyCollectionFile (m_collection)) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
82 m_help_engine->setCollectionFile (m_collection); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
83 else |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
84 QMessageBox::warning (this, tr ("Octave Documentation"), |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
85 tr ("Could not copy help collection to temporary\n" |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
86 "file. Search capabilities may be affected.\n" |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
87 "%1").arg (m_help_engine->error ())); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
88 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
89 connect(m_help_engine, SIGNAL(setupFinished()), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
90 m_help_engine->searchEngine(), SLOT(indexDocumentation())); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
91 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
92 if (! m_help_engine->setupData()) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
93 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
94 QMessageBox::warning (this, tr ("Octave Documentation"), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
95 tr ("Could not setup the data required for the\n" |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
96 "documentation viewer. Only help texts in\n" |
25163
3aed4f0ba3cd
Update some GUI strings identified as unclear by translators.
Rik <rik@octave.org>
parents:
25121
diff
changeset
|
97 "the Command Window will be available.")); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
98 if (m_help_engine) |
25102
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
99 delete m_help_engine; |
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
100 m_help_engine = 0; |
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
101 return; |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
102 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
103 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
104 // The browser |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
105 QWidget *browser_find = new QWidget (this); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
106 m_doc_browser = new documentation_browser (m_help_engine, browser_find); |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
107 connect (m_doc_browser, SIGNAL (cursorPositionChanged (void)), |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
108 this, SLOT(handle_cursor_position_change (void))); |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
109 |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
110 QWidget *find_footer = new QWidget (browser_find); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
111 QLabel *find_label = new QLabel (tr ("Find:"), find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
112 m_find_line_edit = new QLineEdit (find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
113 connect (m_find_line_edit, SIGNAL (returnPressed (void)), |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
114 this, SLOT(find_forward (void))); |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
115 connect (m_find_line_edit, SIGNAL (textEdited (const QString&)), |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
116 this, SLOT(find_forward_from_anchor (const QString&))); |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
117 QToolButton *forward_button = new QToolButton (find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
118 forward_button->setText (tr ("Search forward")); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
119 forward_button->setToolTip (tr ("Search forward")); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
120 forward_button->setIcon (resource_manager::icon ("go-down")); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
121 connect (forward_button, SIGNAL (pressed (void)), |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
122 this, SLOT(find_forward (void))); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
123 QToolButton *backward_button = new QToolButton (find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
124 backward_button->setText (tr ("Search backward")); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
125 backward_button->setToolTip (tr ("Search backward")); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
126 backward_button->setIcon (resource_manager::icon ("go-up")); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
127 connect (backward_button, SIGNAL (pressed (void)), |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
128 this, SLOT(find_backward (void))); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
129 QHBoxLayout *h_box_find_footer = new QHBoxLayout (find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
130 h_box_find_footer->addWidget (find_label); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
131 h_box_find_footer->addWidget (m_find_line_edit); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
132 h_box_find_footer->addWidget (forward_button); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
133 h_box_find_footer->addWidget (backward_button); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
134 h_box_find_footer->setMargin (2); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
135 find_footer->setLayout (h_box_find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
136 |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
137 QVBoxLayout *v_box_browser_find = new QVBoxLayout (browser_find); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
138 v_box_browser_find->addWidget (m_doc_browser); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
139 v_box_browser_find->addWidget (find_footer); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
140 browser_find->setLayout (v_box_browser_find); |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
141 |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
142 notice_settings (resource_manager::get_settings ()); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
143 |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
144 m_show_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
145 connect (m_show_shortcut, SIGNAL (activated (void)), |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
146 m_find_line_edit->parentWidget (), SLOT (show (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
147 connect (m_show_shortcut, SIGNAL (activated (void)), |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
148 m_find_line_edit, SLOT (selectAll (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
149 connect (m_show_shortcut, SIGNAL (activated (void)), |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
150 m_find_line_edit, SLOT (setFocus (void))); |
25257
bf2044618c7b
Don't make shortcut key 'Escape' translateable (bug #53526).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25241
diff
changeset
|
151 QShortcut *hide_shortcut = new QShortcut (Qt::Key_Escape, p); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
152 |
25241
e74d85f7ac47
Change Documentation shortcut context to not interfere with Editor (bug #53640).
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25155
diff
changeset
|
153 hide_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
154 connect (hide_shortcut, SIGNAL (activated (void)), |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
155 m_find_line_edit->parentWidget (), SLOT(hide (void))); |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
156 connect (hide_shortcut, SIGNAL (activated (void)), |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
157 m_doc_browser, SLOT (setFocus (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
158 |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
159 m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
160 connect (m_findnext_shortcut, SIGNAL (activated (void)), |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
161 this, SLOT(find_forward (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
162 m_findprev_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
163 connect (m_findprev_shortcut, SIGNAL (activated (void)), |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
164 this, SLOT(find_backward (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
165 |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
166 find_footer->hide (); |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
167 m_search_anchor_position = 0; |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
168 |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
169 // Zoom Shortcuts |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
170 m_zoom_in_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
171 connect (m_zoom_in_shortcut, SIGNAL (activated (void)), |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
172 m_doc_browser, SLOT (zoom_in (void))); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
173 m_zoom_out_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
174 connect (m_zoom_out_shortcut, SIGNAL (activated (void)), |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
175 m_doc_browser, SLOT (zoom_out (void))); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
176 m_zoom_normal_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
177 connect (m_zoom_normal_shortcut, SIGNAL (activated (void)), |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
178 m_doc_browser, SLOT (zoom_normal (void))); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
179 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
180 // Layout contents, index and search |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
181 QTabWidget *navi = new QTabWidget (this); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
182 navi->setTabsClosable (false); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
183 navi->setMovable (true); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
184 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
185 // Contents |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
186 QHelpContentWidget *content = m_help_engine->contentWidget (); |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
187 content->setObjectName ("documentation_tab_contents"); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
188 navi->addTab (content, tr ("Contents")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
189 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
190 connect(m_help_engine->contentWidget (), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
191 SIGNAL (linkActivated (const QUrl&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
192 m_doc_browser, SLOT(handle_index_clicked (const QUrl&))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
193 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
194 // Index |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
195 QHelpIndexWidget *index = m_help_engine->indexWidget (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
196 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
197 m_filter = new QComboBox (this); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
198 m_filter->setToolTip (tr ("Enter text to search the indices")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
199 m_filter->setEditable (true); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
200 m_filter->setInsertPolicy (QComboBox::NoInsert); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
201 m_filter->setMaxCount (10); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
202 m_filter->setMaxVisibleItems (10); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
203 m_filter->setSizeAdjustPolicy ( |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
204 QComboBox::AdjustToMinimumContentsLengthWithIcon); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
205 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
206 m_filter->setSizePolicy (sizePol); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
207 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
208 QLabel *filter_label = new QLabel (tr ("Search")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
209 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
210 QWidget *filter_all = new QWidget (navi); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
211 QHBoxLayout *h_box_index = new QHBoxLayout (filter_all); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
212 h_box_index->addWidget (filter_label); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
213 h_box_index->addWidget (m_filter); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
214 h_box_index->setMargin (2); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
215 filter_all->setLayout (h_box_index); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
216 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
217 QWidget *index_all = new QWidget (navi); |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
218 index_all->setObjectName ("documentation_tab_index"); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
219 QVBoxLayout *v_box_index = new QVBoxLayout (index_all); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
220 v_box_index->addWidget (filter_all); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
221 v_box_index->addWidget (index); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
222 index_all->setLayout (v_box_index); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
223 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
224 navi->addTab (index_all, tr ("Function Index")); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
225 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
226 connect(m_help_engine->indexWidget (), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
227 SIGNAL (linkActivated (const QUrl&, const QString&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
228 m_doc_browser, SLOT(handle_index_clicked (const QUrl&, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
229 const QString&))); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
230 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
231 connect (m_filter, SIGNAL (editTextChanged (const QString&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
232 this, SLOT(filter_update (const QString&))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
233 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
234 connect (m_filter->lineEdit (), SIGNAL (editingFinished (void)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
235 this, SLOT(filter_update_history (void))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
236 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
237 // Search |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
238 QHelpSearchEngine *search_engine = m_help_engine->searchEngine (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
239 QHelpSearchQueryWidget *search = search_engine->queryWidget (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
240 QHelpSearchResultWidget *result = search_engine->resultWidget (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
241 QWidget *search_all = new QWidget (navi); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
242 QVBoxLayout *v_box_search = new QVBoxLayout (search_all); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
243 v_box_search->addWidget (search); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
244 v_box_search->addWidget (result); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
245 search_all->setLayout (v_box_search); |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
246 search_all->setObjectName ("documentation_tab_search"); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
247 navi->addTab (search_all, tr ("Search")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
248 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
249 connect (search, SIGNAL (search (void)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
250 this, SLOT(global_search (void))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
251 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
252 connect (search_engine, SIGNAL (searchingStarted (void)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
253 this, SLOT(global_search_started (void))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
254 connect (search_engine, SIGNAL (searchingFinished (int)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
255 this, SLOT(global_search_finished (int))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
256 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
257 connect (search_engine->resultWidget (), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
258 SIGNAL (requestShowLink (const QUrl&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
259 m_doc_browser, |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
260 SLOT(handle_index_clicked (const QUrl&))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
261 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
262 // Fill the splitter |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
263 insertWidget (0, navi); |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
264 insertWidget (1, browser_find); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
265 setStretchFactor (1, 1); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
266 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
267 // Initial view: Contents |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
268 m_doc_browser->setSource (QUrl ( |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
269 "qthelp://org.octave.interpreter-1.0/doc/octave.html/index.html")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
270 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
271 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
272 documentation::~documentation (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
273 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
274 if (m_help_engine) |
25102
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
275 delete m_help_engine; |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
276 |
25102
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
277 // Cleanup temporary file and directory |
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
278 QFile file (m_collection); |
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
279 if (file.exists ()) |
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
280 { |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
281 QFileInfo finfo (file); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
282 QString bname = finfo.fileName (); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
283 QDir dir = finfo.absoluteDir (); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
284 dir.setFilter (QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
285 QStringList namefilter; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
286 namefilter.append ("*" + bname + "*"); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
287 foreach (QFileInfo fi, dir.entryInfoList (namefilter)) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
288 { |
25094
c0d48cfbb59a
use Octave system functions to avoid build failure with Qt 4 (bug #53540)
Mike Miller <mtmiller@octave.org>
parents:
25061
diff
changeset
|
289 std::string file_name = fi.absoluteFilePath ().toStdString (); |
c0d48cfbb59a
use Octave system functions to avoid build failure with Qt 4 (bug #53540)
Mike Miller <mtmiller@octave.org>
parents:
25061
diff
changeset
|
290 sys::recursive_rmdir (file_name); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
291 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
292 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
293 file.remove(); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
294 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
295 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
296 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
297 void documentation::global_search (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
298 { |
25061
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
299 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) |
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
300 QString queries |
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
301 = m_help_engine->searchEngine ()->queryWidget ()->searchInput (); |
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
302 #else |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
303 QList<QHelpSearchQuery> queries |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
304 = m_help_engine->searchEngine ()->queryWidget ()->query (); |
25061
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
305 #endif |
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
306 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
307 m_help_engine->searchEngine ()->search (queries); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
308 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
309 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
310 void documentation::global_search_started (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
311 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
312 qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
313 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
314 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
315 void documentation::global_search_finished (int) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
316 { |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
317 if (! m_internal_search.isEmpty ()) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
318 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
319 QHelpSearchEngine *search_engine = m_help_engine->searchEngine (); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
320 if (search_engine) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
321 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
322 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
323 QVector<QHelpSearchResult> res |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
324 = search_engine->searchResults (0, search_engine->searchResultCount ()); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
325 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
326 QList< QPair<QString, QString> > res |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
327 = search_engine->hits (0, search_engine->hitCount ()); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
328 #endif |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
329 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
330 if (res.count ()) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
331 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
332 QUrl url; |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
333 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
334 if (res.count () == 1) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
335 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
336 url = res.front ().url (); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
337 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
338 url = res.front ().first; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
339 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
340 else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
341 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
342 // Remove the quotes we added |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
343 QString search_string = m_internal_search; |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
344 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
345 for (auto r = res.begin (); r != res.end (); r++) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
346 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
347 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
348 QString title = r->title ().toLower (); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
349 QUrl tmpurl = r->url (); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
350 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
351 QString title = r->second.toLower (); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
352 QUrl tmpurl = r->first; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
353 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
354 if (title.contains (search_string.toLower ())) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
355 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
356 if (title.indexOf (search_string.toLower ()) == 0) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
357 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
358 url = tmpurl; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
359 break; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
360 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
361 else if (url.isEmpty ()) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
362 url = tmpurl; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
363 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
364 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
365 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
366 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
367 if (! url.isEmpty ()) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
368 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
369 connect (this, SIGNAL (show_single_result (const QUrl)), |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
370 m_doc_browser, |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
371 SLOT (handle_index_clicked (const QUrl))); |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
372 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
373 emit show_single_result (url); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
374 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
375 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
376 } |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
377 |
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
378 m_internal_search = QString (); |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
379 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
380 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
381 qApp->restoreOverrideCursor(); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
382 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
383 |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
384 void documentation::notice_settings (const QSettings *) |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
385 { |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
386 shortcut_manager::shortcut (m_show_shortcut, "editor_edit:find_replace"); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
387 shortcut_manager::shortcut (m_findnext_shortcut, "editor_edit:find_next"); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
388 shortcut_manager::shortcut (m_findprev_shortcut, "editor_edit:find_previous"); |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
389 shortcut_manager::shortcut (m_zoom_in_shortcut, "editor_view:zoom_in"); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
390 shortcut_manager::shortcut (m_zoom_out_shortcut, "editor_view:zoom_out"); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
391 shortcut_manager::shortcut (m_zoom_normal_shortcut, "editor_view:zoom_normal"); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
392 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
393 |
25962
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
394 void documentation::copyClipboard (void) |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
395 { |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
396 if (m_doc_browser->hasFocus ()) |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
397 { |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
398 m_doc_browser->copy(); |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
399 } |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
400 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
401 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
402 void documentation::pasteClipboard (void) { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
403 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
404 void documentation::selectAll (void) { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
405 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
406 void documentation::load_ref (const QString& ref_name) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
407 { |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
408 if (! m_help_engine) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
409 return; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
410 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
411 // First search in the function index |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
412 QMap<QString, QUrl> found_links |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
413 = m_help_engine->linksForIdentifier (ref_name); |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
414 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
415 QTabWidget *navi = static_cast<QTabWidget*> (widget (0)); |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
416 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
417 if (found_links.count() > 0) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
418 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
419 m_doc_browser->setSource (found_links.constBegin().value()); |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
420 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
421 // Switch to function index tab |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
422 m_help_engine->indexWidget()->filterIndices (ref_name); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
423 QWidget *index_tab |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
424 = navi->findChild<QWidget*> ("documentation_tab_index"); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
425 navi->setCurrentWidget (index_tab); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
426 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
427 else |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
428 { |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
429 // Use full text search to provide the best match |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
430 QHelpSearchEngine *search_engine = m_help_engine->searchEngine (); |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
431 QHelpSearchQueryWidget *search_query = search_engine->queryWidget (); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
432 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
433 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
434 QString query = ref_name; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
435 query.prepend ("\"").append ("\""); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
436 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
437 QList<QHelpSearchQuery> query; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
438 query << QHelpSearchQuery (QHelpSearchQuery::DEFAULT, |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
439 QStringList (QString("\"") + ref_name + QString("\""))); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
440 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
441 m_internal_search = ref_name; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
442 search_engine->search (query); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
443 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
444 // Switch to search tab |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
445 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
446 search_query->setSearchInput (query); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
447 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
448 search_query->setQuery (query); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
449 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
450 QWidget *search_tab |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
451 = navi->findChild<QWidget*> ("documentation_tab_search"); |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
452 navi->setCurrentWidget (search_tab); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
453 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
454 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
455 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
456 void documentation::filter_update (const QString& expression) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
457 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
458 if (! m_help_engine) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
459 return; |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
460 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
461 QString wildcard; |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
462 if (expression.contains (QLatin1Char('*'))) |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
463 wildcard = expression; |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
464 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
465 m_help_engine->indexWidget ()->filterIndices(expression, wildcard); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
466 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
467 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
468 void documentation::filter_update_history (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
469 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
470 QString text = m_filter->currentText (); // get current text |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
471 int index = m_filter->findText (text); // and its actual index |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
472 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
473 if (index > -1) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
474 m_filter->removeItem (index); // remove if already existing |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
475 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
476 m_filter->insertItem (0, text); // (re)insert at beginning |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
477 m_filter->setCurrentIndex (0); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
478 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
479 |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
480 void documentation::find_forward (void) |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
481 { |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
482 if (! m_help_engine) |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
483 return; |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
484 |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
485 m_doc_browser->find (m_find_line_edit->text ()); |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
486 record_anchor_position (); |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
487 } |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
488 |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
489 void documentation::find_backward (void) |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
490 { |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
491 if (! m_help_engine) |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
492 return; |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
493 |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
494 m_doc_browser->find (m_find_line_edit->text (), QTextDocument::FindBackward); |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
495 record_anchor_position (); |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
496 } |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
497 |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
498 void documentation::find_forward_from_anchor (const QString& text) |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
499 { |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
500 if (! m_help_engine) |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
501 return; |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
502 |
25155
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
503 QTextCursor textcur = m_doc_browser->textCursor (); |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
504 textcur.setPosition (m_search_anchor_position); |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
505 m_doc_browser->setTextCursor (textcur); |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
506 m_doc_browser->find (text); |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
507 } |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
508 |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
509 void documentation::record_anchor_position (void) |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
510 { |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
511 if (! m_help_engine) |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
512 return; |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
513 |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
514 m_search_anchor_position = m_doc_browser->textCursor ().position (); |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
515 } |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
516 |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
517 void documentation::handle_cursor_position_change (void) |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
518 { |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
519 if (! m_help_engine) |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
520 return; |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
521 |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
522 if (m_doc_browser->hasFocus ()) |
17387d4edd1d
Add standard key bindings and actions to in-page Documentation find (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25121
diff
changeset
|
523 record_anchor_position (); |
25121
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
524 } |
9578133ca03e
Add a Ctrl+F unhide/hide in-page find footer to the Documentation window (bug #53006)
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
25103
diff
changeset
|
525 |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
526 void documentation::registerDoc (const QString& qch) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
527 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
528 if (m_help_engine) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
529 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
530 QString ns = m_help_engine->namespaceName (qch); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
531 bool do_setup = true; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
532 if (m_help_engine->registeredDocumentations ().contains (ns)) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
533 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
534 if (m_help_engine->documentationFileName (ns) == qch) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
535 do_setup = false; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
536 else |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
537 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
538 m_help_engine->unregisterDocumentation (ns); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
539 m_help_engine->registerDocumentation (qch); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
540 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
541 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
542 else if (! m_help_engine->registerDocumentation (qch)) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
543 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
544 QMessageBox::warning (this, tr ("Octave Documentation"), |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
545 tr ("Unable to register help file %1."). |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
546 arg (qch)); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
547 do_setup = false; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
548 return; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
549 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
550 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
551 if (do_setup) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
552 m_help_engine->setupData(); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
553 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
554 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
555 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
556 void documentation::unregisterDoc (const QString& qch) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
557 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
558 QString ns = m_help_engine->namespaceName (qch); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
559 if (m_help_engine |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
560 && m_help_engine->registeredDocumentations ().contains (ns) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
561 && m_help_engine->documentationFileName (ns) == qch) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
562 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
563 m_help_engine->unregisterDocumentation (ns); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
564 m_help_engine->setupData (); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
565 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
566 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
567 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
568 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
569 // The documentation browser |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
570 documentation_browser::documentation_browser (QHelpEngine *he, QWidget *p) |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
571 : QTextBrowser (p), m_help_engine (he), m_zoom_level (0) |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
572 { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
573 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
574 documentation_browser::~documentation_browser (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
575 { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
576 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
577 void documentation_browser::handle_index_clicked (const QUrl& url, |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
578 const QString&) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
579 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
580 setSource (url); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
581 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
582 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
583 void documentation_browser::notice_settings (const QSettings *) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
584 { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
585 |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
586 QVariant documentation_browser::loadResource (int type, const QUrl &url) |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
587 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
588 if (url.scheme () == "qthelp") |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
589 return QVariant (m_help_engine->fileData(url)); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
590 else |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
591 return QTextBrowser::loadResource(type, url); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
592 } |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
593 |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
594 void documentation_browser::zoom_in (void) |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
595 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
596 if (m_zoom_level < max_zoom_level) |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
597 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
598 zoomIn (); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
599 m_zoom_level++; |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
600 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
601 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
602 |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
603 void documentation_browser::zoom_out (void) |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
604 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
605 if (m_zoom_level > min_zoom_level) |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
606 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
607 zoomOut (); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
608 m_zoom_level--; |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
609 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
610 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
611 |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
612 void documentation_browser::zoom_normal (void) |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
613 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
614 zoomIn (- m_zoom_level); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
615 m_zoom_level = 0; |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
616 } |
25985
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
617 |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
618 void documentation_browser::wheelEvent (QWheelEvent *we) |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
619 { |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
620 if (we->modifiers () == Qt::ControlModifier) |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
621 { |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
622 if (we->delta () > 0) |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
623 zoom_in (); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
624 else |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
625 zoom_out (); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
626 |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
627 we->accept (); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
628 } |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
629 else |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
630 QTextEdit::wheelEvent (we); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
631 } |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
632 |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
633 } |