mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
feat: change message and contac list attribute
This commit is contained in:
@@ -20,8 +20,6 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## feature client Unity
|
## feature client Unity
|
||||||
|
|
||||||
- [ ] Добавить обновление инструктора, если он перелогинился
|
|
||||||
- [ ] FIM проверять на null задачу
|
|
||||||
- [ ] Если staticData не найдена, грузится как оффлайн, проверять просто иконки билда
|
- [ ] Если staticData не найдена, грузится как оффлайн, проверять просто иконки билда
|
||||||
- [ ] Делить по группам номер группы
|
- [ ] Делить по группам номер группы
|
||||||
- [ ] добавить тестово логины в строку контактов
|
- [ ] добавить тестово логины в строку контактов
|
||||||
@@ -40,7 +38,6 @@ kanban-plugin: board
|
|||||||
|
|
||||||
- [ ] добавить генерацию пустых файлов, если shared не найден
|
- [ ] добавить генерацию пустых файлов, если shared не найден
|
||||||
- [ ] ПЕРЕВЕСТИ все действия под операции и формировать процент ПРИ загрузке из них
|
- [ ] ПЕРЕВЕСТИ все действия под операции и формировать процент ПРИ загрузке из них
|
||||||
- [ ] Добавить - фильтрацию trainees или instructor
|
|
||||||
- [ ] убрать clientMap из serverLMS Widget в мультитред сервер
|
- [ ] убрать clientMap из serverLMS Widget в мультитред сервер
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +47,8 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## Complete
|
## Complete
|
||||||
|
|
||||||
|
- [ ] FIM проверять на null задачу
|
||||||
|
- [ ] Добавить - фильтрацию trainees или instructor
|
||||||
- [ ] выбор версии на один клик
|
- [ ] выбор версии на один клик
|
||||||
- [ ] сделать header полупрозрачным прозрачным
|
- [ ] сделать header полупрозрачным прозрачным
|
||||||
- [ ] на старте все мониторы должны быть активны
|
- [ ] на старте все мониторы должны быть активны
|
||||||
@@ -334,6 +333,7 @@ kanban-plugin: board
|
|||||||
|
|
||||||
## Cancel
|
## Cancel
|
||||||
|
|
||||||
|
- [ ] Добавить обновление инструктора, если он перелогинился
|
||||||
- [ ] добавить в settings адрес и булку мат модели
|
- [ ] добавить в settings адрес и булку мат модели
|
||||||
- [ ] Иерархия проекта - папка application, папка updater и линк на основной экзешник
|
- [ ] Иерархия проекта - папка application, папка updater и линк на основной экзешник
|
||||||
- [ ] добавить подключение без DB
|
- [ ] добавить подключение без DB
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ add_library(DataBaseLMS SHARED
|
|||||||
typeQueryToDB.h
|
typeQueryToDB.h
|
||||||
timingoftrainee.cpp
|
timingoftrainee.cpp
|
||||||
timingoftrainee.h
|
timingoftrainee.h
|
||||||
|
contactModel.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
||||||
|
|||||||
52
DataBaseLMS/contactModel.h
Normal file
52
DataBaseLMS/contactModel.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#ifndef CONTACTMODEL_H
|
||||||
|
#define CONTACTMODEL_H
|
||||||
|
|
||||||
|
#include "instructor.h"
|
||||||
|
#include "trainee.h"
|
||||||
|
#include "user.h"
|
||||||
|
|
||||||
|
class ContactModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ContactModel(Instructor instructor)
|
||||||
|
{
|
||||||
|
login = instructor.getLogin();
|
||||||
|
name = instructor.getName();
|
||||||
|
type = 0;
|
||||||
|
loggedIn = instructor.getLoggedIn();
|
||||||
|
id = instructor.getID();
|
||||||
|
};
|
||||||
|
|
||||||
|
ContactModel(Trainee trainee)
|
||||||
|
{
|
||||||
|
login = trainee.getLogin();
|
||||||
|
name = trainee.getName();
|
||||||
|
type = 1;
|
||||||
|
loggedIn = trainee.getLoggedIn();
|
||||||
|
id = trainee.getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setType(int type){this->type = type;}
|
||||||
|
int getType(){return type;}
|
||||||
|
|
||||||
|
void setName(QString name){this->name = name;}
|
||||||
|
QString getName(){return name;}
|
||||||
|
|
||||||
|
void setLoggedIn(bool loggedIn){this->loggedIn = loggedIn;}
|
||||||
|
bool getLoggedIn(){return loggedIn;}
|
||||||
|
|
||||||
|
void setLogin(QString login){this->login = login;}
|
||||||
|
QString getLogin(){return login;}
|
||||||
|
|
||||||
|
void setID(int id){this->id = id;}
|
||||||
|
int getID(){return id;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString login;
|
||||||
|
QString name;
|
||||||
|
bool loggedIn;
|
||||||
|
int type;
|
||||||
|
int id;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONTACTMODEL_H
|
||||||
@@ -76,7 +76,7 @@ QByteArray DataParser::createAuthMessage(ClientAutorization *auth)
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DataParser::createMessage(ClientMessage *clientMessage)
|
QByteArray DataParser::createMessage(ClientMessage clientMessage)
|
||||||
{
|
{
|
||||||
QByteArray array;
|
QByteArray array;
|
||||||
QXmlStreamWriter xmlWriter(&array);
|
QXmlStreamWriter xmlWriter(&array);
|
||||||
@@ -85,9 +85,10 @@ QByteArray DataParser::createMessage(ClientMessage *clientMessage)
|
|||||||
xmlWriter.writeStartDocument();
|
xmlWriter.writeStartDocument();
|
||||||
xmlWriter.writeStartElement("ClientMessage");
|
xmlWriter.writeStartElement("ClientMessage");
|
||||||
|
|
||||||
xmlWriter.writeAttribute("From",clientMessage->fromId);
|
xmlWriter.writeAttribute("From",clientMessage.fromId);
|
||||||
xmlWriter.writeAttribute("To", clientMessage->toId);
|
xmlWriter.writeAttribute("To", clientMessage.toId);
|
||||||
xmlWriter.writeAttribute("Text", clientMessage->Text);
|
xmlWriter.writeAttribute("Text", clientMessage.Text);
|
||||||
|
xmlWriter.writeAttribute("UserType",clientMessage.UserType);
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public:
|
|||||||
void createFileDataList(QList<FileData> fileDataList,QString filename);
|
void createFileDataList(QList<FileData> fileDataList,QString filename);
|
||||||
|
|
||||||
QByteArray createAuthMessage(ClientAutorization *auth);
|
QByteArray createAuthMessage(ClientAutorization *auth);
|
||||||
QByteArray createMessage(ClientMessage *toClientMessage);
|
QByteArray createMessage(ClientMessage toClientMessage);
|
||||||
QByteArray createQueryToDBMessage(ClientQueryToDB *queryToDB, int id = 0, void* data = nullptr);
|
QByteArray createQueryToDBMessage(ClientQueryToDB *queryToDB, int id = 0, void* data = nullptr);
|
||||||
QByteArray createQueryTasksXMLMessage(QString type);
|
QByteArray createQueryTasksXMLMessage(QString type);
|
||||||
QByteArray createDeAuthMessage(ClientDeAutorization *deAuth);
|
QByteArray createDeAuthMessage(ClientDeAutorization *deAuth);
|
||||||
|
|||||||
@@ -526,9 +526,14 @@ void RecognizeSystem::xmlParser(QByteArray array)
|
|||||||
if (name == "Text"){
|
if (name == "Text"){
|
||||||
clientMessage->Text = value;
|
clientMessage->Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name == "UserType")
|
||||||
|
{
|
||||||
|
clientMessage->UserType = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit signal_ReceiveMessage(clientMessage->fromId, clientMessage->toId,clientMessage->Text);
|
emit signal_ReceiveMessage(*clientMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(xmlReader.name() == "ServerDeAuthorization"){
|
if(xmlReader.name() == "ServerDeAuthorization"){
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ signals:
|
|||||||
void sigSocketWaitForReadyRead(int waitTime);
|
void sigSocketWaitForReadyRead(int waitTime);
|
||||||
void sigStartCompare();
|
void sigStartCompare();
|
||||||
|
|
||||||
void signal_ReceiveMessage(QString fromId,QString toId, QString text);
|
void signal_ReceiveMessage(ClientMessage clientMessage);
|
||||||
|
|
||||||
void sigAnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
|
void sigAnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
|
||||||
void sigAnswerQueryToDB_ListGroups(QList<Group> listGroups);
|
void sigAnswerQueryToDB_ListGroups(QList<Group> listGroups);
|
||||||
|
|||||||
@@ -77,6 +77,15 @@ public:
|
|||||||
QString fromId;
|
QString fromId;
|
||||||
QString toId;
|
QString toId;
|
||||||
QString Text;
|
QString Text;
|
||||||
|
QString UserType;
|
||||||
|
ClientMessage(){}
|
||||||
|
ClientMessage(QString fromId, QString toId, QString text, QString UserType)
|
||||||
|
{
|
||||||
|
this->fromId = fromId;
|
||||||
|
this->toId = toId;
|
||||||
|
this->Text = text;
|
||||||
|
this->UserType = UserType;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServerTask
|
class ServerTask
|
||||||
|
|||||||
@@ -81,18 +81,12 @@ bool ConnectorToServer::sendQueryToDB(TypeQueryToDB typeQuery, int id, void* dat
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectorToServer::sendMessage(QString fromId, QString toId, QString text)
|
bool ConnectorToServer::sendMessage(ClientMessage clientMessage)
|
||||||
{
|
{
|
||||||
if (!client->getIsConnected())
|
if (!client->getIsConnected())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientMessage *clientMessage = new ClientMessage;
|
|
||||||
clientMessage->fromId = fromId;
|
|
||||||
clientMessage->toId = toId;
|
|
||||||
clientMessage->Text = text;
|
|
||||||
|
|
||||||
QByteArray array = dataParser->createMessage(clientMessage);
|
QByteArray array = dataParser->createMessage(clientMessage);
|
||||||
emit signal_sendXMLmsgGUItoServer(array);
|
emit signal_sendXMLmsgGUItoServer(array);
|
||||||
|
|
||||||
@@ -372,9 +366,9 @@ void ConnectorToServer::slot_AnswerQueryTasksXML_AMM(QByteArray array)
|
|||||||
emit signal_UpdateTasksAMM();
|
emit signal_UpdateTasksAMM();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectorToServer::slot_sendMessage(QString fromId, QString toId, QString text)
|
void ConnectorToServer::slot_sendMessage(ClientMessage clientMessage)
|
||||||
{
|
{
|
||||||
sendMessage(fromId, toId, text);
|
sendMessage(clientMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectorToServer::showServerList(QList<StreamingVersionData *> *serverList)
|
void ConnectorToServer::showServerList(QList<StreamingVersionData *> *serverList)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public:
|
|||||||
bool deAuthorizationInstructorLocal(QString login);
|
bool deAuthorizationInstructorLocal(QString login);
|
||||||
|
|
||||||
bool sendQueryToDB(TypeQueryToDB typeQuery, int id = 0, void* data = nullptr);
|
bool sendQueryToDB(TypeQueryToDB typeQuery, int id = 0, void* data = nullptr);
|
||||||
bool sendMessage(QString fromId, QString toId, QString text);
|
bool sendMessage(ClientMessage clientMessage);
|
||||||
|
|
||||||
bool sendQueryTasksXML(QString type);
|
bool sendQueryTasksXML(QString type);
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public slots:
|
|||||||
void slot_AnswerQueryTasksXML_FIM(QByteArray array);
|
void slot_AnswerQueryTasksXML_FIM(QByteArray array);
|
||||||
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
|
void slot_AnswerQueryTasksXML_AMM(QByteArray array);
|
||||||
|
|
||||||
void slot_sendMessage(QString fromId, QString toId, QString text);
|
void slot_sendMessage(ClientMessage clientMessage);
|
||||||
void showServerList(QList<StreamingVersionData*> *serverList);
|
void showServerList(QList<StreamingVersionData*> *serverList);
|
||||||
|
|
||||||
void slot_HashReady();
|
void slot_HashReady();
|
||||||
@@ -110,7 +110,7 @@ signals:
|
|||||||
|
|
||||||
void signal_InitMessanger(QList<Trainee> listTrainees);
|
void signal_InitMessanger(QList<Trainee> listTrainees);
|
||||||
|
|
||||||
void signal_receiveMessage(QString fromId, QString toId, QString text);
|
void signal_receiveMessage(ClientMessage clientMessage);
|
||||||
void sigSendAnswerToServer(QByteArray array);
|
void sigSendAnswerToServer(QByteArray array);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
qRegisterMetaType<QList<Module*>>("QList<Module*>");
|
qRegisterMetaType<QList<Module*>>("QList<Module*>");
|
||||||
qRegisterMetaType<QList<QTreeWidgetItem*>>("QList<QTreeWidgetItem*>");
|
qRegisterMetaType<QList<QTreeWidgetItem*>>("QList<QTreeWidgetItem*>");
|
||||||
qRegisterMetaType<QList<TaskAmmFim>>("QList<TaskAmmFim>");
|
qRegisterMetaType<QList<TaskAmmFim>>("QList<TaskAmmFim>");
|
||||||
|
qRegisterMetaType<ClientMessage>("ClientMessage");
|
||||||
|
|
||||||
qDebug() << "InstructorsAndTraineesWidget init thread ID " << QThread::currentThreadId();
|
qDebug() << "InstructorsAndTraineesWidget init thread ID " << QThread::currentThreadId();
|
||||||
|
|
||||||
@@ -218,6 +219,7 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA
|
|||||||
|
|
||||||
connectorToServer->sendQueryTasksXML("fim");
|
connectorToServer->sendQueryTasksXML("fim");
|
||||||
connectorToServer->sendQueryTasksXML("amm");
|
connectorToServer->sendQueryTasksXML("amm");
|
||||||
|
messangerWidget->initialize(serverAuth->Id);
|
||||||
//QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
|
//QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -153,8 +153,9 @@ void MessangerWidget::clear()
|
|||||||
void MessangerWidget::on_btnSend_clicked()
|
void MessangerWidget::on_btnSend_clicked()
|
||||||
{
|
{
|
||||||
QString text = ui->editMsg->toPlainText();
|
QString text = ui->editMsg->toPlainText();
|
||||||
|
ClientMessage message = ClientMessage(currClientId,selectedUserId,text,"0");
|
||||||
|
|
||||||
emit signal_sendMessage(currClientId, selectedUserId, text);
|
emit signal_sendMessage(message);
|
||||||
|
|
||||||
ui->editMsg->clear();
|
ui->editMsg->clear();
|
||||||
|
|
||||||
@@ -226,13 +227,13 @@ void MessangerWidget::slot_InitMessanger(QList<Trainee> listTrainees)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessangerWidget::slot_showMessage(QString fromId, QString toId, QString text)
|
void MessangerWidget::slot_showMessage(ClientMessage clientMessage)
|
||||||
{
|
{
|
||||||
for(Trainee trainee: listTrainees)
|
for(Trainee trainee: listTrainees)
|
||||||
{
|
{
|
||||||
if(QString::number(trainee.getID()) == fromId)
|
if(QString::number(trainee.getID()) == clientMessage.fromId)
|
||||||
{
|
{
|
||||||
addMsgFromClient(trainee, text);
|
addMsgFromClient(trainee, clientMessage.Text);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//сигнал о готовности нового сообщения на отправку клиенту
|
//сигнал о готовности нового сообщения на отправку клиенту
|
||||||
void signal_sendMessage(QString fromId, QString toId, QString text);
|
void signal_sendMessage(ClientMessage clientMessage);
|
||||||
//сигнал об изменении вкладки диалога с клиентом (TabDialogMessenger)
|
//сигнал об изменении вкладки диалога с клиентом (TabDialogMessenger)
|
||||||
void signal_tabMessengerChanged(QString login);
|
void signal_tabMessengerChanged(QString login);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public slots:
|
|||||||
//слот обработки сигнала о выборе обучаемого
|
//слот обработки сигнала о выборе обучаемого
|
||||||
void slot_traineeSelected(QString login);
|
void slot_traineeSelected(QString login);
|
||||||
//слот о приходе нового сообщения от клиента
|
//слот о приходе нового сообщения от клиента
|
||||||
void slot_showMessage(QString fromId, QString toId, QString text);
|
void slot_showMessage(ClientMessage clientMessage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void keyPressEvent(QKeyEvent *event) override;
|
virtual void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ add_library(ServerLMS SHARED
|
|||||||
Systems/tools.h
|
Systems/tools.h
|
||||||
Systems/chatsystem.cpp
|
Systems/chatsystem.cpp
|
||||||
Systems/chatsystem.h
|
Systems/chatsystem.h
|
||||||
|
Data/usertype.h
|
||||||
providerdblms.cpp
|
providerdblms.cpp
|
||||||
providerdblms.h
|
providerdblms.h
|
||||||
resources.qrc
|
resources.qrc
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ enum TypeClientAutorization{
|
|||||||
TYPE_GUI = 10
|
TYPE_GUI = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum UserType
|
||||||
|
{
|
||||||
|
INSTRUCTOR,
|
||||||
|
TRAINEE
|
||||||
|
};
|
||||||
|
|
||||||
class ClientAutorization
|
class ClientAutorization
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -101,13 +107,15 @@ public:
|
|||||||
QString From;
|
QString From;
|
||||||
QString To;
|
QString To;
|
||||||
QString Text;
|
QString Text;
|
||||||
|
QString Type; //ТИП ЮЗЕРА К КОТОРОМУ ПРИХОДИТ СООБЩЕНИЕ
|
||||||
|
|
||||||
ClientMessage(){}
|
ClientMessage(){}
|
||||||
ClientMessage(QString from,QString to,QString text)
|
ClientMessage(QString from,QString to,QString text,QString userType)
|
||||||
{
|
{
|
||||||
From = from;
|
From = from;
|
||||||
To = to;
|
To = to;
|
||||||
Text = text;
|
Text = text;
|
||||||
|
Type = userType;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
9
ServerLMS/Data/userType.h
Normal file
9
ServerLMS/Data/userType.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef USERTYPE_H
|
||||||
|
#define USERTYPE_H
|
||||||
|
|
||||||
|
enum UserType{
|
||||||
|
INSTRUCTOR,
|
||||||
|
TRAINEES
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USERTYPE_H
|
||||||
@@ -43,7 +43,7 @@ QByteArray ClientAnswerParser::deAuthorization(bool result, QString login)
|
|||||||
return dataParser->xmlAnswer(listTag);
|
return dataParser->xmlAnswer(listTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray ClientAnswerParser::message(QString loginFrom,QString loginTo,QString text)
|
QByteArray ClientAnswerParser::message(QString loginFrom,QString loginTo,QString text,QString type)
|
||||||
{
|
{
|
||||||
QList<SXmlAnswerTag> listTag;
|
QList<SXmlAnswerTag> listTag;
|
||||||
QList<SAttribute> listAttr;
|
QList<SAttribute> listAttr;
|
||||||
@@ -54,6 +54,8 @@ QByteArray ClientAnswerParser::message(QString loginFrom,QString loginTo,QString
|
|||||||
listAttr.append(attribute1);
|
listAttr.append(attribute1);
|
||||||
attribute1 = {"Text",text};
|
attribute1 = {"Text",text};
|
||||||
listAttr.append(attribute1);
|
listAttr.append(attribute1);
|
||||||
|
attribute1 = {"UserType",type};
|
||||||
|
listAttr.append(attribute1);
|
||||||
|
|
||||||
SXmlAnswerTag tag = {"ClientMessage", listAttr};
|
SXmlAnswerTag tag = {"ClientMessage", listAttr};
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login, int id);
|
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login, int id);
|
||||||
QByteArray deAuthorization(bool result, QString login);
|
QByteArray deAuthorization(bool result, QString login);
|
||||||
QByteArray message(QString loginFrom,QString loginTo,QString text);
|
QByteArray message(QString loginFrom,QString loginTo,QString text, QString userType);
|
||||||
QByteArray task(QString text);
|
QByteArray task(QString text);
|
||||||
QByteArray notify(QString code);
|
QByteArray notify(QString code);
|
||||||
QByteArray tasks(QStringList listTasks);
|
QByteArray tasks(QStringList listTasks);
|
||||||
|
|||||||
@@ -102,20 +102,22 @@ QByteArray DBAnswerParser::listClassrooms(bool result, QList<Classroom> *listCla
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DBAnswerParser::listContacts(bool result, QList<User> *listContacts)
|
QByteArray DBAnswerParser::listContacts(bool result, QList<ContactModel> *listContacts)
|
||||||
{
|
{
|
||||||
QDomDocument doc;
|
QDomDocument doc;
|
||||||
QDomProcessingInstruction xmlDecl = doc.createProcessingInstruction("xml", "version='1.0' encoding='utf-8'");
|
QDomProcessingInstruction xmlDecl = doc.createProcessingInstruction("xml", "version='1.0' encoding='utf-8'");
|
||||||
doc.insertBefore(xmlDecl,doc.firstChild());
|
doc.insertBefore(xmlDecl,doc.firstChild());
|
||||||
QDomElement root = doc.createElement("ContactArray");
|
QDomElement root = doc.createElement("ContactArray");
|
||||||
|
|
||||||
for(User entity : *listContacts)
|
for(ContactModel entity : *listContacts)
|
||||||
{
|
{
|
||||||
QDomElement contact = doc.createElement("ContactData");
|
QDomElement contact = doc.createElement("ContactData");
|
||||||
contact.toElement().setAttribute("name",entity.getName());
|
contact.toElement().setAttribute("name",entity.getName());
|
||||||
contact.toElement().setAttribute("id",entity.getID());
|
contact.toElement().setAttribute("id",entity.getID());
|
||||||
QString isLogged = entity.getLoggedIn() ? "1" : "0";
|
QString isLogged = entity.getLoggedIn() ? "1" : "0";
|
||||||
contact.toElement().setAttribute("isOnline",isLogged);
|
contact.toElement().setAttribute("isOnline",isLogged);
|
||||||
|
contact.toElement().setAttribute("UserType",entity.getType());
|
||||||
|
contact.toElement().setAttribute("Login",entity.getLogin());
|
||||||
|
|
||||||
root.appendChild(contact);
|
root.appendChild(contact);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
|
#include <contactModel.h>
|
||||||
|
|
||||||
class DBAnswerParser : public QObject
|
class DBAnswerParser : public QObject
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,7 @@ public:
|
|||||||
QByteArray listTrainees(bool result, QList<Trainee> *listTrainees);
|
QByteArray listTrainees(bool result, QList<Trainee> *listTrainees);
|
||||||
QByteArray listComputers(bool result, QList<Computer> *listComputers);
|
QByteArray listComputers(bool result, QList<Computer> *listComputers);
|
||||||
QByteArray listClassrooms(bool result, QList<Classroom> *listClassrooms);
|
QByteArray listClassrooms(bool result, QList<Classroom> *listClassrooms);
|
||||||
QByteArray listContacts(bool result, QList<User> *listContacts);
|
QByteArray listContacts(bool result, QList<ContactModel> *listContacts);
|
||||||
|
|
||||||
QByteArray listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
QByteArray listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
||||||
QByteArray listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
QByteArray listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
||||||
|
|||||||
@@ -498,6 +498,8 @@ void ProcessParser::clientMessage(QXmlStreamReader &xmlReader,ClientHandler *cli
|
|||||||
clientMessage.From = value;
|
clientMessage.From = value;
|
||||||
if (name == "To")
|
if (name == "To")
|
||||||
clientMessage.To = value;
|
clientMessage.To = value;
|
||||||
|
if (name == "UserType")
|
||||||
|
clientMessage.Type = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
processingSystem->processingSendMessage(clientMessage);
|
processingSystem->processingSendMessage(clientMessage);
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ void ChatSystem::initialize(CommonClientHandler *commonClientHandler, DataParser
|
|||||||
clientNotSendedMessage = new QMap<QString,QStack<ClientMessage>*>;
|
clientNotSendedMessage = new QMap<QString,QStack<ClientMessage>*>;
|
||||||
|
|
||||||
auto stack = new QStack<ClientMessage>;
|
auto stack = new QStack<ClientMessage>;
|
||||||
auto clientMessage1 = ClientMessage("1","102","Сообщение 1");
|
auto clientMessage1 = ClientMessage("1","102","Сообщение 1","1");
|
||||||
stack->append(clientMessage1);
|
stack->append(clientMessage1);
|
||||||
auto clientMessage2 = ClientMessage("1","102","Сообщение 2");
|
auto clientMessage2 = ClientMessage("1","102","Сообщение 2","1");
|
||||||
stack->append(clientMessage2);
|
stack->append(clientMessage2);
|
||||||
|
|
||||||
clientNotSendedMessage->insert("102", stack);
|
clientNotSendedMessage->insert("102", stack);
|
||||||
@@ -23,7 +23,7 @@ void ChatSystem::initialize(CommonClientHandler *commonClientHandler, DataParser
|
|||||||
|
|
||||||
bool ChatSystem::sendTo(ClientMessage message)
|
bool ChatSystem::sendTo(ClientMessage message)
|
||||||
{
|
{
|
||||||
QByteArray byteArrayMsg = dataParser->ClientAnswer()->message(message.From,message.To,message.Text);
|
QByteArray byteArrayMsg = dataParser->ClientAnswer()->message(message.From,message.To,message.Text,message.Type);
|
||||||
|
|
||||||
foreach(int idSocket, clientsMap->keys())
|
foreach(int idSocket, clientsMap->keys())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -464,18 +464,20 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
|||||||
|
|
||||||
case TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST:
|
case TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST:
|
||||||
{
|
{
|
||||||
QList<User> entitylist;
|
QList<ContactModel> entitylist;
|
||||||
QList<Instructor> listInstructor = providerDBLMS->GetListAllInstructors();
|
QList<Instructor> listInstructor = providerDBLMS->GetListAllInstructors();
|
||||||
QList<Trainee> listTrainees = providerDBLMS->GetListAllTrainees();
|
QList<Trainee> listTrainees = providerDBLMS->GetListAllTrainees();
|
||||||
|
|
||||||
for (Instructor instructor : listInstructor)
|
for (Instructor instructor : listInstructor)
|
||||||
{
|
{
|
||||||
entitylist.append(static_cast<User>(instructor));
|
ContactModel model = ContactModel(instructor);
|
||||||
|
entitylist.append(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Trainee trainee : listTrainees)
|
for (Trainee trainee : listTrainees)
|
||||||
{
|
{
|
||||||
entitylist.append(static_cast<User>(trainee));
|
ContactModel model = ContactModel(trainee);
|
||||||
|
entitylist.append(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray arrayAnswer;
|
QByteArray arrayAnswer;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void sigLoadHash();
|
void sigLoadHash();
|
||||||
void sigSendToLogger(QString message);
|
void sigSendToLogger(QString message);
|
||||||
QByteArray sigSendXMLmessage(QString loginFrom, QString loginTo, QString text);
|
QByteArray sigSendXMLmessage(QString loginFrom, QString loginTo, QString text, QString userType);
|
||||||
QByteArray sigSendNotify(QString message);
|
QByteArray sigSendNotify(QString message);
|
||||||
QByteArray sigSendVersion();
|
QByteArray sigSendVersion();
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
qRegisterMetaType<PacketType>("PacketType");
|
qRegisterMetaType<PacketType>("PacketType");
|
||||||
|
qRegisterMetaType<UserType>("UserType");
|
||||||
errorCode = 0;
|
errorCode = 0;
|
||||||
|
|
||||||
ui->btnStopServer->setEnabled(false);
|
ui->btnStopServer->setEnabled(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user