mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Оповещения о непрочитанных сообщениях
This commit is contained in:
@@ -89,6 +89,24 @@ void InstructorsView::loadInstructorsFromDB()
|
||||
if(! instructor.getLoggedIn())
|
||||
if(! notLoggedInVisible)
|
||||
ItemInstructor->setHidden(true);
|
||||
|
||||
mtxmapNewMsg.lock();
|
||||
if(mapNewMsg.contains(instructor.getID()))
|
||||
{//Есть непрочитанные сообщения от него
|
||||
if(mapNewMsg.value(instructor.getID()))
|
||||
{
|
||||
if(lastCurrentID == instructor.getID())
|
||||
mapNewMsg.take(lastCurrentID);
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ColumnsTreeUsers::clmn_count; i++)
|
||||
{
|
||||
ItemInstructor->setBackground(i, QBrush(QColor(250, 210, 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mtxmapNewMsg.unlock();
|
||||
}
|
||||
|
||||
treeWidget->expandAll();
|
||||
|
||||
@@ -64,6 +64,17 @@ void ViewerInstructors::changeEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerInstructors::slot_receiveMessage(ClientMessage clientMessage)
|
||||
{
|
||||
int id_instructor = clientMessage.fromId.toInt();
|
||||
|
||||
mtxmapNewMsg.lock();
|
||||
mapNewMsg.insert(id_instructor, true);
|
||||
mtxmapNewMsg.unlock();
|
||||
|
||||
slot_NeedUpdateUI(true, false);
|
||||
}
|
||||
|
||||
void ViewerInstructors::on_btnEditorInstructors_clicked()
|
||||
{
|
||||
connectorToServer->sendQueryBlockAuth(true);
|
||||
@@ -100,6 +111,20 @@ void ViewerInstructors::on_treeWidgetItemClicked(QTreeWidgetItem *item, int colu
|
||||
|
||||
lastCurrentID = newCurrentID;
|
||||
|
||||
mtxmapNewMsg.lock();
|
||||
if(mapNewMsg.contains(newCurrentID))
|
||||
{//Есть непрочитанные сообщения от него
|
||||
if(mapNewMsg.value(newCurrentID))
|
||||
{
|
||||
for (int i = 0; i < ColumnsTreeUsers::clmn_count; i++)
|
||||
{
|
||||
item->setBackground(i, QBrush(Qt::GlobalColor::white));
|
||||
}
|
||||
mapNewMsg.take(newCurrentID);
|
||||
}
|
||||
}
|
||||
mtxmapNewMsg.unlock();
|
||||
|
||||
Q_EMIT signal_instructorSelected(newCurrentID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ public:
|
||||
protected:
|
||||
void changeEvent(QEvent * event) override;
|
||||
|
||||
public slots:
|
||||
void slot_receiveMessage(ClientMessage clientMessage);
|
||||
|
||||
public Q_SLOTS:
|
||||
void on_btnEditorInstructors_clicked();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user