Оповещения о непрочитанных сообщениях

This commit is contained in:
2025-12-01 14:29:26 +03:00
parent 834e192479
commit c97c86ac55
10 changed files with 116 additions and 0 deletions

View File

@@ -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);
}
}