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

View file

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

View file

@ -14,10 +14,7 @@
#include "trice_limits.h" #include "trice_limits.h"
UserListManager::UserListManager(TabSupervisor *_tabSupervisor, AbstractClient *_client) UserListManager::UserListManager(TabSupervisor *_tabSupervisor, AbstractClient *_client)
: client(_client), tabSupervisor(_tabSupervisor), : 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))
{ {
connect(client, &AbstractClient::userJoinedEventReceived, this, &UserListManager::processUserJoinedEvent); connect(client, &AbstractClient::userJoinedEventReceived, this, &UserListManager::processUserJoinedEvent);
connect(client, &AbstractClient::userLeftEventReceived, this, &UserListManager::processUserLeftEvent); connect(client, &AbstractClient::userLeftEventReceived, this, &UserListManager::processUserLeftEvent);

View file

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

View file

@ -5,12 +5,14 @@
#include "user_level.h" #include "user_level.h"
#include <QComboBox> #include <QComboBox>
#include <QDebug>
#include <QDialog> #include <QDialog>
#include <QGroupBox> #include <QGroupBox>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QTextEdit> #include <QTextEdit>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
class UserListManager;
class QTreeWidget; class QTreeWidget;
class ServerInfo_User; class ServerInfo_User;
class AbstractClient; class AbstractClient;
@ -131,6 +133,7 @@ private:
QTreeWidget *userTree; QTreeWidget *userTree;
UserListItemDelegate *itemDelegate; UserListItemDelegate *itemDelegate;
UserContextMenu *userContextMenu; UserContextMenu *userContextMenu;
UserListManager *userListManager;
int onlineCount; int onlineCount;
QString titleStr; QString titleStr;
void updateCount(); void updateCount();
@ -140,7 +143,14 @@ signals:
void openMessageDialog(const QString &userName, bool focus); void openMessageDialog(const QString &userName, bool focus);
public: 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 retranslateUi();
void processUserInfo(const ServerInfo_User &user, bool online); void processUserInfo(const ServerInfo_User &user, bool online);
bool deleteUser(const QString &userName); bool deleteUser(const QString &userName);