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:
@@ -4,27 +4,33 @@
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
|
||||
|
||||
#include "serverlmswidget.h"
|
||||
#include "ui_serverlmswidget.h"
|
||||
|
||||
//#include "instructorsAndTrainees.h"
|
||||
//#include "instructorsandtraineeswidget.h"
|
||||
|
||||
|
||||
ServerLMSWidget::ServerLMSWidget(/*MessangerWidget* messangerWidget, */QWidget *parent) :
|
||||
ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ServerLMSWidget),
|
||||
tcpServer(nullptr),
|
||||
hostPort(6000),
|
||||
stateServer(stoped),
|
||||
stateBlockAutorization(/*unblocked*/blocked),
|
||||
//pInstructorsAndTrainees(instructorsAndTrainees),
|
||||
//pMessangerWidget(messangerWidget),
|
||||
ui(new Ui::ServerLMSWidget)
|
||||
stateBlockAutorization(blocked),
|
||||
updateThread(nullptr),
|
||||
loggerThread(nullptr),
|
||||
dataParser(nullptr),
|
||||
processingSystem(nullptr),
|
||||
updateController(nullptr),
|
||||
logger(nullptr),
|
||||
providerDBLMS(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->comboTasks->addItem("Задача 1");
|
||||
ui->comboTasks->addItem("Задача 2");
|
||||
ui->comboTasks->addItem("Задача 3");
|
||||
ui->comboTasks->addItem("Задача 4");
|
||||
ui->comboTasks->addItem("Задача 5");
|
||||
|
||||
ui->btnStopServer->setEnabled(false);
|
||||
ui->btnStartServer->setEnabled(true);
|
||||
|
||||
@@ -35,19 +41,14 @@ ServerLMSWidget::ServerLMSWidget(/*MessangerWidget* messangerWidget, */QWidget *
|
||||
updateThread = new QThread;
|
||||
loggerThread = new QThread;
|
||||
|
||||
ui->comboTasks->addItem("Задача 1");
|
||||
ui->comboTasks->addItem("Задача 2");
|
||||
ui->comboTasks->addItem("Задача 3");
|
||||
ui->comboTasks->addItem("Задача 4");
|
||||
ui->comboTasks->addItem("Задача 5");
|
||||
|
||||
providerDBLMS = new ProviderDBLMS(this);
|
||||
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
||||
providerDBLMS->ConnectionToDB();
|
||||
|
||||
logger = new Logger(ui->listWidgetLogger);
|
||||
connect(logger,&Logger::sigSendTextToLogger,this,&ServerLMSWidget::slotAddToLog,Qt::QueuedConnection);
|
||||
logger->moveToThread(loggerThread);
|
||||
|
||||
|
||||
processingSystem = new ProcessingSystem(providerDBLMS);
|
||||
dataParser = new DataParser(processingSystem);
|
||||
|
||||
@@ -62,20 +63,12 @@ ServerLMSWidget::ServerLMSWidget(/*MessangerWidget* messangerWidget, */QWidget *
|
||||
|
||||
logger->setTypeLog("widget");
|
||||
|
||||
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
||||
|
||||
//connect(processingSystem,&ProcessingSystem::sigAuthChanged,this,&ServerLMSWidget::signal_authorizationChanged); //Уже не требуется!
|
||||
connect(processingSystem,&ProcessingSystem::sigUpdateListClients,this, &ServerLMSWidget::slotUpdateListClients);
|
||||
//connect(pMessangerWidget, &MessangerWidget::signal_msgToClientReady, this, &ServerLMSWidget::slot_msgToClientReady);
|
||||
|
||||
connect(updateController,&UpdateController::sigLogMessage,logger,&Logger::addTextToLogger);
|
||||
connect(dataParser,&DataParser::sigLogMessage,logger,&Logger::addTextToLogger);
|
||||
connect(processingSystem,&ProcessingSystem::sigLogMessage,logger,&Logger::addTextToLogger);
|
||||
//connect(processingSystem,&ProcessingSystem::sigAddToMessanger,this,&ServerLMSWidget::slotAddToMessanger,Qt::QueuedConnection);
|
||||
connect(this,&ServerLMSWidget::sigLog,logger,&Logger::addTextToLogger);
|
||||
|
||||
providerDBLMS->ConnectionToDB();
|
||||
|
||||
on_btnStartServer_clicked();
|
||||
|
||||
first = true;
|
||||
@@ -94,9 +87,6 @@ void ServerLMSWidget::autorizationHandler(QString login)
|
||||
{//Деавторизовался инструктор
|
||||
|
||||
}
|
||||
|
||||
//Извещаем об изменениях в авторизации ??? не нашел, где он вызывает изменения
|
||||
//emit signal_authorizationChanged(); //Уже не требуется!
|
||||
}
|
||||
|
||||
ServerLMSWidget::~ServerLMSWidget()
|
||||
@@ -198,12 +188,6 @@ void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||
else
|
||||
unBlockAutorization();
|
||||
}
|
||||
/*
|
||||
void ServerLMSWidget::slotAddToMessanger(QString login, QString text)
|
||||
{
|
||||
QString name = pInstructorsAndTrainees->getNameTraineeByLogin(login);
|
||||
pMessangerWidget->addMsg(login, name, text, MessangerWidget::ETypeMsg::fromClient);
|
||||
}*/
|
||||
|
||||
void ServerLMSWidget::removeClient(int idSocket)
|
||||
{
|
||||
@@ -313,4 +297,3 @@ void ServerLMSWidget::changeEvent(QEvent *event)
|
||||
ui->retranslateUi(this); // переведём окно заново
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
#include "ServerLMS_global.h"
|
||||
#include "typesDataServerClient.h"
|
||||
#include "Client.h"
|
||||
//#include "instructorsAndTrainees.h"
|
||||
//#include "instructorsandtraineeswidget.h"
|
||||
//#include "messangerwidget.h"
|
||||
#include "multithreadserver.h"
|
||||
#include "providerdblms.h"
|
||||
|
||||
@@ -42,22 +39,21 @@ class SERVERLMS_EXPORT ServerLMSWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ServerLMSWidget(/*MessangerWidget* messangerWidget, */QWidget *parent = nullptr);
|
||||
void autorizationHandler(QString login);
|
||||
explicit ServerLMSWidget(QWidget *parent = nullptr);
|
||||
~ServerLMSWidget();
|
||||
|
||||
void autorizationHandler(QString login);
|
||||
|
||||
protected:
|
||||
// Метод получения событий
|
||||
// В нём будет производиться проверка события смены перевода приложения
|
||||
void changeEvent(QEvent * event) override;
|
||||
|
||||
signals:
|
||||
//void signal_authorizationChanged();
|
||||
void sigRecognize();
|
||||
QTcpSocket* sigGetSocket();
|
||||
void sigLog(QString log);
|
||||
|
||||
|
||||
public slots:
|
||||
void slot_LanguageChanged(QString language);
|
||||
void addClient(qintptr descriptor, ClientHandler *client);
|
||||
@@ -68,11 +64,10 @@ private slots:
|
||||
//слот обработки сигнала о готовности нового сообщения на отправку клиенту от мессенджера
|
||||
void slot_msgToClientReady(QString login, QString text);
|
||||
void slotAddToLog(QString msg);
|
||||
//void slotAddToMessanger(QString login, QString text);
|
||||
|
||||
public:
|
||||
|
||||
void removeClient(int socketId);
|
||||
|
||||
void blockAutorization()
|
||||
{
|
||||
stateBlockAutorization = blocked;
|
||||
@@ -81,7 +76,6 @@ public:
|
||||
{
|
||||
stateBlockAutorization = unblocked;
|
||||
}
|
||||
|
||||
EStateBlockAutorization getStateBlockAutorization() const
|
||||
{
|
||||
return stateBlockAutorization;
|
||||
@@ -94,11 +88,13 @@ private slots:
|
||||
void on_btnStopServer_clicked();
|
||||
void on_btnTaskSet_clicked();
|
||||
|
||||
|
||||
private:
|
||||
bool startServer();
|
||||
bool stopServer();
|
||||
|
||||
private:
|
||||
Ui::ServerLMSWidget *ui;
|
||||
|
||||
private:
|
||||
MultiThreadServer * tcpServer;
|
||||
qint16 hostPort;
|
||||
@@ -106,9 +102,6 @@ private:
|
||||
EStateServer stateServer;
|
||||
EStateBlockAutorization stateBlockAutorization;
|
||||
|
||||
//InstructorsAndTraineesWidget* pInstructorsAndTrainees;
|
||||
//MessangerWidget* pMessangerWidget;
|
||||
|
||||
QThread *updateThread;
|
||||
QThread *loggerThread;
|
||||
|
||||
@@ -121,8 +114,6 @@ private:
|
||||
|
||||
bool first = true; // для тестов Unity
|
||||
|
||||
private:
|
||||
Ui::ServerLMSWidget *ui;
|
||||
QTranslator qtLanguageTranslator;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user