This commit is contained in:
2026-02-07 08:28:56 +03:00
parent eff857a55e
commit 451ddd9ae0
30 changed files with 3993 additions and 1233 deletions
+66 -6
View File
@@ -10,6 +10,17 @@ HttpServer::HttpServer(QObject *parent)
: QObject(parent)
, m_server(nullptr)
, m_pageBackgroundColor("transparent")
, m_blockColor("#FFFFFF")
, m_borderColor("#000000")
, m_borderSize(2)
, m_transparency(0)
, m_titleFamily("Arial")
, m_titleSize(20)
, m_titleColor("#FFFFFF")
, m_contentFamily("Arial")
, m_contentSize(16)
, m_contentColor("#F5F5F5")
, m_duration(10)
{
}
@@ -78,8 +89,6 @@ void HttpServer::addNotification(const Notification &notification)
m_notifications.append(notif);
// Обновляем всех подключенных клиентов
for (auto client : m_clients) {
if (client->state() == QAbstractSocket::ConnectedState) {
@@ -236,7 +245,7 @@ QString HttpServer::generateHTML()
"<meta charset='UTF-8'>\n"
"<title>Web Notifications</title>\n"
"<style>\n"
"body { background: %1; margin: 0; padding: 0; }\n" // Используем цвет фона страницы
"body { background: %1; margin: 0; padding: 0; }\n" // Используем цвет фона страницы
"#messages { position: fixed; top: 20px; right: 20px; width: 400px; }\n"
".notification { \n"
" margin: 10px 0; \n"
@@ -257,9 +266,9 @@ QString HttpServer::generateHTML()
" from { opacity: 0; transform: translateY(-20px); }\n"
" to { opacity: 1; transform: translateY(0); }\n"
"}\n"
"</style>\n"
"</head>\n"
"<body>\n"
"</style>\n"
"</head>\n"
"<body>\n"
"<div id='messages'></div>\n"
"<script>\n"
"let notifications = new Map(); // Храним активные уведомления по timestamp\n"
@@ -505,3 +514,54 @@ void HttpServer::discardClient()
socket->deleteLater();
}
}
void HttpServer::setBlockColor(const QString &color) { m_blockColor = color; }
QString HttpServer::getBlockColor() const { return m_blockColor; }
void HttpServer::setBorderColor(const QString &color) { m_borderColor = color; }
QString HttpServer::getBorderColor() const { return m_borderColor; }
void HttpServer::setBorderSize(int size) { m_borderSize = size; }
int HttpServer::getBorderSize() const { return m_borderSize; }
void HttpServer::setTransparency(int transparency) { m_transparency = transparency; }
int HttpServer::getTransparency() const { return m_transparency; }
void HttpServer::setPageBackgroundColor(const QString &color) { m_pageBackgroundColor = color; }
QString HttpServer::getPageBackgroundColor() const { return m_pageBackgroundColor; }
QString HttpServer::getTitleFamily() const { return m_titleFamily; }
int HttpServer::getTitleSize() const { return m_titleSize; }
QString HttpServer::getTitleColor() const { return m_titleColor; }
QString HttpServer::getContentFamily() const { return m_contentFamily; }
int HttpServer::getContentSize() const { return m_contentSize; }
QString HttpServer::getContentColor() const { return m_contentColor; }
void HttpServer::setTitleFont(const QString &family, int size, const QString &color) {
m_titleFamily = family;
m_titleSize = size;
m_titleColor = color;
}
void HttpServer::getTitleFont(QString &family, int &size, QString &color) const {
family = m_titleFamily;
size = m_titleSize;
color = m_titleColor;
}
void HttpServer::setContentFont(const QString &family, int size, const QString &color) {
m_contentFamily = family;
m_contentSize = size;
m_contentColor = color;
}
void HttpServer::getContentFont(QString &family, int &size, QString &color) const {
family = m_contentFamily;
size = m_contentSize;
color = m_contentColor;
}
void HttpServer::setDuration(int duration) { m_duration = duration; }
int HttpServer::getDuration() const { return m_duration; }