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 {
32 static constexpr int INITIAL_PORT = 5432;
36 static constexpr bool INITIAL_THREADED =
true;
41 Q_PROPERTY(
QString type READ type WRITE setType NOTIFY typeChanged)
43 Q_PROPERTY(
QString host READ host WRITE setHost NOTIFY hostChanged)
45 Q_PROPERTY(
int port READ port WRITE setPort NOTIFY portChanged)
47 Q_PROPERTY(
QString name READ name WRITE setName NOTIFY nameChanged)
49 Q_PROPERTY(
QString user READ user WRITE setUser NOTIFY userChanged)
51 Q_PROPERTY(
QString password READ password WRITE setPassword NOTIFY passwordChanged)
53 Q_PROPERTY(
QString connectionName READ connectionName WRITE setConnectionName NOTIFY connectionNameChanged)
55 Q_PROPERTY(
bool threaded READ threaded WRITE setThreaded NOTIFY threadedChanged)
57 static bool IsConnected(
const QString & connectionName);
73 void setType(
const QString & type);
85 void setHost(
const QString & host);
97 void setPort(
int port);
109 void setName(
const QString & name);
121 void setUser(
const QString & user);
133 void setPassword(
const QString & password);
139 QString connectionName()
const;
145 void setConnectionName(
const QString & connectionName);
152 bool threaded()
const;
158 void setThreaded(
bool threaded);
206 void initializeConnection();
208 void closeConnection();
210 void onHandlerConnected(
QString connectionName);
212 void onHandlerDisconnected(
QString connectionName);
219 bool threaded = INITIAL_THREADED;
Database.
Definition: Database.hpp:25
static const char * INITIAL_PASSWORD
Definition: Database.hpp:35
void errored(cutehmi::InplaceError error)
static const char * INITIAL_NAME
Definition: Database.hpp:33
static const char * INITIAL_HOST
Definition: Database.hpp:31
static const char * INITIAL_USER
Definition: Database.hpp:34
void connectionNameChanged()
static const char * INITIAL_TYPE
Definition: Database.hpp:30
Definition: DatabaseConfig.hpp:13
Definition: DatabaseThread.hpp:15