1 /******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7 #include "Logger.h"
8 #include <qdebug.h>
9 #include <QGraphicsPixmapItem>
10 #include <QGraphicsScene>
11 #include <QGraphicsView>
12 #include "TutorialButton.h"
13 #include "TutorialDlg.h"
14 #include "TutorialStateContext.h"
15 #include "TutorialStateIntroduction.h"
16
TutorialStateIntroduction(TutorialStateContext & context)17 TutorialStateIntroduction::TutorialStateIntroduction (TutorialStateContext &context) :
18 TutorialStateAbstractBase (context),
19 m_title (nullptr),
20 m_background (nullptr),
21 m_text0 (nullptr),
22 m_text1 (nullptr),
23 m_text2 (nullptr),
24 m_next (nullptr)
25 {
26 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::TutorialStateIntroduction";
27 }
28
begin()29 void TutorialStateIntroduction::begin ()
30 {
31 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::begin ()";
32
33 context().tutorialDlg().scene().clear ();
34
35 m_title = createTitle (tr ("Introduction"));
36 m_background = createPixmapItem (":/engauge/img/SpreadsheetsForDoc.png",
37 QPoint (0, 0));
38 m_text0 = createTextItem (tr ("Engauge Digitizer starts with\n"
39 "images of graphs and maps."),
40 QPoint (200, 40));
41 m_text1 = createTextItem (tr ("You create (or digitize) points along\n"
42 "the graph and map curves."),
43 QPoint (240, 180));
44 m_text2 = createTextItem (tr ("The digitized curve points can be\n"
45 "exported, as numbers, to other software tools."),
46 QPoint (210, 330));
47
48 QSize backgroundSize = context().tutorialDlg().backgroundSize();
49
50 m_next = new TutorialButton (tr ("Next"),
51 context().tutorialDlg().scene());
52 m_next->setGeometry (QPoint (backgroundSize.width () - buttonMargin () - m_next->size ().width (),
53 backgroundSize.height () - buttonMargin () - m_next->size ().height ()));
54 connect (m_next, SIGNAL (signalTriggered ()), this, SLOT (slotNext ()));
55 }
56
end()57 void TutorialStateIntroduction::end ()
58 {
59 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::end ()";
60
61 // It is not safe to remove and deallocate items here since an active TutorialButton
62 // may be on the stack. So we clear the scene as the first step in the next begin()
63 }
64
slotNext()65 void TutorialStateIntroduction::slotNext ()
66 {
67 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::slotNext";
68
69 context().requestDelayedStateTransition (TUTORIAL_STATE_AXIS_POINTS);
70 }
71