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

refactor: Make few methods ConstDialog const

This commit is contained in:
Diadlo 2017-07-27 08:55:32 +03:00
parent c3297600be
commit eb13908926
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 8 additions and 7 deletions

View File

@ -276,12 +276,12 @@ void ContentDialog::removeGroup(int groupId)
}
}
bool ContentDialog::hasFriendWidget(int friendId, GenericChatroomWidget* chatroomWidget)
bool ContentDialog::hasFriendWidget(int friendId, const GenericChatroomWidget* chatroomWidget) const
{
return hasWidget(friendId, chatroomWidget, friendList);
}
bool ContentDialog::hasGroupWidget(int groupId, GenericChatroomWidget* chatroomWidget)
bool ContentDialog::hasGroupWidget(int groupId, const GenericChatroomWidget* chatroomWidget) const
{
return hasWidget(groupId, chatroomWidget, groupList);
}
@ -811,8 +811,8 @@ void ContentDialog::saveSplitterState()
* @param list List with contact info.
* @return True, if chatroomWidget is pair for current instance.
*/
bool ContentDialog::hasWidget(int id, GenericChatroomWidget* chatroomWidget,
const QHash<int, ContactInfo>& list)
bool ContentDialog::hasWidget(int id, const GenericChatroomWidget* chatroomWidget,
const QHash<int, ContactInfo>& list) const
{
auto iter = list.find(id);
if (iter == list.end()) {

View File

@ -56,8 +56,8 @@ public:
GroupWidget* addGroup(int groupId, const QString& name);
void removeFriend(int friendId);
void removeGroup(int groupId);
bool hasFriendWidget(int friendId, GenericChatroomWidget* chatroomWidget);
bool hasGroupWidget(int groupId, GenericChatroomWidget* chatroomWidget);
bool hasFriendWidget(int friendId, const GenericChatroomWidget* chatroomWidget) const;
bool hasGroupWidget(int groupId, const GenericChatroomWidget* chatroomWidget) const;
int chatroomWidgetCount() const;
void ensureSplitterVisible();
void updateTitleAndStatusIcon();
@ -113,7 +113,8 @@ private:
QLayout* nextLayout(QLayout* layout, bool forward) const;
int getCurrentLayout(QLayout*& layout);
bool hasWidget(int id, GenericChatroomWidget* chatroomWidget, const QHash<int, ContactInfo>& list);
bool hasWidget(int id, const GenericChatroomWidget* chatroomWidget,
const QHash<int, ContactInfo>& list) const;
void removeCurrent(QHash<int, ContactInfo>& infos);
static bool existsWidget(int id, const QHash<int, ContactInfo>& list);
static void focusDialog(int id, const QHash<int, ContactInfo>& list);