mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
213 lines
6.6 KiB
C++
213 lines
6.6 KiB
C++
#ifndef CONNECTORTOSERVER_H
|
||
#define CONNECTORTOSERVER_H
|
||
|
||
#include <QObject>
|
||
#include <QMap>
|
||
#include <QMutex>
|
||
#include "Core\tcpclient.h"
|
||
#include "Core\dataparser.h"
|
||
#include "Core\sendsystem.h"
|
||
#include "Core\recognizesystem.h"
|
||
#include "instructor.h"
|
||
#include "trainee.h"
|
||
#include "group.h"
|
||
#include "computer.h"
|
||
#include "classroom.h"
|
||
#include "Datas.h"
|
||
#include "streamingversiondata.h"
|
||
#include "metatypes.h"
|
||
|
||
class ConnectorToServer : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit ConnectorToServer(QObject *parent = nullptr);
|
||
~ConnectorToServer();
|
||
|
||
public:
|
||
ServerSettings getServerSettings();
|
||
bool getIsConnected();
|
||
|
||
SendSystem *getSendSystem() const;
|
||
ServerAuthorization getServerAuth(){return serverAuth;}
|
||
|
||
void SetConnectToServer();
|
||
void StopConnectToServer();
|
||
|
||
void setLoginName(QString name);
|
||
QString getLoginName();
|
||
|
||
public:
|
||
//Send
|
||
bool sendAuthorizationInstructorLocal(QString login, QString password);
|
||
bool sendDeAuthorizationInstructorLocal(QString login);
|
||
|
||
bool sendQueryToDB(TypeQueryToDB typeQuery, int id = 0, void* data = nullptr);
|
||
bool sendMessage(ClientMessage clientMessage);
|
||
|
||
bool sendQueryTasksXML(QString type);
|
||
bool sendQueryListSubProc(QString dmCode);
|
||
bool sendQueryBlockAuth(bool block, QString type);
|
||
|
||
void sendShowVersionSelect();
|
||
bool sendClientNotify(QString command);
|
||
|
||
public:
|
||
//LocalModelDB
|
||
QByteArray getListTaskFimArray();
|
||
QByteArray getListTaskAmmArray();
|
||
|
||
QList<Instructor> getListInstructors();
|
||
QList<Trainee> getListTrainees();
|
||
QList<Group> getListGroups();
|
||
QList<Computer> getListComputers();
|
||
QList<Classroom> getListClassrooms();
|
||
QList<TaskAmmFim> getListTasksAMMforTrainee(int trainee_id);
|
||
QList<TaskAmmFim> getListTasksFIMforTrainee(int trainee_id);
|
||
QList<SubProc> getListSubProcForDMCode(QString dmCode);
|
||
int getCountTasksAMMforTrainee(int trainee_id);
|
||
int getCountTasksFIMforTrainee(int trainee_id);
|
||
|
||
bool isArchivedInstructor(int id);
|
||
bool isAdminInstructor(int id);
|
||
bool isLoggedInInstructor(int id);
|
||
Instructor getInstructor(int id);
|
||
|
||
QList<Trainee> getListTraineesInGroup(int id);
|
||
bool isArchivedTrainee(int id);
|
||
bool isLoggedInTrainee(int id);
|
||
Trainee getTrainee(int id);
|
||
Group getGroup(int id);
|
||
|
||
int getIdTraineeByLogin(QString login);
|
||
int getIdInstructorByLogin(QString login);
|
||
|
||
bool getServerBlockState() const;
|
||
|
||
private:
|
||
//Очистка списочной модели БД СУО
|
||
void clearListModelDB();
|
||
|
||
public slots:
|
||
//AnswerQueryToDB
|
||
void slot_AnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
|
||
void slot_AnswerQueryToDB_ListGroups(QList<Group> listGroups);
|
||
void slot_AnswerQueryToDB_ListTrainees(QList<Trainee> listTrainees);
|
||
void slot_AnswerQueryToDB_ListComputers(QList<Computer> listComputers);
|
||
void slot_AnswerQueryToDB_ListClassrooms(QList<Classroom> listClassrooms);
|
||
void slot_AnswerQueryToDB_ListTasksAMMforTrainee(QList<TaskAmmFim> listTasks, int trainee_id);
|
||
void slot_AnswerQueryToDB_ListTasksFIMforTrainee(QList<TaskAmmFim> listTasks, int trainee_id);
|
||
|
||
void slot_AnswerQueryToDB_ListsTasksAMMofAllTrainees(MapListsTasksAllTraineeType mapOfLists);
|
||
void slot_AnswerQueryToDB_ListsTasksFIMofAllTrainees(MapListsTasksAllTraineeType mapOfLists);
|
||
|
||
void slot_AnswerQueryTasksXML_FIM(QByteArray array);
|
||
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
|
||
void slot_AnswerQuerySubProc(QList<SubProc> listSubProc, QString parentTask_dmCode);
|
||
|
||
void slot_AnswerDocsChanged();
|
||
|
||
public slots:
|
||
void slot_sendMessage(ClientMessage clientMessage);
|
||
void slot_showServerList(QList<StreamingVersionData*> *serverList);
|
||
void slot_HashReady();
|
||
void slot_Auth(ServerAuthorization * serverAuth);
|
||
void slot_ServerBlocked();
|
||
void slot_ErrorAuth(QString error);
|
||
|
||
void slot_SendDeleteVersion(StreamingVersionData *streaming);
|
||
void slot_SendSwitchVersion(StreamingVersionData *selectVersion);
|
||
void slot_SendCopyVersion(QString versionPair);
|
||
|
||
void slot_getVersion();
|
||
|
||
void slot_NotifyVersionControl(QString text);
|
||
|
||
void slot_ServerBlockState(bool state);
|
||
|
||
signals:
|
||
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
|
||
void sigStopConnect();
|
||
void sigInitializeClient(RecognizeSystem *recognizeSystem,
|
||
SendSystem *sendSystem,
|
||
QThread *thread);
|
||
|
||
void sigLoginResult(ServerAuthorization * serverAuth);
|
||
void sigDeLoginResult(ServerDeAuthorization * serverDeAuth);
|
||
|
||
void sigTryBlockResult(bool result, QString type);
|
||
|
||
void sigServerBlocked();
|
||
void sigErrorAuth(QString error);
|
||
|
||
void signal_UpdateDB(bool treeInstructor, bool treeTrainee);
|
||
|
||
void signal_UpdateTasksFIM(); //Общий список
|
||
void signal_UpdateTasksAMM(); //Общий список
|
||
|
||
void signal_UpdateTasksFIMforTrainee(int trainee_id);
|
||
void signal_UpdateTasksAMMforTrainee(int trainee_id);
|
||
|
||
void signal_UpdateSubProcForDMCode(QString dmCode);
|
||
|
||
void signal_ConnectedToServer(bool state);
|
||
|
||
void signal_reInitMessangerByUsers(QList<User> listUsers);
|
||
|
||
void signal_receiveMessage(ClientMessage clientMessage);
|
||
void sigSendAnswerToServer(QByteArray array);
|
||
|
||
void signal_AnswerDocsChanged();
|
||
|
||
void signal_SetVersion(StreamingVersionData* serverVersion);
|
||
|
||
void signal_SendDeleteVersion(StreamingVersionData *streaming);
|
||
void signal_SendSwitchVersion(StreamingVersionData *selectVersion);
|
||
void signal_SendCopyVersion(QString versionPair);
|
||
|
||
void signal_showServerList(QList<StreamingVersionData*> *serverList);
|
||
void signal_SendGetVersion();
|
||
|
||
void signal_NotifyVersionControl(QString text);
|
||
|
||
void signal_ServerBlockState(bool state);
|
||
|
||
private:
|
||
void initialize();
|
||
void bindConnection();
|
||
void createObjects();
|
||
|
||
private:
|
||
QThread *connectionThread;
|
||
TCPClient *client;
|
||
DataParser *dataParser;
|
||
SendSystem *sendSystem;
|
||
RecognizeSystem *recognizeSystem;
|
||
|
||
//Списочная модель БД СУО
|
||
QMutex mtxAccess;
|
||
QList<Instructor> listInstructors;
|
||
QList<Group> listGroups;
|
||
QList<Trainee> listTrainees;
|
||
QList<Computer> listComputers;
|
||
QList<Classroom> listClassrooms;
|
||
QMap<int, QList<TaskAmmFim>> mapTasksAMM;
|
||
QMap<int, QList<TaskAmmFim>> mapTasksFIM;
|
||
QByteArray listTaskFimArray;
|
||
QByteArray listTaskAmmArray;
|
||
|
||
QMap<QString, QList<SubProc>> mapSubProc;
|
||
|
||
ServerSettings serverSettings;
|
||
ServerAuthorization serverAuth;
|
||
|
||
bool fl_GetedOfflineMessages;
|
||
|
||
QString nameInstructorLoggedInLocal;
|
||
|
||
bool serverBlockState;
|
||
};
|
||
|
||
#endif // CONNECTORTOSERVER_H
|