annotate libgui/src/documentation.cc @ 26300:ef7f95f89407 stable

updated language files for translation (bug #55279) * libgui/languages/*.ts: updated language files with new or changed strings * libgui/languages/translators: added translators for nl and lt * libgui/module.mk: added new language file lt_LT.ts * libgui/src/documentation.cc (construct_tool_bar): fixed typos * libgui/src/files-dock-widget.cc (files_dock_widget): fixed typos * libgui/src/settings-dialog.ui: fixed typos
author Torsten <mttl@mailbox.org>
date Tue, 25 Dec 2018 12:41:52 +0100
parents 3f46b474d2bb
children e1b849489e73
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
26050
ce46820c5e9f fix build failure for documentation.cc (bug #55003)
Torsten <mttl@mailbox.org>
parents: 26017
diff changeset
31 #include <QAction>
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
32 #include <QApplication>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
33 #include <QCompleter>
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
34 #include <QDir>
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
35 #include <QFile>
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
36 #include <QFileInfo>
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
37 #include <QHelpContentWidget>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
38 #include <QHelpIndexWidget>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
39 #include <QHelpSearchEngine>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
40 #include <QHelpSearchQueryWidget>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
41 #include <QHelpSearchResultWidget>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
42 #include <QLabel>
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
43 #include <QLineEdit>
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
44 #include <QMessageBox>
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
45 #include <QTabWidget>
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"
26058
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 26050
diff changeset
51 #include "gui-preferences.h"
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
52
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
53 namespace octave
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
54 {
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
55 // 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
56 // of the doc dock widget
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
57 documentation::documentation (QWidget *p)
25371
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
58 : 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
59 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
60 m_tool_bar (new QToolBar (p)),
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
61 m_query_string (QString ()),
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
62 m_prev_pages_menu (new QMenu (p)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
63 m_next_pages_menu (new QMenu (p)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
64 m_prev_pages_count (0),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
65 m_next_pages_count (0),
25371
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
66 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
67 m_findprev_shortcut (new QShortcut (p))
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
68 {
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
69 // Get original collection
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
70 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
71 if (collection.isEmpty ())
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
72 collection = QString::fromStdString (config::oct_doc_dir ()
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
73 + sys::file_ops::dir_sep_str ()
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
74 + "octave_interpreter.qhc");
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
75
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
76 // 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
77 // 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
78 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
79
25101
29641449ca90 use qt routines for determining users tmp directory (bug #53006)
Torsten <mttl@mailbox.org>
parents: 25094
diff changeset
80 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
81 m_collection
25336
389757b7b6af eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 25258
diff changeset
82 = QString::fromStdString (sys::tempnam (tmpdir.toStdString (),
389757b7b6af eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 25258
diff changeset
83 "oct-qhelp-"));
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
84
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
85 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
86 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
87 else
26064
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
88 #ifdef ENABLE_DOCS
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
89 // FIXME: Perhaps a better way to do this would be to keep a count
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
90 // in the GUI preferences file. After issuing this warning 3 times
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
91 // it would be disabled. The count would need to be reset when a new
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
92 // version of Octave is installed.
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
93 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
94 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
95 "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
96 "%1").arg (m_help_engine->error ()));
26064
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
97 #endif
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
98
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
99 connect(m_help_engine, SIGNAL(setupFinished()),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
100 m_help_engine->searchEngine(), SLOT(indexDocumentation()));
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 if (! m_help_engine->setupData())
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
103 {
26064
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
104 #ifdef ENABLE_DOCS
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
105 QMessageBox::warning (this, tr ("Octave Documentation"),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
106 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
107 "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
108 "the Command Window will be available."));
26064
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
109 #endif
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
110 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
111 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
112 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
113 return;
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
114 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
115
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
116 // 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
117 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
118 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
119 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
120 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
121
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
122 // Tool bar
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
123 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
124
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
125 // 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
126 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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135 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
136 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
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 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
152
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
153 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
154 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
155 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
156 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
157 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
158
25371
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
159 notice_settings (resource_manager::get_settings ());
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
160
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
161 m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
162 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
163 this, SLOT(find_forward (void)));
25371
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
164 m_findprev_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
165 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
166 this, SLOT(find_backward (void)));
25371
41bbdf17f51a make shortcuts for searching within the documentation configurable
Torsten <mttl@mailbox.org>
parents: 25336
diff changeset
167
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
168 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
169 m_search_anchor_position = 0;
25042
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 // Layout contents, index and search
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
172 QTabWidget *navi = new QTabWidget (this);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
173 navi->setTabsClosable (false);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
174 navi->setMovable (true);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
175
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
176 // Contents
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
177 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
178 content->setObjectName ("documentation_tab_contents");
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
179 navi->addTab (content, tr ("Contents"));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
180
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
181 connect(m_help_engine->contentWidget (),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
182 SIGNAL (linkActivated (const QUrl&)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
183 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
184
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
185 // Index
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
186 QHelpIndexWidget *index = m_help_engine->indexWidget ();
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
187
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
188 m_filter = new QComboBox (this);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
189 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
190 m_filter->setEditable (true);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
191 m_filter->setInsertPolicy (QComboBox::NoInsert);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
192 m_filter->setMaxCount (10);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
193 m_filter->setMaxVisibleItems (10);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
194 m_filter->setSizeAdjustPolicy (
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
195 QComboBox::AdjustToMinimumContentsLengthWithIcon);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
196 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
197 m_filter->setSizePolicy (sizePol);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
198 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
199 QLabel *filter_label = new QLabel (tr ("Search"));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
200
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
201 QWidget *filter_all = new QWidget (navi);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
202 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
203 h_box_index->addWidget (filter_label);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
204 h_box_index->addWidget (m_filter);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
205 h_box_index->setMargin (2);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
206 filter_all->setLayout (h_box_index);
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 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
209 index_all->setObjectName ("documentation_tab_index");
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
210 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
211 v_box_index->addWidget (filter_all);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
212 v_box_index->addWidget (index);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
213 index_all->setLayout (v_box_index);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
214
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
215 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
216
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
217 connect(m_help_engine->indexWidget (),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
218 SIGNAL (linkActivated (const QUrl&, const QString&)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
219 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
220 const QString&)));
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
221
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
222 connect (m_filter, SIGNAL (editTextChanged (const QString&)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
223 this, SLOT(filter_update (const QString&)));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
224
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
225 connect (m_filter->lineEdit (), SIGNAL (editingFinished (void)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
226 this, SLOT(filter_update_history (void)));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
227
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
228 // Search
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
229 QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
230 QHelpSearchQueryWidget *search = search_engine->queryWidget ();
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
231 QHelpSearchResultWidget *result = search_engine->resultWidget ();
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
232 QWidget *search_all = new QWidget (navi);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
233 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
234 v_box_search->addWidget (search);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
235 v_box_search->addWidget (result);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
236 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
237 search_all->setObjectName ("documentation_tab_search");
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
238 navi->addTab (search_all, tr ("Search"));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
239
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
240 connect (search, SIGNAL (search (void)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
241 this, SLOT(global_search (void)));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
242
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
243 connect (search_engine, SIGNAL (searchingStarted (void)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
244 this, SLOT(global_search_started (void)));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
245 connect (search_engine, SIGNAL (searchingFinished (int)),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
246 this, SLOT(global_search_finished (int)));
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 connect (search_engine->resultWidget (),
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
249 SIGNAL (requestShowLink (const QUrl&)),
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
250 this,
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
251 SLOT(handle_search_result_clicked (const QUrl&)));
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
252
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
253 // Fill the splitter
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
254 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
255 insertWidget (1, browser_find);
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
256 setStretchFactor (1, 1);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
257
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
258 // Initial view: Contents
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
259 m_doc_browser->setSource (QUrl (
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
260 "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
261 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
262
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
263 documentation::~documentation (void)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
264 {
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
265 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
266 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
267
25102
65b7380655f2 prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents: 25101
diff changeset
268 // 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
269 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
270 if (file.exists ())
65b7380655f2 prevent crash if help data could not be set up (bug #53006)
Torsten <mttl@mailbox.org>
parents: 25101
diff changeset
271 {
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
272 QFileInfo finfo (file);
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
273 QString bname = finfo.fileName ();
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
274 QDir dir = finfo.absoluteDir ();
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
275 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
276 QStringList namefilter;
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
277 namefilter.append ("*" + bname + "*");
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
278 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
279 {
25094
c0d48cfbb59a use Octave system functions to avoid build failure with Qt 4 (bug #53540)
Mike Miller <mtmiller@octave.org>
parents: 25061
diff changeset
280 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
281 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
282 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
283
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
284 file.remove();
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
285 }
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
286 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
287
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
288 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
289 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
290 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
291 {
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
292 QAction *a;
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
293 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
294 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
295 r = receiver;
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 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
298 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
299
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
300 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
301 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
302
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_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
304 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
305
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
306 return a;
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
307 }
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
308
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
309 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
310 {
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
311 // 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
312 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
313 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
314 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
315 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
316 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
317 m_doc_browser, m_tool_bar);
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
318 m_action_go_prev->setEnabled (false);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
319
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
320 // popdown menu with prev pages files
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
321 QToolButton *popdown_button_prev_pages = new QToolButton ();
26300
ef7f95f89407 updated language files for translation (bug #55279)
Torsten <mttl@mailbox.org>
parents: 26257
diff changeset
322 popdown_button_prev_pages->setToolTip (tr ("Previous pages"));
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
323 popdown_button_prev_pages->setMenu (m_prev_pages_menu);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
324 popdown_button_prev_pages->setPopupMode (QToolButton::InstantPopup);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
325 popdown_button_prev_pages->setToolButtonStyle (Qt::ToolButtonTextOnly);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
326 popdown_button_prev_pages->setCheckable (false);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
327 popdown_button_prev_pages->setArrowType(Qt::DownArrow);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
328 m_tool_bar->addWidget (popdown_button_prev_pages);
26017
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_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
330 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
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 m_action_go_next->setEnabled (false);
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
333
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
334 // popdown menu with prev pages files
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
335 QToolButton *popdown_button_next_pages = new QToolButton ();
26300
ef7f95f89407 updated language files for translation (bug #55279)
Torsten <mttl@mailbox.org>
parents: 26257
diff changeset
336 popdown_button_next_pages->setToolTip (tr ("Next pages"));
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
337 popdown_button_next_pages->setMenu (m_next_pages_menu);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
338 popdown_button_next_pages->setPopupMode (QToolButton::InstantPopup);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
339 popdown_button_next_pages->setToolButtonStyle (Qt::ToolButtonTextOnly);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
340 popdown_button_next_pages->setArrowType(Qt::DownArrow);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
341 m_tool_bar->addWidget (popdown_button_next_pages);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
342
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
343 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
344 m_action_go_prev, SLOT (setEnabled (bool)));
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
345 connect (m_doc_browser, SIGNAL (backwardAvailable (bool)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
346 popdown_button_prev_pages, SLOT (setEnabled (bool)));
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
347 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
348 m_action_go_next, SLOT (setEnabled (bool)));
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
349 connect (m_doc_browser, SIGNAL (forwardAvailable (bool)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
350 popdown_button_next_pages, SLOT (setEnabled (bool)));
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
351 connect (m_doc_browser, SIGNAL (historyChanged (void)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
352 this, SLOT (update_history_menus (void)));
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
353
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
354 // Init prev/next menus
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
355 for (int i = 0; i < max_history_entries; ++i)
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
356 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
357 m_prev_pages_actions[i] = new QAction (this);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
358 m_prev_pages_actions[i]->setVisible (false);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
359 m_next_pages_actions[i] = new QAction (this);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
360 m_next_pages_actions[i]->setVisible (false);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
361 m_prev_pages_menu->addAction (m_prev_pages_actions[i]);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
362 m_next_pages_menu->addAction (m_next_pages_actions[i]);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
363 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
364
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
365 connect (m_prev_pages_menu, SIGNAL (triggered (QAction *)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
366 this, SLOT (open_hist_url (QAction *)));
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
367 connect (m_next_pages_menu, SIGNAL (triggered (QAction *)),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
368 this, SLOT (open_hist_url (QAction *)));
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
369
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
370 // Find
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
371 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
372 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
373 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
374 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
375
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
376 // Zoom
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
377 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
378 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
379 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
380 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
381 m_action_zoom_out = add_action (resource_manager::icon ("zoom-out"),
26133
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
382 tr ("Zoom out"), SLOT (zoom_out (void)),
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
383 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
384 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
385 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
386 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
387 }
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
388
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
389 void documentation::global_search (void)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
390 {
25061
5fef743c34d7 build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents: 25060
diff changeset
391 #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
392 QString queries
5fef743c34d7 build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents: 25060
diff changeset
393 = m_help_engine->searchEngine ()->queryWidget ()->searchInput ();
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
394 m_query_string = queries.split (" ").first ();
25061
5fef743c34d7 build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents: 25060
diff changeset
395 #else
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
396 QList<QHelpSearchQuery> queries
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
397 = m_help_engine->searchEngine ()->queryWidget ()->query ();
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
398 if (queries.count ())
26252
e603f555e2d7 Fix build failure with old Qt versions (bug #55234)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 26245
diff changeset
399 m_query_string = queries.first ().wordList.first ();
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
400 else
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
401 m_query_string = "";
25061
5fef743c34d7 build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents: 25060
diff changeset
402 #endif
5fef743c34d7 build: Check for new help query member in qt 5.9 (bug #53006).
Torsten <mttl@mailbox.org>
parents: 25060
diff changeset
403
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
404
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
405 m_help_engine->searchEngine ()->search (queries);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
406 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
407
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
408 void documentation::global_search_started (void)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
409 {
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
410 qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
411 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
412
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
413 void documentation::global_search_finished (int)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
414 {
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
415 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
416 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
417 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
418 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
419 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
420 #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
421 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
422 = 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
423 #else
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
424 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
425 = 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
426 #endif
25609
506419b5f817 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25541
diff changeset
427
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
428 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
429 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
430 QUrl url;
25609
506419b5f817 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25541
diff changeset
431
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
432 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
433 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
434 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
435 #else
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
436 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
437 #endif
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
438 else
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
439 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
440 // 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
441 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
442
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
443 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
444 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
445 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
446 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
447 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
448 #else
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
449 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
450 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
451 #endif
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
452 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
453 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
454 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
455 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
456 url = tmpurl;
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
457 break;
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
458 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
459 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
460 url = tmpurl;
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
461 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
462 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
463 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
464
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
465 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
466 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
467 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
468 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
469 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
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 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
472 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
473 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
474 }
25609
506419b5f817 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25541
diff changeset
475
506419b5f817 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 25541
diff changeset
476 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
477 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
478
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
479 qApp->restoreOverrideCursor();
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
480 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
481
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
482 void documentation::handle_search_result_clicked (const QUrl& url)
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
483 {
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
484 // Open url with matching text
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
485 m_doc_browser->handle_index_clicked (url);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
486
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
487 // Select all occurrences of matching text
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
488 select_all_occurrences (m_query_string);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
489
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
490 // Open search widget with matching text as search string
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
491 m_find_line_edit->setText (m_query_string);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
492 m_find_line_edit->parentWidget ()->show ();
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
493
26257
3f46b474d2bb ensure right text position when clicking a search result link (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26252
diff changeset
494 // Go to to first occurrence of search text. Going to the end and then
3f46b474d2bb ensure right text position when clicking a search result link (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26252
diff changeset
495 // search backwards until the last occurrence ensures the search text
3f46b474d2bb ensure right text position when clicking a search result link (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26252
diff changeset
496 // is visible in the first line of the visible part of the text.
3f46b474d2bb ensure right text position when clicking a search result link (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26252
diff changeset
497 m_doc_browser->moveCursor (QTextCursor::End);
3f46b474d2bb ensure right text position when clicking a search result link (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26252
diff changeset
498 while (m_doc_browser->find (m_find_line_edit->text (),
3f46b474d2bb ensure right text position when clicking a search result link (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26252
diff changeset
499 QTextDocument::FindBackward));
26245
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
500 }
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
501
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
502 void documentation::select_all_occurrences (const QString& text)
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
503 {
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
504 // Get highlight background and text color
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
505 QPalette pal = QApplication::palette ();
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
506 QTextCharFormat format;
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
507 QColor col = pal.color (QPalette::Highlight);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
508 col.setAlphaF (0.25);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
509 format.setBackground (QBrush (col));
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
510 format.setForeground (QBrush (pal.color (QPalette::Text)));
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
511
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
512 // Create list for extra selected items
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
513 QList<QTextEdit::ExtraSelection> selected;
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
514 m_doc_browser->moveCursor (QTextCursor::Start);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
515
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
516 // Find all occurrences and add them to the selection
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
517 while ( m_doc_browser->find (text) )
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
518 {
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
519 QTextEdit::ExtraSelection selected_item;
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
520 selected_item.cursor = m_doc_browser->textCursor ();
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
521 selected_item.format = format;
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
522 selected.append (selected_item);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
523 }
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
524
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
525 // Apply selection and move back to the beginning
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
526 m_doc_browser->setExtraSelections (selected);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
527 m_doc_browser->moveCursor (QTextCursor::Start);
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
528 }
af99ea9c325f Doc browser: go to search text when clicking a search result (bug #55228)
Torsten <mttl@mailbox.org>
parents: 26190
diff changeset
529
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
530 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
531 {
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
532 // Icon size in the toolbar.
26058
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 26050
diff changeset
533 int size_idx = settings->value (global_icon_size.key,
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 26050
diff changeset
534 global_icon_size.def).toInt ();
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 26050
diff changeset
535 size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
536
26058
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 26050
diff changeset
537 QStyle *st = style ();
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 26050
diff changeset
538 int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
539 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
540
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
541 // Shortcuts
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
542 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
543 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
544 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
545 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
546 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
547 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
548 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
549 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
550 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
551 }
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
552
25962
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
553 void documentation::copyClipboard (void)
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
554 {
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
555 if (m_doc_browser->hasFocus ())
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
556 {
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
557 m_doc_browser->copy();
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
558 }
12ad5eb2328e Call the document browser copy on clipboard signal (Bug #54879)
John Donoghue
parents: 25609
diff changeset
559 }
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
560
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
561 void documentation::pasteClipboard (void) { }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
562
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
563 void documentation::selectAll (void) { }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
564
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
565 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
566 {
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
567 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
568 return;
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
569
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
570 // 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
571 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
572 = 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
573
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
574 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
575
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
576 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
577 {
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
578 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
579
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
580 // 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
581 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
582 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
583 = 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
584 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
585 }
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
586 else
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
587 {
25541
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
588 // 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
589 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
590 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
591
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
592 #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
593 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
594 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
595 #else
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
596 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
597 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
598 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
599 #endif
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
600 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
601 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
602
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
603 // 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
604 #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
605 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
606 #else
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
607 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
608 #endif
517c73173011 doc.m: allow full text search in GUI mode (bug #54053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25460
diff changeset
609 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
610 = 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
611 navi->setCurrentWidget (search_tab);
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
612 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
613 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
614
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
615 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
616 {
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
617 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
618 {
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
619 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
620 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
621 }
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
622 else
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
623 {
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
624 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
625 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
626 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
627 }
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
628 }
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
629
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
630 void documentation::filter_update (const QString& expression)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
631 {
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
632 if (! m_help_engine)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
633 return;
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
634
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
635 QString wildcard;
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25102
diff changeset
636 if (expression.contains (QLatin1Char('*')))
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
637 wildcard = expression;
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 m_help_engine->indexWidget ()->filterIndices(expression, wildcard);
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
640 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
641
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
642 void documentation::filter_update_history (void)
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 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
645 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
646
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
647 if (index > -1)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
648 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
649
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
650 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
651 m_filter->setCurrentIndex (0);
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
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
654 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
655 {
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
656 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
657 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
658
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
659 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
660 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
661 }
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
662
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
663 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
664 {
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
665 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
666 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
667
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
668 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
669 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
670 }
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
671
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
672 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
673 {
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
674 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
675 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
676
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
677 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
678 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
679 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
680 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
681 }
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
682
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
683 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
684 {
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
685 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
686 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
687
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
688 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
689 }
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
690
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
691 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
692 {
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
693 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
694 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
695
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
696 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
697 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
698 }
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
699
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
700 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
701 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
702 if (m_help_engine)
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
703 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
704 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
705 bool do_setup = true;
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
706 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
707 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
708 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
709 do_setup = false;
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
710 else
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
711 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
712 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
713 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
714 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
715 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
716 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
717 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
718 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
719 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
720 arg (qch));
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
721 do_setup = false;
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
722 return;
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
723 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
724
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
725 if (do_setup)
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
726 m_help_engine->setupData();
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
727 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
728 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
729
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
730 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
731 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
732 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
733 if (m_help_engine
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
734 && 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
735 && 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
736 {
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
737 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
738 m_help_engine->setupData ();
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
739 }
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25042
diff changeset
740 }
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
741
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
742 void documentation::update_history_menus (void)
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
743 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
744 if (m_prev_pages_count != m_doc_browser->backwardHistoryCount ())
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
745 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
746 update_history (m_doc_browser->backwardHistoryCount (),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
747 m_prev_pages_actions);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
748 m_prev_pages_count = m_doc_browser->backwardHistoryCount ();
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
749 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
750
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
751 if (m_next_pages_count != m_doc_browser->forwardHistoryCount ())
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
752 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
753 update_history (m_doc_browser->forwardHistoryCount (),
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
754 m_next_pages_actions);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
755 m_next_pages_count = m_doc_browser->forwardHistoryCount ();
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
756 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
757 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
758
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
759 void documentation::update_history (int new_count, QAction **actions)
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
760 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
761 // Which menu has to be updated?
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
762 int prev_next = -1;
26133
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
763 QAction *a = m_action_go_prev;
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
764 if (actions == m_next_pages_actions)
26133
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
765 {
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
766 prev_next = 1;
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
767 a = m_action_go_next;
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
768 }
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
769
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
770 // Get maximal count limited by array size
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
771 int count = qMin (new_count, int (max_history_entries));
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
772
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
773 // Fill used menu entries
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
774 for (int i = 0; i < count; i++)
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
775 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
776 QString title = m_doc_browser->historyTitle (prev_next*(i+1));
26143
c7f845bf4fec doc browser: improve filtering of octave version in history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26134
diff changeset
777 title.remove (QRegExp ("\\s*\\(*GNU Octave \\(version [^\\)]*\\)[: \\)]*"));
26133
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
778
26144
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
779 // Sinve the title only contains the section name and not the
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
780 // specific anchor, extract the latter from the url and append
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
781 // it to the title
26190
c2137ac45dd9 fix build failure with Qt4.8 (bug #55191)
Torsten <mttl@mailbox.org>
parents: 26144
diff changeset
782 QString url = m_doc_browser->historyUrl (prev_next*(i+1)).toString ();
26144
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
783 if (url.contains ('#'))
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
784 {
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
785 // Get the anchor from the url
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
786 QString anchor = url.split ('#').last ();
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
787
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
788 // Remove internal string parts
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
789 anchor.remove (QRegExp ("^index-"));
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
790 anchor.remove (QRegExp ("^SEC_"));
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
791 anchor.remove (QRegExp ("^XREF"));
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
792 anchor.remove ("Concept-Index_cp_letter-");
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
793 anchor.replace ("-"," ");
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
794
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
795 // replace encoded special chars by there unencoded versions
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
796 QRegExp rx = QRegExp ("_00([0-7][0-9a-f])");
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
797 int pos = 0;
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
798 while ((pos = rx.indexIn(anchor, pos)) != -1)
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
799 {
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
800 anchor.replace ("_00"+rx.cap (1), QChar (rx.cap (1).toInt (nullptr,16)));
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
801 pos += rx.matchedLength();
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
802 }
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
803
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
804 if (title != anchor)
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
805 title = title + ": " + anchor;
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
806 }
494452db0477 doc browser: append anchor from url to history titles (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26143
diff changeset
807
26133
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
808 if (i == 0)
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
809 a->setText (title); // set tool tip for prev/next buttons
84cd950f0f75 fix some tool tips in the documentation browser (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26128
diff changeset
810
26128
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
811 actions[i]->setText (title);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
812 actions[i]->setData (m_doc_browser->historyUrl (prev_next*(i+1)));
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
813 actions[i]->setEnabled (true);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
814 actions[i]->setVisible (true);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
815 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
816
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
817 // Hide unused menu entries
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
818 for (int j = count; j < max_history_entries; j++)
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
819 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
820 actions[j]->setEnabled (false);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
821 actions[j]->setVisible (false);
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
822 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
823 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
824
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
825 void documentation::open_hist_url (QAction *a)
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
826 {
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
827 m_doc_browser->setSource (a->data ().toUrl ());
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
828 }
20b87596b99a add mru-lists to the doc browser back/forward buttons (bug #54938)
Torsten <mttl@mailbox.org>
parents: 26064
diff changeset
829
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
830
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
831 // The documentation browser
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
832 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
833 : QTextBrowser (p), m_help_engine (he), m_zoom_level (0)
26134
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
834 {
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
835 setOpenLinks (false);
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
836 connect (this, SIGNAL (anchorClicked (QUrl)),
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
837 this, SLOT (handle_index_clicked (QUrl)));
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
838 }
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
839
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
840 documentation_browser::~documentation_browser (void)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
841 { }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
842
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
843 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
844 const QString&)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
845 {
26134
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
846 if (url.scheme () == "qthelp")
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
847 setSource (url);
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
848 else
3a38afebf949 open external links indoc browser help files in the standard browser
Torsten <mttl@mailbox.org>
parents: 26133
diff changeset
849 QDesktopServices::openUrl (url);
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
850 }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
851
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
852 void documentation_browser::notice_settings (const QSettings *)
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
853 { }
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents:
diff changeset
854
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25102
diff changeset
855 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
856 {
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25102
diff changeset
857 if (url.scheme () == "qthelp")
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25102
diff changeset
858 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
859 else
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25102
diff changeset
860 return QTextBrowser::loadResource(type, url);
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25102
diff changeset
861 }
25976
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
862
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
863 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
864 {
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
865 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
866 {
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
867 zoomIn ();
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
868 m_zoom_level++;
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
869 }
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
870 }
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
871
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
872 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
873 {
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
874 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
875 {
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
876 zoomOut ();
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
877 m_zoom_level--;
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
878 }
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
879 }
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
880
26017
390d59717711 adding a toolbar with common browse tools to the doc browser (bug 54938)
Torsten <mttl@mailbox.org>
parents: 25985
diff changeset
881 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
882 {
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
883 zoomIn (- m_zoom_level);
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
884 m_zoom_level = 0;
a7cc5b7a3d22 provide shortcuts for zooming into the doc browser (bug #54877)
Torsten <mttl@mailbox.org>
parents: 25962
diff changeset
885 }
25985
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
886
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
887 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
888 {
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
889 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
890 {
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
891 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
892 zoom_in ();
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
893 else
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
894 zoom_out ();
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
895
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
896 we->accept ();
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
897 }
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
898 else
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
899 QTextEdit::wheelEvent (we);
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
900 }
49ffd0e0242d enable resetting doc browser zoom level even when zooming with mouse wheel
Torsten <mttl@mailbox.org>
parents: 25976
diff changeset
901
26064
673b1af42143 Don't complain about missing Qt help files when configure with --disable-docs (bug #53006).
Rik <rik@octave.org>
parents: 26058
diff changeset
902 }