Refact connectortoserver

This commit is contained in:
2025-10-17 16:12:33 +03:00
parent e2a2d8142c
commit 2d8c13fd1a
5 changed files with 324 additions and 313 deletions

View File

@@ -3,6 +3,7 @@
#include <QObject>
#include <QMap>
#include <QMutex>
#include <widgets/versionselectwidget.h>
#include "Core\tcpclient.h"
#include "Core\dataparser.h"
@@ -19,10 +20,12 @@
class ConnectorToServer : public QObject
{
Q_OBJECT
public:
explicit ConnectorToServer(QWidget* parentWidget, QObject *parent = nullptr);
~ConnectorToServer();
public:
bool authorizationInstructorLocal(QString login, QString password);
bool deAuthorizationInstructorLocal(QString login);
@@ -32,15 +35,24 @@ public:
bool sendQueryTasksXML(QString type);
bool sendQueryBlockAuth(bool block);
void showVersionSelect();
void setLoginName(QString name);
bool sendClientNotify(QString command);
ServerSettings getServerSettings();
bool getIsConnected();
SendSystem *getSendSystem() const;
ServerAuthorization getServerAuth(){return serverAuth;}
void SetConnectToServer();
void StopConnectToServer();
public:
//Запросы к БД (локальной)
QByteArray getListTaskFimArray();
QByteArray getListTaskAmmArray();
public:
//Запросы к БД (локальной)
QList<Instructor> getListInstructors();
QList<Trainee> getListTrainees();
QList<Group> getListGroups();
@@ -64,18 +76,13 @@ public:
int getIdTraineeByLogin(QString login);
int getIdInstructorByLogin(QString login);
void showVersionSelect();
void setLoginName(QString name);
private:
//Очистка списочной модели БД СУО
void clearListModelDB();
ServerSettings getServerSettings();
bool getIsConnected();
SendSystem *getSendSystem() const;
ServerAuthorization getServerAuth(){return serverAuth;}
bool sendClientNotify(QString command);
public slots:
//Ответы на запросы к Серверу
void slot_AnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
void slot_AnswerQueryToDB_ListGroups(QList<Group> listGroups);
void slot_AnswerQueryToDB_ListTrainees(QList<Trainee> listTrainees);
@@ -88,6 +95,7 @@ public slots:
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
void slot_sendMessage(ClientMessage clientMessage);
void slot_showServerList(QList<StreamingVersionData*> *serverList);
void slot_HashReady();
@@ -124,9 +132,6 @@ private:
void bindConnection();
void createObjects();
//Очистка списочной модели БД СУО
void clearListModelDB();
private:
QWidget* parentWidget;
QThread *connectionThread;
@@ -146,7 +151,6 @@ private:
QList<Classroom> listClassrooms;
QMap<int, QList<TaskAmmFim>> mapTasksAMM;
QMap<int, QList<TaskAmmFim>> mapTasksFIM;
QByteArray listTaskFimArray;
QByteArray listTaskAmmArray;
@@ -154,6 +158,8 @@ private:
ServerAuthorization serverAuth;
bool fl_GetedOfflineMessages;
QMutex mtxAccess;
};
#endif // CONNECTORTOSERVER_H