00001
00002
00003
00004
00005
00006
00007 #include "Logger.h"
00008 #include <qdebug.h>
00009 #include <QGraphicsPixmapItem>
00010 #include <QGraphicsScene>
00011 #include <QGraphicsView>
00012 #include "TutorialButton.h"
00013 #include "TutorialDlg.h"
00014 #include "TutorialStateCurveSelection.h"
00015 #include "TutorialStateContext.h"
00016
00017 TutorialStateCurveSelection::TutorialStateCurveSelection (TutorialStateContext &context) :
00018 TutorialStateAbstractBase (context)
00019 {
00020 }
00021
00022 void TutorialStateCurveSelection::begin ()
00023 {
00024 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveSelection::begin ()";
00025
00026 m_title = createTitle ("Curve Selection");
00027 m_background = createPixmapItem (":/engauge/img/panel_curve_selection.png",
00028 QPoint (0, 30));
00029 m_text0 = createTextItem (tr ("After the axis points have been created, a\n"
00030 "curve is selected to receive curve points.\n"
00031 "Step 1 - click on Curve, Point Match, Color\n"
00032 "Picker or Segment Fill buttons."),
00033 QPoint (250, 40));
00034 m_text1 = createTextItem (tr ("Step 2 - Select the desired curve name. If\n"
00035 "that curve name has not been created yet,\n"
00036 "use the menu option Settings / Curve Names\n"
00037 "to create it."),
00038 QPoint (250, 120));
00039 m_text2 = createTextItem (tr ("Step 3 - Change the background from the\n"
00040 "original image to the filtered image\n"
00041 "produced for the current curve, using the\n"
00042 "menu option View / Background / Filtered\n"
00043 "Image. This filtering enables the powerful\n"
00044 "automated algorithms discussed later in\n"
00045 "the tutorial."),
00046 QPoint (250, 200));
00047 m_text3 = createTextItem (tr ("If the current curve is no longer visible\n"
00048 "in the filtered image, then change the\n"
00049 "current Color Filter settings. In the figure,\n"
00050 "the orange points have disappeared."),
00051 QPoint (250, 330));
00052
00053 QSize backgroundSize = context().tutorialDlg().backgroundSize();
00054
00055 m_previous = new TutorialButton (tr ("Previous"),
00056 context().tutorialDlg().scene());
00057 m_previous->setGeometry (QPoint (buttonMargin (),
00058 backgroundSize.height() - buttonMargin() - m_previous->size().height()));
00059 connect (m_previous, SIGNAL (signalTriggered ()), this, SLOT (slotPrevious ()));
00060
00061 m_colorFilter = new TutorialButton (tr ("Color Filter Settings"),
00062 context().tutorialDlg().scene());
00063 m_colorFilter->setGeometry (QPoint (backgroundSize.width () / 2.0 - m_colorFilter->size ().width () / 2,
00064 backgroundSize.height () - buttonMargin () - m_colorFilter->size ().height ()));
00065 connect (m_colorFilter, SIGNAL (signalTriggered ()), this, SLOT (slotColorFilter ()));
00066
00067 m_next = new TutorialButton (tr ("Next"),
00068 context().tutorialDlg().scene());
00069 m_next->setGeometry (QPoint (backgroundSize.width () - buttonMargin () - m_next->size ().width (),
00070 backgroundSize.height () - buttonMargin () - m_next->size ().height ()));
00071 connect (m_next, SIGNAL (signalTriggered ()), this, SLOT (slotNext ()));
00072 }
00073
00074 void TutorialStateCurveSelection::end ()
00075 {
00076 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveSelection::end ()";
00077
00078 context().tutorialDlg().scene().removeItem (m_title);
00079 context().tutorialDlg().scene().removeItem (m_background);
00080 context().tutorialDlg().scene().removeItem (m_text0);
00081 context().tutorialDlg().scene().removeItem (m_text1);
00082 context().tutorialDlg().scene().removeItem (m_text2);
00083 context().tutorialDlg().scene().removeItem (m_text3);
00084
00085
00086 delete m_title;
00087 delete m_background;
00088 delete m_text0;
00089 delete m_text1;
00090 delete m_text2;
00091 delete m_text3;
00092 delete m_next;
00093 delete m_colorFilter;
00094 delete m_previous;
00095
00096 m_title = 0;
00097 m_background = 0;
00098 m_text0 = 0;
00099 m_text1 = 0;
00100 m_text2 = 0;
00101 m_text3 = 0;
00102 m_next = 0;
00103 m_colorFilter = 0;
00104 m_previous = 0;
00105 }
00106
00107 void TutorialStateCurveSelection::slotColorFilter ()
00108 {
00109 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveSelection::slotColorFilter";
00110
00111 context().requestDelayedStateTransition (TUTORIAL_STATE_COLOR_FILTER);
00112 }
00113
00114 void TutorialStateCurveSelection::slotNext ()
00115 {
00116 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveSelection::slotNextCurves";
00117
00118 context().requestDelayedStateTransition (TUTORIAL_STATE_CURVE_TYPE);
00119 }
00120
00121 void TutorialStateCurveSelection::slotPrevious ()
00122 {
00123 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveSelection::slotPrevious";
00124
00125 context().requestDelayedStateTransition (TUTORIAL_STATE_AXIS_POINTS);
00126 }