annotate libgui/src/documentation-dock-widget.h @ 29330:b92614cfdfed

add bookmark functionality to the documentation browser (bug #54938) * libgui/src/documentation-bookmarks.cc: new file for the bookmarks tab; (documentation_bookmarks): initialize the tab, the filter and the tree; prepare the bookmark file and read existing bookmarks; (~documentation_bookmarks): empty destructor; (add_bookmark): slot for the adding bookmark action, get current title and url; (add_bookmark): do the adding, possibly as child of a parent item; (add_folder): slot for context menu action for adding a folder, check current position where to insert the new folder; (add_folder): do the folder adding; (filter_bookmarks): filter bookmarks following the changed filter text; (filter_activate): enable/disable filter; (update_filter_history): save a search term when acknowledged by return; (handle_double_click): open the clicked bookmark; (ctx_menu): show context menu at current mouse position; (open): open a bookmark via context menu; (edit): edit a bookmark via context menu; (remove): remove selected bookmarks via context menu; (show_filter): toggle visibility of the filter; (save_settings): save settings and initiate writing the bookmarks; (write_bookmarks): open file and initiate writing all top level items; (write_tree_item): write a single item and its children; (read_bookmarks): open the file, check if it is valid and loop over all top level items for reading them from the file; (read_next_item): read an item and its children in case of a folder; * documentation-bookmarks.h: class documentation_bookmarks derived from QWidget, declaration of all required functions and class variables; * documentation-dock-widget.cc (save_settings): new derived method, emitting a signal for saving setting in child widgets and callinf the original method * documentation-dock-widget.h: derived method save_settings and signal for child widgets * documentation.cc: include documentation-bookmarks.h; (documentation): add bookmark tab, connect signal for saving settings; (add_action): check reveiver before connection the actions signal; (construct_tool_bar): add toolbar button for adding a bookmark, connect its signal the add_bookmark slot and connect signal for saving settings; (notice_settings): add shortcut for adding a bookmark; (update_history): move combining page title and current anchor into a more specific title ... (title_and_anchor): to here; * documentation.h: new function title_and_anchor, new action * gui-preferences-dc.h: new file with constants for some bookmark settings and for the xbel file syntax * gui-preferences-sc.h: default value for bookmark action * bookmark-new.png/bookmark-new.svg: icon for tool bar button * icons_license: add new icon * module.mk: add new files * shortcut-manager.cc (init_data): initialize new short for bookmarking
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 10 Jan 2021 14:04:35 +0100
parents bd51beb6205e
children 7854d5752dd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
3 // Copyright (C) 2011-2020 The Octave Project Developers
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
15055
48ae6a7c69c1 Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff changeset
25
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
26 #if ! defined (octave_documentation_dock_widget_h)
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 20945
diff changeset
27 #define octave_documentation_dock_widget_h 1
15055
48ae6a7c69c1 Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff changeset
28
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
29 #include "documentation.h"
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 15552
diff changeset
30 #include "octave-dock-widget.h"
15055
48ae6a7c69c1 Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff changeset
31
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
32 namespace octave
15055
48ae6a7c69c1 Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff changeset
33 {
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
34 class base_qobject;
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27611
diff changeset
35
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
36 class documentation_dock_widget : public octave_dock_widget
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
37 {
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
38 Q_OBJECT
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 15552
diff changeset
39
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
40 public:
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
41
27629
8b6e928e0705 in GUI objects, store reference to base_qobject instead of resource_manager
John W. Eaton <jwe@octave.org>
parents: 27620
diff changeset
42 documentation_dock_widget (QWidget *parent, base_qobject& oct_qobj);
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents: 24733
diff changeset
43 ~documentation_dock_widget (void);
15055
48ae6a7c69c1 Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff changeset
44
29330
b92614cfdfed add bookmark functionality to the documentation browser (bug #54938)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
45 signals:
b92614cfdfed add bookmark functionality to the documentation browser (bug #54938)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
46
b92614cfdfed add bookmark functionality to the documentation browser (bug #54938)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
47 void save_settings_signal (void);
b92614cfdfed add bookmark functionality to the documentation browser (bug #54938)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
48
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
49 public slots:
23322
c4aebfe51a17 provide a context menu and shortcuts for the doc browser tab bar (bug #44605)
Torsten <mttl@mailbox.org>
parents: 23220
diff changeset
50
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27412
diff changeset
51 void notice_settings (const gui_settings *settings);
29330
b92614cfdfed add bookmark functionality to the documentation browser (bug #54938)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27923
diff changeset
52 void save_settings (void);
23322
c4aebfe51a17 provide a context menu and shortcuts for the doc browser tab bar (bug #44605)
Torsten <mttl@mailbox.org>
parents: 23220
diff changeset
53
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
54 protected slots:
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
55
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
56 void copyClipboard (void);
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
57 void pasteClipboard (void);
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
58 void selectAll (void);
24011
9107bae20480 style fixes for some GUI source files
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
59
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
60 void showDoc (const QString & name);
25060
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
61 void registerDoc (const QString & name);
1cd3aeda7598 Allow registering compressed help at run time (bug #53006).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
62 void unregisterDoc (const QString & name);
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
63
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
64 private:
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16461
diff changeset
65
25336
389757b7b6af eliminate redundant octave:: namespace tags
John W. Eaton <jwe@octave.org>
parents: 25060
diff changeset
66 documentation *m_docs;
24733
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
67 };
e15d53d2de1e move more GUI classse inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24718
diff changeset
68 }
15055
48ae6a7c69c1 Integrated texinfo browser from QtOctave.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
diff changeset
69
20945
9d9270e2f98f eliminate comments after preprocessor conditionals
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
70 #endif