Engauge Digitizer  2
ChecklistGuideBrowser.h
1 #ifndef CHECKLIST_GUIDE_BROWSER_H
2 #define CHECKLIST_GUIDE_BROWSER_H
3 
4 #include "CmdMediator.h"
5 #include <QHash>
6 #include <QTextBrowser>
7 
9 class ChecklistGuideBrowser : public QTextBrowser
10 {
11  Q_OBJECT;
12 
13  public:
16 
18  virtual void setTemplateHtml (const QString &html,
19  const QStringList &curveNames);
20 
22  void update (const CmdMediator &cmdMediator,
23  bool documentIsExported);
24 
25  private slots:
26  void slotAnchorClicked (const QUrl &url);
27 
28  private:
29 
30  QString ahref (QString &html,
31  const QString &name) const;
32 
33  void check (QString &html,
34  const QString &anchor,
35  bool isChecked) const;
36  void divHide (QString &html,
37  const QString &anchor) const;
38  void divShow (QString &html,
39  const QString &anchor) const;
40 
43  QString processAhrefs (const QString &htmlBefore);
44 
46  QString processCheckboxes (const QString &htmlBefore);
47 
49  QString processDivs (const QString &htmlBefore);
50 
52  void refresh ();
53 
54  void repopulateCheckedTags (const CmdMediator &cmdMediator,
55  bool documentIsExported);
56 
57  QString m_templateHtml;
58  QStringList m_curveNames; // Needed for iterating over all Curves in Document
59 
60  // Staging area for information that gets displayed. Since this information comes from two sources (QTextBrowser hyperlinks
61  // and Document), this information is stored here. When either QTextBrowser or Document has new data, we update the info here
62  // and then refresh the display
63  QString m_anchor; // From user clicking on a hyperlink in the browser window. Empty value means no div gets shown
64  QHash<QString, bool> m_checkedTags; // From Document. Each tag is in this lookup table if checked, otherwise unchecked. Boolean value is ignored
65 };
66 
67 #endif // CHECKLIST_GUIDE_BROWSER_H
virtual void setTemplateHtml(const QString &html, const QStringList &curveNames)
Populate the browser with template html. The template html will be converted to real html...
void update(const CmdMediator &cmdMediator, bool documentIsExported)
Update using current CmdMediator/Document state.
Class that adds rudimentary tree collapse/expand functionality to QTextBrowser.
Command queue stack.
Definition: CmdMediator.h:16
ChecklistGuideBrowser()
Single constructor.