GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
documentation-bookmarks.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2018-2023 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_bookmarks_h)
27 #define octave_documentation_bookmarks_h 1
28 
29 #include <QCheckBox>
30 #include <QComboBox>
31 #include <QTreeWidget>
32 #include <QXmlStreamWriter>
33 
34 #include "documentation.h"
35 #include "octave-qobject.h"
36 
38 
39 class base_qobject;
40 class documentation;
41 
43 {
44  Q_OBJECT
45 
46 public:
47 
49  documentation *doc, documentation_browser *browser,
50  base_qobject& oct_qobj, QWidget *p = nullptr);
51 
52  ~documentation_bookmarks (void) = default;
53 
54 public slots:
55 
56  void add_bookmark (void);
57  void add_folder (bool);
59 
60 private slots:
61 
62  void filter_bookmarks (const QString& pattern);
63  void filter_activate (bool state);
64  void update_filter_history (void);
65  void handle_double_click (QTreeWidgetItem *item, int col = 0);
66  void ctx_menu (const QPoint& xpos);
67  void open (bool);
68  void edit (bool);
69  void remove (bool);
70  void show_filter (bool);
71 
72 private:
73 
74  enum item_role
75  {
76  url_role = Qt::UserRole,
77  tag_role = Qt::UserRole + 1
78  };
79  enum item_tag
80  {
83  };
84 
85  void add_bookmark (const QString& title, const QString& url,
86  QTreeWidgetItem *item = nullptr);
87  QTreeWidgetItem* add_folder (const QString& folder,
88  QTreeWidgetItem *item = nullptr,
89  bool expanded = true);
90 
91  /*!
92  Writing to and reading bookmarks from an xbel-file as
93  proposed in the qt example
94  [QXmlStream Bookmarks Example](https://doc.qt.io/qt-5/qtxml-streambookmarks-example.html)
95  */
96  void write_bookmarks (void);
97  void write_tree_item (QXmlStreamWriter *xml_writer,
98  const QTreeWidgetItem *item);
99  QString read_bookmarks (void);
100  void read_next_item (QXmlStreamReader *xml_writer, item_tag tag,
101  QTreeWidgetItem *item = nullptr);
102 
106 
107  QComboBox *m_filter;
108  QTreeWidget *m_tree;
109 
110  QTreeWidgetItem *m_ctx_menu_item;
111 
112  QIcon icon_folder;
114 
116  QCheckBox *m_filter_checkbox;
118 
119  QFile m_xbel_file;
120 };
121 
123 
124 #endif
OCTAVE_END_NAMESPACE(octave)
Base class for Octave interfaces that use Qt.
documentation_browser * m_browser
void handle_double_click(QTreeWidgetItem *item, int col=0)
documentation_bookmarks(documentation *doc, documentation_browser *browser, base_qobject &oct_qobj, QWidget *p=nullptr)
void save_settings(gui_settings *settings)
~documentation_bookmarks(void)=default
void write_tree_item(QXmlStreamWriter *xml_writer, const QTreeWidgetItem *item)
void read_next_item(QXmlStreamReader *xml_writer, item_tag tag, QTreeWidgetItem *item=nullptr)
void filter_bookmarks(const QString &pattern)
void ctx_menu(const QPoint &xpos)
Documentation browser derived from Textbrowser.
Definition: documentation.h:51
The documentation main class derived from QSplitter.
Definition: documentation.h:99
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static uint32_t state[624]
Definition: randmtzig.cc:193