Engauge Digitizer  2
TutorialStateChecklistWizardAbstract.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 "TutorialStateChecklistWizardAbstract.h"
15 #include "TutorialStateContext.h"
16 
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_text3 (nullptr),
25  m_previous (nullptr)
26 {
27 }
28 
30 {
31  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateChecklistWizardAbstract::begin ()";
32 
33  m_title = createTitle (tr ("Checklist Wizard and Checklist Guide"));
34  m_background = createPixmapItem (":/engauge/img/panel_checklist.png",
35  QPoint (0, 30));
36  m_text0 = createTextItem (tr ("For new Engauge users, a Checklist Wizard\n"
37  "is available when importing an image file.\n"
38  "This wizard produces a helpful checklist of\n"
39  "steps to follow to digitize the image file."),
40  QPoint (260, 30));
41  m_text1 = createTextItem (tr ("Step 1 - Enable the menu option Help /\n"
42  "Checklist Guide Wizard."),
43  QPoint (285, 125));
44  m_text2 = createTextItem (tr ("Step 2 - Import the file using File /\n"
45  "Import. The Checklist Wizard will appear\n"
46  "and ask some simple questions to\n"
47  "determine how the image can be\n"
48  "digitized."),
49  QPoint (285, 175));
50  m_text3 = createTextItem (tr ("Additional options are available in\n"
51  "the various Settings menus.\n\n"
52  "This ends the tutorial. Good luck!"),
53  QPoint (285, 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 }
62 
64 {
65  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateChecklistWizardAbstract::end ()";
66 
67  context().tutorialDlg().scene().removeItem (m_title);
68  context().tutorialDlg().scene().removeItem (m_background);
69  context().tutorialDlg().scene().removeItem (m_text0);
70  context().tutorialDlg().scene().removeItem (m_text1);
71  context().tutorialDlg().scene().removeItem (m_text2);
72  context().tutorialDlg().scene().removeItem (m_text3);
73  // TutorialButtons removes themselves from the scene
74 
75  delete m_title;
76  delete m_background;
77  delete m_text0;
78  delete m_text1;
79  delete m_text2;
80  delete m_text3;
81  delete m_previous;
82 
83  m_title = nullptr;
84  m_background = nullptr;
85  m_text0 = nullptr;
86  m_text1 = nullptr;
87  m_text2 = nullptr;
88  m_text3 = nullptr;
89  m_previous = nullptr;
90 }
91 
93 {
94  return m_previous;
95 }
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...
QGraphicsScene & scene()
Single scene the covers the entire tutorial dialog.
Definition: TutorialDlg.cpp:76
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.
QGraphicsPixmapItem * createPixmapItem(const QString &resource, const QPoint &pos)
Factory method for pixmap items.
TutorialButton * previous()
Previous button for hooking up button to slot.
TutorialStateChecklistWizardAbstract(TutorialStateContext &context)
Single constructor.
QSize backgroundSize() const
Make geometry available for layout.
Definition: TutorialDlg.cpp:44
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.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.