Engauge Digitizer  2
TutorialStateAxisPoints.cpp
Go to the documentation of this file.
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"
15 #include "TutorialStateContext.h"
16 
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_previous (nullptr),
25  m_next (nullptr)
26 {
27 }
28 
30 {
31  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateAxisPoints::begin ()";
32 
33  context().tutorialDlg().scene().clear ();
34 
35  m_title = createTitle (tr ("Axis Points"));
36  m_background = createPixmapItem (":/engauge/img/panel_axis_points.png",
37  QPoint (0, 30));
38  m_text0 = createTextItem (tr ("Axis points are first defined to\n"
39  "define the coordinates. Step 1 -\n"
40  "Click on the Axis Points button"),
41  QPoint (320, 60));
42  m_text1 = createTextItem (tr ("Step 2 - Click on an axis or grid\n"
43  "line with known coordinates. An axis\n"
44  "point appears, with a dialog window\n"
45  "for entering the axis point\n"
46  "coordinates"),
47  QPoint (300, 210));
48  m_text2 = createTextItem (tr ("Step 3 - Enter the two coordinates\n"
49  "of the axis point and then click Ok.\n"
50  "Repeat steps 2 and 3 twice more\n"
51  "until three axis points are created"),
52  QPoint (280, 320));
53 
54  QSize backgroundSize = context().tutorialDlg().backgroundSize();
55 
56  m_previous = new TutorialButton (tr ("Previous"),
57  context().tutorialDlg().scene());
58  m_previous->setGeometry (QPoint (buttonMargin (),
59  backgroundSize.height() - buttonMargin() - m_previous->size().height()));
60  connect (m_previous, SIGNAL (signalTriggered ()), this, SLOT (slotPrevious ()));
61 
62  m_next = new TutorialButton (tr ("Next"),
63  context().tutorialDlg().scene());
64  m_next->setGeometry (QPoint (backgroundSize.width () - buttonMargin () - m_next->size ().width (),
65  backgroundSize.height () - buttonMargin () - m_next->size ().height ()));
66  connect (m_next, SIGNAL (signalTriggered ()), this, SLOT (slotNext ()));
67 }
68 
70 {
71  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateAxisPoints::end ()";
72 
73  // It is not safe to remove and deallocate items here since an active TutorialButton
74  // may be on the stack. So we clear the scene as the first step in the next begin()
75 }
76 
78 {
79  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateAxisPoints::slotNextCurves";
80 
82 }
83 
85 {
86  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateAxisPoints::slotPrevious";
87 
89 }
One state manages one panel of the tutorial.
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...
Show a button with text for clicking ion. The button is implemented using layering of two graphics it...
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
void slotNext()
Slot called when next button is triggered.
virtual void begin()
Transition into this state.
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
Definition: TutorialDlg.cpp:76
TutorialStateAxisPoints(TutorialStateContext &context)
Single constructor.
void slotPrevious()
Slot called to return to previous panel.
TutorialStateContext & context()
Context class for the tutorial state machine.
QGraphicsTextItem * createTextItem(const QString &text, const QPoint &pos)
Factory method for text items.
virtual void end()
Transition out of this state.
QGraphicsTextItem * createTitle(const QString &text)
Factory method for title items.
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
QSize backgroundSize() const
Make geometry available for layout.
Definition: TutorialDlg.cpp:44
log4cpp::Category * mainCat
Definition: Logger.cpp:14
Context class for tutorial state machine.
int buttonMargin() const
Buttons are placed up against bottom side, and left or right side, separated by this margin.
void requestDelayedStateTransition(TutorialState tutorialState)
Request a transition to the specified state from the current state.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.