itom
Loading...
Searching...
No Matches
helpTreeDockWidget.h
1#ifndef HELPTREEDOCKWIDGET_H
2#define HELPTREEDOCKWIDGET_H
3
4#include "../../common/sharedStructures.h"
5
6#include <qwidget.h>
7#include <qstandarditemmodel.h>
8#include <qtimer.h>
9#include <qfuturewatcher.h>
10#include <qmovie.h>
11
12#include "../widgets/abstractDockWidget.h"
13
14#include "ui_helpTreeDockWidget.h"
15
16class QShowEvent; //forward declaration
17
18namespace ito
19{
20
21class LeafFilterProxyModel; //forward declaration
22
23class HelpTreeDockWidget : public QWidget
24{
25 Q_OBJECT
26
27 // the following properties replace $<name>$ tags in the help_style.css file,
28 // where <name> is the name of the property
29 Q_PROPERTY(QColor backgroundColorHeading READ backgroundColorHeading WRITE setBackgroundColorHeading) // default: #efefef;
30 Q_PROPERTY(QColor textColorHeading READ textColorHeading WRITE setTextColorHeading) // default: #0c3762;
31 Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor); // default: #dc3c01
32 Q_PROPERTY(QColor backgroundParamName READ backgroundParamName WRITE setBackgroundParamName); // default: #dcb8aa
33 Q_PROPERTY(QColor textColorSection READ textColorSection WRITE setTextColorSection); // default: #dc3c01
34 Q_PROPERTY(QColor backgroundColorSection READ backgroundColorSection WRITE setBackgroundColorSection); // default: #eeeeee
35
36 Q_FLAGS(State States)
37
38public:
40 QWidget* parent,
42 Qt::WindowFlags flags = Qt::WindowFlags());
44
45 enum HelpItemType
46 {
47 typeFilter = 2, /* a filter method from an algorithm plugin */
48 typeWidget = 3, /* a widget method from an algorithm plugin */
49 typeFPlugin = 4, /* an algorithm plugin in the filter section */
50 typeWPlugin = 5, /* an algorithm plugin in the widget section */
51 typeCategory = 6, /* a category */
52 typeDataIO = 7, /* a dataIO plugin */
53 typeActuator = 8 /* an actuator plugin */
54 };
55
56 enum IconType
57 {
58 iconFilter = 100,
59 iconPluginAlgo = 101,
60 iconPluginFilter = 102,
61 iconWidget = 103,
62 iconPluginDataIO = 104,
63 iconPluginGrabber = 105,
64 iconPluginAdda = 106,
65 iconPluginRawIO = 107,
66 iconPluginActuator = 108
67 };
68
69 enum State
70 {
71 stateIdle = 0x00,
72 stateVisible = 0x01,
73 stateContentLoaded = 0x02
74 };
75 Q_DECLARE_FLAGS(States, State)
76
77
78 QColor backgroundColorHeading() const;
79 void setBackgroundColorHeading(const QColor &color);
80
81 QColor textColorHeading() const;
82 void setTextColorHeading(const QColor &color);
83
84 QColor backgroundColorSection() const;
85 void setBackgroundColorSection(const QColor &color);
86
87 QColor textColorSection() const;
88 void setTextColorSection(const QColor &color);
89
90 QColor linkColor() const;
91 void setLinkColor(const QColor &color);
92
93 QColor backgroundParamName() const;
94 void setBackgroundParamName(const QColor &color);
95
96
97
98public slots:
99 void navigateBackwards();
100 void navigateForwards();
101 void expandTree();
102 void collapseTree();
103 void reloadHelpResources();
104 void liveFilter(const QString &filterText);
105 void propertiesChanged();
106 void showPluginInfo(const QString &name, HelpItemType type, const QModelIndex &modelIndex, bool fromLink);
107 ito::RetVal showFilterWidgetPluginHelp(const QString &filtername, HelpItemType type);
108
109private slots:
110 void on_splitter_splitterMoved ( int pos, int index );
111 void on_helpTreeContent_anchorClicked(const QUrl & link);
112
113 void loadHelpResourcesFinished(int index);
114
115 void on_treeView_expanded(const QModelIndex &index);
116 void on_treeView_collapsed(const QModelIndex &index);
117
118 void selectedItemChanged(const QModelIndex &current, const QModelIndex &previous);
119
120private:
121
122 static void createFilterWidgetNode(int fOrW, QStandardItemModel* model, const QMap<int,QIcon> *iconGallery);
123 static ito::RetVal loadHelpResources(QStandardItemModel *mainModel, const QMap<int,QIcon> *iconGallery);
124
125 void storeSettings();
126 void restoreSettings();
127 QStringList separateLink(const QUrl &link);
128 ito::RetVal highlightContent(const QString &prefix , const QString &name , const QString &param , const QString &shortDesc, const QString &helpText, const QString &error, QTextDocument *document, const QMap<QString, QImage> &images);
129 QModelIndex findIndexByPath(const int type, QStringList path, const QStandardItem* current);
130
131 QString parseFilterWidgetContent(const QString &input);
132 ito::RetVal parseParamVector(const QString &sectionname, const QVector<ito::Param> &paramVector, QString &content);
133 QString parseParam(const QString &tmpl, const ito::Param &param);
134
135 void loadAndProcessCssStyleSheet();
136
137 // Const
138 static const int rolePath = Qt::UserRole + 1;
139 static const int roleType = Qt::UserRole + 2;
140 static const int roleFilename = Qt::UserRole + 3;
141
142 // Variables
143 Ui::HelpTreeDockWidget ui;
144 QStandardItemModel *m_pMainModel;
147 QList<QModelIndex> m_history;
149 QMap<int, QIcon> m_iconGallery;
150 int m_historyIndex;
154 bool m_treeVisible;
156 bool m_autoCollTree;
159 States m_state;
160 QString m_filterTextPending;
161 int m_filterTextPendingTimer;
162
163 QColor m_backgroundColorHeading; // default: #efefef;
164 QColor m_textColorHeading; // default: #0c3762;
165 QColor m_linkColor; // default: #dc3c01
166 QColor m_backgroundParamName; // default: #dcb8aa
167 QColor m_textColorSection; // default: #dc3c01
168 QColor m_backgroundColorSection; // default: #eeeeee
169
170 QFutureWatcher<ito::RetVal> m_loaderWatcher;
171 QMutex m_dbLoaderMutex;
172
173protected:
174 void showEvent(QShowEvent *event);
175 void timerEvent(QTimerEvent *event);
176};
177
178} //end namespace ito
179
180#endif // HELPTREEDOCKWIDGET_H
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition abstractDockWidget.h:55
Definition helpTreeDockWidget.h:24
LeafFilterProxyModel * m_pMainFilterModel
Definition helpTreeDockWidget.h:145
ito::RetVal showFilterWidgetPluginHelp(const QString &filtername, HelpItemType type)
Get the DocString from a Filter and parse is to html.
Definition helpTreeDockWidget.cpp:367
static ito::RetVal loadHelpResources(QStandardItemModel *mainModel, const QMap< int, QIcon > *iconGallery)
Load help resources from various plugins in a different thread.
Definition helpTreeDockWidget.cpp:1400
QString parseFilterWidgetContent(const QString &input)
Reformats all help strings that come from the widgets and plugins.
Definition helpTreeDockWidget.cpp:1107
bool m_plaintext
Definition helpTreeDockWidget.h:155
QStandardItemModel * m_pMainModel
Definition helpTreeDockWidget.h:144
bool m_doingExpandAll
Definition helpTreeDockWidget.h:158
void restoreSettings()
Load Gui positions to Main-ini-File.
Definition helpTreeDockWidget.cpp:1235
void loadHelpResourcesFinished(int index)
This slot is called when the loading thread is finished.
Definition helpTreeDockWidget.cpp:1348
ito::AbstractDockWidget * m_pParent
Definition helpTreeDockWidget.h:146
void storeSettings()
Save Gui positions to Main-ini-File.
Definition helpTreeDockWidget.cpp:1222
void reloadHelpResources()
Reload different help resources and clear search-edit and start the new thread.
Definition helpTreeDockWidget.cpp:1302
QMovie * m_previewMovie
Definition helpTreeDockWidget.h:148
bool m_internalCall
Definition helpTreeDockWidget.h:157
int m_autoCollTime
Definition helpTreeDockWidget.h:151
QList< QModelIndex > m_history
Definition helpTreeDockWidget.h:147
static void createFilterWidgetNode(int fOrW, QStandardItemModel *model, const QMap< int, QIcon > *iconGallery)
Get The Filters and put them into a node of the Tree.
Definition helpTreeDockWidget.cpp:137
ito::RetVal parseParamVector(const QString &sectionname, const QVector< ito::Param > &paramVector, QString &content)
Creates the Parameter- and Return- sections in html-Code.
Definition helpTreeDockWidget.cpp:1124
double m_treeWidthInvisible
Definition helpTreeDockWidget.h:153
void propertiesChanged()
(Re)load the help resources if some properties have changed
Definition helpTreeDockWidget.cpp:1274
States m_state
Definition helpTreeDockWidget.h:159
QString parseParam(const QString &tmpl, const ito::Param &param)
Parses a single Parameter to html code (called by parseParamVector)
Definition helpTreeDockWidget.cpp:1183
QStringList separateLink(const QUrl &link)
Returns a list containing the protocol[0] and the real link[1].
Definition helpTreeDockWidget.cpp:1581
void showPluginInfo(const QString &name, HelpItemType type, const QModelIndex &modelIndex, bool fromLink)
slot invoked by different widgets to display a help page from extern
Definition helpTreeDockWidget.cpp:1639
double m_treeWidthVisible
Definition helpTreeDockWidget.h:152
QModelIndex findIndexByPath(const int type, QStringList path, const QStandardItem *current)
finds a model index related to MainModel (not FilterModel)belonging to an Itemname
Definition helpTreeDockWidget.cpp:1710
void liveFilter(const QString &filterText)
slot invoked by toolbar
Definition helpTreeDockWidget.cpp:1546
This class provides a special search function to the help model. The normal filtermodel hides nodes i...
Definition leafFilterProxyModel.h:32
class for parameter handling e.g. to pass parameters to plugins
Definition param.h:477
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40