Мессенджер полностью работает

This commit is contained in:
krivoshein
2024-12-17 12:54:43 +03:00
parent e393244bf7
commit a839f964fe
69 changed files with 724 additions and 605 deletions

View File

@@ -357,6 +357,26 @@ void RecognizeSystem::xmlParser(QByteArray array)
emit sigAuth(serverAuth);
}
if(xmlReader.name() == "ServerMessage"){
ClientMessage *clientMessage = new ClientMessage;
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if (name == "Login"){
clientMessage->Login = value;
}
if (name == "Text"){
clientMessage->Text = value;
}
}
emit signal_MessageForGUI(clientMessage->Login, clientMessage->Text);
}
if(xmlReader.name() == "ServerDeAuthorization"){
ServerDeAuthorization *serverDeAuth = new ServerDeAuthorization;

View File

@@ -10,6 +10,7 @@
#include "instructor.h"
#include "trainee.h"
#include "group.h"
#include "Datas.h"
class RecognizeSystem : public QObject
@@ -38,6 +39,8 @@ signals:
void sigSocketWaitForReadyRead(int waitTime);
void sigStartCompare();
void signal_MessageForGUI(QString login, QString text);
void sigAnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
void sigAnswerQueryToDB_ListGroups(QList<Group> listGroups);
void sigAnswerQueryToDB_ListTrainees(QList<Trainee> listTrainees);

View File

@@ -32,6 +32,8 @@ enum PacketType{
TYPE_QT = 9,
TYPE_DISABLE = 11,
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
//xml-ответы на запросы к БД
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS = 101,

View File

@@ -69,6 +69,7 @@ public:
class ClientMessage
{
public:
QString Login;
QString Text;
};

View File

@@ -281,8 +281,6 @@ void ConnectorToServer::slot_msgToClientReady(QString login, QString text)
sendMessageForClient(id, login, text);
}
void ConnectorToServer::initialize()
{
createObjects();
@@ -302,6 +300,7 @@ void ConnectorToServer::bindConnection()
connect(recognizeSystem,&RecognizeSystem::sigAuth,this,&ConnectorToServer::sigLoginResult);
connect(recognizeSystem,&RecognizeSystem::sigDeAuth,this,&ConnectorToServer::sigDeLoginResult);
connect(recognizeSystem,&RecognizeSystem::signal_MessageForGUI,this,&ConnectorToServer::signal_msgFromClientReady);
//connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB,this,&ConnectorToServer::slot_AnswerQueryToDB);
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListInstructors,this,&ConnectorToServer::slot_AnswerQueryToDB_ListInstructors);

View File

@@ -80,6 +80,8 @@ signals:
void signal_InitMessanger(QList<Trainee> listTrainees);
void signal_msgFromClientReady(QString login, QString text);
private:
void initialize();