mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Индикация блокировки Сервера на ГУИ
This commit is contained in:
@@ -52,5 +52,6 @@
|
||||
<file>resources/icons/new.png</file>
|
||||
<file>resources/icons/branch-closed.png</file>
|
||||
<file>resources/icons/save.png</file>
|
||||
<file>resources/icons/lock.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -260,12 +260,12 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
|
||||
if(packetType == PacketType::BUSY)
|
||||
{
|
||||
//emit sigAnimationActivated(true);
|
||||
signal_ServerBlockState(true);
|
||||
}
|
||||
|
||||
if(packetType == PacketType::FREE)
|
||||
{
|
||||
//emit sigAnimationActivated(false);
|
||||
signal_ServerBlockState(false);
|
||||
}
|
||||
|
||||
if(packetType == PacketType::HASH_READY)
|
||||
|
||||
@@ -62,6 +62,8 @@ signals:
|
||||
|
||||
void signal_AnswerDocsChanged();
|
||||
|
||||
void signal_ServerBlockState(bool state);
|
||||
|
||||
private:
|
||||
QList<QString> *folderList;
|
||||
//MainWindow *mainWindow;
|
||||
|
||||
@@ -9,7 +9,8 @@ ConnectorToServer::ConnectorToServer(QObject *parent) :
|
||||
sendSystem(nullptr),
|
||||
recognizeSystem(nullptr),
|
||||
fl_GetedOfflineMessages(false),
|
||||
nameInstructorLoggedInLocal("")
|
||||
nameInstructorLoggedInLocal(""),
|
||||
serverBlockState(false)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
@@ -38,6 +39,8 @@ bool ConnectorToServer::getIsConnected()
|
||||
|
||||
void ConnectorToServer::SetConnectToServer()
|
||||
{
|
||||
serverBlockState = false;
|
||||
|
||||
qDebug() << "connectorToServer::SetConnectToServer() thread ID " << QThread::currentThreadId();
|
||||
serverSettings = *dataParser->getServerSettings();
|
||||
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
||||
@@ -45,6 +48,8 @@ void ConnectorToServer::SetConnectToServer()
|
||||
|
||||
void ConnectorToServer::StopConnectToServer()
|
||||
{
|
||||
serverBlockState = false;
|
||||
|
||||
emit sigStopConnect();
|
||||
clearListModelDB();
|
||||
}
|
||||
@@ -117,6 +122,12 @@ void ConnectorToServer::slot_NotifyVersionControl(QString text)
|
||||
emit signal_NotifyVersionControl(text);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_ServerBlockState(bool state)
|
||||
{
|
||||
serverBlockState = state;
|
||||
emit signal_ServerBlockState(state);
|
||||
}
|
||||
|
||||
void ConnectorToServer::initialize()
|
||||
{
|
||||
createObjects();
|
||||
@@ -169,6 +180,8 @@ void ConnectorToServer::bindConnection()
|
||||
|
||||
connect(recognizeSystem, &RecognizeSystem::sigSetVersion, this, &ConnectorToServer::signal_SetVersion);
|
||||
|
||||
connect(recognizeSystem,&RecognizeSystem::signal_ServerBlockState,this,&ConnectorToServer::slot_ServerBlockState);
|
||||
|
||||
connect(this, &ConnectorToServer::signal_SendCopyVersion, sendSystem, &SendSystem::sendCopyVersion);
|
||||
connect(this, &ConnectorToServer::signal_SendDeleteVersion, sendSystem, &SendSystem::sendDeleteVersion);
|
||||
connect(this, &ConnectorToServer::signal_SendSwitchVersion, sendSystem, &SendSystem::sendChangeVersion);
|
||||
@@ -195,6 +208,11 @@ void ConnectorToServer::createObjects()
|
||||
connectionThread->setPriority(QThread::HighestPriority);
|
||||
}
|
||||
|
||||
bool ConnectorToServer::getServerBlockState() const
|
||||
{
|
||||
return serverBlockState;
|
||||
}
|
||||
|
||||
SendSystem *ConnectorToServer::getSendSystem() const
|
||||
{
|
||||
return sendSystem;
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
int getIdTraineeByLogin(QString login);
|
||||
int getIdInstructorByLogin(QString login);
|
||||
|
||||
bool getServerBlockState() const;
|
||||
|
||||
private:
|
||||
//Очистка списочной модели БД СУО
|
||||
void clearListModelDB();
|
||||
@@ -117,6 +119,8 @@ public slots:
|
||||
|
||||
void slot_NotifyVersionControl(QString text);
|
||||
|
||||
void slot_ServerBlockState(bool state);
|
||||
|
||||
signals:
|
||||
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
|
||||
void sigStopConnect();
|
||||
@@ -159,6 +163,8 @@ signals:
|
||||
|
||||
void signal_NotifyVersionControl(QString text);
|
||||
|
||||
void signal_ServerBlockState(bool state);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
void bindConnection();
|
||||
@@ -191,6 +197,8 @@ private:
|
||||
bool fl_GetedOfflineMessages;
|
||||
|
||||
QString nameInstructorLoggedInLocal;
|
||||
|
||||
bool serverBlockState;
|
||||
};
|
||||
|
||||
#endif // CONNECTORTOSERVER_H
|
||||
|
||||
@@ -55,6 +55,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
connect(connectorToServer, &ConnectorToServer::sigErrorAuth, this, &InstructorsAndTraineesWidget::slot_ErrorAuth);
|
||||
connect(connectorToServer, &ConnectorToServer::signal_SetVersion, this, &InstructorsAndTraineesWidget::slot_SetVersion);
|
||||
connect(connectorToServer, &ConnectorToServer::signal_AnswerDocsChanged,this, &InstructorsAndTraineesWidget::slot_AnswerDocsChanged);
|
||||
connect(connectorToServer, &ConnectorToServer::signal_ServerBlockState, this, &InstructorsAndTraineesWidget::slot_ServerBlockState);
|
||||
|
||||
messangerController = new MessangerController(connectorToServer, this);
|
||||
|
||||
@@ -337,8 +338,6 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
||||
ui->btnConnectionToServer->setEnabled(false);
|
||||
ui->btnAuthorizationInstructor->setEnabled(true);
|
||||
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
|
||||
updateLabelLoggedInInstructor(instructorLoggedInLocal);
|
||||
|
||||
flTryConnectToServer = false;
|
||||
@@ -354,7 +353,6 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state)
|
||||
//ui->btnConnectionToServer->setEnabled(true);
|
||||
ui->btnAuthorizationInstructor->setEnabled(false);
|
||||
ui->btnAuthorizationInstructor->setChecked(false);
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
|
||||
viewerInstructors->setAuthComplited(false);
|
||||
viewerTrainees->setAuthComplited(false);
|
||||
@@ -475,6 +473,11 @@ void InstructorsAndTraineesWidget::slot_TryConnectToServer()
|
||||
connectorToServer->SetConnectToServer();
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::slot_ServerBlockState(bool state)
|
||||
{
|
||||
updateLabelServer();
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
||||
{
|
||||
dlgAuthorization = new DialogAuthorization(parent);
|
||||
@@ -622,11 +625,27 @@ void InstructorsAndTraineesWidget::updateLabelServer()
|
||||
{
|
||||
if(connectorToServer->getIsConnected())
|
||||
{
|
||||
if(connectorToServer->getServerBlockState())
|
||||
{//Заблокирован!
|
||||
ServerSettings serverSettings = connectorToServer->getServerSettings();
|
||||
ui->lblServer->setText(tr("connected") + " " + serverSettings.Address + " : " +serverSettings.Port);
|
||||
ui->lblServer->setText(tr("connected") + " " + serverSettings.Address + " : " +serverSettings.Port + ", " + tr("blocked"));
|
||||
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerSettings serverSettings = connectorToServer->getServerSettings();
|
||||
ui->lblServer->setText(tr("connected") + " " + serverSettings.Address + " : " +serverSettings.Port);
|
||||
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lblServer->setText(tr("not connected"));
|
||||
|
||||
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ public Q_SLOTS:
|
||||
|
||||
void slot_TryConnectToServer();
|
||||
|
||||
void slot_ServerBlockState(bool state);
|
||||
|
||||
Q_SIGNALS:
|
||||
//сигнал смены языка
|
||||
void signal_LanguageChanged(QString language);
|
||||
|
||||
BIN
LibInstructorsAndTrainees/resources/icons/lock.png
Normal file
BIN
LibInstructorsAndTrainees/resources/icons/lock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
@@ -162,7 +162,12 @@ bool MultiThreadServer::slot_BlockAutorization(bool block, QString whoFullName,
|
||||
{
|
||||
blockersMap.take(whoFullName);
|
||||
if(!blockersMap.count())
|
||||
{
|
||||
this->unBlockAutorization();
|
||||
blockRes = false;
|
||||
}
|
||||
else
|
||||
blockRes = true;
|
||||
}
|
||||
|
||||
if(res)
|
||||
|
||||
Reference in New Issue
Block a user