[Tooling] Apply include-what-you-use across the tree (#7396)

* [DeckList] Apply include-what-you-use to libcockatrice_deck_list

* [IWYU] Apply include-what-you-use across the tree

Run one whole-tree IWYU pass over the libcockatrice_* libraries, the
Cockatrice client, Oracle, Servatrice and the test suite, so each
translation unit includes what it uses directly and forward-declares
what it does not need.

IWYU only analyses real translation units, never the moc code CMake
generates from Q_OBJECT headers, so it strips includes that moc output
silently relies on. Where a type is passed by value (or nested in a
QList/QMap) in a signal or slot signature, the generated moc code needs
the complete type; those includes are kept with an explanatory
`// IWYU pragma: keep`. The same holds for Q_DECLARE_METATYPE targets
such as QSqlDatabase.

A handful of includes are added by hand where callers brace-initialize a
const-reference parameter, which also requires the complete type.

Applied as a single commit on purpose: stripping includes from the
libcockatrice_* headers is precisely what breaks the client, test and
server translation units, and the fixes for those live in the same
translation units. Splitting by component would therefore leave
intermediate commits that do not compile.

All 426 modified Q_OBJECT/Q_GADGET headers were verified to be
moc-self-contained by compiling each generated moc_*.cpp standalone;
several built only because of moc include ordering in
mocs_compilation.cpp before the keep-includes were added.

* [Tooling] Emit public Qt headers and fix IWYU fallout CI found

Three problems the local build could not see, all because a green local
build only proves the configuration it was run under.

Private Qt headers. IWYU emitted private, lowercase Qt headers, and
qtypes.h does not exist at all before Qt 6.9, so the Debian 12 and
Ubuntu 24.04 jobs on Qt 6.4.2 failed to compile. The generator only
emitted a mapping when the capital header name mirrored the private one
(QAbstractAnimation for qabstractanimation.h), so qtypes.h, which is
wrapped by QtTypes instead, got no mapping and kept the private
spelling. Map it explicitly to <QtTypes>, which is public since Qt 5 and
provides the same typedefs either way, and rewrite the 100 affected
includes.

Do not generalize this to "prefer any Qt* wrapper". The table is
generated from whichever Qt is installed, and the wrappers are not
equally old: QtLogging only appeared in Qt 6.8 and QtMinMax in 6.5, so
that heuristic trades one breakage for another. Every other lowercase
header still in the tree has shipped publicly since Qt 5, so those are
left alone.

Platform-guarded includes. IWYU only sees the preprocessor configuration
it is handed, so it dropped an include that only the macOS branch of
main.cpp needs, and the macOS jobs failed on an undeclared
UrlSchemeEventFilter. Restore the include. Force-compiling every file
that carries a platform guard under Q_OS_MAC, Q_OS_MACOS and __APPLE__
reports nothing else, so the macOS branches are covered rather than
assumed.

shellcheck. Drop a leftover variable and stop assigning the
include-what-you-use lookup, which was only ever an existence check.

* [Tooling] Map Qt 6.5+ split headers to QtGlobal for Qt 6.4 compatibility

IWYU emitted QtTypes, QtPreprocessorSupport, QtVersionChecks, QtAssert,
QtMinMax, QtClassHelperMacros, QtEnvironmentVariables and QtTranslation.
Qt 6.5 split those declarations out of qglobal.h into separate headers, so
neither the Qt* wrapper nor the q*.h private name exists on the oldest Qt we
support (6.4.2), and Debian 12 / Ubuntu 24.04 fail with "No such file or
directory". qtypes.h is worse still: it only appeared in Qt 6.9.

QtGlobal is the one spelling that works across the whole supported range. It
has been public since Qt 5, defines these declarations itself up to Qt 6.4, and
includes the split headers from Qt 6.5 on, so redirect all eight private
headers to it and collapse the affected includes in the tree.

Curated overrides now take precedence over the name-mirroring rule, which
cannot know about Qt version floors because the mapping is generated from
whatever Qt is installed. That rule was mapping qtversionchecks.h to
<QtVersionChecks> even with an override present, because the override was only
consulted as a fallback. A curated key that matches nothing is now a hard
error rather than a silent fallback, and the redirected headers are no longer
advertised as the home of a symbol.

Verified every Qt include in the tree resolves against the real
qt6-base-dev 6.4.2 package: 15 distinct includes, 0 missing.

* [Tooling] Map QOverload to QtGlobal and drop the QMetaMethodArgument include

Two more headers IWYU emitted do not exist on Qt 6.4.2:

QOverload was split out of qglobal.h in Qt 6.5, so on 6.4.2 it is declared in
qglobal.h directly and the standalone header is a hard error. QtGlobal covers
both, so map qoverload.h to it like the other 6.5+ split headers.

QMetaMethodArgument is never referenced anywhere in the tree. It is a bare
forwarder for qobjectdefs.h that our generator advertised as a class symbol,
which is how IWYU came to add the include at all. The symbol mappings are
generated from header names, so they cannot tell a forwarder that happens to be
capitalised from a real class; removing the unused include is the fix, and the
generic case stays a known limitation of the generator.

Extending the audit to every Q* header (an earlier pass only matched headers
starting with "Qt" or lowercase q*.h, so it missed all of them) against the real
qt6-base-dev, qt6-multimedia-dev, qt6-declarative-dev, qt6-svg-dev and
qt6-websockets-dev 6.4.2 packages: 341 distinct Qt includes, 0 missing.

* [Game] Give moc the complete CardItem type in player_actions.h

player_actions.h forward declares CardItem but passes QList<CardItem *> by
value in actPlay/actPlayFacedown/actHide. moc instantiates the metatype for
those parameters, and on Qt 6.4 that expands to sizeof(CardItem), so Ubuntu
24.04 fails with "invalid application of 'sizeof' to incomplete type
'CardItem'". Newer Qt tolerates the incomplete type, which is why only the
6.4.2 jobs failed.

Include the defining header with an IWYU pragma keep, matching how the other
MOC-required includes in this area are handled.

* [Game] Give moc the complete ServerInfo_Card type

player_logic.h, game_scene.h, view_zone.h and view_zone_widget.h forward
declare ServerInfo_Card but pass QList<const ServerInfo_Card *> through signal
and slot signatures. moc instantiates the metatype for those parameters, which
Qt 6.4 expands to sizeof(ServerInfo_Card), so the connect in game_scene.cpp
fails on Debian 12 and Ubuntu 24.04 with "invalid application of 'sizeof' to
incomplete type 'const ServerInfo_Card'". Newer Qt tolerates it, so only the
6.4.2 jobs failed.

Include the generated protobuf header with an IWYU pragma keep, following the
pattern already used for ServerInfo_Player and ServerInfo_User in
game_event_handler.h.

* [Client] Complete the types Qt 6.4 needs for connect and moc

Qt 6.4 expands QMetaType::fromType on the normalised argument list of a
PMF connect and on moc-generated metatypes, which requires sizeof on every
signal and slot parameter. Newer Qt tolerates forward declarations there,
so only the Debian 12 and Ubuntu 24.04 jobs failed, with
"invalid application of 'sizeof' to incomplete type" for QMouseEvent,
QPrinter and GameReplay.

Replace the forward declarations with the real includes:

- QMouseEvent in the nine widget headers that pass it through signals
- QPrinter in abstract_tab_deck_editor.cpp, for the actPrintDeck lambda
- game_replay.pb.h in tab_replays.h. GameReplay is a protobuf message, so
  the project's game/replay.h only forward declares it and cannot supply
  the complete type.

Found by recompiling all 1918 project TUs against the Debian Qt 6.4.2
headers, which reproduces those two CI jobs locally in one pass.

* [Client] Complete Release and QMenu for Qt 6.4 moc and connect

Continuing the Qt 6.4 complete-type sweep:

- window_main.cpp connects ClientUpdateChecker::finishedCheck to
  MainWindow::checkClientUpdatesFinished, whose Release * parameter made
  moc 6.4 instantiate the metatype. GameReplay turned out to be a protobuf
  message, so Release likewise needed release_channel.h in the three
  headers declaring those signals: window_main.h, dlg_update.h and
  client_update_checker.h.
- moc 6.4 also needs sizeof(QMenu) for the QList<QMenu *> carried by
  TabSupervisor::setMenu and MainWindow::updateTabMenu.

Verified by regenerating moc output with the Debian moc 6.4.2 for all 434
Q_OBJECT/Q_GADGET classes and compiling it, plus recompiling all 1612
source TUs, against the Qt 6.4.2 headers: no remaining failures.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-08 11:13:50 +02:00 • committed by GitHub
parent b1f4d1e99d
commit d603a2bb6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1078 changed files with 9093 additions and 1769 deletions

View file

@ -4,22 +4,47 @@
#include "../../client/sound_engine.h"
#include "../../interface/card_localization.h"
#include "../../interface/pixel_map_generator.h"
#include "../../interface/widgets/tabs/tab_account.h"
#include "../../tabs/tab_supervisor.h"
#include "../user/user_context_menu.h"
#include "../user/user_list_manager.h"
#include "../user/user_list_proxy.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/protocol/pb/event_room_say.pb.h"
#include "room_message_type.h"
#include <QApplication>
#include <QBrush>
#include <QChar>
#include <QDateTime>
#include <QDesktopServices>
#include <QFlag>
#include <QFlags>
#include <QFont>
#include <QFontInfo>
#include <QMouseEvent>
#include <QPalette>
#include <QPixmap>
#include <QPointF>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QScrollBar>
#include <QSharedPointer>
#include <QTextBlockFormat>
#include <QTextDocument>
#include <QTimer>
#include <QUrl>
#include <QUrlQuery>
#include <QWidget>
#include <QtGlobal>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/network/server/remote/user_level.h>
#include <libcockatrice/settings/chat_settings.h>
#include <libcockatrice/utility/card_ref.h>
#include <qnamespace.h>
#include <qobjectdefs.h>
class QPoint;
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);

