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 "TutorialStateContext.h"
00015 #include "TutorialStateCurveType.h"
00016
00017 TutorialStateCurveType::TutorialStateCurveType (TutorialStateContext &context) :
00018 TutorialStateAbstractBase (context)
00019 {
00020 }
00021
00022 void TutorialStateCurveType::begin ()
00023 {
00024 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::begin ()";
00025
00026 m_title = createTitle (tr ("Curve Type"));
00027 m_background = createPixmapItem (":/engauge/img/panel_lines_points.png",
00028 QPoint (0, 0));
00029 m_text0 = createTextItem (tr ("The next steps depend on how the curves\n"
00030 "are drawn, in terms of lines and points."),
00031 QPoint (240, 40));
00032 m_text1 = createTextItem (tr ("If the curves are drawn\n"
00033 "with lines (with or without\n"
00034 "points) then click on\n"
00035 "Next (Lines)."),
00036 QPoint (265, 110));
00037 m_text2 = createTextItem (tr ("If the curves are drawn\n"
00038 "without lines and only\n"
00039 "with points, then click on\n"
00040 "Next (Points)."),
00041 QPoint (265, 270));
00042
00043 QSize backgroundSize = context().tutorialDlg().backgroundSize();
00044
00045 m_previous = new TutorialButton (tr ("Previous"),
00046 context().tutorialDlg().scene());
00047 m_previous->setGeometry (QPoint (buttonMargin (),
00048 backgroundSize.height () - buttonMargin() - m_previous->size().height()));
00049 connect (m_previous, SIGNAL (signalTriggered ()), this, SLOT (slotPrevious ()));
00050
00051 m_nextLines = new TutorialButton (tr ("Next (Lines)"),
00052 context().tutorialDlg().scene());
00053 m_nextLines->setGeometry (QPoint (backgroundSize.width () - buttonMargin () - m_nextLines->size ().width (),
00054 backgroundSize.height () / 3.0 - m_nextLines->size ().height () / 2.0));
00055 connect (m_nextLines, SIGNAL (signalTriggered ()), this, SLOT (slotNextCurves ()));
00056
00057 m_nextPoints = new TutorialButton (tr ("Next (Points)"),
00058 context().tutorialDlg().scene());
00059 m_nextPoints->setGeometry (QPoint (backgroundSize.width () - buttonMargin () - m_nextPoints->size ().width (),
00060 backgroundSize.height () * 2.0 / 3.0 - m_nextPoints->size ().height () / 2.0));
00061 connect (m_nextPoints, SIGNAL (signalTriggered ()), this, SLOT (slotNextLines ()));
00062 }
00063
00064 void TutorialStateCurveType::end ()
00065 {
00066 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::end ()";
00067
00068 context().tutorialDlg().scene().removeItem (m_title);
00069 context().tutorialDlg().scene().removeItem (m_background);
00070 context().tutorialDlg().scene().removeItem (m_text0);
00071 context().tutorialDlg().scene().removeItem (m_text1);
00072 context().tutorialDlg().scene().removeItem (m_text2);
00073
00074
00075 delete m_title;
00076 delete m_background;
00077 delete m_text0;
00078 delete m_text1;
00079 delete m_text2;
00080 delete m_nextLines;
00081 delete m_nextPoints;
00082 delete m_previous;
00083
00084 m_title = 0;
00085 m_background = 0;
00086 m_text0 = 0;
00087 m_text1 = 0;
00088 m_text2 = 0;
00089 m_nextLines = 0;
00090 m_nextPoints = 0;
00091 m_previous = 0;
00092 }
00093
00094 void TutorialStateCurveType::slotNextCurves ()
00095 {
00096 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::slotNextCurves";
00097
00098 context().requestDelayedStateTransition (TUTORIAL_STATE_SEGMENT_FILL);
00099 }
00100
00101 void TutorialStateCurveType::slotNextLines ()
00102 {
00103 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::slotNextLines";
00104
00105 context().requestDelayedStateTransition (TUTORIAL_STATE_POINT_MATCH);
00106 }
00107
00108 void TutorialStateCurveType::slotPrevious ()
00109 {
00110 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::slotNextCurves";
00111
00112 context().requestDelayedStateTransition (TUTORIAL_STATE_CURVE_SELECTION);
00113 }