Mercurial > octave
annotate libgui/src/documentation.cc @ 26017:390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
* documentation.cc (documentation::documentation): remove obsolete shortcut
initialization, initialize a toolbar and call method for adding actions,
add tool bar into the browser layout, remove connections for the show and
hide find bar shortcuts;
(add_action): new method for simplifying the creation of tool bar actions;
(construct_tool_bar): add actions to the doc browser and its tool bar;
(notice_settings): get icon size and shortcuts from the settings file;
(activate_find): new slot for the find action, showing/hiding the bar
and setting/resetting focus;
(zoom_normal) renamed into zoom_original
* documentation.h: renamed zoom_normal into zoom_original,
new slot activate_find, new methods construct_tool_bar and add_action,
new class variables for the actions and the parent dock-widget
* zoom-original.svg, zoom-original.png: new icon for windows or if not
contained in system icon set
* module.mk: new icon png file
* resource.qrc: new icon png file
* shortcut-manager.cc (do_init_data): New shortcuts for the doc browsers
new actions;
(fill_tree_widget): add doc browser shortcuts to the tree widget in the
preferences dialog
author | Torsten <mttl@mailbox.org> |
---|---|
date | Sun, 04 Nov 2018 13:28:27 +0100 |
parents | 49ffd0e0242d |
children | ce46820c5e9f |
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), |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
58 m_doc_widget (p), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
59 m_tool_bar (new QToolBar (p)), |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
60 m_findnext_shortcut (new QShortcut (p)), |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
61 m_findprev_shortcut (new QShortcut (p)) |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
62 { |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
63 // Get original collection |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
64 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
|
65 if (collection.isEmpty ()) |
25460
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
66 collection = QString::fromStdString (config::oct_doc_dir () |
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
67 + sys::file_ops::dir_sep_str () |
627d6bde9b8d
solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents:
25440
diff
changeset
|
68 + "octave_interpreter.qhc"); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
69 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
70 // 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
|
71 // 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
|
72 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
|
73 |
25101
29641449ca90
use qt routines for determining users tmp directory (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25094
diff
changeset
|
74 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
|
75 m_collection |
25336
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25258
diff
changeset
|
76 = QString::fromStdString (sys::tempnam (tmpdir.toStdString (), |
389757b7b6af
eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents:
25258
diff
changeset
|
77 "oct-qhelp-")); |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
78 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
79 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
|
80 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
|
81 else |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
82 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
|
83 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
|
84 "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
|
85 "%1").arg (m_help_engine->error ())); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
86 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
87 connect(m_help_engine, SIGNAL(setupFinished()), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
88 m_help_engine->searchEngine(), SLOT(indexDocumentation())); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
89 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
90 if (! m_help_engine->setupData()) |
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 QMessageBox::warning (this, tr ("Octave Documentation"), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
93 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
|
94 "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
|
95 "the Command Window will be available.")); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 return; |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
100 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
101 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
102 // 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
108 // Tool bar |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
109 construct_tool_bar (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
110 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
111 // Find bar |
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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 |
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 QVBoxLayout *v_box_browser_find = new QVBoxLayout (browser_find); |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
140 v_box_browser_find->addWidget (m_tool_bar); |
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
|
141 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
|
142 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
|
143 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
|
144 |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
145 notice_settings (resource_manager::get_settings ()); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
146 |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
147 m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
148 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
|
149 this, SLOT(find_forward (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
150 m_findprev_shortcut->setContext (Qt::WidgetWithChildrenShortcut); |
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
151 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
|
152 this, SLOT(find_backward (void))); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
153 |
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
|
154 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
|
155 m_search_anchor_position = 0; |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
156 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
157 // Layout contents, index and search |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
158 QTabWidget *navi = new QTabWidget (this); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
159 navi->setTabsClosable (false); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
160 navi->setMovable (true); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
161 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
162 // Contents |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
163 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
|
164 content->setObjectName ("documentation_tab_contents"); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
165 navi->addTab (content, tr ("Contents")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
166 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
167 connect(m_help_engine->contentWidget (), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
168 SIGNAL (linkActivated (const QUrl&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
169 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
|
170 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
171 // Index |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
172 QHelpIndexWidget *index = m_help_engine->indexWidget (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
173 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
174 m_filter = new QComboBox (this); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
175 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
|
176 m_filter->setEditable (true); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
177 m_filter->setInsertPolicy (QComboBox::NoInsert); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
178 m_filter->setMaxCount (10); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
179 m_filter->setMaxVisibleItems (10); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
180 m_filter->setSizeAdjustPolicy ( |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
181 QComboBox::AdjustToMinimumContentsLengthWithIcon); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
182 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
183 m_filter->setSizePolicy (sizePol); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
184 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
185 QLabel *filter_label = new QLabel (tr ("Search")); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
186 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
187 QWidget *filter_all = new QWidget (navi); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
188 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
|
189 h_box_index->addWidget (filter_label); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
190 h_box_index->addWidget (m_filter); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
191 h_box_index->setMargin (2); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
192 filter_all->setLayout (h_box_index); |
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 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
|
195 index_all->setObjectName ("documentation_tab_index"); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
196 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
|
197 v_box_index->addWidget (filter_all); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
198 v_box_index->addWidget (index); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
199 index_all->setLayout (v_box_index); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
200 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
201 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
|
202 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
203 connect(m_help_engine->indexWidget (), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
204 SIGNAL (linkActivated (const QUrl&, const QString&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
205 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
|
206 const QString&))); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
207 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
208 connect (m_filter, SIGNAL (editTextChanged (const QString&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
209 this, SLOT(filter_update (const QString&))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
210 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
211 connect (m_filter->lineEdit (), SIGNAL (editingFinished (void)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
212 this, SLOT(filter_update_history (void))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
213 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
214 // Search |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
215 QHelpSearchEngine *search_engine = m_help_engine->searchEngine (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
216 QHelpSearchQueryWidget *search = search_engine->queryWidget (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
217 QHelpSearchResultWidget *result = search_engine->resultWidget (); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
218 QWidget *search_all = new QWidget (navi); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
219 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
|
220 v_box_search->addWidget (search); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
221 v_box_search->addWidget (result); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
222 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
|
223 search_all->setObjectName ("documentation_tab_search"); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
224 navi->addTab (search_all, tr ("Search")); |
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 (search, SIGNAL (search (void)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
227 this, SLOT(global_search (void))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
228 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
229 connect (search_engine, SIGNAL (searchingStarted (void)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
230 this, SLOT(global_search_started (void))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
231 connect (search_engine, SIGNAL (searchingFinished (int)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
232 this, SLOT(global_search_finished (int))); |
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 (search_engine->resultWidget (), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
235 SIGNAL (requestShowLink (const QUrl&)), |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
236 m_doc_browser, |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
237 SLOT(handle_index_clicked (const QUrl&))); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
238 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
239 // Fill the splitter |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
240 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
|
241 insertWidget (1, browser_find); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
242 setStretchFactor (1, 1); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
243 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
244 // Initial view: Contents |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
245 m_doc_browser->setSource (QUrl ( |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
246 "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
|
247 } |
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 documentation::~documentation (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
250 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
251 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
|
252 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
|
253 |
25102
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
254 // 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
|
255 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
|
256 if (file.exists ()) |
65b7380655f2
prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents:
25101
diff
changeset
|
257 { |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
258 QFileInfo finfo (file); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
259 QString bname = finfo.fileName (); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
260 QDir dir = finfo.absoluteDir (); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
261 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
|
262 QStringList namefilter; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
263 namefilter.append ("*" + bname + "*"); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
264 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
|
265 { |
25094
c0d48cfbb59a
use Octave system functions to avoid build failure with Qt 4 (bug #53540)
Mike Miller <mtmiller@octave.org>
parents:
25061
diff
changeset
|
266 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
|
267 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
|
268 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
269 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
270 file.remove(); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
271 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
272 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
273 |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
274 QAction * documentation::add_action (const QIcon& icon, const QString& text, |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
275 const char *member, QWidget *receiver, |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
276 QToolBar *tool_bar) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
277 { |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
278 QAction *a; |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
279 QWidget *r = this; |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
280 if (receiver != nullptr) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
281 r = receiver; |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
282 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
283 a = new QAction (icon, text, this); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
284 connect (a, SIGNAL (triggered ()), r, member); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
285 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
286 if (tool_bar) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
287 tool_bar->addAction (a); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
288 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
289 m_doc_widget->addAction (a); // important for shortcut context |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
290 a->setShortcutContext (Qt::WidgetWithChildrenShortcut); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
291 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
292 return a; |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
293 } |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
294 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
295 void documentation::construct_tool_bar (void) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
296 { |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
297 // Home, Previous, Next |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
298 m_action_go_home = add_action (resource_manager::icon ("go-home"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
299 tr ("Go home"), SLOT (home (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
300 m_doc_browser, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
301 m_action_go_prev = add_action (resource_manager::icon ("go-previous"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
302 tr ("Go back"), SLOT (backward (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
303 m_doc_browser, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
304 m_action_go_next = add_action (resource_manager::icon ("go-next"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
305 tr ("Go forward"), SLOT (forward (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
306 m_doc_browser, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
307 m_action_go_prev->setEnabled (false); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
308 m_action_go_next->setEnabled (false); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
309 connect (m_doc_browser, SIGNAL (backwardAvailable (bool)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
310 m_action_go_prev, SLOT (setEnabled (bool))); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
311 connect (m_doc_browser, SIGNAL (forwardAvailable (bool)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
312 m_action_go_next, SLOT (setEnabled (bool))); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
313 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
314 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
315 // Find |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
316 m_tool_bar->addSeparator (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
317 m_action_find = add_action (resource_manager::icon ("edit-find"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
318 tr ("Find"), SLOT (activate_find (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
319 this, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
320 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
321 // Zoom |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
322 m_tool_bar->addSeparator (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
323 m_action_zoom_in = add_action (resource_manager::icon ("zoom-in"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
324 tr ("Zoom in"), SLOT (zoom_in (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
325 m_doc_browser, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
326 m_action_zoom_out = add_action (resource_manager::icon ("zoom-out"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
327 tr ("Zoom in"), SLOT (zoom_out (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
328 m_doc_browser, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
329 m_action_zoom_original = add_action (resource_manager::icon ("zoom-original"), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
330 tr ("Zoom original"), SLOT (zoom_original (void)), |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
331 m_doc_browser, m_tool_bar); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
332 } |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
333 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
334 void documentation::global_search (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
335 { |
25061
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
336 #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
|
337 QString queries |
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
338 = 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
|
339 #else |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
340 QList<QHelpSearchQuery> queries |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
341 = 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
|
342 #endif |
5fef743c34d7
build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents:
25060
diff
changeset
|
343 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
344 m_help_engine->searchEngine ()->search (queries); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
345 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
346 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
347 void documentation::global_search_started (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
348 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
349 qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
350 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
351 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
352 void documentation::global_search_finished (int) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
353 { |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
354 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
|
355 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
356 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
|
357 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
|
358 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
359 #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
|
360 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
|
361 = 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
|
362 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
363 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
|
364 = 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
|
365 #endif |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
366 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
367 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
|
368 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
369 QUrl url; |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
370 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
371 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
|
372 #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
|
373 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
|
374 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
375 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
|
376 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
377 else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
378 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
379 // 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
|
380 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
|
381 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
382 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
|
383 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
384 #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
|
385 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
|
386 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
|
387 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
388 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
|
389 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
|
390 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
391 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
|
392 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
393 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
|
394 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
395 url = tmpurl; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
396 break; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
397 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
398 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
|
399 url = tmpurl; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
400 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
401 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
402 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
403 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
404 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
|
405 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
406 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
|
407 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
|
408 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
|
409 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
410 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
|
411 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
412 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
413 } |
25609
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
414 |
506419b5f817
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25541
diff
changeset
|
415 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
|
416 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
417 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
418 qApp->restoreOverrideCursor(); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
419 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
420 |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
421 void documentation::notice_settings (const QSettings *settings) |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
422 { |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
423 // Icon size in the toolbar. |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
424 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
425 int icon_size_settings = settings->value ("toolbar_icon_size", 0).toInt (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
426 QStyle *st = style (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
427 int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
428 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
429 // FIXME: Magic numbers. Use enum? |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
430 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
431 if (icon_size_settings == 1) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
432 icon_size = st->pixelMetric (QStyle::PM_LargeIconSize); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
433 else if (icon_size_settings == -1) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
434 icon_size = st->pixelMetric (QStyle::PM_SmallIconSize); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
435 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
436 m_tool_bar->setIconSize (QSize (icon_size, icon_size)); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
437 |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
438 // Shortcuts |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
439 shortcut_manager::set_shortcut (m_action_find, "editor_edit:find_replace"); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
440 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
|
441 shortcut_manager::shortcut (m_findprev_shortcut, "editor_edit:find_previous"); |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
442 shortcut_manager::set_shortcut (m_action_zoom_in, "editor_view:zoom_in"); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
443 shortcut_manager::set_shortcut (m_action_zoom_out, "editor_view:zoom_out"); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
444 shortcut_manager::set_shortcut (m_action_zoom_original, "editor_view:zoom_normal"); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
445 shortcut_manager::set_shortcut (m_action_go_home, "doc_browser:go_home"); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
446 shortcut_manager::set_shortcut (m_action_go_prev, "doc_browser:go_back"); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
447 shortcut_manager::set_shortcut (m_action_go_next, "doc_browser:go_next"); |
25371
41bbdf17f51a
make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents:
25336
diff
changeset
|
448 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
449 |
25962
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
450 void documentation::copyClipboard (void) |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
451 { |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
452 if (m_doc_browser->hasFocus ()) |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
453 { |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
454 m_doc_browser->copy(); |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
455 } |
12ad5eb2328e
Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents:
25609
diff
changeset
|
456 } |
25042
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 void documentation::pasteClipboard (void) { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
459 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
460 void documentation::selectAll (void) { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
461 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
462 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
|
463 { |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
464 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
|
465 return; |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
466 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
467 // 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
|
468 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
|
469 = 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
|
470 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
471 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
|
472 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
473 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
|
474 { |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
475 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
|
476 |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
477 // 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
|
478 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
|
479 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
|
480 = 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
|
481 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
|
482 } |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
483 else |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
484 { |
25541
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
485 // 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
|
486 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
|
487 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
|
488 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
489 #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
|
490 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
|
491 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
|
492 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
497 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
|
498 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
|
499 |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
500 // 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
|
501 #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
|
502 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
|
503 #else |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
504 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
|
505 #endif |
517c73173011
doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25460
diff
changeset
|
506 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
|
507 = 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
|
508 navi->setCurrentWidget (search_tab); |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
509 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
510 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
511 |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
512 void documentation::activate_find (void) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
513 { |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
514 if (m_find_line_edit->parentWidget ()->isVisible ()) |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
515 { |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
516 m_find_line_edit->parentWidget ()->hide (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
517 m_doc_browser->setFocus (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
518 } |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
519 else |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
520 { |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
521 m_find_line_edit->parentWidget ()->show (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
522 m_find_line_edit->selectAll (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
523 m_find_line_edit->setFocus (); |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
524 } |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
525 } |
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
526 |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
527 void documentation::filter_update (const QString& expression) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
528 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
529 if (! m_help_engine) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
530 return; |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
531 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
532 QString wildcard; |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
533 if (expression.contains (QLatin1Char('*'))) |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
534 wildcard = expression; |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
535 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
536 m_help_engine->indexWidget ()->filterIndices(expression, wildcard); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
537 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
538 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
539 void documentation::filter_update_history (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
540 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
541 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
|
542 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
|
543 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
544 if (index > -1) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
545 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
|
546 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
547 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
|
548 m_filter->setCurrentIndex (0); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
549 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
550 |
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
|
551 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
|
552 { |
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
|
553 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
|
554 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
|
555 |
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
|
556 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
|
557 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
|
558 } |
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
|
559 |
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
|
560 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
|
561 { |
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
|
562 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
|
563 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
|
564 |
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
|
565 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
|
566 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
|
567 } |
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
|
568 |
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
|
569 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
|
570 { |
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
|
571 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
|
572 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
|
573 |
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
|
574 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
|
575 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
|
576 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
|
577 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
|
578 } |
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
|
579 |
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
|
580 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
|
581 { |
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
|
582 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
|
583 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
|
584 |
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
|
585 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
|
586 } |
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
|
587 |
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
|
588 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
|
589 { |
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
|
590 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
|
591 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
|
592 |
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
|
593 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
|
594 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
|
595 } |
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
|
596 |
25060
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
597 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
|
598 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
599 if (m_help_engine) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
600 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
601 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
|
602 bool do_setup = true; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
603 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
|
604 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
605 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
|
606 do_setup = false; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
607 else |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
608 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
609 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
|
610 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
|
611 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
612 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
613 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
|
614 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
615 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
|
616 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
|
617 arg (qch)); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
618 do_setup = false; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
619 return; |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
620 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
621 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
622 if (do_setup) |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
623 m_help_engine->setupData(); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
624 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
625 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
626 |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
627 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
|
628 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
629 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
|
630 if (m_help_engine |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
631 && 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
|
632 && 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
|
633 { |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
634 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
|
635 m_help_engine->setupData (); |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
636 } |
1cd3aeda7598
Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
25042
diff
changeset
|
637 } |
25042
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
638 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
639 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
640 // The documentation browser |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
641 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
|
642 : 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
|
643 { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
644 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
645 documentation_browser::~documentation_browser (void) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
646 { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
647 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
648 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
|
649 const QString&) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
650 { |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
651 setSource (url); |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
652 } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
653 |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
654 void documentation_browser::notice_settings (const QSettings *) |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
655 { } |
ba5af45bbfc4
documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff
changeset
|
656 |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
657 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
|
658 { |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
659 if (url.scheme () == "qthelp") |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
660 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
|
661 else |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
662 return QTextBrowser::loadResource(type, url); |
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25102
diff
changeset
|
663 } |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
664 |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
665 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
|
666 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
667 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
|
668 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
669 zoomIn (); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
670 m_zoom_level++; |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
671 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
672 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
673 |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
674 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
|
675 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
676 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
|
677 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
678 zoomOut (); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
679 m_zoom_level--; |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
680 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
681 } |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
682 |
26017
390d59717711
adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents:
25985
diff
changeset
|
683 void documentation_browser::zoom_original (void) |
25976
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
684 { |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
685 zoomIn (- m_zoom_level); |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
686 m_zoom_level = 0; |
a7cc5b7a3d22
provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents:
25962
diff
changeset
|
687 } |
25985
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
688 |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
689 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
|
690 { |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
691 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
|
692 { |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
693 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
|
694 zoom_in (); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
695 else |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
696 zoom_out (); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
697 |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
698 we->accept (); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
699 } |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
700 else |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
701 QTextEdit::wheelEvent (we); |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
702 } |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
703 |
49ffd0e0242d
enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents:
25976
diff
changeset
|
704 } |