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:
parent
9129f256fa
commit
bb08d628fb
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user