Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Tutorial
TutorialStateSegmentFill.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 "
TutorialStateContext.h
"
15
#include "
TutorialStateSegmentFill.h
"
16
17
TutorialStateSegmentFill::TutorialStateSegmentFill
(
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
qCInfo(ENGAUGE_LOG) <<
"TutorialStateSegmentFill::TutorialStateSegmentFill"
;
28
}
29
30
void
TutorialStateSegmentFill::begin
()
31
{
32
qCInfo(ENGAUGE_LOG) <<
"TutorialStateSegmentFill::begin ()"
;
33
34
context
().
tutorialDlg
().
scene
().clear ();
35
36
m_title =
createTitle
(tr (
"Segment Fill"
));
37
m_background =
createPixmapItem
(
":/engauge/img/panel_segment_fill.png"
,
38
QPoint (0, 30));
39
m_text0 =
createTextItem
(tr (
"Segment Fill mode places several\n"
40
"points all along the line segments\n"
41
"of a curve. Step 1 - Click on the\n"
42
"Segment Fill button."
),
43
QPoint (300, 40));
44
m_text1 =
createTextItem
(tr (
"Step 2 - Select the curve the new\n"
45
"points will belong to."
),
46
QPoint (300, 140));
47
m_text2 =
createTextItem
(tr (
"Step 3 - Move the cursor over a line\n"
48
"segment in the desired curve. If a\n"
49
"green line appears, click on it once\n"
50
"to generate many points."
),
51
QPoint (300, 220));
52
53
QSize backgroundSize =
context
().
tutorialDlg
().
backgroundSize
();
54
55
m_previous =
new
TutorialButton
(tr (
"Previous"
),
56
context
().tutorialDlg().scene());
57
m_previous->setGeometry (QPoint (
buttonMargin
(),
58
backgroundSize.height() -
buttonMargin
() - m_previous->size().height()));
59
connect (m_previous, SIGNAL (signalTriggered ()),
this
, SLOT (
slotPrevious
()));
60
61
m_next =
new
TutorialButton
(tr (
"Next"
),
62
context
().tutorialDlg().scene());
63
m_next->setGeometry (QPoint (backgroundSize.width () -
buttonMargin
() - m_next->size ().width (),
64
backgroundSize.height () -
buttonMargin
() - m_next->size ().height ()));
65
connect (m_next, SIGNAL (signalTriggered ()),
this
, SLOT (
slotNext
()));
66
}
67
68
void
TutorialStateSegmentFill::end
()
69
{
70
qCInfo(ENGAUGE_LOG) <<
"TutorialStateSegmentFill::end ()"
;
71
72
// It is not safe to remove and deallocate items here since an active TutorialButton
73
// may be on the stack. So we clear the scene as the first step in the next begin()
74
}
75
76
void
TutorialStateSegmentFill::slotNext
()
77
{
78
qCInfo(ENGAUGE_LOG) <<
"TutorialStateSegmentFill::slotNext"
;
79
80
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_CHECKLIST_WIZARD_LINES
);
81
}
82
83
void
TutorialStateSegmentFill::slotPrevious
()
84
{
85
qCInfo(ENGAUGE_LOG) <<
"TutorialStateSegmentFill::slotPrevious"
;
86
87
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_CURVE_TYPE
);
88
}
Logger.h
TutorialButton.h
TutorialDlg.h
TUTORIAL_STATE_CURVE_TYPE
@ TUTORIAL_STATE_CURVE_TYPE
Definition
TutorialStateAbstractBase.h:18
TUTORIAL_STATE_CHECKLIST_WIZARD_LINES
@ TUTORIAL_STATE_CHECKLIST_WIZARD_LINES
Definition
TutorialStateAbstractBase.h:14
TutorialStateContext.h
TutorialStateSegmentFill.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
TutorialStateSegmentFill::end
virtual void end()
Transition out of this state.
Definition
TutorialStateSegmentFill.cpp:68
TutorialStateSegmentFill::slotNext
void slotNext()
Slot called when next button is triggered.
Definition
TutorialStateSegmentFill.cpp:76
TutorialStateSegmentFill::slotPrevious
void slotPrevious()
Slot called to return to previous panel.
Definition
TutorialStateSegmentFill.cpp:83
TutorialStateSegmentFill::TutorialStateSegmentFill
TutorialStateSegmentFill(TutorialStateContext &context)
Single constructor.
Definition
TutorialStateSegmentFill.cpp:17
TutorialStateSegmentFill::begin
virtual void begin()
Transition into this state.
Definition
TutorialStateSegmentFill.cpp:30
Generated on
for Engauge Digitizer by
1.17.0