src/bmsapp.h

changeset 90
2396457a8167
parent 89
231a0b1292f3
child 91
409d9c7214be
equal deleted inserted replaced
89:231a0b1292f3 90:2396457a8167
1 #ifndef _BMSAPP_H
2 #define _BMSAPP_H
3
4 #include <QApplication>
5 #include <QDateTime>
6 #include <QDebug>
7 #include <QDir>
8 // #include <QDomDocument>
9 #include <QFile>
10 #include <QList>
11 #include <QMenu>
12 #include <QMetaProperty>
13 #include <QObject>
14 #include <QSettings>
15 #include <QString>
16 #include <QTextStream>
17 #include <QTranslator>
18 #include <QtSql>
19 #include <QUuid>
20 #include <QStyle>
21 #include <QPlainTextEdit>
22 #include <QMessageBox>
23 #include <QLabel>
24 #include <QImage>
25 #include <QImageReader>
26 #include <QImageWriter>
27 #include <QColorSpace>
28 #include <QGraphicsView>
29 #include <QFileDialog>
30 #include <QXmlStreamReader>
31 #include <QXmlStreamWriter>
32 #include <QJsonArray>
33 #include <QJsonDocument>
34 #include <QJsonObject>
35 #include <QMap>
36 #include <QPrinter>
37 #include <QWidget>
38
39 #include "Utils.h"
40 #include "PrinterDialog.h"
41
42
43 typedef struct IniMySQL
44 {
45 QString host; ///< MySQL host
46 QString port; ///< MySQL port
47 QString name; ///< MySQL database
48 QString user; ///< MySQL username
49 QString pass; ///< MySQL password
50 QString charset; ///< MySQL character encoding
51 } IniMySQL;
52
53 static IniMySQL dbProd;
54 static IniMySQL dbDev;
55
56 typedef struct IniMQTT
57 {
58 QString host; ///< MQTT host
59 QString port; ///< MQTT port
60 QString user; ///< MQTT username
61 QString pass; ///< MQTT password
62 } IniMQTT;
63
64 static IniMQTT mqttProd;
65 static IniMQTT mqttDev;
66
67
68 class MainWindow;
69
70
71 class Bmsapp : public QObject
72 {
73 Q_OBJECT
74
75 friend class MainWindow;
76
77 public:
78 Bmsapp();
79
80 /**
81 * @brief Blocking call that executes the application.
82 * @return Exit code from the application.
83 */
84 static int run(bool useDevelop, bool startConfig);
85
86 MainWindow* m_mainWindow;
87
88 private:
89 /**
90 * @brief Run before showing MainWindow, does all system setup.
91 * @return false if anything goes awry, true if it's ok to start MainWindow.
92 */
93 static bool initialize(bool useDevelop);
94
95 /**
96 * @brief Run after QApplication exits to clean up shit, close database, etc.
97 */
98 static void cleanup();
99
100 /**
101 * @brief Read user settings for the MySQL connection.
102 */
103 static void readsettings();
104
105 /**
106 * @brief Write or update the user settings for the MySQL connection.
107 */
108 static void writesettings();
109 };
110
111
112 #endif

mercurial