mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Сделал первый этап разделения Сервера и GUI
This commit is contained in:
@@ -10,17 +10,17 @@
|
||||
#include "ui_serverlmswidget.h"
|
||||
|
||||
//#include "instructorsAndTrainees.h"
|
||||
#include "instructorsandtraineeswidget.h"
|
||||
//#include "instructorsandtraineeswidget.h"
|
||||
|
||||
|
||||
ServerLMSWidget::ServerLMSWidget(InstructorsAndTraineesWidget* instructorsAndTrainees, MessangerWidget* messangerWidget, QWidget *parent) :
|
||||
ServerLMSWidget::ServerLMSWidget(/*MessangerWidget* messangerWidget, */QWidget *parent) :
|
||||
QWidget(parent),
|
||||
tcpServer(nullptr),
|
||||
hostPort(6000),
|
||||
stateServer(stoped),
|
||||
stateBlockAutorization(/*unblocked*/blocked),
|
||||
pInstructorsAndTrainees(instructorsAndTrainees),
|
||||
pMessangerWidget(messangerWidget),
|
||||
//pInstructorsAndTrainees(instructorsAndTrainees),
|
||||
//pMessangerWidget(messangerWidget),
|
||||
ui(new Ui::ServerLMSWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -41,12 +41,14 @@ ServerLMSWidget::ServerLMSWidget(InstructorsAndTraineesWidget* instructorsAndTra
|
||||
ui->comboTasks->addItem("Задача 4");
|
||||
ui->comboTasks->addItem("Задача 5");
|
||||
|
||||
providerDBLMS = new ProviderDBLMS(this);
|
||||
|
||||
logger = new Logger(ui->listWidgetLogger);
|
||||
connect(logger,&Logger::sigSendTextToLogger,this,&ServerLMSWidget::slotAddToLog,Qt::QueuedConnection);
|
||||
logger->moveToThread(loggerThread);
|
||||
|
||||
|
||||
processingSystem = new ProcessingSystem;
|
||||
processingSystem = new ProcessingSystem(providerDBLMS);
|
||||
dataParser = new DataParser(processingSystem);
|
||||
|
||||
updateController = new UpdateController;
|
||||
@@ -56,20 +58,24 @@ ServerLMSWidget::ServerLMSWidget(InstructorsAndTraineesWidget* instructorsAndTra
|
||||
updateThread->start();
|
||||
|
||||
updateController->initialize(nullptr,dataParser);
|
||||
processingSystem->initialize(dataParser,this,instructorsAndTrainees);
|
||||
processingSystem->initialize(dataParser,this);
|
||||
|
||||
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(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(processingSystem,&ProcessingSystem::sigAddToMessanger,this,&ServerLMSWidget::slotAddToMessanger,Qt::QueuedConnection);
|
||||
connect(this,&ServerLMSWidget::sigLog,logger,&Logger::addTextToLogger);
|
||||
|
||||
providerDBLMS->ConnectionToDB();
|
||||
|
||||
on_btnStartServer_clicked();
|
||||
|
||||
first = true;
|
||||
@@ -80,11 +86,11 @@ void ServerLMSWidget::autorizationHandler(QString login)
|
||||
{
|
||||
//Отмена авторизации в БД
|
||||
|
||||
if(pInstructorsAndTrainees->deAuthorizationTrainee(login))
|
||||
if(providerDBLMS->deAuthorizationTrainee(login))
|
||||
{//Деавторизовался обучаемый
|
||||
|
||||
}
|
||||
else if(pInstructorsAndTrainees->deAuthorizationInstructor(login))
|
||||
else if(providerDBLMS->deAuthorizationInstructor(login))
|
||||
{//Деавторизовался инструктор
|
||||
|
||||
}
|
||||
@@ -192,12 +198,12 @@ 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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user