-
Notifications
You must be signed in to change notification settings - Fork 1
/
tipoftheday.h
85 lines (72 loc) · 1.84 KB
/
tipoftheday.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef TIPOFTHEDAY_H
#define TIPOFTHEDAY_H
#include <QWidget>
#include <QDialog>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QTextBrowser>
#include <QLabel>
#include <QCheckBox>
#include <QPushButton>
#include <QCloseEvent>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QList>
#define IMAGE_RESOURCE ":/img/lightbulb"
#define IMAGE_MARGIN 12
#define TIPS_RESOURCE ":/json/tips"
#define TIPS_TRANSLATIONS ":/json/resources/translations/tips_"
enum tip_type_t { UNDEF, HTML, PLAIN };
typedef tip_type_t tip_type;
typedef struct {
int tipId;
tip_type tipType = UNDEF;
QString tipTitle;
QString tipContent;
} tip_t;
class TipOfTheDay : public QDialog {
Q_OBJECT
public:
TipOfTheDay( QWidget *parent = nullptr );
public Q_SLOTS:
void setShowAtStartUp( bool toggle );
bool showTipNumber( int showTip );
void closeDialog( void );
protected:
QVBoxLayout *verticalLayout;
QHBoxLayout *horizontalTipLayout;
QLabel *imageFrame;
QHBoxLayout *horizontalLayout;
QSpacerItem *imageSpacer;
QVBoxLayout *verticalTipLayout;
QLabel *dykLabel;
QFrame *line;
QLabel *tipTitle;
QSpacerItem *titleSpacer;
QTextBrowser *tipTextFrame;
QHBoxLayout *horizontalButtonLayout;
QCheckBox *showTipsCheckBox;
QSpacerItem *verticalSpacer;
QSpacerItem *buttonSpacer;
QPushButton *previousButton;
QPushButton *nextButton;
QPushButton *closeButton;
protected Q_SLOTS:
void loadNextTip( void );
void loadPreviousTip( void );
void closeEvent( QCloseEvent *event );
bool loadTips( void );
void showTip( void );
void getLocale( void );
Q_SIGNALS:
void showAtStartUp( bool );
private:
bool _showAtStarup;
int _currentTip = -1;
bool _tipsLoaded = false;
QString _language = "en";
QList<tip_t> _tips;
};
#endif // TIPOFTHEDAY_H