View file

@ -8,22 +8,34 @@
#ifndef CHATVIEW_H
#define CHATVIEW_H
#include "../../interface/widgets/tabs/tab_supervisor.h"
#include "../user/user_list_widget.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include <QAction>
#include <QColor>
#include <QDateTime>
#include <QList>
#include <QMap>
#include <QString>
#include <QStringList>
#include <QTextBlock>
#include <QTextBrowser>
#include <QTextCharFormat>
#include <QTextCursor>
#include <QTextFragment>
#include <QVector>
#include <libcockatrice/network/server/remote/room_message_type.h>
#include <libcockatrice/network/server/remote/user_level.h>
#include <qtmetamacros.h>
class AbstractGame;
class QTextTable;
class QMouseEvent;
class UserContextMenu;
class UserListProxy;
class QAction;
class QPoint;
class QUrl;
class QWidget;
class TabSupervisor;
struct CardRef;
template <typename Enum> class QFlags;
class UserMessagePosition
{

View file

@ -1,6 +1,11 @@
#ifndef COCKATRICE_GAME_FILTER_CONFIGS_H
#define COCKATRICE_GAME_FILTER_CONFIGS_H
#include <QList>
#include <QSet>
#include <QSharedPointer>
#include <QString>
#include <QStringList>
#include <QTime>
/**

View file

@ -1,32 +1,54 @@
#include "game_selector.h"
#include "../../../client/settings/cache_settings.h"
#include "../../pixel_map_generator.h"
#include "../interface/widgets/dialogs/dlg_create_game.h"
#include "../interface/widgets/dialogs/dlg_filter_games.h"
#include "../interface/widgets/tabs/tab_account.h"
#include "../interface/widgets/tabs/tab_game.h"
#include "../interface/widgets/tabs/tab_room.h"
#include "../interface/widgets/tabs/tab_supervisor.h"
#include "../interface/widgets/utility/get_text_with_max.h"
#include "game_link.h"
#include "game_selector_quick_filter_toolbar.h"
#include "games_model.h"
#include "libcockatrice/protocol/pb/event_add_to_list.pb.h"
#include "libcockatrice/protocol/pb/event_remove_from_list.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include "user/user_list_manager.h"
#include <QAction>
#include <QClipboard>
#include <QDebug>
#include <QGuiApplication>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QItemSelectionModel>
#include <QLineEdit>
#include <QMap>
#include <QMenu>
#include <QMessageBox>
#include <QModelIndex>
#include <QPushButton>
#include <QSize>
#include <QString>
#include <QStringLiteral>
#include <QTreeView>
#include <QVBoxLayout>
#include <QVariant>
#include <QtGlobal>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/response.pb.h>
#include <libcockatrice/protocol/pb/room_commands.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <libcockatrice/settings/cards_display_settings.h>
#include <libcockatrice/settings/interface_settings.h>
#include <qlogging.h>
#include <qnamespace.h>
#include <string>
class QModelIndex;
class QPoint;
class QWidget;
template <typename T> class QList;
GameSelector::GameSelector(AbstractClient *_client,
TabSupervisor *_tabSupervisor,

View file

@ -1,25 +1,34 @@
#ifndef GAMESELECTOR_H
#define GAMESELECTOR_H
#include "game_selector_quick_filter_toolbar.h"
#include "game_type_map.h"
#include <QGroupBox>
#include <libcockatrice/protocol/pb/commands.pb.h>
#include <libcockatrice/protocol/pb/event_add_to_list.pb.h>
#include <libcockatrice/protocol/pb/event_remove_from_list.pb.h>
#include <qtmetamacros.h>
// IWYU pragma: keep
// ServerInfo_User appears by value and inside QList in slot signatures, so the
// moc-generated code needs the complete type.
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
class QTreeView;
class GamesModel;
class GamesProxyModel;
class QPushButton;
class QCheckBox;
class QLabel;
class AbstractClient;
class TabSupervisor;
class TabRoom;
class ServerInfo_Game;
class Response;
class Event_AddToList;
class Event_RemoveFromList;
class GameSelectorQuickFilterToolBar;
class QModelIndex;
class QPoint;
class QString;
class QWidget;
class ServerInfo_User;
template <class Key, class T> class QMap;
template <typename T> class QList;
/**
* @class GameSelector

View file

@ -1,12 +1,22 @@
#include "game_selector_quick_filter_toolbar.h"
#include "game_filter_configs.h"
#include "games_model.h"
#include "user/user_list_manager.h"
#include <QCheckBox>
#include <QComboBox>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QMapIterator>
#include <QSet>
#include <QSharedPointer>
#include <QSignalBlocker>
#include <QString>
#include <QVariant>
#include <QtGlobal>
class TabSupervisor;
template <class Key, class T> class QMap;
GameSelectorQuickFilterToolBar::GameSelectorQuickFilterToolBar(QWidget *parent,
TabSupervisor *_tabSupervisor,

View file

@ -1,12 +1,19 @@
#ifndef COCKATRICE_GAME_SELECTOR_QUICK_FILTER_TOOLBAR_H
#define COCKATRICE_GAME_SELECTOR_QUICK_FILTER_TOOLBAR_H
#include "../tabs/tab_supervisor.h"
#include "games_model.h"
#include <QHBoxLayout>
#include <QLineEdit>
#include <QWidget>
#include <functional>
#include <qtmetamacros.h>
class GamesProxyModel;
class QCheckBox;
class QComboBox;
class QHBoxLayout;
class QLineEdit;
class QString;
class TabSupervisor;
struct GameFilterConfigs;
template <class Key, class T> class QMap;
class GameSelectorQuickFilterToolBar : public QWidget
{

View file

@ -2,13 +2,26 @@
#include "../../../client/settings/cache_settings.h"
#include "../interface/pixel_map_generator.h"
#include "../interface/widgets/tabs/tab_account.h"
#include "user/user_list_manager.h"
#include "user/user_list_widget.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include "user/user_list_proxy.h"
#include "user_level.h"
#include <QAbstractItemModel>
#include <QDate>
#include <QDateTime>
#include <QFlag>
#include <QIcon>
#include <QMapIterator>
#include <QObject>
#include <QSet>
#include <QSharedPointer>
#include <QStringList>
#include <QTime>
#include <QTimeZone>
#include <QVariant>
#include <QtGlobal>
#include <compare>
#include <initializer_list>
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
#include <libcockatrice/settings/game_filters_settings.h>

View file

@ -4,13 +4,18 @@
#include "game_filter_configs.h"
#include "game_type_map.h"
#include <QAbstractTableModel>
#include <QList>
#include <QSet>
#include <QMap>
#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QTime>
#include <QString>
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
#include <qnamespace.h>
#include <qtmetamacros.h>
class UserListProxy;
class QObject;
/**
* @class GamesModel

View file

@ -2,10 +2,19 @@
#include "../../../client/settings/cache_settings.h"
#include <QByteArray>
#include <QDebug>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSharedPointer>
#include <QUrl>
#include <QVariant>
#include <QVariantMap>
#include <libcockatrice/settings/servers_settings.h>
#include <qlogging.h>
#define PUBLIC_SERVERS_JSON "https://cockatrice.github.io/public-servers.json"

View file

@ -9,8 +9,17 @@
#include "user/user_info_connection.h"
#include <QList>
#include <QMap>
#include <QObject>
#include <QString>
#include <QStringList>
#include <qtmetamacros.h>
#include <utility>
class QNetworkReply;
class QNetworkAccessManager;
class QVariant;
/**
* This class is used to update the servers.ini file and ensure

View file

@ -1,14 +1,23 @@
#include "remote_decklist_tree_widget.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include <QAbstractItemView>
#include <QFileIconProvider>
#include <QHeaderView>
#include <QItemSelectionModel>
#include <QSharedPointer>
#include <QSortFilterProxyModel>
#include <QVariant>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/command_deck_list.pb.h>
#include <libcockatrice/protocol/pb/response_deck_list.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_deckstorage.pb.h>
#include <libcockatrice/protocol/pending_command.h>
class QObject;
class QWidget;
RemoteDeckList_TreeModel::DirectoryNode::DirectoryNode(const QString &_name,
RemoteDeckList_TreeModel::DirectoryNode *_parent)
: RemoteDeckList_TreeModel::Node(_name, _parent)

View file

@ -8,13 +8,23 @@
#ifndef REMOTEDECKLIST_TREEWIDGET_H
#define REMOTEDECKLIST_TREEWIDGET_H
#include <QAbstractItemModel>
#include <QDateTime>
#include <QIcon>
#include <QList>
#include <QModelIndex>
#include <QString>
#include <QStringList>
#include <QTreeView>
#include <qnamespace.h>
#include <qtmetamacros.h>
class Response;
class AbstractClient;
class QSortFilterProxyModel;
class ServerInfo_DeckStorage_TreeItem;
class QObject;
class QWidget;
class RemoteDeckList_TreeModel : public QAbstractItemModel
{
@ -22,6 +32,7 @@ class RemoteDeckList_TreeModel : public QAbstractItemModel
public:
class DirectoryNode;
class FileNode;
class Node
{
protected:

View file

@ -1,16 +1,27 @@
#include "remote_replay_list_tree_widget.h"
#include "../../../pixel_map_generator.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_replay_match.pb.h"
#include <QAbstractItemView>
#include <QDateTime>
#include <QFileIconProvider>
#include <QHeaderView>
#include <QItemSelectionModel>
#include <QSortFilterProxyModel>
#include <QStringList>
#include <QStringLiteral>
#include <QVariant>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/command_replay_list.pb.h>
#include <libcockatrice/protocol/pb/response_replay_list.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_replay.pb.h>
#include <libcockatrice/protocol/pending_command.h>
class QObject;
class QWidget;
const int RemoteReplayList_TreeModel::numberOfColumns = 6;
RemoteReplayList_TreeModel::MatchNode::MatchNode(const ServerInfo_ReplayMatch &_matchInfo)

View file

@ -9,21 +9,30 @@
#ifndef REMOTEREPLAYLIST_TREEWIDGET_H
#define REMOTEREPLAYLIST_TREEWIDGET_H
#include <QDateTime>
#include <QAbstractItemModel>
#include <QIcon>
#include <QList>
#include <QModelIndex>
#include <QSet>
#include <QString>
#include <QTreeView>
#include <libcockatrice/protocol/pb/serverinfo_replay.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_replay_match.pb.h>
#include <qnamespace.h>
#include <qtmetamacros.h>
class Response;
class AbstractClient;
class QSortFilterProxyModel;
class QObject;
class QWidget;
class RemoteReplayList_TreeModel : public QAbstractItemModel
{
Q_OBJECT
private:
class MatchNode;
class ReplayNode;
class Node
{
protected:

View file

@ -1,8 +1,15 @@
#include "user_avatar_provider.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include "libcockatrice/protocol/pb/session_commands.pb.h"
#include <QtGlobal>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/response_get_user_info.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <string>
#include <sys/types.h>
UserAvatarProvider::UserAvatarProvider(AbstractClient *client, QObject *parent) : QObject(parent), client(client)
{

View file

@ -5,6 +5,8 @@
#include <QObject>
#include <QPixmap>
#include <QSet>
#include <QString>
#include <qtmetamacros.h>
class AbstractClient;

View file

@ -2,9 +2,22 @@
#include "../../../card_picture_loader/card_picture_loader.h"
#include "../../cards/card_art_utils.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/database/card_database.h"
#include "libcockatrice/card/database/card_database_loader.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/card/printing/printing_info.h"
#include <QChar>
#include <QMetaObject>
#include <QPointer>
#include <QRect>
#include <QSize>
#include <QStringList>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/utility/card_ref.h>
#include <memory>
static QString makeKey(const QString &user, const QString &card, const QString &providerId)
{

View file

@ -1,12 +1,16 @@
#ifndef COCKATRICE_USER_CARD_ART_PROVIDER_H
#define COCKATRICE_USER_CARD_ART_PROVIDER_H
#include <QList>
#include <QMap>
#include <QObject>
#include <QPixmap>
#include <QQueue>
#include <QSet>
#include <libcockatrice/card/printing/exact_card.h>
#include <QString>
#include <qtmetamacros.h>
class ExactCard;
class UserCardArtProvider : public QObject
{

View file

@ -3,30 +3,50 @@
#include "../../../card_picture_loader/card_picture_loader.h"
#include "../../cards/art_crop_attribution.h"
#include "../../utility/completer_utils.h"
#include "card/card_search_model.h"
#include "card_database_display_model.h"
#include "card_database_model.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/card/printing/printing_info.h"
#include "libcockatrice/card/set/card_set.h"
#include "user_card_art_provider.h"
#include "user_list_painter.h"
#include <QBrush>
#include <QColor>
#include <QComboBox>
#include <QCompleter>
#include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QFlags>
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLabel>
#include <QLineEdit>
#include <QLinearGradient>
#include <QList>
#include <QMouseEvent>
#include <QPainter>
#include <QPainterPath>
#include <QPalette>
#include <QPen>
#include <QPushButton>
#include <QRegularExpression>
#include <QRect>
#include <QRectF>
#include <QSharedPointer>
#include <QSize>
#include <QSizePolicy>
#include <QVBoxLayout>
#include <QVariant>
#include <QWheelEvent>
#include <QtGlobal>
#include <cmath>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/utility/card_ref.h>
#include <qnamespace.h>
#include <qnumeric.h>
namespace
{

View file

@ -3,24 +3,26 @@
#include "user_list_painter.h"
#include <QComboBox>
#include <QDialog>
#include <QMetaObject>
#include <QPixmap>
#include <QPoint>
#include <QString>
#include <QWidget>
#include <QtGlobal>
#include <qtmetamacros.h>
class QCompleter;
class QFocusEvent;
class QGroupBox;
class QKeyEvent;
class QMouseEvent;
class QLineEdit;
class QDoubleSpinBox;
class QLabel;
class QPushButton;
class QWheelEvent;
class CardDatabaseModel;
class CardDatabaseDisplayModel;
class CardSearchModel;
class CardCompleterProxyModel;
class QComboBox;
/**
* @brief Interactive preview of the user list banner art.

View file

@ -1,20 +1,42 @@
#include "user_context_menu.h"
#include "../../../../game/abstract_game.h"
#include "../../../../game/game_event_handler.h"
#include "../../../../game/game_meta_info.h"
#include "../../dialogs/dlg_report_user.h"
#include "../../interface/widgets/tabs/tab_account.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../../interface/widgets/tabs/tab_supervisor.h"
#include "../chat_view/chat_view.h"
#include "../game_link.h"
#include "../game_selector.h"
#include "../game_type_map.h"
#include "libcockatrice/protocol/pb/admin_commands.pb.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_ban.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_gametype.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_room.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_warning.pb.h"
#include "user_info_box.h"
#include "user_level.h"
#include "user_list_dialog.h"
#include "user_list_manager.h"
#include "user_list_proxy.h"
#include <QAction>
#include <QClipboard>
#include <QCursor>
#include <QDialog>
#include <QFlags>
#include <QGuiApplication>
#include <QHeaderView>
#include <QMap>
#include <QMenu>
#include <QtGui>
#include <QtWidgets>
#include <QMessageBox>
#include <QSharedPointer>
#include <QSizePolicy>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QWidget>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/command_kick_from_game.pb.h>
#include <libcockatrice/protocol/pb/commands.pb.h>
@ -27,6 +49,10 @@
#include <libcockatrice/protocol/pb/response_warn_list.pb.h>
#include <libcockatrice/protocol/pb/session_commands.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <qnamespace.h>
#include <string>
class QVariant;
UserContextMenu::UserContextMenu(TabSupervisor *_tabSupervisor, QWidget *parent, AbstractGame *_game)
: QObject(parent), client(_tabSupervisor->getClient()), tabSupervisor(_tabSupervisor),

View file

@ -11,19 +11,22 @@
#include <QList>
#include <QObject>
#include <QString>
#include <functional>
#include <libcockatrice/network/server/remote/user_level.h>
#include <qtmetamacros.h>
#include <utility>
class AbstractGame;
class UserListProxy;
class AbstractClient;
class ChatView;
class CommandContainer;
class QAction;
class QMenu;
class QPoint;
class Response;
class ServerInfo_User;
class TabSupervisor;
class QWidget;
class UserContextMenu : public QObject
{

View file

@ -5,20 +5,36 @@
#include "../../interface/widgets/dialogs/dlg_edit_password.h"
#include "../../interface/widgets/dialogs/dlg_edit_user.h"
#include "../../interface/widgets/utility/get_text_with_max.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/utility/days_years_between.h"
#include "user_card_settings_dialog.h"
#include "user_level.h"
#include "user_list_painter.h"
#include <QByteArray>
#include <QDate>
#include <QDateTime>
#include <QDialog>
#include <QFlag>
#include <QFont>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QInputDialog>
#include <QLabel>
#include <QLineEdit>
#include <QLocale>
#include <QMessageBox>
#include <QSharedPointer>
#include <QSize>
#include <QSizePolicy>
#include <QtGlobal>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/response_get_user_info.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <libcockatrice/protocol/pb/session_commands.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <libcockatrice/utility/passwordhasher.h>
#include <string>
#include <sys/types.h>
UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *parent, Qt::WindowFlags flags)
: QWidget(parent, flags), client(_client), editable(_editable)

View file

@ -7,13 +7,15 @@
#ifndef USERINFOBOX_H
#define USERINFOBOX_H
#include <QDateTime>
#include <QLabel>
#include <QPixmap>
#include <QPushButton>
#include <QString>
#include <QWidget>
#include <libcockatrice/network/server/remote/user_level.h>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <libcockatrice/utility/days_years_between.h>
#include <qnamespace.h>
#include <qtmetamacros.h>
class AbstractClient;
class Response;

View file

@ -2,7 +2,10 @@
#include "../../../../client/settings/cache_settings.h"
#include <QDebug>
#include <QList>
#include <QMessageLogger>
#include <QSharedPointer>
#include <QVariant>
#include <libcockatrice/settings/servers_settings.h>
#include <utility>

View file

@ -7,12 +7,11 @@
#ifndef USERCONNECTION_INFORMATION_H
#define USERCONNECTION_INFORMATION_H
#include <QApplication>
#include <QDir>
#include <QFile>
#include <QLoggingCategory>
#include <QSettings>
#include <QStandardPaths>
#include <QMap>
#include <QString>
#include <QStringList>
#include <utility>
inline Q_LOGGING_CATEGORY(UserInfoConnectionLog, "user_info_connection");

View file

@ -4,26 +4,61 @@
#include "../../interface/pixel_map_generator.h"
#include "../../interface/theme_manager.h"
#include "../../interface/widgets/tabs/tab_supervisor.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_game.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include "libcockatrice/protocol/pb/session_commands.pb.h"
#include "user_level.h"
#include "user_list_painter.h"
#include <QApplication>
#include <QBrush>
#include <QChar>
#include <QFlag>
#include <QFlags>
#include <QFont>
#include <QFontMetrics>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QImage>
#include <QLabel>
#include <QLayout>
#include <QLinearGradient>
#include <QList>
#include <QListView>
#include <QMap>
#include <QMenu>
#include <QModelIndex>
#include <QPainter>
#include <QPainterPath>
#include <QPropertyAnimation>
#include <QPen>
#include <QPoint>
#include <QPushButton>
#include <QScreen>
#include <QScrollBar>
#include <QRect>
#include <QRectF>
#include <QSharedPointer>
#include <QSize>
#include <QSizePolicy>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QStringLiteral>
#include <QStyle>
#include <QStyleOptionViewItem>
#include <QStyledItemDelegate>
#include <QVBoxLayout>
#include <QVariant>
#include <QtGlobal>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/commands.pb.h>
#include <libcockatrice/protocol/pb/response_get_games_of_user.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <libcockatrice/utility/card_ref.h>
#include <qnumeric.h>
#include <string>
class QAction;
/// Qt stylesheets accept #aarrggbb, which is QColor::name(QColor::HexArgb).
static QString colorStr(const QColor &color)

View file

@ -1,24 +1,29 @@
#ifndef COCKATRICE_USER_INFO_POPUP_H
#define COCKATRICE_USER_INFO_POPUP_H
#include "../../interface/widgets/server/game_type_map.h"
#include "user_list_painter.h"
#include <QColor>
#include <QFrame>
#include <QListView>
#include <QMap>
#include <QPalette>
#include <QPixmap>
#include <QStandardItemModel>
#include <QString>
#include <QWidget>
#include <functional>
#include <libcockatrice/network/server/remote/user_level.h>
#include <libcockatrice/protocol/pb/response.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <qnamespace.h>
#include <qtmetamacros.h>
#include <utility>
class AbstractClient;
class QLabel;
class QPushButton;
class TabSupervisor;
class QListView;
class QPoint;
class QStandardItemModel;
class Response;
template <class Key, class T> class QMap;
// ── Roles ─────────────────────────────────────────────────────────────────────

View file

@ -1,17 +1,26 @@
#include "user_list_dialog.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include <QCheckBox>
#include <QComboBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPlainTextEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QSharedPointer>
#include <QSpinBox>
#include <QVBoxLayout>
#include <QVariant>
#include <libcockatrice/utility/string_limits.h>
#include <qnamespace.h>
class QWidget;
BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(parent)
{

View file

@ -2,7 +2,8 @@
#define COCKATRICE_USER_LIST_DIALOG_H
#include <QDialog>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <QString>
#include <qtmetamacros.h>
class QComboBox;
class QLabel;
@ -11,6 +12,8 @@ class QRadioButton;
class QSpinBox;
class QLineEdit;
class QCheckBox;
class QWidget;
class ServerInfo_User;
class BanDialog : public QDialog
{

View file

@ -1,8 +1,11 @@
#include "user_list_manager.h"
#include "../../client/sound_engine.h"
#include "user_info_box.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include <QList>
#include <QSharedPointer>
#include <algorithm>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/pb/event_add_to_list.pb.h>
#include <libcockatrice/protocol/pb/event_remove_from_list.pb.h>

View file

@ -10,18 +10,22 @@
#include "user_list_proxy.h"
#include <QMap>
#include <QWidget>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
// IWYU pragma: keep
// ServerInfo_User appears by value and inside QList in slot signatures, so the
// moc-generated code needs the complete type.
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
class AbstractClient;
class Event_AddToList;
class Event_ListRooms;
class Event_RemoveFromList;
class Event_UserJoined;
class Event_UserLeft;
class Response;
class ServerInfo_User;
class TabSupervisor;
template <typename T> class QList;
class UserListManager : public QObject, public UserListProxy
{

View file

@ -1,14 +1,35 @@
#include "user_list_painter.h"
#include "../../interface/pixel_map_generator.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include <QAbstractScrollArea>
#include <QApplication>
#include <QBrush>
#include <QChar>
#include <QFlag>
#include <QFlags>
#include <QFont>
#include <QFontMetrics>
#include <QImage>
#include <QLinearGradient>
#include <QMap>
#include <QModelIndex>
#include <QObject>
#include <QPainter>
#include <QPainterPath>
#include <QPen>
#include <QPixmap>
#include <QPoint>
#include <QScrollBar>
#include <QSharedPointer>
#include <QStyle>
#include <QStyleOptionViewItem>
#include <QVariant>
#include <QWidget>
#include <QtGlobal>
#include <qnamespace.h>
#include <qnumeric.h>
static constexpr int RowHeight = 72;
static constexpr int AvatarSize = 36;

View file

@ -5,16 +5,19 @@
#include <QColor>
#include <QList>
#include <QMap>
#include <QPalette>
#include <QPixmap>
#include <QRect>
#include <QRectF>
#include <QSize>
#include <QString>
#include <QtGlobal>
class QPainter;
class QModelIndex;
class QStyleOptionViewItem;
class ServerInfo_User;
class QPixmap;
template <class Key, class T> class QMap;
struct CardArtParams
{

View file

@ -1,12 +1,13 @@
#include "user_list_panel_widget.h"
#include "../../../../client/settings/cache_settings.h"
#include "user_list_manager.h"
#include "user_list_widget.h"
#include <QLineEdit>
#include <QList>
#include <QStringList>
#include <QStringLiteral>
#include <QVBoxLayout>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/settings/interface_settings.h>
namespace

View file

@ -8,7 +8,9 @@
#include "user_list_widget.h"
#include <QString>
#include <QWidget>
#include <qtmetamacros.h>
class AbstractClient;
class QLineEdit;

View file

@ -4,18 +4,64 @@
#include "../../interface/pixel_map_generator.h"
#include "../../interface/theme_manager.h"
#include "../../interface/widgets/tabs/tab_supervisor.h"
#include "user_avatar_provider.h"
#include "user_card_art_provider.h"
#include "user_context_menu.h"
#include "user_info_popup.h"
#include "user_level.h"
#include "user_list_manager.h"
#include "user_list_painter.h"
#include "user_list_proxy.h"
#include <QAbstractAnimation>
#include <QAbstractItemModel>
#include <QApplication>
#include <QByteArray>
#include <QColor>
#include <QContextMenuEvent>
#include <QCursor>
#include <QEvent>
#include <QFlag>
#include <QFlags>
#include <QFont>
#include <QFontMetrics>
#include <QFrame>
#include <QGuiApplication>
#include <QHeaderView>
#include <QIcon>
#include <QItemSelection>
#include <QItemSelectionModel>
#include <QKeyEvent>
#include <QLayout>
#include <QMenu>
#include <QModelIndex>
#include <QMouseEvent>
#include <QObject>
#include <QPainter>
#include <QPalette>
#include <QPoint>
#include <QPointF>
#include <QPropertyAnimation>
#include <QRect>
#include <QScreen>
#include <QScrollBar>
#include <QSharedPointer>
#include <QSignalBlocker>
#include <QSize>
#include <QStringLiteral>
#include <QStyle>
#include <QStyleOptionViewItem>
#include <QTimer>
#include <QTreeWidget>
#include <QVBoxLayout>
#include <QVariant>
#include <QWidget>
#include <QtGlobal>
#include <libcockatrice/settings/appearance_settings.h>
#include <qnamespace.h>
class QPixmap;
struct GameInviteOption;
namespace UserListRoles
{

View file

@ -7,33 +7,34 @@
#ifndef USERLIST_H
#define USERLIST_H
#include "../../cards/card_info_picture_art_crop_widget.h"
#include "../../interface/widgets/server/game_link.h"
#include "user_avatar_provider.h"
#include "user_card_art_provider.h"
#include "user_info_popup.h"
#include "user_list_manager.h"
#include "user_list_painter.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include <QComboBox>
#include <QGroupBox>
#include <QList>
#include <QMap>
#include <QSet>
#include <QString>
#include <QStyledItemDelegate>
#include <QTextEdit>
#include <QTreeWidgetItem>
#include <functional>
#include <libcockatrice/network/server/remote/user_level.h>
#include <libcockatrice/protocol/pb/moderator_commands.pb.h>
#include <qtmetamacros.h>
#include <utility>
class QTreeWidget;
class ServerInfo_User;
class AbstractClient;
class TabSupervisor;
class Response;
class CommandContainer;
class UserContextMenu;
class UserListWidget;
class QShowEvent;
class QModelIndex;
class QPixmap;
class QPoint;
class QTimer;
class QWidget;
class UserAvatarProvider;
class UserCardArtProvider;
class UserInfoPopup;
class UserListManager;
struct CardArtParams;
struct GameInviteOption;
class UserListItemDelegate : public QStyledItemDelegate
{