rename class

This commit is contained in:
RickyRister 2025-01-13 23:29:45 -08:00
parent 686645c1e4
commit a1f40aa3ba
4 changed files with 35 additions and 35 deletions

View file

@ -18,7 +18,7 @@
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo) TabAccount::TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo)
: Tab(_tabSupervisor), client(_client) : Tab(_tabSupervisor), client(_client)
{ {
allUsersList = new UserList(_tabSupervisor, client, UserList::AllUsersList); allUsersList = new UserList(_tabSupervisor, client, UserList::AllUsersList);
@ -27,22 +27,22 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_clien
userInfoBox = new UserInfoBox(client, true); userInfoBox = new UserInfoBox(client, true);
userInfoBox->updateInfo(userInfo); userInfoBox->updateInfo(userInfo);
connect(allUsersList, &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog); connect(allUsersList, &UserList::openMessageDialog, this, &TabAccount::openMessageDialog);
connect(buddyList, &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog); connect(buddyList, &UserList::openMessageDialog, this, &TabAccount::openMessageDialog);
connect(ignoreList, &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog); connect(ignoreList, &UserList::openMessageDialog, this, &TabAccount::openMessageDialog);
connect(client, &AbstractClient::userJoinedEventReceived, this, &TabUserLists::processUserJoinedEvent); connect(client, &AbstractClient::userJoinedEventReceived, this, &TabAccount::processUserJoinedEvent);
connect(client, &AbstractClient::userLeftEventReceived, this, &TabUserLists::processUserLeftEvent); connect(client, &AbstractClient::userLeftEventReceived, this, &TabAccount::processUserLeftEvent);
connect(client, &AbstractClient::buddyListReceived, this, &TabUserLists::buddyListReceived); connect(client, &AbstractClient::buddyListReceived, this, &TabAccount::buddyListReceived);
connect(client, &AbstractClient::ignoreListReceived, this, &TabUserLists::ignoreListReceived); connect(client, &AbstractClient::ignoreListReceived, this, &TabAccount::ignoreListReceived);
connect(client, &AbstractClient::addToListEventReceived, this, &TabUserLists::processAddToListEvent); connect(client, &AbstractClient::addToListEventReceived, this, &TabAccount::processAddToListEvent);
connect(client, &AbstractClient::removeFromListEventReceived, this, &TabUserLists::processRemoveFromListEvent); connect(client, &AbstractClient::removeFromListEventReceived, this, &TabAccount::processRemoveFromListEvent);
PendingCommand *pend = client->prepareSessionCommand(Command_ListUsers()); PendingCommand *pend = client->prepareSessionCommand(Command_ListUsers());
connect(pend, connect(pend,
static_cast<void (PendingCommand::*)(const Response &, const CommandContainer &, const QVariant &)>( static_cast<void (PendingCommand::*)(const Response &, const CommandContainer &, const QVariant &)>(
&PendingCommand::finished), &PendingCommand::finished),
this, &TabUserLists::processListUsersResponse); this, &TabAccount::processListUsersResponse);
client->sendCommand(pend); client->sendCommand(pend);
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
@ -53,9 +53,9 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_clien
addBuddyEdit = new LineEditUnfocusable; addBuddyEdit = new LineEditUnfocusable;
addBuddyEdit->setMaxLength(MAX_NAME_LENGTH); addBuddyEdit->setMaxLength(MAX_NAME_LENGTH);
addBuddyEdit->setPlaceholderText(tr("Add to Buddy List")); addBuddyEdit->setPlaceholderText(tr("Add to Buddy List"));
connect(addBuddyEdit, &LineEditUnfocusable::returnPressed, this, &TabUserLists::addToBuddyList); connect(addBuddyEdit, &LineEditUnfocusable::returnPressed, this, &TabAccount::addToBuddyList);
QPushButton *addBuddyButton = new QPushButton("Add"); QPushButton *addBuddyButton = new QPushButton("Add");
connect(addBuddyButton, &QPushButton::clicked, this, &TabUserLists::addToBuddyList); connect(addBuddyButton, &QPushButton::clicked, this, &TabAccount::addToBuddyList);
addToBuddyList->addWidget(addBuddyEdit); addToBuddyList->addWidget(addBuddyEdit);
addToBuddyList->addWidget(addBuddyButton); addToBuddyList->addWidget(addBuddyButton);
@ -63,9 +63,9 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_clien
addIgnoreEdit = new LineEditUnfocusable; addIgnoreEdit = new LineEditUnfocusable;
addIgnoreEdit->setMaxLength(MAX_NAME_LENGTH); addIgnoreEdit->setMaxLength(MAX_NAME_LENGTH);
addIgnoreEdit->setPlaceholderText(tr("Add to Ignore List")); addIgnoreEdit->setPlaceholderText(tr("Add to Ignore List"));
connect(addIgnoreEdit, &LineEditUnfocusable::returnPressed, this, &TabUserLists::addToIgnoreList); connect(addIgnoreEdit, &LineEditUnfocusable::returnPressed, this, &TabAccount::addToIgnoreList);
QPushButton *addIgnoreButton = new QPushButton("Add"); QPushButton *addIgnoreButton = new QPushButton("Add");
connect(addIgnoreButton, &QPushButton::clicked, this, &TabUserLists::addToIgnoreList); connect(addIgnoreButton, &QPushButton::clicked, this, &TabAccount::addToIgnoreList);
addToIgnoreList->addWidget(addIgnoreEdit); addToIgnoreList->addWidget(addIgnoreEdit);
addToIgnoreList->addWidget(addIgnoreButton); addToIgnoreList->addWidget(addIgnoreButton);
@ -89,7 +89,7 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_clien
setCentralWidget(mainWidget); setCentralWidget(mainWidget);
} }
void TabUserLists::addToBuddyList() void TabAccount::addToBuddyList()
{ {
QString userName = addBuddyEdit->text(); QString userName = addBuddyEdit->text();
if (userName.length() < 1) if (userName.length() < 1)
@ -100,7 +100,7 @@ void TabUserLists::addToBuddyList()
addBuddyEdit->clear(); addBuddyEdit->clear();
} }
void TabUserLists::addToIgnoreList() void TabAccount::addToIgnoreList()
{ {
QString userName = addIgnoreEdit->text(); QString userName = addIgnoreEdit->text();
if (userName.length() < 1) if (userName.length() < 1)
@ -111,7 +111,7 @@ void TabUserLists::addToIgnoreList()
addIgnoreEdit->clear(); addIgnoreEdit->clear();
} }
void TabUserLists::addToList(const std::string &listName, const QString &userName) void TabAccount::addToList(const std::string &listName, const QString &userName)
{ {
Command_AddToList cmd; Command_AddToList cmd;
cmd.set_list(listName); cmd.set_list(listName);
@ -120,7 +120,7 @@ void TabUserLists::addToList(const std::string &listName, const QString &userNam
client->sendCommand(client->prepareSessionCommand(cmd)); client->sendCommand(client->prepareSessionCommand(cmd));
} }
void TabUserLists::retranslateUi() void TabAccount::retranslateUi()
{ {
allUsersList->retranslateUi(); allUsersList->retranslateUi();
buddyList->retranslateUi(); buddyList->retranslateUi();
@ -128,7 +128,7 @@ void TabUserLists::retranslateUi()
userInfoBox->retranslateUi(); userInfoBox->retranslateUi();
} }
void TabUserLists::processListUsersResponse(const Response &response) void TabAccount::processListUsersResponse(const Response &response)
{ {
const Response_ListUsers &resp = response.GetExtension(Response_ListUsers::ext); const Response_ListUsers &resp = response.GetExtension(Response_ListUsers::ext);
@ -146,7 +146,7 @@ void TabUserLists::processListUsersResponse(const Response &response)
buddyList->sortItems(); buddyList->sortItems();
} }
void TabUserLists::processUserJoinedEvent(const Event_UserJoined &event) void TabAccount::processUserJoinedEvent(const Event_UserJoined &event)
{ {
const ServerInfo_User &info = event.user_info(); const ServerInfo_User &info = event.user_info();
const QString userName = QString::fromStdString(info.name()); const QString userName = QString::fromStdString(info.name());
@ -165,7 +165,7 @@ void TabUserLists::processUserJoinedEvent(const Event_UserJoined &event)
emit userJoined(info); emit userJoined(info);
} }
void TabUserLists::processUserLeftEvent(const Event_UserLeft &event) void TabAccount::processUserLeftEvent(const Event_UserLeft &event)
{ {
QString userName = QString::fromStdString(event.name()); QString userName = QString::fromStdString(event.name());
@ -182,21 +182,21 @@ void TabUserLists::processUserLeftEvent(const Event_UserLeft &event)
} }
} }
void TabUserLists::buddyListReceived(const QList<ServerInfo_User> &_buddyList) void TabAccount::buddyListReceived(const QList<ServerInfo_User> &_buddyList)
{ {
for (int i = 0; i < _buddyList.size(); ++i) for (int i = 0; i < _buddyList.size(); ++i)
buddyList->processUserInfo(_buddyList[i], false); buddyList->processUserInfo(_buddyList[i], false);
buddyList->sortItems(); buddyList->sortItems();
} }
void TabUserLists::ignoreListReceived(const QList<ServerInfo_User> &_ignoreList) void TabAccount::ignoreListReceived(const QList<ServerInfo_User> &_ignoreList)
{ {
for (int i = 0; i < _ignoreList.size(); ++i) for (int i = 0; i < _ignoreList.size(); ++i)
ignoreList->processUserInfo(_ignoreList[i], false); ignoreList->processUserInfo(_ignoreList[i], false);
ignoreList->sortItems(); ignoreList->sortItems();
} }
void TabUserLists::processAddToListEvent(const Event_AddToList &event) void TabAccount::processAddToListEvent(const Event_AddToList &event)
{ {
const ServerInfo_User &info = event.user_info(); const ServerInfo_User &info = event.user_info();
bool online = allUsersList->getUsers().contains(QString::fromStdString(info.name())); bool online = allUsersList->getUsers().contains(QString::fromStdString(info.name()));
@ -213,7 +213,7 @@ void TabUserLists::processAddToListEvent(const Event_AddToList &event)
userList->sortItems(); userList->sortItems();
} }
void TabUserLists::processRemoveFromListEvent(const Event_RemoveFromList &event) void TabAccount::processRemoveFromListEvent(const Event_RemoveFromList &event)
{ {
QString list = QString::fromStdString(event.list_name()); QString list = QString::fromStdString(event.list_name());
QString user = QString::fromStdString(event.user_name()); QString user = QString::fromStdString(event.user_name());

View file

@ -17,7 +17,7 @@ class ServerInfo_User;
class Event_AddToList; class Event_AddToList;
class Event_RemoveFromList; class Event_RemoveFromList;
class TabUserLists : public Tab class TabAccount : public Tab
{ {
Q_OBJECT Q_OBJECT
signals: signals:
@ -46,7 +46,7 @@ private:
void addToList(const std::string &listName, const QString &userName); void addToList(const std::string &listName, const QString &userName);
public: public:
TabUserLists(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo); TabAccount(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &userInfo);
void retranslateUi() override; void retranslateUi() override;
QString getTabText() const override QString getTabText() const override
{ {

View file

@ -432,10 +432,10 @@ void TabSupervisor::actTabServer(bool checked)
void TabSupervisor::actTabUserLists(bool checked) void TabSupervisor::actTabUserLists(bool checked)
{ {
if (checked && !tabUserLists) { if (checked && !tabUserLists) {
tabUserLists = new TabUserLists(this, client, *userInfo); tabUserLists = new TabAccount(this, client, *userInfo);
connect(tabUserLists, &TabUserLists::openMessageDialog, this, &TabSupervisor::addMessageTab); connect(tabUserLists, &TabAccount::openMessageDialog, this, &TabSupervisor::addMessageTab);
connect(tabUserLists, &TabUserLists::userJoined, this, &TabSupervisor::processUserJoined); connect(tabUserLists, &TabAccount::userJoined, this, &TabSupervisor::processUserJoined);
connect(tabUserLists, &TabUserLists::userLeft, this, &TabSupervisor::processUserLeft); connect(tabUserLists, &TabAccount::userLeft, this, &TabSupervisor::processUserLeft);
myAddTab(tabUserLists); myAddTab(tabUserLists);
connect(tabUserLists, &Tab::closed, this, [this] { connect(tabUserLists, &Tab::closed, this, [this] {
tabUserLists = nullptr; tabUserLists = nullptr;

View file

@ -21,7 +21,7 @@ class TabDeckStorage;
class TabReplays; class TabReplays;
class TabAdmin; class TabAdmin;
class TabMessage; class TabMessage;
class TabUserLists; class TabAccount;
class TabDeckEditor; class TabDeckEditor;
class TabLog; class TabLog;
class RoomEvent; class RoomEvent;
@ -72,7 +72,7 @@ private:
QMenu *tabsMenu; QMenu *tabsMenu;
TabDeckStorageVisual *tabVisualDeckStorage; TabDeckStorageVisual *tabVisualDeckStorage;
TabServer *tabServer; TabServer *tabServer;
TabUserLists *tabUserLists; TabAccount *tabUserLists;
TabDeckStorage *tabDeckStorage; TabDeckStorage *tabDeckStorage;
TabReplays *tabReplays; TabReplays *tabReplays;
TabAdmin *tabAdmin; TabAdmin *tabAdmin;
@ -108,7 +108,7 @@ public:
{ {
return gameTabs.size(); return gameTabs.size();
} }
TabUserLists *getUserListsTab() const TabAccount *getUserListsTab() const
{ {
return tabUserLists; return tabUserLists;
} }