Doesn't work

This commit is contained in:
ZeldaZach 2025-01-14 01:21:35 -05:00
parent 63c9cbcf12
commit bc9af0716d
No known key found for this signature in database
5 changed files with 27 additions and 15 deletions

View file

@ -28,9 +28,13 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor,
userInfoBox = new UserInfoBox(client, true);
userInfoBox->updateInfo(userInfo);
connect(userListManager->getAllUsersList(), &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog);
connect(userListManager->getBuddyList(), &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog);
connect(userListManager->getIgnoreList(), &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog);
allUsersList = new UserList(tabSupervisor, client, UserList::AllUsersList);
buddyList = new UserList(tabSupervisor, client, UserList::BuddyList);
ignoreList = new UserList(tabSupervisor, client, UserList::IgnoreList);
connect(allUsersList, &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog);
connect(buddyList, &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog);
connect(ignoreList, &UserList::openMessageDialog, this, &TabUserLists::openMessageDialog);
PendingCommand *pend = client->prepareSessionCommand(Command_ListUsers());
connect(pend,
@ -41,7 +45,7 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor,
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(userInfoBox);
vbox->addWidget(userListManager->getAllUsersList());
vbox->addWidget(allUsersList);
QHBoxLayout *addToBuddyList = new QHBoxLayout;
addBuddyEdit = new LineEditUnfocusable;
@ -64,11 +68,11 @@ TabUserLists::TabUserLists(TabSupervisor *_tabSupervisor,
addToIgnoreList->addWidget(addIgnoreButton);
QVBoxLayout *buddyPanel = new QVBoxLayout;
buddyPanel->addWidget(userListManager->getBuddyList());
buddyPanel->addWidget(buddyList);
buddyPanel->addLayout(addToBuddyList);
QVBoxLayout *ignorePanel = new QVBoxLayout;
ignorePanel->addWidget(userListManager->getIgnoreList());
ignorePanel->addWidget(ignoreList);
ignorePanel->addLayout(addToIgnoreList);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addLayout(buddyPanel);

View file

@ -32,6 +32,7 @@ private:
UserInfoBox *userInfoBox;
LineEditUnfocusable *addBuddyEdit;
LineEditUnfocusable *addIgnoreEdit;
UserList *allUsersList, *buddyList, *ignoreList;
public:
TabUserLists(TabSupervisor *_tabSupervisor,

View file

@ -14,10 +14,7 @@
#include "trice_limits.h"
UserListManager::UserListManager(TabSupervisor *_tabSupervisor, AbstractClient *_client)
: client(_client), tabSupervisor(_tabSupervisor),
allUsersList(new UserList(tabSupervisor, client, UserList::AllUsersList)),
buddyList(new UserList(tabSupervisor, client, UserList::BuddyList)),
ignoreList(new UserList(tabSupervisor, client, UserList::IgnoreList))
: client(_client), tabSupervisor(_tabSupervisor)
{
connect(client, &AbstractClient::userJoinedEventReceived, this, &UserListManager::processUserJoinedEvent);
connect(client, &AbstractClient::userLeftEventReceived, this, &UserListManager::processUserLeftEvent);

View file

@ -23,7 +23,7 @@ class UserListManager : public QWidget
private:
AbstractClient *client;
TabSupervisor *tabSupervisor;
UserList *allUsersList, *buddyList, *ignoreList;
QList<ServerInfo_User> allUsersList, buddyList, ignoreList;
private slots:
void processUserJoinedEvent(const Event_UserJoined &event);
@ -35,15 +35,15 @@ private slots:
public:
explicit UserListManager(TabSupervisor *_tabSupervisor, AbstractClient *_client);
[[nodiscard]] UserList *getAllUsersList() const
[[nodiscard]] QList<ServerInfo_User> getAllUsersList() const
{
return allUsersList;
}
[[nodiscard]] UserList *getBuddyList() const
[[nodiscard]] QList<ServerInfo_User> getBuddyList() const
{
return buddyList;
}
[[nodiscard]] UserList *getIgnoreList() const
[[nodiscard]] QList<ServerInfo_User> getIgnoreList() const
{
return ignoreList;
}

View file

@ -5,12 +5,14 @@
#include "user_level.h"
#include <QComboBox>
#include <QDebug>
#include <QDialog>
#include <QGroupBox>
#include <QStyledItemDelegate>
#include <QTextEdit>
#include <QTreeWidgetItem>
class UserListManager;
class QTreeWidget;
class ServerInfo_User;
class AbstractClient;
@ -131,6 +133,7 @@ private:
QTreeWidget *userTree;
UserListItemDelegate *itemDelegate;
UserContextMenu *userContextMenu;
UserListManager *userListManager;
int onlineCount;
QString titleStr;
void updateCount();
@ -140,7 +143,14 @@ signals:
void openMessageDialog(const QString &userName, bool focus);
public:
explicit UserList(TabSupervisor *_tabSupervisor, AbstractClient *_client, UserListType _type, QWidget *parent = nullptr);
explicit UserList(TabSupervisor *_tabSupervisor,
AbstractClient *_client,
UserListType _type,
QWidget *parent = nullptr);
~UserList()
{
qDebug() << "DESTROYING" << type;
}
void retranslateUi();
void processUserInfo(const ServerInfo_User &user, bool online);
bool deleteUser(const QString &userName);