Engauge Digitizer  2
ChecklistGuideWizard.cpp
1 #include "ChecklistGuidePage.h"
2 #include "ChecklistGuidePageConclusion.h"
3 #include "ChecklistGuidePageCurves.h"
4 #include "ChecklistGuidePageIntro.h"
5 #include "ChecklistGuideWizard.h"
6 #include "ChecklistTemplate.h"
7 #include "ColorFilterSettings.h"
8 #include "Logger.h"
9 #include "MainWindow.h"
10 #include <QGridLayout>
11 #include <QHeaderView>
12 #include <QPushButton>
13 #include <QRadioButton>
14 #include <QTextStream>
15 #include <QVBoxLayout>
16 
18  m_mainWindow (mainWindow),
19  m_dialogName ("ChecklistGuide")
20 {
21  setWindowTitle (tr ("Checklist Guide Wizard"));
22  setModal (true);
23  QPixmap splash (":/engauge/img/SpreadsheetsForDoc.png");
24  setPixmap (QWizard::WatermarkPixmap, splash); // For ClassicStyle and ModernStyle
25  setPixmap (QWizard::BackgroundPixmap, splash); // For MacStyle
26 
27  m_pageIntro = new ChecklistGuidePageIntro();
28  m_pageCurves = new ChecklistGuidePageCurves();
29  m_pageConclusion = new ChecklistGuidePageConclusion();
30 
31  addPage(m_pageIntro);
32  addPage(m_pageCurves);
33  addPage(m_pageConclusion);
34 }
35 
37 {
38  return m_pageCurves->curveNames();
39 }
40 
42 {
43  LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::populateCurvesGraphs";
44 
45  QStringList curveNames = m_pageCurves->curveNames();
46  QStringList::const_iterator itr;
47  for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
48 
49  QString curveName = *itr;
50 
51  curvesGraphs.addGraphCurveAtEnd(Curve (curveName,
54  PointStyle::defaultGraphCurve (curvesGraphs.numCurves ()))));
55  }
56 }
57 
59 {
60  LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::templateHtml";
61 
62  QStringList curveNames = m_pageCurves->curveNames();
63  bool withLines = m_pageCurves->withLines();
64 
65  QString html;
66  QTextStream str (&html);
67 
68  // Insert additional space between successive list items, using stylesheet
69  str << "<style type='text/css'>li { margin-top: 10px 0; }</style>";
70 
71  str << "<p>The coordinates are defined by creating axis points:</p>\n";
72  str << "<p>" << TAG_ANCHOR_AXIS_1 << "&nbsp;Add first of three axis points. " << TAG_AHREF_AXIS_1 << "</p>\n";
73  str << TAG_DIV_AXIS_START_1;
74  str << "<ul>\n";
75  str << "<li>Click on <img src="":/engauge/img/16-DigitAxis""> for <b>Axis Points</b> mode</li>\n";
76  str << "<li>Click on an axis tick mark, or intersection of two grid lines, with labeled coordinates</li>\n";
77  str << "<li>Enter the coordinates of the axis point</li>\n";
78  str << "<li>Click on Ok</li>\n";
79  str << "</ul>\n";
80  str << TAG_DIV_AXIS_END_1;
81  str << "<p>" << TAG_ANCHOR_AXIS_2 << "&nbsp;Add second of three axis points. " << TAG_AHREF_AXIS_2 << "</p>\n";
82  str << TAG_DIV_AXIS_START_2;
83  str << "<ul>\n";
84  str << "<li>Click on <img src="":/engauge/img/16-DigitAxis""> for <b>Axis Points</b> mode</li>\n";
85  str << "<li>Click on an axis tick mark, or intersection of two grid lines, with labeled coordinates, away from the other axis point</li>\n";
86  str << "<li>Enter the coordinates of the axis point</li>\n";
87  str << "<li>Click on Ok</li>\n";
88  str << "</ul>\n";
89  str << TAG_DIV_AXIS_END_2;
90  str << "<p>" << TAG_ANCHOR_AXIS_3 << "&nbsp;Add third of three axis points. " << TAG_AHREF_AXIS_3 << "</p>\n";
91  str << TAG_DIV_AXIS_START_3;
92  str << "<ul>\n";
93  str << "<li>Click on <img src="":/engauge/img/16-DigitAxis""> for <b>Axis Points</b> mode</li>\n";
94  str << "<li>Click on an axis tick mark, or intersection of two grid lines, with labeled coordinates, away from the other axis points</li>\n";
95  str << "<li>Enter the coordinates of the axis point</li>\n";
96  str << "<li>Click on Ok</li>\n";
97  str << "</ul>\n";
98  str << TAG_DIV_AXIS_END_3;
99 
100  str << "<p>&nbsp;</p>\n";
101  str << "<p>Points are digitized along each curve:</p>\n";
102  QStringList::const_iterator itr;
103  for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
104 
105  QString curveName = *itr;
106 
107  QString tagACurve = QString ("%1%2%3")
108  .arg (TAG_AHREF_DELIMITER_START)
109  .arg (curveName)
110  .arg (TAG_AHREF_DELIMITER_END);
111 
112  str << "<p>" << TAG_ANCHOR_DELIMITER_START << curveName << TAG_ANCHOR_DELIMITER_END
113  << "&nbsp;Add points for curve <b>" << curveName << "</b>. " << tagACurve << "</p>\n";
114  str << TAG_DIV_DELIMITER_START << curveName << TAG_DIV_DELIMITER_END;
115  str << "<ul>\n";
116 
117  if (withLines) {
118 
119  str << "<li>Click on <img src="":/engauge/img/16-DigitSegment""> for <b>Segment Fill</b> mode</li>\n";
120  str << "<li>Select curve <b>" << curveName << "</b> in the drop-down list</li>\n";
121  str << "<li>Move the cursor over the curve. If a line does not appear then adjust the <b>Color Filter</b> settings for this curve:\n";
122  str << templateHtmlToAdjustColorFilterSettings () << "</li>\n";
123  str << "<li>Move the cursor over the curve again. When the <b>Segment Fill</b> line appears, click on it to generate points</li>\n";
124  str << "</ul>\n";
125 
126  } else {
127 
128  str << "<li>Click on <img src="":/engauge/img/16-DigitPointMatch""> for <b>Point Match</b> mode</li>\n";
129  str << "<li>Select curve <b>" << curveName << "</b> in the drop-down list</li>\n";
130  str << "<li>Move the cursor over a typical point in the curve. If the cursor circle does not change color then adjust";
131  str << " the <b>Color Filter</b> settings for this curve:\n";
132  str << templateHtmlToAdjustColorFilterSettings () << "</li>\n";
133  str << "<li>Move the cursor over a typical point in the curve again. Click on the point to start point matching</li>\n";
134  str << "<li>Engauge will display a candidate point. To accept that candidate point, press the right arrow key</li>\n";
135  str << "<li>The previous step repeats until you select a different mode</li>\n";
136  str << "</ul>\n";
137  }
138 
139  str << TAG_DIV_DELIMITER_START_SLASH << curveName << TAG_DIV_DELIMITER_END;
140  }
141 
142  str << "<p>&nbsp;</p>\n";
143  str << "<p>The digitized points can be exported:</p>\n";
144  str << "<p>" << TAG_ANCHOR_EXPORT << "&nbsp;Export the points to a file. " << TAG_AHREF_EXPORT << "</p>\n";
145  str << TAG_DIV_EXPORT_START;
146  str << "<ul>\n";
147  str << "<li>Select menu option <b>File / Export</b></li>\n";
148  str << "<li>Enter the file name</li>\n";
149  str << "<li>Click on Ok</li>\n";
150  str << "<li>Congratulations!</li>\n";
151  str << "</ul>\n";
152  str << TAG_DIV_EXPORT_END;
153 
154  str << "<p>&nbsp;</p>\n";
155  str << "<p>Hint - The background image can be switched between the original image and filtered image. " << TAG_AHREF_BACKGROUND << "</p>\n";
156  str << TAG_DIV_BACKGROUND_START;
157  str << "<ul>\n";
158  str << "<li>Select menu option <b>View / Background / Show Original Image</b> to see the original image</li>\n";
159  str << "<li>Select menu option <b>View / Background / Show Filtered Image</b> to see the image from <b>Color Filter</b></li>\n";
160  str << "</ul>\n";
161  str << TAG_DIV_BACKGROUND_END;
162 
163  return html;
164 }
165 
166 QString ChecklistGuideWizard::templateHtmlToAdjustColorFilterSettings () const
167 {
168  LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::templateHtmlToAdjustColorFilterSettings";
169 
170  QString html;
171  QTextStream str (&html);
172 
173  str << " <ul>\n";
174  str << " <li>Select menu option <b>Settings / Color Filter</b><li>\n";
175  str << " <li>Select the method for filtering. Hue is best if the curves have different colors</li>\n";
176  str << " <li>Slide the green buttons back and forth until the curve is easily visible in the preview window</li>\n";
177  str << " <li>Click on Ok</li>\n";
178  str << " </ul>\n";
179 
180  return html;
181 }
ChecklistGuideWizard(MainWindow &mainWindow)
Single constructor.
static LineStyle defaultGraphCurve(int index)
Initial default for index'th graph curve.
Definition: LineStyle.cpp:55
QString templateHtml() const
Template html comprising the checklist for display.
int numCurves() const
Current number of graphs curves.
void addGraphCurveAtEnd(Curve curve)
Append new graph Curve to end of Curve list.
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
Container for all graph curves. The axes point curve is external to this class.
Definition: CurvesGraphs.h:18
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:12
Container for one set of digitized Points.
Definition: Curve.h:26
This class sets up the introduction page.
QStringList curveNames() const
Curve names to be placed into Document.
bool withLines() const
Drawn with lines, else points.
void populateCurvesGraphs(CurvesGraphs &curvesGraphs)
Create entries in CurvesGraphs for each curve name that user provided.
QStringList curveNames() const
Wizard selection for curve names.
This class adds validation to the Curves page.
This class uses the validation method of the Conclusion page to perform final processing for Checklis...
static PointStyle defaultGraphCurve(int index)
Initial default for index'th graph curve.
Definition: PointStyle.cpp:57
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:60