Engauge Digitizer 2
Loading...
Searching...
No Matches
ChecklistGuideBrowser.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef CHECKLIST_GUIDE_BROWSER_H
8#define CHECKLIST_GUIDE_BROWSER_H
9
10#include "CmdMediator.h"
11#include <QHash>
12#include <QTextBrowser>
13
15class ChecklistGuideBrowser : public QTextBrowser
16{
17 Q_OBJECT;
18
19 public:
22
24 virtual void setTemplateHtml (const QString &html,
25 const QStringList &curveNames);
26
28 void update (const CmdMediator &cmdMediator,
29 bool documentIsExported);
30
31 private slots:
32 void slotAnchorClicked (const QUrl &url);
33
34 private:
35
36 QString ahref (QString &html,
37 const QString &name) const;
38
39 void check (QString &html,
40 const QString &anchor,
41 bool isChecked) const;
42 void divHide (QString &html,
43 const QString &anchor) const;
44 void divShow (QString &html,
45 const QString &anchor) const;
46
49 QString processAhrefs (const QString &htmlBefore);
50
52 QString processCheckboxes (const QString &htmlBefore);
53
55 QString processDivs (const QString &htmlBefore);
56
58 void refresh ();
59
60 void repopulateCheckedTags (const CmdMediator &cmdMediator,
61 bool documentIsExported);
62
63 QString m_templateHtml;
64 QStringList m_curveNames; // Needed for iterating over all Curves in Document
65
66 // Staging area for information that gets displayed. Since this information comes from two sources (QTextBrowser hyperlinks
67 // and Document), this information is stored here. When either QTextBrowser or Document has new data, we update the info here
68 // and then refresh the display
69 QString m_anchor; // From user clicking on a hyperlink in the browser window. Empty value means no div gets shown
70 QHash<QString, bool> m_checkedTags; // From Document. Each tag is in this lookup table if checked, otherwise unchecked. Boolean value is ignored
71};
72
73#endif // CHECKLIST_GUIDE_BROWSER_H
ChecklistGuideBrowser()
Single constructor.
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
virtual void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html. The template html will be converted to real html.
Command queue stack.
Definition CmdMediator.h:24