Engauge Digitizer  2
TutorialStateColorFilter.cpp
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 "TutorialStateColorFilter.h"
15 #include "TutorialStateContext.h"
16 
19 {
20 }
21 
23 {
24  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateColorFilter::begin ()";
25 
26  m_title = createTitle (tr ("Color Filter"));
27  m_background = createPixmapItem (":/engauge/img/panel_color_filter.png",
28  QPoint (0, 30));
29  m_text0 = createTextItem (tr ("Each curve has Color Filter settings that\n"
30  "are applied in Segment Fill mode. For\n"
31  "black lines the defaults work well, but for\n"
32  "colored lines the settings can be improved."),
33  QPoint (260, 30));
34  m_text1 = createTextItem (tr ("Step 1 - Select the Settings / Color\n"
35  "Filter menu option."),
36  QPoint (285, 115));
37  m_text2 = createTextItem (tr ("Step 2 - Select the curve that will\n"
38  "be given the new settings."),
39  QPoint (285, 165));
40  m_text3 = createTextItem (tr ("Step 3 - Select the mode. Intensity is\n"
41  "suggested for uncolored lines, and Hue\n"
42  "is suggested for colored lines."),
43  QPoint (285, 210));
44  m_text4 = createTextItem (tr ("Step 4 - Adjust the included range by\n"
45  "dragging the green handles, until the\n"
46  "curve is clear in the preview window\n"
47  "below. The graph shows a histogram\n"
48  "distribution of the values underneath.\n"
49  "Click Ok when finished."),
50  QPoint (285, 280));
51 
52  QSize backgroundSize = context().tutorialDlg().backgroundSize();
53 
54  m_back = new TutorialButton (tr ("Back"),
55  context().tutorialDlg().scene());
56  m_back->setGeometry (QPoint (backgroundSize.width () / 2 - m_back->size().width () / 2,
57  backgroundSize.height() - buttonMargin() - m_back->size().height()));
58  connect (m_back, SIGNAL (signalTriggered ()), this, SLOT (slotBack ()));
59 }
60 
62 {
63  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateColorFilter::end ()";
64 
65  context().tutorialDlg().scene().removeItem (m_title);
66  context().tutorialDlg().scene().removeItem (m_background);
67  context().tutorialDlg().scene().removeItem (m_text0);
68  context().tutorialDlg().scene().removeItem (m_text1);
69  context().tutorialDlg().scene().removeItem (m_text2);
70  context().tutorialDlg().scene().removeItem (m_text3);
71  context().tutorialDlg().scene().removeItem (m_text4);
72  // TutorialButtons removes themselves from the scene
73 
74  delete m_title;
75  delete m_background;
76  delete m_text0;
77  delete m_text1;
78  delete m_text2;
79  delete m_text3;
80  delete m_text4;
81  delete m_back;
82 
83  m_title = 0;
84  m_background = 0;
85  m_text0 = 0;
86  m_text1 = 0;
87  m_text2 = 0;
88  m_text3 = 0;
89  m_text4 = 0;
90  m_back = 0;
91 }
92 
94 {
95  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateColorFilter::slotBack";
96 
97  context().requestDelayedStateTransition (TUTORIAL_STATE_CURVE_SELECTION);
98 }
One state manages one panel of the tutorial.
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...
Show a button with text for clicking ion. The button is implemented using layering of two graphics it...
virtual void begin()
Transition into this state.
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
Definition: TutorialDlg.cpp:66
TutorialStateContext & context()
Context class for the tutorial state machine.
QGraphicsTextItem * createTextItem(const QString &text, const QPoint &pos)
Factory method for text items.
QGraphicsTextItem * createTitle(const QString &text)
Factory method for title items.
virtual void end()
Transition out of this state.
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
void slotBack()
Slot called to return to previous panel.
QSize backgroundSize() const
Make geometry available for layout.
Definition: TutorialDlg.cpp:34
Context class for tutorial state machine.
int buttonMargin() const
Buttons are placed up against bottom side, and left or right side, separated by this margin...
TutorialStateColorFilter(TutorialStateContext &context)
Single constructor.
void requestDelayedStateTransition(TutorialState tutorialState)
Request a transition to the specified state from the current state.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.