00001
00002
00003
00004
00005
00006
00007 #include "ChecklistGuidePage.h"
00008 #include "ChecklistGuidePageConclusion.h"
00009 #include "ChecklistGuidePageCurves.h"
00010 #include "ChecklistGuidePageIntro.h"
00011 #include "ChecklistGuideWizard.h"
00012 #include "ChecklistTemplate.h"
00013 #include "ColorFilterSettings.h"
00014 #include "EngaugeAssert.h"
00015 #include "Logger.h"
00016 #include "MainWindow.h"
00017 #include <QGridLayout>
00018 #include <QHeaderView>
00019 #include <QPushButton>
00020 #include <QRadioButton>
00021 #include <QTextStream>
00022 #include <QVBoxLayout>
00023
00024 ChecklistGuideWizard::ChecklistGuideWizard (MainWindow &mainWindow,
00025 unsigned int numberCoordSystem) :
00026 m_mainWindow (mainWindow),
00027 m_dialogName ("ChecklistGuide")
00028 {
00029 setWindowTitle (tr ("Checklist Guide Wizard"));
00030 setModal (true);
00031 QPixmap splash (":/engauge/img/SpreadsheetsForDoc.png");
00032 setPixmap (QWizard::WatermarkPixmap, splash);
00033 setPixmap (QWizard::BackgroundPixmap, splash);
00034
00035 m_pageIntro = new ChecklistGuidePageIntro();
00036 addPage(m_pageIntro);
00037
00038 for (CoordSystemIndex coordSystemIndex = 0; coordSystemIndex < numberCoordSystem; coordSystemIndex++) {
00039 m_pageCurves.push_back (new ChecklistGuidePageCurves(pageCurvesTitle (coordSystemIndex, numberCoordSystem)));
00040 addPage(m_pageCurves.last());
00041 }
00042
00043 m_pageConclusion = new ChecklistGuidePageConclusion();
00044 addPage(m_pageConclusion);
00045 }
00046
00047 QStringList ChecklistGuideWizard::curveNames(CoordSystemIndex coordSystemIndex) const
00048 {
00049 return m_pageCurves [coordSystemIndex]->curveNames();
00050 }
00051
00052 QString ChecklistGuideWizard::pageCurvesTitle (CoordSystemIndex coordSystemIndex,
00053 unsigned int numberCoordSystem) const
00054 {
00055 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::pageCurvesTitle";
00056
00057 ENGAUGE_ASSERT (coordSystemIndex < numberCoordSystem);
00058
00059 if (numberCoordSystem == 1) {
00060
00061
00062 return tr ("Curves");
00063
00064 } else {
00065
00066
00067 unsigned int indexOneBased = coordSystemIndex + 1;
00068 return QString ("%1 %2")
00069 .arg (QObject::tr ("Curves for coordinate system"))
00070 .arg (indexOneBased);
00071
00072 }
00073 }
00074
00075 void ChecklistGuideWizard::populateCurvesGraphs (CoordSystemIndex coordSystemIndex,
00076 CurvesGraphs &curvesGraphs)
00077 {
00078 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::populateCurvesGraphs";
00079
00080 QStringList curveNames = m_pageCurves [coordSystemIndex]->curveNames();
00081 QStringList::const_iterator itr;
00082 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
00083
00084 QString curveName = *itr;
00085
00086 curvesGraphs.addGraphCurveAtEnd(Curve (curveName,
00087 ColorFilterSettings::defaultFilter (),
00088 CurveStyle (LineStyle::defaultGraphCurve (curvesGraphs.numCurves ()),
00089 PointStyle::defaultGraphCurve (curvesGraphs.numCurves ()))));
00090 }
00091 }
00092
00093 QString ChecklistGuideWizard::templateHtml (CoordSystemIndex coordSystemIndex) const
00094 {
00095 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::templateHtml";
00096
00097 QStringList curveNames = m_pageCurves [coordSystemIndex]->curveNames();
00098 bool withLines = m_pageCurves [coordSystemIndex]->withLines();
00099
00100 QString html;
00101 QTextStream str (&html);
00102
00103
00104 str << "<style type='text/css'>li { margin-top: 10px 0; }</style>";
00105
00106 str << "<p>" << tr ("Follow this checklist of steps to digitize your image. Each step will show a check when it has been completed.");
00107 str << "<p>" << tr ("The coordinates are defined by creating axis points:") << "</p>\n";
00108 str << "<p>" << TAG_ANCHOR_AXIS_1 << " " << tr ("Add first of three axis points.") << " " << TAG_AHREF_AXIS_1 << "</p>\n";
00109 str << TAG_DIV_AXIS_START_1;
00110 str << "<ul>\n";
00111 str << "<li>" << tr ("Click on") << " <img src="":/engauge/img/16-DigitAxis""> " << tr ("for <b>Axis Points</b> mode") << "</li>\n";
00112 str << "<li>" << tr ("Click on an axis tick mark, or intersection of two grid lines, with labeled coordinates") << "</li>\n";
00113 str << "<li>" << tr ("Enter the coordinates of the axis point") << "</li>\n";
00114 str << "<li>" << tr ("Click on Ok") << "</li>\n";
00115 str << "</ul>\n";
00116 str << TAG_DIV_AXIS_END_1;
00117 str << "<p>" << TAG_ANCHOR_AXIS_2 << " " << tr ("Add second of three axis points.") << " " << TAG_AHREF_AXIS_2 << "</p>\n";
00118 str << TAG_DIV_AXIS_START_2;
00119 str << "<ul>\n";
00120 str << "<li>" << tr ("Click on") << " <img src="":/engauge/img/16-DigitAxis""> " << tr ("for <b>Axis Points</b> mode") << "</li>\n";
00121 str << "<li>" << tr ("Click on an axis tick mark, or intersection of two grid lines, with labeled coordinates, away from the other axis point") << "</li>\n";
00122 str << "<li>" << tr ("Enter the coordinates of the axis point") << "</li>\n";
00123 str << "<li>" << tr ("Click on Ok") << "</li>\n";
00124 str << "</ul>\n";
00125 str << TAG_DIV_AXIS_END_2;
00126 str << "<p>" << TAG_ANCHOR_AXIS_3 << " " << tr ("Add third of three axis points.") << " " << TAG_AHREF_AXIS_3 << "</p>\n";
00127 str << TAG_DIV_AXIS_START_3;
00128 str << "<ul>\n";
00129 str << "<li>" << tr ("Click on") << " <img src="":/engauge/img/16-DigitAxis""> " << tr ("for <b>Axis Points</b> mode") << "</li>\n";
00130 str << "<li>" << tr ("Click on an axis tick mark, or intersection of two grid lines, with labeled coordinates, away from the other axis points") << "</li>\n";
00131 str << "<li>" << tr ("Enter the coordinates of the axis point") << "</li>\n";
00132 str << "<li>" << tr ("Click on Ok") << "</li>\n";
00133 str << "</ul>\n";
00134 str << TAG_DIV_AXIS_END_3;
00135
00136 str << "<p> </p>\n";
00137 str << "<p>" << tr ("Points are digitized along each curve:") << "</p>\n";
00138 QStringList::const_iterator itr;
00139 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
00140
00141 QString curveName = *itr;
00142
00143 QString tagACurve = QString ("%1%2%3")
00144 .arg (TAG_AHREF_DELIMITER_START)
00145 .arg (curveName)
00146 .arg (TAG_AHREF_DELIMITER_END);
00147
00148 str << "<p>" << TAG_ANCHOR_DELIMITER_START << curveName << TAG_ANCHOR_DELIMITER_END
00149 << " " << tr ("Add points for curve") << " <b>" << curveName << "</b>. " << tagACurve << "</p>\n";
00150 str << TAG_DIV_DELIMITER_START << curveName << TAG_DIV_DELIMITER_END;
00151 str << "<ul>\n";
00152
00153 if (withLines) {
00154
00155 str << "<li>" << tr ("Click on") << " <img src="":/engauge/img/16-DigitSegment""> " << tr ("for <b>Segment Fill</b> mode") << "</li>\n";
00156 str << "<li>" << tr ("Select curve") << " <b>" << curveName << "</b> " << tr ("in the drop-down list") << "</li>\n";
00157 str << "<li>" << tr ("Move the cursor over the curve. If a line does not appear then adjust the <b>Color Filter</b> settings for this curve") << ":\n";
00158 str << templateHtmlToAdjustColorFilterSettings () << "</li>\n";
00159 str << "<li>" << tr ("Move the cursor over the curve again. When the <b>Segment Fill</b> line appears, click on it to generate points") << "</li>\n";
00160 str << "</ul>\n";
00161
00162 } else {
00163
00164 str << "<li>" << tr ("Click on") << " <img src="":/engauge/img/16-DigitPointMatch""> " << tr ("for <b>Point Match</b> mode") << "</li>\n";
00165 str << "<li>" << tr ("Select curve") << " <b>" << curveName << "</b> " << tr ("in the drop-down list") << "</li>\n";
00166 str << "<li>" << tr ("Move the cursor over a typical point in the curve. If the cursor circle does not change color then adjust "
00167 "the <b>Color Filter</b> settings for this curve") << ":\n";
00168 str << templateHtmlToAdjustColorFilterSettings () << "</li>\n";
00169 str << "<li>" << tr ("Move the cursor over a typical point in the curve again. Click on the point to start point matching") << "</li>\n";
00170 str << "<li>" << tr ("Engauge will display a candidate point. To accept that candidate point, press the right arrow key") << "</li>\n";
00171 str << "<li>" << tr ("The previous step repeats until you select a different mode") << "</li>\n";
00172 str << "</ul>\n";
00173 }
00174
00175 str << TAG_DIV_DELIMITER_START_SLASH << curveName << TAG_DIV_DELIMITER_END;
00176 }
00177
00178 str << "<p> </p>\n";
00179 str << "<p>" << tr ("The digitized points can be exported") << ":</p>\n";
00180 str << "<p>" << TAG_ANCHOR_EXPORT << " " << tr ("Export the points to a file") << ". " << TAG_AHREF_EXPORT << "</p>\n";
00181 str << TAG_DIV_EXPORT_START;
00182 str << "<ul>\n";
00183 str << "<li>" << tr ("Select menu option <b>File / Export</b>") << "</li>\n";
00184 str << "<li>" << tr ("Enter the file name") << "</li>\n";
00185 str << "<li>" << tr ("Click on Ok") << "</li>\n";
00186 str << "<li>" << tr ("Congratulations!") << "</li>\n";
00187 str << "</ul>\n";
00188 str << TAG_DIV_EXPORT_END;
00189
00190 str << "<p> </p>\n";
00191 str << "<p>" << tr ("Hint - The background image can be switched between the original image and filtered image.") << " " << TAG_AHREF_BACKGROUND << "</p>\n";
00192 str << TAG_DIV_BACKGROUND_START;
00193 str << "<ul>\n";
00194 str << "<li>" << tr ("Select menu option <b>View / Background / Show Original Image</b> to see the original image") << "</li>\n";
00195 str << "<li>" << tr ("Select menu option <b>View / Background / Show Filtered Image</b> to see the image from <b>Color Filter</b>") << "</li>\n";
00196 str << "</ul>\n";
00197 str << TAG_DIV_BACKGROUND_END;
00198
00199 return html;
00200 }
00201
00202 QString ChecklistGuideWizard::templateHtmlToAdjustColorFilterSettings () const
00203 {
00204 LOG4CPP_INFO_S ((*mainCat)) << "ChecklistGuideWizard::templateHtmlToAdjustColorFilterSettings";
00205
00206 QString html;
00207 QTextStream str (&html);
00208
00209 str << " <ul>\n";
00210 str << " <li>" << tr ("Select menu option <b>Settings / Color Filter</b>") << "<li>\n";
00211 str << " <li>" << tr ("Select the method for filtering. Hue is best if the curves have different colors") << "</li>\n";
00212 str << " <li>" << tr ("Slide the green buttons back and forth until the curve is easily visible in the preview window") << "</li>\n";
00213 str << " <li>" << tr ("Click on Ok") << "</li>\n";
00214 str << " </ul>\n";
00215
00216 return html;
00217 }