mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add new states
This commit is contained in:
@@ -135,15 +135,29 @@ bool DataParser::xmlParser(const QByteArray& array)
|
||||
|
||||
if (value == "UNCHANGEABLE")
|
||||
{
|
||||
//версию нельзя изменять
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (value == "CHANGEABLE")
|
||||
{
|
||||
postProcessSystem->compareFiles();
|
||||
//emit sigUpdateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||
}
|
||||
|
||||
if (value == "ERROR_AUTH_ARCHIVED")
|
||||
{
|
||||
postProcessSystem->userArchived();
|
||||
}
|
||||
|
||||
if (value == "ERROR_AUTH_LOGINORPASSWORD")
|
||||
{
|
||||
postProcessSystem->wrongLoginOrPass();
|
||||
}
|
||||
|
||||
if (value == "ERROR_AUTH_ALREADYLOGIN")
|
||||
{
|
||||
postProcessSystem->alreadyLogin();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,29 @@ void PostProcessorSystem::initialize(DataParserOutput *dataParserOutput,
|
||||
|
||||
}
|
||||
|
||||
void PostProcessorSystem::userArchived()
|
||||
{
|
||||
emit sigShowError(ErrorsEnum::ARCHIVED);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::wrongLoginOrPass()
|
||||
{
|
||||
emit sigShowError(ErrorsEnum::LOGIN_OR_PASS);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::alreadyLogin()
|
||||
{
|
||||
emit sigShowError(ErrorsEnum::ALREADYLOGIN);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::socketDisable()
|
||||
{
|
||||
emit sigSocketDisabled();
|
||||
emit sigShowError(ErrorsEnum::DISABLE);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::serverBlocked()
|
||||
{
|
||||
emit sigServerBlocked();
|
||||
emit sigShowError(ErrorsEnum::BLOCKED);
|
||||
}
|
||||
|
||||
void PostProcessorSystem::startCompare()
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "UpdateController.h"
|
||||
#include <QObject>
|
||||
#include <Data/Datas.h>
|
||||
#include <Data/ErrorsEnum.h>
|
||||
|
||||
class PostProcessorSystem : public QObject
|
||||
{
|
||||
@@ -24,9 +25,11 @@ public:
|
||||
void saveLoginData(ServerAuthorization *auth);
|
||||
void setServerVersion(StreamingVersionData *serverVersion);
|
||||
void calculateCommonHash();
|
||||
void userArchived();
|
||||
void wrongLoginOrPass();
|
||||
void alreadyLogin();
|
||||
signals:
|
||||
void sigSocketDisabled();
|
||||
void sigServerBlocked();
|
||||
void sigShowError(ErrorsEnum error);
|
||||
void sigStartCompare(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash);
|
||||
void sigCallUpdateList();
|
||||
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
||||
|
||||
13
Data/ErrorsEnum.h
Normal file
13
Data/ErrorsEnum.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef ERRORSENUM_H
|
||||
#define ERRORSENUM_H
|
||||
|
||||
enum ErrorsEnum
|
||||
{
|
||||
BLOCKED,
|
||||
ARCHIVED,
|
||||
LOGIN_OR_PASS,
|
||||
ALREADYLOGIN,
|
||||
DISABLE
|
||||
};
|
||||
|
||||
#endif // ERRORSENUM_H
|
||||
@@ -60,6 +60,7 @@ HEADERS += \
|
||||
Core\tools.h\
|
||||
Core\hashcomparer.h \
|
||||
Data/Client.h \
|
||||
Data/ErrorsEnum.h \
|
||||
Data/monitorInfo.h \
|
||||
Data/streamingversiondata.h \
|
||||
Data\FileData.h\
|
||||
|
||||
2
StaticData/authData.xml
Normal file
2
StaticData/authData.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuthData Login="O2" Password="934b535800b1cba8f96a5d72f72f1611" InstructorName="" ClientName="" AccessType=""/>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ServerSettingsContainer>
|
||||
<ServerSettings Address="192.168.100.134" Port="6000" Language="RUS" AutoStart="0"/>
|
||||
<VersionData Version="ver1" Created="Чт дек 11 17:55:24 2025" isChangable="1"/>
|
||||
<VersionData Version="-----" isChangable="0"/>
|
||||
</ServerSettingsContainer>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ClientNotify Code="CHECKVERSIONLIST"/>
|
||||
<ClientAutorization Login="O2" Password="934b535800b1cba8f96a5d72f72f1611"/>
|
||||
|
||||
@@ -11,6 +11,7 @@ Bootstrap::Bootstrap(QObject *parent) : QObject(parent)
|
||||
void Bootstrap::initialize()
|
||||
{
|
||||
qRegisterMetaType<PacketType>("PacketType");
|
||||
qRegisterMetaType<ErrorsEnum>("ErrorsEnum");
|
||||
|
||||
widgetManager->initialize();
|
||||
coreManager->initialize(widgetManager, workerThread);
|
||||
|
||||
@@ -80,8 +80,7 @@ void CoreManager::binding()
|
||||
connect(this,&CoreManager::sigSetLoadSettings,widgetManager,&WidgetManager::slotSetLoadSettings,Qt::AutoConnection);
|
||||
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigSocketDisabled,this,&CoreManager::lostConnection,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigServerBlocked,this,&CoreManager::serverBlocked,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigShowError,this,&CoreManager::showError,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas,Qt::AutoConnection);
|
||||
connect(postProcessorSystem,&PostProcessorSystem::sigSaveLoginData,this,&CoreManager::checkLoginResult,Qt::AutoConnection);
|
||||
|
||||
@@ -168,16 +167,11 @@ void CoreManager::callUpdateList()
|
||||
emit sigSendXMLAnswer(cmd_GetServerHash);
|
||||
}
|
||||
|
||||
void CoreManager::lostConnection()
|
||||
void CoreManager::showError(ErrorsEnum errorEnum)
|
||||
{
|
||||
widgetManager->setLostConnectionState();
|
||||
client->setIsLoggedIn(false);
|
||||
widgetManager->getMainWindow()->showError(errorEnum);
|
||||
}
|
||||
|
||||
void CoreManager::serverBlocked()
|
||||
{
|
||||
widgetManager->getMainWindow()->serverBlocked();
|
||||
}
|
||||
|
||||
void CoreManager::setServerVersion(StreamingVersionData *version)
|
||||
{
|
||||
|
||||
@@ -96,8 +96,7 @@ private:
|
||||
void binding();
|
||||
void initializeSystems();
|
||||
void callUpdateList();
|
||||
void lostConnection();
|
||||
void serverBlocked();
|
||||
void showError(ErrorsEnum errorEnum);
|
||||
void checkLoginResult(ServerAuthorization *auth);
|
||||
void checkAccessType(const QString &accessType);
|
||||
void setServerVersion(StreamingVersionData *version);
|
||||
|
||||
@@ -97,16 +97,36 @@ void MainWindow::setNeedUpdateState(const QString& notifyText)
|
||||
ui->autostartCheckBox->show();
|
||||
}
|
||||
|
||||
void MainWindow::serverBlocked()
|
||||
{
|
||||
ui->notificationLabel->show();
|
||||
QPalette palette = ui->notificationLabel->palette();
|
||||
QColor orangeColor(255,165,0);
|
||||
palette.setColor(ui->notificationLabel->foregroundRole(),orangeColor);
|
||||
ui->notificationLabel->setText(tr("Сервер заблокирован"));
|
||||
|
||||
ui->notificationLabel->setPalette(palette);
|
||||
timer->start(3000);
|
||||
void MainWindow::showError(ErrorsEnum errorNum)
|
||||
{
|
||||
if (errorNum == ErrorsEnum::BLOCKED)
|
||||
{
|
||||
serverNotifyShow(tr("Сервер заблокирован"));
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::DISABLE)
|
||||
{
|
||||
showConnectionEmpty();
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::LOGIN_OR_PASS)
|
||||
{
|
||||
serverNotifyShow(tr("Неверный логин/пароль"));
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::ARCHIVED)
|
||||
{
|
||||
serverNotifyShow(tr("Пользователь в архиве"));
|
||||
}
|
||||
else if (errorNum == ErrorsEnum::ALREADYLOGIN)
|
||||
{
|
||||
serverNotifyShow(tr("Пользователь уже в сети"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::serverNotifyShow(QString text, int durationMS)
|
||||
{
|
||||
ui->notificationLabel->setText(text);
|
||||
ui->notificationLabel->show();
|
||||
timer->start(durationMS);
|
||||
}
|
||||
|
||||
void MainWindow::setLoginSuccessState()
|
||||
@@ -116,19 +136,6 @@ void MainWindow::setLoginSuccessState()
|
||||
ui->versionLayoutWidget->show();
|
||||
}
|
||||
|
||||
void MainWindow::setLoginFailedState()
|
||||
{
|
||||
ui->notificationLabel->setText(tr("Неверный логин/пароль"));
|
||||
timer->setInterval(3000);
|
||||
timer->start();
|
||||
|
||||
QPalette palette = ui->notificationLabel->palette();
|
||||
palette.setColor(ui->notificationLabel->foregroundRole(), Qt::red);
|
||||
|
||||
ui->notificationLabel->setPalette(palette);
|
||||
ui->notificationLabel->show();
|
||||
}
|
||||
|
||||
void MainWindow::setStartOfflineButton(bool isAvailable)
|
||||
{
|
||||
ui->offlineStartButton->setEnabled(isAvailable);
|
||||
|
||||
@@ -31,7 +31,6 @@ public:
|
||||
void addWidgetToInteractiveGroup(EntryWidget *entryWidget);
|
||||
void setLoadSettings(Settings *serverSettings);
|
||||
void setLoginSuccessState();
|
||||
void setLoginFailedState();
|
||||
void setClientVersionName(const QString &versionName);
|
||||
|
||||
void loadToServer();
|
||||
@@ -47,9 +46,11 @@ public:
|
||||
void showOfflineButton(bool flag);
|
||||
void setStartOfflineButton(bool isAvailable);
|
||||
void setStartState();
|
||||
void serverBlocked();
|
||||
void serverNotifyShow(QString text, int durationMS = 3000);
|
||||
void showError(ErrorsEnum errorNum);
|
||||
|
||||
QHBoxLayout *getDisplayLayout() const;
|
||||
void serverBlockedState();
|
||||
public slots:
|
||||
void slotShowUpdateInfo();
|
||||
void slotConnectionState(bool flag);
|
||||
|
||||
@@ -60,7 +60,6 @@ void WidgetManager::setLoginSuccess()
|
||||
void WidgetManager::setLoginFailed()
|
||||
{
|
||||
entryWidget->showLoginWidget(true);
|
||||
mainWindow->setLoginFailedState();
|
||||
activateLoadingAnimation(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user