1#ifndef H_EXTENSIONS_CUTEHMI_SHAREDDATABASE_1_INCLUDE_CUTEHMI_SHAREDDATABASE_DATABASE_HPP
2#define H_EXTENSIONS_CUTEHMI_SHAREDDATABASE_1_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>
16namespace shareddatabase {
31 static constexpr int INITIAL_PORT = 5432;
35 static constexpr bool INITIAL_THREADED =
true;
40 Q_PROPERTY(
QString type READ type WRITE setType NOTIFY typeChanged)
42 Q_PROPERTY(
QString host READ host WRITE setHost NOTIFY hostChanged)
44 Q_PROPERTY(
int port READ port WRITE setPort NOTIFY portChanged)
46 Q_PROPERTY(
QString name READ name WRITE setName NOTIFY nameChanged)
48 Q_PROPERTY(
QString user READ user WRITE setUser NOTIFY userChanged)
50 Q_PROPERTY(
QString password READ password WRITE setPassword NOTIFY passwordChanged)
52 Q_PROPERTY(
QString connectionName READ connectionName WRITE setConnectionName NOTIFY connectionNameChanged)
54 Q_PROPERTY(
bool threaded READ threaded WRITE setThreaded NOTIFY threadedChanged)
56 static bool IsConnected(
const QString & connectionName);
72 void setType(
const QString & type);
84 void setHost(
const QString & host);
96 void setPort(
int port);
108 void setName(
const QString & name);
120 void setUser(
const QString & user);
132 void setPassword(
const QString & password);
138 QString connectionName()
const;
144 void setConnectionName(
const QString & connectionName);
151 bool threaded()
const;
157 void setThreaded(
bool threaded);
205 void initializeConnection();
207 void closeConnection();
209 void onHandlerConnected(
QString connectionName);
211 void onHandlerDisconnected(
QString connectionName);
218 bool threaded = INITIAL_THREADED;
Database.
Definition: Database.hpp:24
static const char * INITIAL_PASSWORD
Definition: Database.hpp:34
void errored(cutehmi::InplaceError error)
static const char * INITIAL_NAME
Definition: Database.hpp:32
static const char * INITIAL_HOST
Definition: Database.hpp:30
static const char * INITIAL_USER
Definition: Database.hpp:33
void connectionNameChanged()
static const char * INITIAL_TYPE
Definition: Database.hpp:29
Definition: DatabaseConfig.hpp:13
Definition: DatabaseThread.hpp:15