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