Cockatrice/cockatrice/src/interface/widgets/tabs/tab_moderation.h
Lukas Brübach 3823dfa087 [Client] Alt investigation entry points and in-tab navigation
TabModeration gains an Open alt graph button plus alts-table double-click, both routing to the User Alts tab. UserContextMenu gains an Investigate alts action. TabAlts gains row double-click navigation with a Back history stack so moderators can walk the alt graph without retyping names.
2026-10-13 20:50:33 +02:00

89 lines
2.4 KiB
C++

#ifndef TAB_MODERATION_H
#define TAB_MODERATION_H
#include "tab.h"
#include <QString>
#include <QtGlobal>
#include <qtmetamacros.h>
class AbstractClient;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QTableWidget;
class QTextEdit;
class Response;
class TabSupervisor;
/**
* Staff investigation tool. Lets moderators look up a user's account data,
* alternate accounts, login sessions, and staff login activity, and offers
* the password-reset and remove-avatar actions.
*/
class TabModeration : public Tab
{
Q_OBJECT
public:
explicit TabModeration(TabSupervisor *_tabSupervisor, AbstractClient *_client, const QString &initialUser = {});
void retranslateUi() override;
[[nodiscard]] QString getTabText() const override
{
return tr("Moderation");
}
void investigate(const QString &userName);
private slots:
void investigateUser();
void openAltsGraph();
void userInfoResponse(const Response &response);
void sessionsResponse(const Response &response);
void altsResponse(const Response &response);
void moderatorLoginsResponse(const Response &response);
void resetPassword();
void resetPasswordResponse(const Response &response);
void removeAvatar();
void removeAvatarResponse(const Response &response);
private:
void requestUserInfo(const QString &userName);
void requestSessions(const QString &userName);
void requestAlts(const QString &userName);
void requestModeratorLogins();
void clearUserData();
[[nodiscard]] QString formatEpoch(quint64 ts) const;
AbstractClient *client;
QString currentUser;
QLineEdit *searchEdit;
QPushButton *investigateButton;
QPushButton *resetPasswordButton;
QPushButton *removeAvatarButton;
QGroupBox *userInfoGroup;
QLabel *userInfoNameLabel;
QLabel *userInfoNameValue;
QLabel *userInfoRegisteredLabel;
QLabel *userInfoRegisteredValue;
QLabel *userInfoLastLoginLabel;
QLabel *userInfoLastLoginValue;
QLabel *userInfoStatusLabel;
QLabel *userInfoStatusValue;
QLabel *userInfoCountsLabel;
QLabel *userInfoCountsValue;
QLabel *userInfoNotesLabel;
QTextEdit *userInfoNotesEdit;
QGroupBox *altsGroup;
QTableWidget *altsTable;
QPushButton *openAltsButton;
QGroupBox *sessionsGroup;
QTableWidget *sessionsTable;
QGroupBox *staffGroup;
QTableWidget *staffTable;
QPushButton *refreshStaffButton;
};
#endif // TAB_MODERATION_H