Engauge Digitizer 2
Loading...
Searching...
No Matches
TutorialStateIntroduction.cpp
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
21
23{
24 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::begin ()";
25
26 m_title = createTitle (tr ("Introduction"));
27 m_background = createPixmapItem (":/engauge/img/SpreadsheetsForDoc.png",
28 QPoint (0, 0));
29 m_text0 = createTextItem (tr ("Engauge Digitizer starts with\n"
30 "images of graphs and maps."),
31 QPoint (200, 40));
32 m_text1 = createTextItem (tr ("You create (or digitize) points along\n"
33 "the graph and map curves."),
34 QPoint (240, 180));
35 m_text2 = createTextItem (tr ("The digitized curve points can be\n"
36 "exported, as numbers, to other software tools."),
37 QPoint (210, 330));
38
39 QSize backgroundSize = context().tutorialDlg().backgroundSize();
40
41 m_next = new TutorialButton (tr ("Next"),
42 context().tutorialDlg().scene());
43 m_next->setGeometry (QPoint (backgroundSize.width () - buttonMargin () - m_next->size ().width (),
44 backgroundSize.height () - buttonMargin () - m_next->size ().height ()));
45 connect (m_next, SIGNAL (signalTriggered ()), this, SLOT (slotNext ()));
46}
47
49{
50 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::end ()";
51
52 context().tutorialDlg().scene().removeItem (m_title);
53 context().tutorialDlg().scene().removeItem (m_background);
54 context().tutorialDlg().scene().removeItem (m_text0);
55 context().tutorialDlg().scene().removeItem (m_text1);
56 context().tutorialDlg().scene().removeItem (m_text2);
57 // TutorialButtons removes themselves from the scene
58
59 delete m_title;
60 delete m_background;
61 delete m_text0;
62 delete m_text1;
63 delete m_text2;
64 delete m_next;
65
66 m_title = 0;
67 m_background = 0;
68 m_text0 = 0;
69 m_text1 = 0;
70 m_text2 = 0;
71 m_next = 0;
72}
73
75{
76 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateIntroduction::slotNext";
77
78 context().requestDelayedStateTransition (TUTORIAL_STATE_AXIS_POINTS);
79}
Show a button with text for clicking ion. The button is implemented using layering of two graphics it...
QSize size() const
Size of this button.
void setGeometry(const QPoint &pos)
Set the position. This is called after creation so screen extent is available for positioning calcula...
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
QSize backgroundSize() const
Make geometry available for layout.
One state manages one panel of the tutorial.
QGraphicsTextItem * createTitle(const QString &text)
Factory method for title items.
QGraphicsTextItem * createTextItem(const QString &text, const QPoint &pos)
Factory method for text items.
TutorialStateContext & context()
Context class for the tutorial state machine.
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
int buttonMargin() const
Buttons are placed up against bottom side, and left or right side, separated by this margin.
Context class for tutorial state machine.
void requestDelayedStateTransition(TutorialState tutorialState)
Request a transition to the specified state from the current state.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.
void slotNext()
Slot called when next button is triggered.
virtual void end()
Transition out of this state.
virtual void begin()
Transition into this state.
TutorialStateIntroduction(TutorialStateContext &context)
Single constructor.