1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: Rewrite getDialog

This commit is contained in:
Diadlo 2018-12-24 20:53:23 +03:00
parent 9129f256fa
commit bb08d628fb
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727

View File

@ -206,12 +206,12 @@ bool ContentDialogManager::isWidgetActive(int id, const QHash<int, ContactInfo>&
ContentDialog* ContentDialogManager::getFriendDialog(int friendId) const
{
return getDialog(friendId, friendList);
return friendDialogs.value(friendId);
}
ContentDialog* ContentDialogManager::getGroupDialog(int groupId) const
{
return getDialog(groupId, groupList);
return groupDialogs.value(groupId);
}
/**
@ -235,22 +235,6 @@ void ContentDialogManager::updateStatus(int id, const QHash<int, ContactInfo>& l
}
}
/**
* @brief Select ContentDialog by id from the list.
* @param id User Id.
* @param list List with contact info.
* @return ContentDialog for user and nullptr if not found.
*/
ContentDialog* ContentDialogManager::getDialog(int id, const QHash<int, ContactInfo>& list) const
{
auto iter = list.find(id);
if (iter == list.end()) {
return nullptr;
}
return std::get<0>(iter.value());
}
ContentDialogManager* ContentDialogManager::getInstance()
{
if (instance == nullptr) {