Engauge Digitizer 2
Loading...
Searching...
No Matches
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"
17
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 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::TutorialStateCurveType";
30}
31
33{
34 LOG4CPP_INFO_S ((*mainCat)) << "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
77{
78 LOG4CPP_INFO_S ((*mainCat)) << "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
85{
86 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::slotNextCurves";
87
89}
90
92{
93 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::slotNextLines";
94
96}
97
99{
100 LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateCurveType::slotNextCurves";
101
103}
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
@ TUTORIAL_STATE_POINT_MATCH
@ TUTORIAL_STATE_CURVE_SELECTION
@ TUTORIAL_STATE_SEGMENT_FILL
Show a button with text for clicking ion. The button is implemented using layering of two graphics it...
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...
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
QSize backgroundSize() const
Make geometry available for layout.
One state manages one panel of the tutorial.
QGraphicsTextItem * createTitle(const QString &text)
Factory method for title items.
QGraphicsTextItem * createTextItem(const QString &text, const QPoint &pos)
Factory method for text items.
TutorialStateContext & context()
Context class for the tutorial state machine.
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
int buttonMargin() const
Buttons are placed up against bottom side, and left or right side, separated by this margin.
Context class for tutorial state machine.
void requestDelayedStateTransition(TutorialState tutorialState)
Request a transition to the specified state from the current state.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.
TutorialStateCurveType(TutorialStateContext &context)
Single constructor.
void slotNextCurves()
Slot called when next button for curves is triggered.
virtual void begin()
Transition into this state.
virtual void end()
Transition out of this state.
void slotPrevious()
Slot called to return to previous panel.
void slotNextLines()
Slot called when next button for lines is triggered.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18