mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
149 lines
4.7 KiB
C++
149 lines
4.7 KiB
C++
#ifndef CONNECTORTOSERVER_H
|
||
#define CONNECTORTOSERVER_H
|
||
|
||
#include <QObject>
|
||
#include <QMap>
|
||
#include <widgets/versionselectwidget.h>
|
||
#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 "streamingversiondata.h"
|
||
#include "Datas.h"
|
||
|
||
class ConnectorToServer : public QObject
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit ConnectorToServer(QWidget* parentWidget, QObject *parent = nullptr);
|
||
~ConnectorToServer();
|
||
|
||
bool authorizationInstructorLocal(QString login, QString password);
|
||
bool deAuthorizationInstructorLocal(QString login);
|
||
|
||
bool sendQueryToDB(TypeQueryToDB typeQuery, int id = 0, void* data = nullptr);
|
||
bool sendMessage(QString fromId, QString toId, QString text);
|
||
|
||
bool sendQueryTasksXML(QString type);
|
||
|
||
void SetConnectToServer();
|
||
void StopConnectToServer();
|
||
|
||
public:
|
||
QByteArray getListTaskFimArray();
|
||
QByteArray getListTaskAmmArray();
|
||
|
||
public:
|
||
//Запросы к БД (локальной)
|
||
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);
|
||
|
||
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);
|
||
void showVersionSelect();
|
||
|
||
void setLoginName(QString name);
|
||
|
||
ServerSettings getServerSettings();
|
||
bool getIsConnected();
|
||
|
||
public slots:
|
||
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_AnswerQueryTasksXML_FIM(QByteArray array);
|
||
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
|
||
|
||
void slot_sendMessage(QString fromId, QString toId, QString text);
|
||
void showServerList(QList<StreamingVersionData*> *serverList);
|
||
|
||
void slot_HashReady();
|
||
|
||
signals:
|
||
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
|
||
void sigStopConnect();
|
||
void sigInitializeClient(RecognizeSystem *recognizeSystem,
|
||
SendSystem *sendSystem,
|
||
QThread *thread);
|
||
|
||
void signal_sendXMLmsgGUItoServer(QByteArray array);
|
||
|
||
void sigLoginResult(ServerAuthorization * serverAuth);
|
||
void sigDeLoginResult(ServerDeAuthorization * serverDeAuth);
|
||
|
||
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_ConnectedToServer(bool state);
|
||
|
||
void signal_InitMessanger(QList<Trainee> listTrainees);
|
||
|
||
void signal_receiveMessage(QString fromId, QString toId, QString text);
|
||
void sigSendAnswerToServer(QByteArray array);
|
||
|
||
private:
|
||
void initialize();
|
||
void bindConnection();
|
||
void createObjects();
|
||
|
||
//Очистка списочной модели БД СУО
|
||
void clearListModelDB();
|
||
|
||
private:
|
||
QWidget* parentWidget;
|
||
QThread *connectionThread;
|
||
TCPClient *client;
|
||
DataParser *dataParser;
|
||
SendSystem *sendSystem;
|
||
RecognizeSystem *recognizeSystem;
|
||
VersionSelectWidget *versionSelectWidget;
|
||
VersionContainer *versionContainer;
|
||
NotifyController *notifyController;
|
||
|
||
//Списочная модель БД СУО
|
||
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;
|
||
|
||
ServerSettings serverSettings;
|
||
};
|
||
|
||
#endif // CONNECTORTOSERVER_H
|