1 #ifndef H_EXTENSIONS_CUTEHMI_SHAREDDATABASE_0_INCLUDE_CUTEHMI_SHAREDDATABASE_DATABASE_HPP
2 #define H_EXTENSIONS_CUTEHMI_SHAREDDATABASE_0_INCLUDE_CUTEHMI_SHAREDDATABASE_DATABASE_HPP
4 #include "internal/common.hpp"
5 #include "internal/DatabaseConfig.hpp"
6 #include "internal/DatabaseConnectionHandler.hpp"
7 #include "internal/DatabaseThread.hpp"
9 #include <cutehmi/services/Serviceable.hpp>
10 #include <cutehmi/macros.hpp>
15 namespace shareddatabase {
30 static constexpr
int INITIAL_PORT = 5432;
34 static constexpr
bool INITIAL_THREADED =
true;
39 Q_PROPERTY(
QString type READ type WRITE setType NOTIFY typeChanged)
41 Q_PROPERTY(
QString host READ host WRITE setHost NOTIFY hostChanged)
43 Q_PROPERTY(
int port READ port WRITE setPort NOTIFY portChanged)
45 Q_PROPERTY(
QString name READ name WRITE setName NOTIFY nameChanged)
47 Q_PROPERTY(
QString user READ user WRITE setUser NOTIFY userChanged)
49 Q_PROPERTY(
QString password READ password WRITE setPassword NOTIFY passwordChanged)
51 Q_PROPERTY(
QString connectionName READ connectionName WRITE setConnectionName NOTIFY connectionNameChanged)
53 Q_PROPERTY(
bool threaded READ threaded WRITE setThreaded NOTIFY threadedChanged)
55 static
bool IsConnected(const
QString & connectionName);
71 void setType(const
QString & type);
83 void setHost(const
QString & host);
95 void setPort(
int port);
107 void setName(const
QString & name);
119 void setUser(const
QString & user);
131 void setPassword(const
QString & password);
137 QString connectionName() const;
143 void setConnectionName(const
QString & connectionName);
150 bool threaded() const;
156 void setThreaded(
bool threaded);
191 void passwordChanged();
193 void connectionNameChanged();
195 void threadedChanged();
204 void initializeConnection();
206 void closeConnection();
208 void onHandlerConnected(
QString connectionName);
210 void onHandlerDisconnected(
QString connectionName);
217 bool threaded = INITIAL_THREADED;