Debian Codegraph @

src/GUI/GettingStartedTip.hxx

raw symbols SCIP
1 #ifndef GETTINGSTARTEDTIP_HXX
2 #define GETTINGSTARTEDTIP_HXX
3
4 #include <QQuickItem>
5 #include <QString>
6 #include <QPointer>
7
8 #include "GettingStartedTipsController.hxx"
9
10 class GettingStartedTip : public QQuickItem
11 {
12 Q_OBJECT
13
14 Q_PROPERTY(QString tipId MEMBER _id NOTIFY tipChanged)
15 Q_PROPERTY(QString text MEMBER _text NOTIFY tipChanged)
16 Q_PROPERTY(QString nextTip MEMBER _nextId NOTIFY tipChanged)
17
18 Q_PROPERTY(Arrow arrow MEMBER _arrow NOTIFY tipChanged)
19
20 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
21
22 Q_PROPERTY(GettingStartedTipsController* controller READ controller NOTIFY controllerChanged)
23
24 /// standalone tips are excluded from their scope when activated;
25 /// instead they need to be activated manually
26 Q_PROPERTY(bool standalone READ standalone WRITE setStandalone NOTIFY standaloneChanged)
27 public:
28 enum class Arrow
29 {
30 TopCenter, // directly below the item, centered
31 LeftCenter,
32 RightCenter,
33 BottomCenter,
34 BottomRight,
35 TopRight,
36 TopLeft,
37 LeftTop, // on the left side, at the top
38 NoArrow
39 };
40
41 Q_ENUM(Arrow)
42
43 explicit GettingStartedTip(QQuickItem *parent = nullptr);
44 ~GettingStartedTip() override;
45
46 QString tipId() const
47 {
48 return _id;
49 }
50
51 Arrow arrow() const
52 {
53 return _arrow;
54 }
55
56 bool isEnabled() const
57 {
58 return _enabled;
59 }
60
61 GettingStartedTipsController* controller() const;
62
63 void componentComplete() override; // from QQmlParserStatus
64
65 bool standalone() const
66 {
67 return _standalone;
68 }
69
70 QString nextTip() const
71 {
72 return _nextId;
73 }
74
75 // allow disabling all tips progrmatically : this is a temporary
76 // measure to make life less annoying for our translators
77 static void setGlobalTipsEnabled(bool enable);
78 public slots:
79 void setEnabled(bool enabled);
80
81 void showOneShot();
82 void setStandalone(bool standalone);
83
84 signals:
85
86 void tipChanged();
87 void enabledChanged();
88 void controllerChanged();
89
90 void standaloneChanged(bool standalone);
91
92 protected:
93 void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override;
94
95 private:
96 void registerWithScope();
97 void unregisterFromScope();
98
99 GettingStartedTipsController* findController();
100
101 QString _id,
102 _text,
103 _nextId;
104
105 Arrow _arrow = Arrow::LeftCenter;
106 bool _enabled = true;
107 QPointer<GettingStartedTipsController> _controller;
108 bool _standalone = false;
109 };
110
111 #endif // GETTINGSTARTEDTIP_HXX