Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Tutorial
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
"
14
#include "
TutorialStateAxisPoints.h
"
15
#include "
TutorialStateContext.h
"
16
17
TutorialStateAxisPoints::TutorialStateAxisPoints
(
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_previous (nullptr),
25
m_next (nullptr)
26
{
27
}
28
29
void
TutorialStateAxisPoints::begin
()
30
{
31
qCInfo(ENGAUGE_LOG) <<
"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
69
void
TutorialStateAxisPoints::end
()
70
{
71
qCInfo(ENGAUGE_LOG) <<
"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
77
void
TutorialStateAxisPoints::slotNext
()
78
{
79
qCInfo(ENGAUGE_LOG) <<
"TutorialStateAxisPoints::slotNextCurves"
;
80
81
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_CURVE_SELECTION
);
82
}
83
84
void
TutorialStateAxisPoints::slotPrevious
()
85
{
86
qCInfo(ENGAUGE_LOG) <<
"TutorialStateAxisPoints::slotPrevious"
;
87
88
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_INTRODUCTION
);
89
}
Logger.h
TutorialButton.h
TutorialDlg.h
TUTORIAL_STATE_CURVE_SELECTION
@ TUTORIAL_STATE_CURVE_SELECTION
Definition
TutorialStateAbstractBase.h:17
TUTORIAL_STATE_INTRODUCTION
@ TUTORIAL_STATE_INTRODUCTION
Definition
TutorialStateAbstractBase.h:19
TutorialStateAxisPoints.h
TutorialStateContext.h
TutorialButton
Show a button with text for clicking ion. The button is implemented using layering of two graphics it...
Definition
TutorialButton.h:21
TutorialDlg::scene
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
Definition
TutorialDlg.cpp:76
TutorialDlg::backgroundSize
QSize backgroundSize() const
Make geometry available for layout.
Definition
TutorialDlg.cpp:44
TutorialStateAbstractBase::TutorialStateAbstractBase
TutorialStateAbstractBase(TutorialStateContext &context)
Single constructor.
Definition
TutorialStateAbstractBase.cpp:18
TutorialStateAbstractBase::createTitle
QGraphicsTextItem * createTitle(const QString &text)
Factory method for title items.
Definition
TutorialStateAbstractBase.cpp:57
TutorialStateAbstractBase::createTextItem
QGraphicsTextItem * createTextItem(const QString &text, const QPoint &pos)
Factory method for text items.
Definition
TutorialStateAbstractBase.cpp:47
TutorialStateAbstractBase::context
TutorialStateContext & context()
Context class for the tutorial state machine.
Definition
TutorialStateAbstractBase.cpp:32
TutorialStateAbstractBase::createPixmapItem
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
Definition
TutorialStateAbstractBase.cpp:37
TutorialStateAbstractBase::buttonMargin
int buttonMargin() const
Buttons are placed up against bottom side, and left or right side, separated by this margin.
Definition
TutorialStateAbstractBase.cpp:27
TutorialStateAxisPoints::begin
virtual void begin()
Transition into this state.
Definition
TutorialStateAxisPoints.cpp:29
TutorialStateAxisPoints::slotNext
void slotNext()
Slot called when next button is triggered.
Definition
TutorialStateAxisPoints.cpp:77
TutorialStateAxisPoints::slotPrevious
void slotPrevious()
Slot called to return to previous panel.
Definition
TutorialStateAxisPoints.cpp:84
TutorialStateAxisPoints::TutorialStateAxisPoints
TutorialStateAxisPoints(TutorialStateContext &context)
Single constructor.
Definition
TutorialStateAxisPoints.cpp:17
TutorialStateAxisPoints::end
virtual void end()
Transition out of this state.
Definition
TutorialStateAxisPoints.cpp:69
TutorialStateContext
Context class for tutorial state machine.
Definition
TutorialStateContext.h:21
TutorialStateContext::requestDelayedStateTransition
void requestDelayedStateTransition(TutorialState tutorialState)
Request a transition to the specified state from the current state.
Definition
TutorialStateContext.cpp:86
TutorialStateContext::tutorialDlg
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.
Definition
TutorialStateContext.cpp:109
Generated on
for Engauge Digitizer by
1.17.0