mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
Populate TabAccount if reopened (#5483)
This commit is contained in:
parent
80165c28a9
commit
cb64a5eea0
2 changed files with 18 additions and 12 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include "../../deck/custom_line_edit.h"
|
||||
#include "../../server/pending_command.h"
|
||||
#include "../../server/user/user_info_box.h"
|
||||
#include "../../server/user/user_list_manager.h"
|
||||
#include "../../server/user/user_list_widget.h"
|
||||
#include "../game_logic/abstract_client.h"
|
||||
#include "../sound_engine.h"
|
||||
|
|
@ -12,6 +13,7 @@
|
|||
#include "pb/event_user_left.pb.h"
|
||||
#include "pb/response_list_users.pb.h"
|
||||
#include "pb/session_commands.pb.h"
|
||||
#include "tab_supervisor.h"
|
||||
#include "trice_limits.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
|
@ -38,6 +40,10 @@ TabAccount::TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
|||
connect(client, &AbstractClient::addToListEventReceived, this, &TabAccount::processAddToListEvent);
|
||||
connect(client, &AbstractClient::removeFromListEventReceived, this, &TabAccount::processRemoveFromListEvent);
|
||||
|
||||
// Attempt to populate the tab with the cache
|
||||
buddyListReceived(tabSupervisor->getUserListManager()->getBuddyList().values());
|
||||
ignoreListReceived(tabSupervisor->getUserListManager()->getIgnoreList().values());
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(Command_ListUsers());
|
||||
connect(pend, &PendingCommand::finished, this, &TabAccount::processListUsersResponse);
|
||||
client->sendCommand(pend);
|
||||
|
|
@ -181,15 +187,15 @@ void TabAccount::processUserLeftEvent(const Event_UserLeft &event)
|
|||
|
||||
void TabAccount::buddyListReceived(const QList<ServerInfo_User> &_buddyList)
|
||||
{
|
||||
for (int i = 0; i < _buddyList.size(); ++i)
|
||||
buddyList->processUserInfo(_buddyList[i], false);
|
||||
for (const auto &user : _buddyList)
|
||||
buddyList->processUserInfo(user, false);
|
||||
buddyList->sortItems();
|
||||
}
|
||||
|
||||
void TabAccount::ignoreListReceived(const QList<ServerInfo_User> &_ignoreList)
|
||||
{
|
||||
for (int i = 0; i < _ignoreList.size(); ++i)
|
||||
ignoreList->processUserInfo(_ignoreList[i], false);
|
||||
for (const auto &user : _ignoreList)
|
||||
ignoreList->processUserInfo(user, false);
|
||||
ignoreList->sortItems();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue