From bb08d628fb206429fa2ea3ae8b34d2609f78518c Mon Sep 17 00:00:00 2001 From: Diadlo Date: Mon, 24 Dec 2018 20:53:23 +0300 Subject: [PATCH] refactor: Rewrite getDialog --- src/widget/contentdialogmanager.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/widget/contentdialogmanager.cpp b/src/widget/contentdialogmanager.cpp index b50fd4698..1b92765a6 100644 --- a/src/widget/contentdialogmanager.cpp +++ b/src/widget/contentdialogmanager.cpp @@ -206,12 +206,12 @@ bool ContentDialogManager::isWidgetActive(int id, const QHash& 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& 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& 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) {