сохранение веб сервисов с чатом

This commit is contained in:
2026-01-29 21:13:51 +03:00
parent c348019bf5
commit eff857a55e
6 changed files with 382 additions and 10 deletions
+36
View File
@@ -12,12 +12,35 @@
#include <QFile>
#include <QTableWidget>
#include "timerinfo.h"
#include "webserverchat.h"
struct ChatSettings {
int id;
QString name;
QString type; // "chat" или "notification"
int port;
QStringList fontList;
QString backgroundColor;
QString blockColor;
QString borderColor;
int borderSize;
int padding;
int transparency;
QString fontFamily;
int fontSize;
QString fontColor;
bool freez;
int messageTimeout;
int maxMsgCount;
bool deleteByTime;
};
class uDataBase : public QObject
{
Q_OBJECT
// Информация о таймере
public:
// Конструктор с указанием файла базы данных
explicit uDataBase(const QString& dbFileName, QObject* parent = nullptr);
@@ -25,6 +48,8 @@ public:
// Деструктор
~uDataBase();
// Чтение настройки
QString readSetting(const QString& aName, const QString& aDefault = "");
@@ -50,6 +75,16 @@ public:
bool LoadRandomGroups(QListWidget *listWidget);
QString ProcessResponseTemplateRecursive(const QString &templateText, int depth);
bool createChatsTable();
bool saveChat(const QString &name, const QString &type,
HttpServerChat *server, const QString &fontList);
bool updateChat(const QString &name, HttpServerChat *server,
const QString &fontList, int oldPort);
bool deleteChat(int port);
QList<ChatSettings> loadAllChats();
// Проверка подключения к БД
bool isConnected() const;
@@ -60,6 +95,7 @@ public:
private:
// Инициализация базы данных (создание таблицы, если нужно)
bool initializeDatabase();