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 
19 {
20 }
21 
23 {
24  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateChecklistWizardAbstract::begin ()";
25 
26  m_title = createTitle (tr ("Checklist Wizard and Checklist Guide"));
27  m_background = createPixmapItem (":/engauge/img/panel_checklist.png",
28  QPoint (0, 30));
29  m_text0 = createTextItem (tr ("For new Engauge users, a Checklist Wizard\n"
30  "is available when importing an image file.\n"
31  "This wizard produces a helpful checklist of\n"
32  "steps to follow to digitize the image file."),
33  QPoint (260, 30));
34  m_text1 = createTextItem (tr ("Step 1 - Enable the menu option Help /\n"
35  "Checklist Guide Wizard."),
36  QPoint (285, 125));
37  m_text2 = createTextItem (tr ("Step 2 - Import the file using File /\n"
38  "Import. The Checklist Wizard will appear\n"
39  "and ask some simple questions to\n"
40  "determine how the image can be\n"
41  "digitized."),
42  QPoint (285, 175));
43  m_text3 = createTextItem (tr ("Additional options are available in\n"
44  "the various Settings menus.\n\n"
45  "This ends the tutorial. Good luck!"),
46  QPoint (285, 270));
47 
48  QSize backgroundSize = context().tutorialDlg().backgroundSize();
49 
50  m_previous = new TutorialButton (tr ("Previous"),
51  context().tutorialDlg().scene());
52  m_previous->setGeometry (QPoint (buttonMargin (),
53  backgroundSize.height () - buttonMargin() - m_previous->size().height()));
54 }
55 
57 {
58  LOG4CPP_INFO_S ((*mainCat)) << "TutorialStateChecklistWizardAbstract::end ()";
59 
60  context().tutorialDlg().scene().removeItem (m_title);
61  context().tutorialDlg().scene().removeItem (m_background);
62  context().tutorialDlg().scene().removeItem (m_text0);
63  context().tutorialDlg().scene().removeItem (m_text1);
64  context().tutorialDlg().scene().removeItem (m_text2);
65  context().tutorialDlg().scene().removeItem (m_text3);
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_previous;
75 
76  m_title = 0;
77  m_background = 0;
78  m_text0 = 0;
79  m_text1 = 0;
80  m_text2 = 0;
81  m_text3 = 0;
82  m_previous = 0;
83 }
84 
86 {
87  return m_previous;
88 }
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...
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:66
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:34
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 size() const
Size of this button.
Context class for tutorial state machine.
TutorialDlg & tutorialDlg()
Access to tutorial dialogs and its scene.