GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
documentation.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2018-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_documentation_h)
27#define octave_documentation_h 1
28
29#include <QComboBox>
30#include <QMenu>
31#include <QShortcut>
32#include <QSplitter>
33#include <QTextBrowser>
34#include <QToolBar>
35#include <QListWidget>
36#include <QToolButton>
37#include <QWidget>
38#include <QtHelp/QHelpEngine>
39
40#include "gui-settings.h"
41
42namespace octave
43{
44 class base_qobject;
45 class documentation;
46 class documentation_bookmarks;
47
48 //! Documentation browser derived from Textbrowser
49
51 {
52 Q_OBJECT
53
54 public:
55
56 documentation_browser (QHelpEngine *help_engine, QWidget *parent = nullptr);
57 ~documentation_browser (void) = default;
58
59 virtual QVariant loadResource (int type, const QUrl& url);
60
61 public slots:
62
63 void handle_index_clicked (const QUrl& url,
64 const QString& keyword = QString ());
67
68 //! Zooming in and out while taking care of the zoom level
69 //!@{
70 void zoom_in (void);
71 void zoom_out (void);
72 void zoom_original (void);
73 //!@}
74
75 protected:
76
77 void wheelEvent (QWheelEvent *we);
78
79 private:
80
81 QHelpEngine *m_help_engine;
82
83 //! Store the current zoom level
85
86 //! Minimal and maximal zoom level avoiding calling
87 //! zoom_in and zoom_out without actually zooming but
88 //! with changing the stored zoom level
89 enum
90 {
93 };
94 };
95
96
97 //! The documentation main class derived from QSplitter
98
99 class documentation : public QSplitter
100 {
101 Q_OBJECT
102
103 public:
104
105 documentation (QWidget *parent, base_qobject& oct_qobj);
106 ~documentation (void);
107
108 /*!
109 Generate a string with page name @p title and current anchor
110 from @p url for using in prev/next or bookmarks menu:
111
112 @param title current title of the page as QString
113 @param url current url as QUrl
114
115 @return QString "title: anchor"
116 */
117 QString title_and_anchor (const QString& title, const QUrl& url);
118
119 signals:
120
121 void show_single_result (const QUrl&);
122
123 public slots:
124
126 void save_settings (void);
127
128 void copyClipboard (void);
129 void pasteClipboard (void);
130 void selectAll (void);
131
132 void load_index (void);
133 void load_ref (const QString& name = QString ());
134 void registerDoc (const QString& name);
135 void unregisterDoc (const QString& name);
136
137 private slots:
138
139 void activate_find (void);
140 void global_search (void);
141 void global_search_started (void);
142 void global_search_finished (int hits);
143 void filter_update (const QString& expression);
144 void filter_update_history (void);
145 void find (bool backward = false);
146 void find_backward (void);
147 void find_forward_from_anchor (const QString& text);
148 void record_anchor_position (void);
150 void handle_search_result_clicked (const QUrl& url);
151
152 void update_history_menus (void);
153 void open_hist_url (QAction *a);
154
155 private:
156
157 void construct_tool_bar (void);
158 QAction * add_action (const QIcon& icon, const QString& text,
159 const char *member, QWidget *receiver = nullptr,
160 QToolBar *tool_bar = nullptr);
161 void update_history (int new_count, QAction **actions);
162
163 //! Select all occurrences of a string in the doc browser
164 void select_all_occurrences (const QString& text);
165
167
168 QHelpEngine *m_help_engine;
174 QComboBox *m_filter;
176
178 QToolBar *m_tool_bar;
180
183
191
192 enum { max_history_entries = 10 };
195
197
201
205 };
206
207}
208
209#endif
Base class for Octave interfaces that use Qt.
Documentation browser derived from Textbrowser.
Definition: documentation.h:51
void zoom_original(void)
Zooming in and out while taking care of the zoom level.
void zoom_out(void)
Zooming in and out while taking care of the zoom level.
~documentation_browser(void)=default
int m_zoom_level
Store the current zoom level.
Definition: documentation.h:84
void handle_index_clicked(const QUrl &url, const QString &keyword=QString())
void zoom_in(void)
Zooming in and out while taking care of the zoom level.
void save_settings(gui_settings *settings)
void notice_settings(const gui_settings *settings)
documentation_browser(QHelpEngine *help_engine, QWidget *parent=nullptr)
virtual QVariant loadResource(int type, const QUrl &url)
void wheelEvent(QWheelEvent *we)
The documentation main class derived from QSplitter.
QString title_and_anchor(const QString &title, const QUrl &url)
void filter_update_history(void)
documentation(QWidget *parent, base_qobject &oct_qobj)
void filter_update(const QString &expression)
void load_ref(const QString &name=QString())
QShortcut * m_findprev_shortcut
void find_forward_from_anchor(const QString &text)
void global_search_started(void)
QHelpEngine * m_help_engine
QAction * m_prev_pages_actions[max_history_entries]
QAction * m_next_pages_actions[max_history_entries]
documentation_browser * m_doc_browser
void construct_tool_bar(void)
base_qobject & m_octave_qobj
void handle_search_result_clicked(const QUrl &url)
QShortcut * m_findnext_shortcut
void update_history_menus(void)
void handle_cursor_position_change(void)
void record_anchor_position(void)
QAction * m_action_zoom_original
documentation_bookmarks * m_bookmarks
QAction * add_action(const QIcon &icon, const QString &text, const char *member, QWidget *receiver=nullptr, QToolBar *tool_bar=nullptr)
void open_hist_url(QAction *a)
void update_history(int new_count, QAction **actions)
void global_search_finished(int hits)
void select_all_occurrences(const QString &text)
Select all occurrences of a string in the doc browser.
void find(bool backward=false)
void show_single_result(const QUrl &)
void notice_settings(const gui_settings *settings)
QLineEdit * m_find_line_edit
void registerDoc(const QString &name)
void unregisterDoc(const QString &name)
QString name
static double we[256]
Definition: randmtzig.cc:465