Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Tutorial
TutorialStateCurveType.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 <qmath.h>
13
#include "
TutorialButton.h
"
14
#include "
TutorialDlg.h
"
15
#include "
TutorialStateContext.h
"
16
#include "
TutorialStateCurveType.h
"
17
18
TutorialStateCurveType::TutorialStateCurveType
(
TutorialStateContext
&
context
) :
19
TutorialStateAbstractBase
(
context
),
20
m_title (nullptr),
21
m_background (nullptr),
22
m_text0 (nullptr),
23
m_text1 (nullptr),
24
m_text2 (nullptr),
25
m_previous (nullptr),
26
m_nextLines (nullptr),
27
m_nextPoints (nullptr)
28
{
29
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveType::TutorialStateCurveType"
;
30
}
31
32
void
TutorialStateCurveType::begin
()
33
{
34
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveType::begin ()"
;
35
36
context
().
tutorialDlg
().
scene
().clear ();
37
38
m_title =
createTitle
(tr (
"Curve Type"
));
39
m_background =
createPixmapItem
(
":/engauge/img/panel_lines_points.png"
,
40
QPoint (0, 0));
41
m_text0 =
createTextItem
(tr (
"The next steps depend on how the curves\n"
42
"are drawn, in terms of lines and points."
),
43
QPoint (240, 40));
44
m_text1 =
createTextItem
(tr (
"If the curves are drawn\n"
45
"with lines (with or without\n"
46
"points) then click on\n"
47
"Next (Lines)."
),
48
QPoint (265, 110));
49
m_text2 =
createTextItem
(tr (
"If the curves are drawn\n"
50
"without lines and only\n"
51
"with points, then click on\n"
52
"Next (Points)."
),
53
QPoint (265, 270));
54
55
QSize backgroundSize =
context
().
tutorialDlg
().
backgroundSize
();
56
57
m_previous =
new
TutorialButton
(tr (
"Previous"
),
58
context
().tutorialDlg().scene());
59
m_previous->setGeometry (QPoint (
buttonMargin
(),
60
backgroundSize.height () -
buttonMargin
() - m_previous->size().height()));
61
connect (m_previous, SIGNAL (signalTriggered ()),
this
, SLOT (
slotPrevious
()));
62
63
m_nextLines =
new
TutorialButton
(tr (
"Next (Lines)"
),
64
context
().tutorialDlg().scene());
65
m_nextLines->setGeometry (QPoint (qFloor (backgroundSize.width () -
buttonMargin
() - m_nextLines->size ().width ()),
66
qFloor (backgroundSize.height () / 3.0 - m_nextLines->size ().height () / 2.0)));
67
connect (m_nextLines, SIGNAL (signalTriggered ()),
this
, SLOT (
slotNextCurves
()));
68
69
m_nextPoints =
new
TutorialButton
(tr (
"Next (Points)"
),
70
context
().tutorialDlg().scene());
71
m_nextPoints->setGeometry (QPoint (qFloor (backgroundSize.width () -
buttonMargin
() - m_nextPoints->size ().width ()),
72
qFloor (backgroundSize.height () * 2.0 / 3.0 - m_nextPoints->size ().height () / 2.0)));
73
connect (m_nextPoints, SIGNAL (signalTriggered ()),
this
, SLOT (
slotNextLines
()));
74
}
75
76
void
TutorialStateCurveType::end
()
77
{
78
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveType::end ()"
;
79
80
// It is not safe to remove and deallocate items here since an active TutorialButton
81
// may be on the stack. So we clear the scene as the first step in the next begin()
82
}
83
84
void
TutorialStateCurveType::slotNextCurves
()
85
{
86
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveType::slotNextCurves"
;
87
88
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_SEGMENT_FILL
);
89
}
90
91
void
TutorialStateCurveType::slotNextLines
()
92
{
93
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveType::slotNextLines"
;
94
95
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_POINT_MATCH
);
96
}
97
98
void
TutorialStateCurveType::slotPrevious
()
99
{
100
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveType::slotNextCurves"
;
101
102
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_CURVE_SELECTION
);
103
}
Logger.h
TutorialButton.h
TutorialDlg.h
TUTORIAL_STATE_POINT_MATCH
@ TUTORIAL_STATE_POINT_MATCH
Definition
TutorialStateAbstractBase.h:20
TUTORIAL_STATE_CURVE_SELECTION
@ TUTORIAL_STATE_CURVE_SELECTION
Definition
TutorialStateAbstractBase.h:17
TUTORIAL_STATE_SEGMENT_FILL
@ TUTORIAL_STATE_SEGMENT_FILL
Definition
TutorialStateAbstractBase.h:21
TutorialStateContext.h
TutorialStateCurveType.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
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
TutorialStateCurveType::TutorialStateCurveType
TutorialStateCurveType(TutorialStateContext &context)
Single constructor.
Definition
TutorialStateCurveType.cpp:18
TutorialStateCurveType::slotNextCurves
void slotNextCurves()
Slot called when next button for curves is triggered.
Definition
TutorialStateCurveType.cpp:84
TutorialStateCurveType::begin
virtual void begin()
Transition into this state.
Definition
TutorialStateCurveType.cpp:32
TutorialStateCurveType::end
virtual void end()
Transition out of this state.
Definition
TutorialStateCurveType.cpp:76
TutorialStateCurveType::slotPrevious
void slotPrevious()
Slot called to return to previous panel.
Definition
TutorialStateCurveType.cpp:98
TutorialStateCurveType::slotNextLines
void slotNextLines()
Slot called when next button for lines is triggered.
Definition
TutorialStateCurveType.cpp:91
Generated on
for Engauge Digitizer by
1.17.0