Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Tutorial
TutorialStateCurveSelection.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 "
TutorialStateCurveSelection.h
"
16
#include "
TutorialStateContext.h
"
17
18
TutorialStateCurveSelection::TutorialStateCurveSelection
(
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_text3 (nullptr),
26
m_previous (nullptr),
27
m_colorFilter (nullptr),
28
m_next (nullptr)
29
{
30
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveSelection::TutorialStateCurveSelection"
;
31
}
32
33
void
TutorialStateCurveSelection::begin
()
34
{
35
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveSelection::begin ()"
;
36
37
context
().
tutorialDlg
().
scene
().clear ();
38
39
m_title =
createTitle
(
"Curve Selection"
);
40
m_background =
createPixmapItem
(
":/engauge/img/panel_curve_selection.png"
,
41
QPoint (0, 30));
42
m_text0 =
createTextItem
(tr (
"After the axis points have been created, a\n"
43
"curve is selected to receive curve points.\n"
44
"Step 1 - click on Curve, Point Match, Color\n"
45
"Picker or Segment Fill buttons."
),
46
QPoint (250, 40));
47
m_text1 =
createTextItem
(tr (
"Step 2 - Select the desired curve name. If\n"
48
"that curve name has not been created yet,\n"
49
"use the menu option Settings / Curve Names\n"
50
"to create it."
),
51
QPoint (250, 120));
52
m_text2 =
createTextItem
(tr (
"Step 3 - Change the background from the\n"
53
"original image to the filtered image\n"
54
"produced for the current curve, using the\n"
55
"menu option View / Background / Filtered\n"
56
"Image. This filtering enables the powerful\n"
57
"automated algorithms discussed later in\n"
58
"the tutorial."
),
59
QPoint (250, 200));
60
m_text3 =
createTextItem
(tr (
"If the current curve is no longer visible\n"
61
"in the filtered image, then change the\n"
62
"current Color Filter settings. In the figure,\n"
63
"the orange points have disappeared."
),
64
QPoint (250, 330));
65
66
QSize backgroundSize =
context
().
tutorialDlg
().
backgroundSize
();
67
68
m_previous =
new
TutorialButton
(tr (
"Previous"
),
69
context
().tutorialDlg().scene());
70
m_previous->setGeometry (QPoint (
buttonMargin
(),
71
backgroundSize.height() -
buttonMargin
() - m_previous->size().height()));
72
connect (m_previous, SIGNAL (signalTriggered ()),
this
, SLOT (
slotPrevious
()));
73
74
m_colorFilter =
new
TutorialButton
(tr (
"Color Filter Settings"
),
75
context
().tutorialDlg().scene());
76
m_colorFilter->setGeometry (QPoint (qFloor (backgroundSize.width () / 2.0 - m_colorFilter->size ().width () / 2),
77
qFloor (backgroundSize.height () -
buttonMargin
() - m_colorFilter->size ().height ())));
78
connect (m_colorFilter, SIGNAL (signalTriggered ()),
this
, SLOT (
slotColorFilter
()));
79
80
m_next =
new
TutorialButton
(tr (
"Next"
),
81
context
().tutorialDlg().scene());
82
m_next->setGeometry (QPoint (backgroundSize.width () -
buttonMargin
() - m_next->size ().width (),
83
backgroundSize.height () -
buttonMargin
() - m_next->size ().height ()));
84
connect (m_next, SIGNAL (signalTriggered ()),
this
, SLOT (
slotNext
()));
85
}
86
87
void
TutorialStateCurveSelection::end
()
88
{
89
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveSelection::end ()"
;
90
91
// It is not safe to remove and deallocate items here since an active TutorialButton
92
// may be on the stack. So we clear the scene as the first step in the next begin()
93
}
94
95
void
TutorialStateCurveSelection::slotColorFilter
()
96
{
97
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveSelection::slotColorFilter"
;
98
99
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_COLOR_FILTER
);
100
}
101
102
void
TutorialStateCurveSelection::slotNext
()
103
{
104
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveSelection::slotNextCurves"
;
105
106
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_CURVE_TYPE
);
107
}
108
109
void
TutorialStateCurveSelection::slotPrevious
()
110
{
111
qCInfo(ENGAUGE_LOG) <<
"TutorialStateCurveSelection::slotPrevious"
;
112
113
context
().
requestDelayedStateTransition
(
TUTORIAL_STATE_AXIS_POINTS
);
114
}
Logger.h
TutorialButton.h
TutorialDlg.h
TUTORIAL_STATE_AXIS_POINTS
@ TUTORIAL_STATE_AXIS_POINTS
Definition
TutorialStateAbstractBase.h:13
TUTORIAL_STATE_COLOR_FILTER
@ TUTORIAL_STATE_COLOR_FILTER
Definition
TutorialStateAbstractBase.h:16
TUTORIAL_STATE_CURVE_TYPE
@ TUTORIAL_STATE_CURVE_TYPE
Definition
TutorialStateAbstractBase.h:18
TutorialStateContext.h
TutorialStateCurveSelection.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
TutorialStateCurveSelection::begin
virtual void begin()
Transition into this state.
Definition
TutorialStateCurveSelection.cpp:33
TutorialStateCurveSelection::TutorialStateCurveSelection
TutorialStateCurveSelection(TutorialStateContext &context)
Single constructor.
Definition
TutorialStateCurveSelection.cpp:18
TutorialStateCurveSelection::slotNext
void slotNext()
Slot called when next button is triggered.
Definition
TutorialStateCurveSelection.cpp:102
TutorialStateCurveSelection::slotPrevious
void slotPrevious()
Slot called to return to previous panel.
Definition
TutorialStateCurveSelection.cpp:109
TutorialStateCurveSelection::slotColorFilter
void slotColorFilter()
Slot called when settings button is triggered.
Definition
TutorialStateCurveSelection.cpp:95
TutorialStateCurveSelection::end
virtual void end()
Transition out of this state.
Definition
TutorialStateCurveSelection.cpp:87
Generated on
for Engauge Digitizer by
1.17.0