mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Rewrite update status message
This commit is contained in:
parent
8937f87f87
commit
4353468647
|
@ -663,6 +663,15 @@ bool ContentDialog::isGroupWidgetActive(int groupId)
|
|||
return widget->isActive();
|
||||
}
|
||||
|
||||
// TODO: Connect to widget directly
|
||||
void ContentDialog::setStatusMessage(int friendId, const QString& message)
|
||||
{
|
||||
auto widget = friendWidgets.value(friendId);
|
||||
if (widget != nullptr) {
|
||||
widget->setStatusMsg(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update friend widget name and position.
|
||||
* @param friendId Friend Id.
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
bool isFriendWidgetActive(int friendId);
|
||||
bool isGroupWidgetActive(int groupId);
|
||||
|
||||
void setStatusMessage(int friendId, const QString& message);
|
||||
|
||||
signals:
|
||||
void friendDialogShown(const Friend* f);
|
||||
void groupDialogShown(Group* g);
|
||||
|
|
|
@ -165,12 +165,10 @@ void ContentDialogManager::updateFriendStatus(int friendId)
|
|||
*/
|
||||
void ContentDialogManager::updateFriendStatusMessage(int friendId, const QString& message)
|
||||
{
|
||||
auto iter = friendList.find(friendId);
|
||||
if (iter == friendList.end()) {
|
||||
return;
|
||||
auto dialog = friendDialogs.value(friendId);
|
||||
if (dialog != nullptr) {
|
||||
dialog->setStatusMessage(friendId, message);
|
||||
}
|
||||
|
||||
std::get<1>(iter.value())->setStatusMsg(message);
|
||||
}
|
||||
|
||||
void ContentDialogManager::updateGroupStatus(int groupId)
|
||||
|
|
Loading…
Reference in New Issue
Block a user