[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
1078 changed files with 9093 additions and 1769 deletions

View File

@@ -1,7 +1,10 @@
#include "lag_monitor.h"
#include <QApplication>
#include <QCoreApplication>
#include <QDateTime>
#include <QEvent>
#include <QMessageLogger>
#include <QTimer>
LagMonitor::LagMonitor(QObject *parent) : QObject(parent)

View File

@@ -6,15 +6,15 @@
#ifndef LAG_MONITOR_H
#define LAG_MONITOR_H
#include <QDateTime>
#include <QElapsedTimer>
#include <QList>
#include <QLoggingCategory>
#include <QObject>
#include <QtGlobal>
#include <qtmetamacros.h>
inline Q_LOGGING_CATEGORY(LagMonitorLog, "lag_monitor");
class QEvent;
class QTimer;
/**

View File

@@ -5,7 +5,11 @@
#include "latency_graph_widget.h"
#include <QColor>
#include <QPainter>
#include <QRectF>
#include <QtGlobal>
#include <qnumeric.h>
LatencyGraphWidget::LatencyGraphWidget(QWidget *parent) : QWidget(parent)
{

View File

@@ -8,6 +8,8 @@
#include <QList>
#include <QWidget>
#include <QtGlobal>
#include <qtmetamacros.h>
/**
* @brief Bar graph of recent network round-trip samples.

View File

@@ -6,11 +6,15 @@
#include "latency_status_widget.h"
#include "latency_graph_widget.h"
#include "latency_tracker.h"
#include <QEvent>
#include <QHBoxLayout>
#include <QLabel>
#include <QObject>
#include <QPoint>
#include <QVBoxLayout>
#include <qnamespace.h>
LatencyStatusWidget::LatencyStatusWidget(QWidget *parent) : QWidget(parent)
{

View File

@@ -7,8 +7,10 @@
#define LATENCY_STATUS_WIDGET_H
#include <QList>
#include <QString>
#include <QWidget>
#include <libcockatrice/network/client/abstract/latency_tracker.h>
#include <qtmetamacros.h>
class QLabel;
class LatencyGraphWidget;

View File

@@ -8,14 +8,25 @@
#include "../interface/widgets/dialogs/dlg_forgot_password_reset.h"
#include "../interface/widgets/dialogs/dlg_register.h"
#include "../interface/widgets/utility/get_text_with_max.h"
#include "libcockatrice/protocol/pb/event_connection_closed.pb.h"
#include "libcockatrice/protocol/pb/event_server_shutdown.pb.h"
#include <QChar>
#include <QDateTime>
#include <QDebug>
#include <QLineEdit>
#include <QList>
#include <QMessageBox>
#include <QPixmap>
#include <QStringList>
#include <QStringLiteral>
#include <QThread>
#include <libcockatrice/network/client/remote/remote_client.h>
#include <libcockatrice/protocol/pb/response.pb.h>
#include <libcockatrice/settings/servers_settings.h>
#include <qnamespace.h>
class QWidget;
ConnectionController::ConnectionController(QWidget *dialogParent, QObject *parent)
: QObject(parent), dialogParent(dialogParent)

View File

@@ -2,17 +2,22 @@
#define COCKATRICE_REMOTE_CONNECTION_CONTROLLER_H
#include "abstract_client.h"
#include "latency_tracker.h"
#include <QMessageBox>
#include <QObject>
#include <QString>
#include <QThread>
#include <libcockatrice/protocol/pb/event_connection_closed.pb.h>
#include <libcockatrice/protocol/pb/event_server_shutdown.pb.h>
#include <QtGlobal>
#include <qtmetamacros.h>
class RemoteClient;
class ServerInfo_User;
class DlgConnect;
class Event_ConnectionClosed;
class Event_ServerShutdown;
class QThread;
class QWidget;
template <typename T> class QList;
/**
* Owns the RemoteClient and its worker thread.

View File

@@ -1,11 +1,22 @@
#include "deck_stats_interface.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/deck_list/tree/inner_deck_list_node.h"
#include <QByteArray>
#include <QDesktopServices>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QSharedPointer>
#include <QString>
#include <QUrl>
#include <QUrlQuery>
#include <functional>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/deck_list/deck_list.h>
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>

View File

@@ -7,7 +7,8 @@
#ifndef DECKSTATS_INTERFACE_H
#define DECKSTATS_INTERFACE_H
#include <libcockatrice/deck_list/deck_list.h>
#include <QObject>
#include <qtmetamacros.h>
class QByteArray;
class QNetworkAccessManager;

View File

@@ -1,11 +1,28 @@
#include "tapped_out_interface.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/deck_list/tree/inner_deck_list_node.h"
#include <QByteArray>
#include <QDebug>
#include <QDesktopServices>
#include <QList>
#include <QMessageBox>
#include <QMessageLogger>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QRegularExpressionMatchIterator>
#include <QSharedPointer>
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QUrlQuery>
#include <QVariant>
#include <functional>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/deck_list/deck_list.h>
#include <libcockatrice/deck_list/tree/deck_list_card_node.h>

View File

@@ -9,6 +9,7 @@
#include <QLoggingCategory>
#include <QObject>
#include <qtmetamacros.h>
inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface");

View File

@@ -1,6 +1,7 @@
#include "deck_link_to_api_transformer.h"
#include <QRegularExpression>
#include <QRegularExpressionMatch>
namespace DeckLinkToApiTransformer
{

View File

@@ -1,21 +1,35 @@
#include "spoiler_background_updater.h"
#include "../../../../interface/window_main.h"
#include "../../../../main.h"
#include "../../../settings/cache_settings.h"
#include <QChar>
#include <QCryptographicHash>
#include <QDateTime>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QIODevice>
#include <QList>
#include <QLocale>
#include <QMessageLogger>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSharedPointer>
#include <QSystemTrayIcon>
#include <QTimeZone>
#include <QUrl>
#include <QtConcurrent>
#include <QtConcurrentRun>
#include <QtGlobal>
#include <functional>
#include <libcockatrice/card/database/card_database.h>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/settings/download_settings.h>
#include <libcockatrice/settings/paths_settings.h>
#include <tuple>
#include <utility>
#include <version_string.h>
#define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled"

View File

@@ -10,7 +10,11 @@
#include <QByteArray>
#include <QLoggingCategory>
#include <QObject>
#include <QProcess>
#include <QString>
#include <qtmetamacros.h>
class QProcess;
class QUrl;
inline Q_LOGGING_CATEGORY(SpoilerBackgroundUpdaterLog, "spoiler_background_updater");

View File

@@ -6,9 +6,12 @@
#ifndef CLIENT_UPDATE_CHECKER_H
#define CLIENT_UPDATE_CHECKER_H
#include <QObject>
#include "release_channel.h"
class Release;
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
/**
* We use a singleton instance of UpdateChannel, which can cause interference and feedback loops when multiple objects

View File

@@ -2,15 +2,27 @@
#include "version_string.h"
#include <QByteArray>
#include <QDebug>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QMessageBox>
#include <QJsonParseError>
#include <QJsonValue>
#include <QMap>
#include <QMessageLogger>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QRegularExpression>
#include <QSysInfo>
#include <QRegularExpressionMatch>
#include <QUrl>
#include <QVariant>
#include <QVariantMap>
#include <QtGlobal>
#include <optional>
#include <qnamespace.h>
#include <qprocessordetection.h>
#if defined(Q_OS_MACOS)
#include <sys/sysctl.h>

View File

@@ -11,8 +11,9 @@
#include <QLoggingCategory>
#include <QObject>
#include <QString>
#include <QVariantMap>
#include <QVariantList>
#include <optional>
#include <qtmetamacros.h>
#include <utility>
inline Q_LOGGING_CATEGORY(ReleaseChannelLog, "release_channel");

View File

@@ -1,6 +1,14 @@
#include "update_downloader.h"
#include <QByteArray>
#include <QChar>
#include <QDir>
#include <QFile>
#include <QIODevice>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QUrl>
#include <QVariant>
UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent), response(nullptr)
{

View File

@@ -7,8 +7,14 @@
#ifndef COCKATRICE_UPDATEDOWNLOADER_H
#define COCKATRICE_UPDATEDOWNLOADER_H
#include <QNetworkReply>
#include <QObject>
#include <QtNetwork>
#include <QString>
#include <QUrl>
#include <QtGlobal>
#include <qtmetamacros.h>
class QNetworkAccessManager;
class UpdateDownloader : public QObject
{

View File

@@ -2,15 +2,20 @@
#include "../network/update/client/release_channel.h"
#include "card_counter_settings.h"
#include "libcockatrice/interfaces/interface_card_database_path_provider.h"
#include "shortcuts_settings.h"
#include "version_string.h"
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QGlobalStatic>
#include <QMessageLogger>
#include <QSettings>
#include <QSharedPointer>
#include <QStandardPaths>
#include <QVariant>
#include <QtGlobal>
#include <libcockatrice/settings/appearance_settings.h>
#include <libcockatrice/settings/cache_storage_settings.h>
#include <libcockatrice/settings/card_database_settings.h>

View File

@@ -7,11 +7,13 @@
#ifndef SETTINGSCACHE_H
#define SETTINGSCACHE_H
#include <QList>
#include <QLoggingCategory>
#include <QString>
#include <QStringList>
#include <libcockatrice/interfaces/interface_card_database_path_provider.h>
#include <libcockatrice/interfaces/interface_network_settings_provider.h>
#include <libcockatrice/utility/macros.h>
#include <qtmetamacros.h>
inline Q_LOGGING_CATEGORY(SettingsCacheLog, "settings_cache");

View File

@@ -1,8 +1,15 @@
#include "card_counter_settings.h"
#include "libcockatrice/settings/settings_manager.h"
#include <QChar>
#include <QColor>
#include <QSettings>
#include <QVariant>
#include <QtMath>
#include <iterator>
class QObject;
CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *parent)
: SettingsManager(settingsPath + "card_counters.ini", "cards", "counters", parent)

View File

@@ -7,10 +7,12 @@
#ifndef CARD_COUNTER_SETTINGS_H
#define CARD_COUNTER_SETTINGS_H
#include <QString>
#include <libcockatrice/settings/settings_manager.h>
#include <qtmetamacros.h>
class QSettings;
class QColor;
class QObject;
class CardCounterSettings : public SettingsManager
{

View File

@@ -3,7 +3,24 @@
#include "cache_settings.h"
#include "shortcuts_settings.h"
#include <QAbstractItemModel>
#include <QAbstractItemView>
#include <QFont>
#include <QHash>
#include <QHeaderView>
#include <QList>
#include <QModelIndex>
#include <QRegularExpression>
#include <QSharedPointer>
#include <QStandardItem>
#include <QStandardItemModel>
#include <QStringList>
#include <QVariant>
#include <algorithm>
#include <qnamespace.h>
class QObject;
class QWidget;
ShortcutFilterProxyModel::ShortcutFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{

View File

@@ -8,8 +8,13 @@
#define SHORTCUT_TREEVIEW_H
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QString>
#include <QTreeView>
#include <qtmetamacros.h>
class QObject;
class QStandardItemModel;
class QWidget;
/**
* Custom implementation of QSortFilterProxyModel that appends the source and parent strings together when filtering

View File

@@ -2,9 +2,13 @@
#include <QDebug>
#include <QFile>
#include <QMap>
#include <QMessageBox>
#include <QMessageLogger>
#include <QSettings>
#include <QSharedPointer>
#include <QStringList>
#include <utility>
#include <QVariant>
ShortcutKey::ShortcutKey(const QString &_name, QList<QKeySequence> _sequence, ShortcutGroup::Groups _group)
: QList<QKeySequence>(_sequence), name(_name), group(_group)

View File

@@ -8,9 +8,18 @@
#define SHORTCUTSSETTINGS_H
#include <QApplication>
#include <QByteArray>
#include <QChar>
#include <QHash>
#include <QKeySequence>
#include <QList>
#include <QLoggingCategory>
#include <QSettings>
#include <QObject>
#include <QString>
#include <QStringList>
#include <QtGlobal>
#include <qtmetamacros.h>
#include <utility>
inline Q_LOGGING_CATEGORY(ShortcutsSettingsLog, "shortcuts_settings");

View File

@@ -4,8 +4,15 @@
#include <QApplication>
#include <QAudioOutput>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QList>
#include <QMediaPlayer>
#include <QMessageLogger>
#include <QStringList>
#include <QUrl>
#include <QtGlobal>
#include <libcockatrice/settings/sound_settings.h>
#define DEFAULT_THEME_NAME "Default"

View File

@@ -7,17 +7,17 @@
#ifndef SOUNDENGINE_H
#define SOUNDENGINE_H
#include <QAudioOutput>
#include <QLoggingCategory>
#include <QMap>
#include <QMediaPlayer>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
class QAudioOutput;
class QMediaPlayer;
inline Q_LOGGING_CATEGORY(SoundEngineLog, "sound_engine");
class QBuffer;
typedef QMap<QString, QString> QStringMap;
class SoundEngine : public QObject

View File

@@ -1,9 +1,27 @@
#include "deck_filter_string.h"
#include "../interface/deck_loader/loaded_deck.h"
#include "libcockatrice/card/card_localization.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/deck_list/deck_list.h"
#include "libcockatrice/deck_list/tree/deck_list_card_node.h"
#include <QByteArray>
#include <QDebug>
#include <QFileInfo>
#include <QList>
#include <QMessageLogger>
#include <QSharedPointer>
#include <algorithm>
#include <any>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/filters/filter_string.h>
#include <libcockatrice/utility/peglib.h>
#include <mutex>
#include <qnamespace.h>
#include <stddef.h>
#include <string>
#include <vector>
static peg::parser search(R"(
Start <- QueryPartList

View File

@@ -7,13 +7,14 @@
#ifndef DECK_FILTER_STRING_H
#define DECK_FILTER_STRING_H
#include "../interface/deck_loader/loaded_deck.h"
#include <QLoggingCategory>
#include <QString>
#include <functional>
#include <libcockatrice/card/card_localization.h>
struct CardSearchLanguage;
struct LoadedDeck;
inline Q_LOGGING_CATEGORY(DeckFilterStringLog, "deck_filter_string");
/**

View File

@@ -5,8 +5,15 @@
#include <QComboBox>
#include <QGridLayout>
#include <QIcon>
#include <QPushButton>
#include <QSizePolicy>
#include <QString>
#include <QStringLiteral>
#include <QVariant>
#include <QtGlobal>
#include <libcockatrice/filters/filter_card.h>
#include <stddef.h>
FilterBuilder::FilterBuilder(QWidget *parent) : QWidget(parent)
{

View File

@@ -8,8 +8,8 @@
#define FILTERBUILDER_H
#include <QWidget>
#include <qtmetamacros.h>
class QCheckBox;
class QComboBox;
class LineEditUnfocusable;
class CardFilter;

View File

@@ -1,8 +1,15 @@
#include "filter_tree_model.h"
#include <QFlags>
#include <QFont>
#include <QString>
#include <QVariant>
#include <functional>
#include <libcockatrice/filters/filter_card.h>
#include <libcockatrice/filters/filter_tree.h>
#include <stddef.h>
class QObject;
FilterTreeModel::FilterTreeModel(QObject *parent) : QAbstractItemModel(parent)
{

View File

@@ -8,11 +8,15 @@
#define FILTERTREEMODEL_H
#include <QAbstractItemModel>
#include <QList>
#include <QModelIndex>
#include <libcockatrice/filters/filter_card.h>
#include <qnamespace.h>
#include <qtmetamacros.h>
class FilterTree;
class CardFilter;
class FilterTreeNode;
class QObject;
class FilterTreeModel : public QAbstractItemModel
{

View File

@@ -1,8 +1,21 @@
#include "syntax_help.h"
#include <QDebug>
#include <QFile>
#include <QFlags>
#include <QIODevice>
#include <QLineEdit>
#include <QMessageLogger>
#include <QObject>
#include <QRegularExpression>
#include <QSharedPointer>
#include <QSize>
#include <QString>
#include <QTextBrowser>
#include <QTextDocument>
#include <QTextStream>
#include <QUrl>
#include <qnamespace.h>
/**
* Creates the card search syntax help window

View File

@@ -8,9 +8,10 @@
#ifndef SEARCH_SYNTAX_HELP_H
#define SEARCH_SYNTAX_HELP_H
#include <QLineEdit>
#include <QLoggingCategory>
#include <QTextBrowser>
class QLineEdit;
class QTextBrowser;
inline Q_LOGGING_CATEGORY(SyntaxHelpLog, "syntax_help");

View File

@@ -1,7 +1,18 @@
#include "abstract_game.h"
#include "../interface/widgets/tabs/tab_game.h"
#include "game_event_handler.h"
#include "game_meta_info.h"
#include "game_state.h"
#include "libcockatrice/protocol/pb/game_replay.pb.h"
#include "player/player_info.h"
#include "player/player_logic.h"
#include "player/player_manager.h"
#include "zones/card_zone_logic.h"
#include <QList>
#include <QMap>
class AbstractClient;
AbstractGame::AbstractGame(QObject *_parent) : QObject(_parent)
{

View File

@@ -7,15 +7,18 @@
#ifndef COCKATRICE_ABSTRACT_GAME_H
#define COCKATRICE_ABSTRACT_GAME_H
#include "game_event_handler.h"
#include "game_meta_info.h"
#include "game_state.h"
#include "player/player_manager.h"
#include <QObject>
#include <libcockatrice/protocol/pb/game_replay.pb.h>
#include <QString>
#include <qtmetamacros.h>
class CardItem;
class AbstractClient;
class GameEventHandler;
class GameMetaInfo;
class GameReplay;
class GameState;
class PlayerManager;
class AbstractGame : public QObject
{
Q_OBJECT

View File

@@ -1,6 +1,9 @@
#include "arrow_registry.h"
#include "../game_graphics/board/arrow_item.h"
#include "board/arrow_data.h"
#include <QSharedPointer>
void ArrowRegistry::insert(QSharedPointer<ArrowData> data, ArrowItem *arrow)
{

View File

@@ -1,13 +1,13 @@
#ifndef COCKATRICE_ARROW_REGISTRY_H
#define COCKATRICE_ARROW_REGISTRY_H
#include "board/arrow_data.h"
#include <QList>
#include <QMap>
#include <QSet>
#include <QSharedPointer>
class ArrowItem;
struct ArrowData;
template <class T> class QSharedPointer;
struct ArrowKey
{

View File

@@ -1,5 +1,8 @@
#include "arrow_data.h"
#include "libcockatrice/protocol/pb/serverinfo_arrow.pb.h"
#include "libcockatrice/utility/color.h"
ArrowData ArrowData::fromProto(const ServerInfo_Arrow &arrow, int creatorId, bool isLocalCreator)
{
ArrowData data;

View File

@@ -3,8 +3,8 @@
#include <QColor>
#include <QString>
#include <libcockatrice/protocol/pb/serverinfo_arrow.pb.h>
#include <libcockatrice/utility/color.h>
class ServerInfo_Arrow;
struct ArrowData
{

View File

@@ -1,9 +1,14 @@
#include "card_list.h"
#include "../../game_graphics/board/card_item.h"
#include "libcockatrice/card/printing/exact_card.h"
#include <QChar>
#include <QDebug>
#include <QMessageLogger>
#include <QSharedPointer>
#include <algorithm>
#include <compare>
#include <libcockatrice/card/card_info.h>
CardList::CardList(bool _contentsKnown) : QList<CardItem *>(), contentsKnown(_contentsKnown)

View File

@@ -9,6 +9,8 @@
#include <QList>
#include <QLoggingCategory>
#include <QString>
#include <functional>
inline Q_LOGGING_CATEGORY(CardListLog, "card_list");

View File

@@ -1,5 +1,7 @@
#include "card_state.h"
#include <QSharedPointer>
void CardState::resetState(bool keepAnnotations)
{
attacking = false;

View File

@@ -3,9 +3,12 @@
#include <QMap>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
class CardZoneLogic;
class CardItem;
class CardState : public QObject
{
Q_OBJECT

View File

@@ -1,5 +1,7 @@
#include "counter_state.h"
#include "libcockatrice/protocol/pb/serverinfo_counter.pb.h"
#include <libcockatrice/utility/color.h>
CounterState::CounterState(int id, const QString &name, const QColor &color, int radius, int value, QObject *parent)

View File

@@ -4,7 +4,9 @@
#include <QColor>
#include <QObject>
#include <QString>
#include <libcockatrice/protocol/pb/serverinfo_counter.pb.h>
#include <qtmetamacros.h>
class ServerInfo_Counter;
class CounterState : public QObject
{

View File

@@ -1,9 +1,17 @@
#include "game.h"
#include "../interface/widgets/tabs/tab_game.h"
#include "game_meta_info.h"
#include "game_state.h"
#include "player/player_manager.h"
#include <QList>
#include <QMap>
#include <QString>
#include <libcockatrice/protocol/pb/event_game_joined.pb.h>
class AbstractClient;
class QObject;
Game::Game(QObject *_parent,
bool isLocalGame,
QList<AbstractClient *> &_clients,

View File

@@ -9,7 +9,14 @@
#include "abstract_game.h"
#include <QObject>
#include <qtmetamacros.h>
class AbstractClient;
class Event_GameJoined;
class QObject;
class QString;
template <class Key, class T> class QMap;
template <typename T> class QList;
class Game : public AbstractGame
{

View File

@@ -1,9 +1,30 @@
#include "game_event_handler.h"
#include "../game_graphics/log/message_log_widget.h"
#include "../interface/widgets/tabs/tab_game.h"
#include "abstract_game.h"
#include "game_meta_info.h"
#include "game_state.h"
#include "libcockatrice/protocol/pb/commands.pb.h"
#include "libcockatrice/protocol/pb/game_commands.pb.h"
#include "libcockatrice/protocol/pb/game_event.pb.h"
#include "libcockatrice/protocol/pb/game_event_context.pb.h"
#include "libcockatrice/protocol/pb/response.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_game.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_player.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include "player/player_event_handler.h"
#include "player/player_info.h"
#include "player/player_logic.h"
#include "player/player_manager.h"
#include <QList>
#include <QMap>
#include <QMapIterator>
#include <QMessageLogger>
#include <QSharedPointer>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/stubs/port.h>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <libcockatrice/protocol/get_pb_extension.h>
#include <libcockatrice/protocol/pb/command_concede.pb.h>
@@ -13,7 +34,6 @@
#include <libcockatrice/protocol/pb/command_next_turn.pb.h>
#include <libcockatrice/protocol/pb/command_reverse_turn.pb.h>
#include <libcockatrice/protocol/pb/command_set_active_phase.pb.h>
#include <libcockatrice/protocol/pb/context_connection_state_changed.pb.h>
#include <libcockatrice/protocol/pb/context_deck_select.pb.h>
#include <libcockatrice/protocol/pb/event_game_closed.pb.h>
#include <libcockatrice/protocol/pb/event_game_host_changed.pb.h>
@@ -28,6 +48,8 @@
#include <libcockatrice/protocol/pb/event_set_active_player.pb.h>
#include <libcockatrice/protocol/pb/game_event_container.pb.h>
#include <libcockatrice/protocol/pending_command.h>
#include <string>
#include <utility>
GameEventHandler::GameEventHandler(AbstractGame *_game) : QObject(_game), game(_game)
{

View File

@@ -19,23 +19,29 @@
#include <QLoggingCategory>
#include <QObject>
#include <QPair>
#include <QString>
#include <QVector>
#include <libcockatrice/protocol/pb/event_leave.pb.h>
#include <qtmetamacros.h>
// IWYU pragma: keep
// GameEventContext, ServerInfo_Player and ServerInfo_User are passed by value
// to signals and slots, so the moc-generated code needs the complete types.
#include <libcockatrice/protocol/pb/game_event_context.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_player.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
class AbstractClient;
class AbstractGame;
class CommandContainer;
class GameCommand;
class GameEventContainer;
class GameEventContext;
class PendingCommand;
class PlayerLogic;
class Response;
class Event_GameStateChanged;
class Event_PlayerPropertiesChanged;
class Event_Join;
class Event_Leave;
class Event_GameHostChanged;
class Event_GameClosed;
class Event_SetActivePlayer;
@@ -44,6 +50,15 @@ class Event_GameSay;
class Event_Kicked;
class Event_ReverseTurn;
class Event_Ping;
class ServerInfo_PlayerProperties;
namespace google
{
namespace protobuf
{
class Message;
} // namespace protobuf
} // namespace google
template <typename T> class QList;
inline Q_LOGGING_CATEGORY(GameEventHandlerLog, "game_event_handler");

View File

@@ -9,13 +9,16 @@
#include <QMap>
#include <QObject>
#include <QString>
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
#include <qtmetamacros.h>
// Translation layer class to expose protobuf safely and hook it up to Qt Signals.
// This class de-couples the domain object (i.e. the GameMetaInfo) from the network object.
// If the network object changes, only this class needs to be adjusted.
class AbstractGame;
class GameMetaInfo : public QObject
{
Q_OBJECT

View File

@@ -2,6 +2,11 @@
#include "abstract_game.h"
#include <QChar>
#include <QTimer>
class AbstractClient;
GameState::GameState(AbstractGame *parent,
int _secondsElapsed,
int _hostId,

View File

@@ -7,12 +7,14 @@
#ifndef COCKATRICE_GAME_STATE_H
#define COCKATRICE_GAME_STATE_H
#include <QTimer>
#include <libcockatrice/network/client/abstract/abstract_client.h>
#include <QList>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
class AbstractGame;
class ServerInfo_PlayerProperties;
class ServerInfo_User;
class AbstractClient;
class QTimer;
class GameState : public QObject
{

View File

@@ -1,5 +1,10 @@
#include "phase.h"
#include <QByteArray>
#include <QList>
#include <QSharedPointer>
#include <QtGlobal>
Phase::Phase(const QString &_name, const QString &_color, const QString &_soundFileName)
: name(_name), color(_color), soundFileName(_soundFileName)
{

View File

@@ -7,8 +7,9 @@
#ifndef PHASE_H
#define PHASE_H
#include <QApplication>
#include <QCoreApplication>
#include <QString>
#include <QVector>
class Phase
{

View File

@@ -1,14 +1,54 @@
#include "player_actions.h"
#include "../../client/settings/cache_settings.h"
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/dialogs/dlg_create_token.h"
#include "../../game_graphics/dialogs/dlg_move_top_cards_until.h"
#include "../../game_graphics/dialogs/dlg_roll_dice.h"
#include "../../game_graphics/player/card_menu_action_type.h"
#include "../../game_graphics/zones/hand_zone.h"
#include "../../game_graphics/zones/table_zone.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../../interface/widgets/utility/get_text_with_max.h"
#include "../../interface/deck_loader/loaded_deck.h"
#include "../abstract_game.h"
#include "../board/counter_state.h"
#include "../game_event_handler.h"
#include "../zones/card_zone_logic.h"
#include "../zones/hand_zone_logic.h"
#include "../zones/pile_zone_logic.h"
#include "../zones/table_zone_logic.h"
#include "../zones/view_zone_logic.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/relation/card_relation_type.h"
#include "libcockatrice/deck_list/deck_list.h"
#include "libcockatrice/filters/filter_string.h"
#include "libcockatrice/protocol/pb/card_attributes.pb.h"
#include "libcockatrice/protocol/pb/game_commands.pb.h"
#include "libcockatrice/settings/cards_display_settings.h"
#include "player_info.h"
#include "player_logic.h"
#include <QAction>
#include <QChar>
#include <QColor>
#include <QFlags>
#include <QInputDialog>
#include <QKeyEvent>
#include <QList>
#include <QMap>
#include <QMapIterator>
#include <QMetaType>
#include <QPoint>
#include <QPointF>
#include <QSharedPointer>
#include <QTimer>
#include <QVariant>
#include <QVariantList>
#include <QtGlobal>
#include <algorithm>
#include <functional>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/stubs/port.h>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/card/relation/card_relation.h>
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
@@ -26,13 +66,16 @@
#include <libcockatrice/protocol/pb/command_set_card_counter.pb.h>
#include <libcockatrice/protocol/pb/command_shuffle.pb.h>
#include <libcockatrice/protocol/pb/command_undo_draw.pb.h>
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
#include <libcockatrice/settings/card_override_settings.h>
#include <libcockatrice/settings/interface_settings.h>
#include <libcockatrice/utility/clamped_arithmetic.h>
#include <libcockatrice/utility/counter_limits.h>
#include <libcockatrice/utility/expression.h>
#include <libcockatrice/utility/zone_names.h>
#include <memory>
#include <qnamespace.h>
#include <qnumeric.h>
#include <string>
// milliseconds in between triggers of the move top cards until action
static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100;

View File

@@ -8,17 +8,25 @@
#ifndef COCKATRICE_PLAYER_ACTIONS_H
#define COCKATRICE_PLAYER_ACTIONS_H
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/board/card_item.h" // IWYU pragma: keep - moc instantiates the metatype for QList<CardItem *>, which Qt 6.4 needs complete
#include "../../game_graphics/dialogs/dlg_create_token.h"
#include "../../game_graphics/dialogs/dlg_move_top_cards_until.h"
#include "../../game_graphics/player/card_menu_action_type.h"
#include "event_processing_options.h"
#include "player_logic.h"
#include "../board/card_list.h"
#include "libcockatrice/card/card_info.h"
#include <QMenu>
#include <QObject>
#include <QString>
#include <QStringList>
#include <libcockatrice/card/relation/card_relation_type.h>
#include <libcockatrice/filters/filter_string.h>
#include <qtmetamacros.h>
class CardItem;
class CardRelation;
class QAction;
class QTimer;
template <typename T> class QList;
namespace google
{
@@ -29,9 +37,9 @@ class Message;
} // namespace google
class Command_MoveCard;
class GameEventContext;
class PendingCommand;
class PlayerLogic;
class PlayerActions : public QObject
{
Q_OBJECT

View File

@@ -1,15 +1,32 @@
#include "player_event_handler.h"
#include "../../game_graphics/board/arrow_item.h"
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/zones/view_zone.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../abstract_game.h"
#include "../board/arrow_data.h"
#include "../board/card_list.h"
#include "../board/counter_state.h"
#include "../zones/card_zone_logic.h"
#include "../zones/hand_zone_logic.h"
#include "../zones/pile_zone_logic.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/protocol/pb/card_attributes.pb.h"
#include "libcockatrice/protocol/pb/game_event.pb.h"
#include "libcockatrice/protocol/pb/game_event_context.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_card.pb.h"
#include "libcockatrice/utility/card_ref.h"
#include "player_actions.h"
#include "player_info.h"
#include "player_logic.h"
#include "player_manager.h"
#include <libcockatrice/protocol/pb/command_set_card_attr.pb.h>
#include <QDebug>
#include <QList>
#include <QMap>
#include <QSharedPointer>
#include <QtGlobal>
#include <algorithm>
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
#include <libcockatrice/protocol/pb/context_undo_draw.pb.h>
#include <libcockatrice/protocol/pb/event_attach_card.pb.h>
@@ -32,8 +49,9 @@
#include <libcockatrice/protocol/pb/event_set_card_counter.pb.h>
#include <libcockatrice/protocol/pb/event_set_counter.pb.h>
#include <libcockatrice/protocol/pb/event_shuffle.pb.h>
#include <libcockatrice/utility/color.h>
#include <libcockatrice/utility/zone_names.h>
#include <qlogging.h>
#include <string>
PlayerEventHandler::PlayerEventHandler(PlayerLogic *_player) : QObject(_player), player(_player)
{

View File

@@ -22,14 +22,14 @@
#include "event_processing_options.h"
#include <QObject>
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
#include <QString>
#include <libcockatrice/protocol/pb/game_event.pb.h>
#include <libcockatrice/protocol/pb/game_event_context.pb.h>
#include <qtmetamacros.h>
#include <sys/types.h>
class CardItem;
class CardZoneLogic;
class PlayerLogic;
class Event_AttachCard;
class Event_ChangeZoneProperties;
class Event_CreateArrow;
@@ -50,6 +50,9 @@ class Event_SetCardCounter;
class Event_SetCounter;
class Event_Shuffle;
class Event_GameLogNotice;
class GameEventContext;
enum CardAttribute : int;
template <typename T> class QList;
/**
* @class PlayerEventHandler

View File

@@ -1,5 +1,7 @@
#include "player_info.h"
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
PlayerInfo::PlayerInfo(const ServerInfo_User &info, int _id, bool _local, bool _judge)
: id(_id), local(_local), judge(_judge)
{

View File

@@ -7,10 +7,10 @@
#ifndef COCKATRICE_PLAYER_INFO_H
#define COCKATRICE_PLAYER_INFO_H
#include "../../game_graphics/player/player_target.h"
#include <QObject>
#include <QString>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <qtmetamacros.h>
class PlayerInfo : public QObject
{

View File

@@ -1,33 +1,37 @@
#include "player_logic.h"
#include "../../game_graphics/board/arrow_item.h"
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/board/counter_general.h"
#include "../../game_graphics/game_scene.h"
#include "../../game_graphics/player/player_target.h"
#include "../../game_graphics/zones/hand_zone.h"
#include "../../game_graphics/zones/pile_zone.h"
#include "../../game_graphics/zones/stack_zone.h"
#include "../../game_graphics/zones/table_zone.h"
#include "../../interface/theme_manager.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../board/card_list.h"
#include "../abstract_game.h"
#include "../board/arrow_data.h"
#include "../board/counter_state.h"
#include "../game_meta_info.h"
#include "../zones/hand_zone_logic.h"
#include "../zones/pile_zone_logic.h"
#include "../zones/stack_zone_logic.h"
#include "../zones/table_zone_logic.h"
#include "libcockatrice/protocol/pb/serverinfo_card.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_counter.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h"
#include "libcockatrice/utility/zone_names.h"
#include "player_actions.h"
#include "player_event_handler.h"
#include "player_info.h"
#include "player_manager.h"
#include <QDebug>
#include <QMenu>
#include <QMetaType>
#include <QPainter>
#include <QtConcurrent>
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
#include <libcockatrice/protocol/pb/command_set_card_counter.pb.h>
#include <libcockatrice/protocol/pb/event_create_arrow.pb.h>
#include <libcockatrice/protocol/pb/event_create_counter.pb.h>
#include <libcockatrice/protocol/pb/event_draw_cards.pb.h>
#include <QMapIterator>
#include <QMessageLogger>
#include <QMutableMapIterator>
#include <QSet>
#include <QSharedPointer>
#include <QtGlobal>
#include <libcockatrice/protocol/pb/serverinfo_player.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_zone.pb.h>
#include <libcockatrice/utility/card_ref.h>
#include <libcockatrice/utility/color.h>
#include <qalgorithms.h>
#include <string>
PlayerLogic::PlayerLogic(const ServerInfo_User &info, int _id, bool _local, bool _judge, AbstractGame *_parent)
: QObject(_parent), game(_parent), playerInfo(new PlayerInfo(info, _id, _local, _judge)),

View File

@@ -7,57 +7,48 @@
#ifndef PLAYER_H
#define PLAYER_H
#include "../../game_graphics/player/player_area.h"
#include "../../interface/widgets/menus/tearoff_menu.h"
#include "../board/arrow_data.h"
#include "../interface/deck_loader/loaded_deck.h"
#include "../zones/card_zone_logic.h"
#include "../zones/hand_zone_logic.h"
#include "../zones/pile_zone_logic.h"
#include "../zones/stack_zone_logic.h"
#include "../zones/table_zone_logic.h"
#include "player_event_handler.h"
#include "player_info.h"
#include "player_manager.h"
#include "libcockatrice/deck_list/deck_list.h"
#include "libcockatrice/utility/card_ref.h"
#include "libcockatrice/utility/playmat_params.h"
#include <QColor>
#include <QInputDialog>
#include <QList>
#include <QLoggingCategory>
#include <QMap>
#include <QTimer>
#include <libcockatrice/filters/filter_string.h>
#include <libcockatrice/protocol/pb/card_attributes.pb.h>
#include <libcockatrice/protocol/pb/game_event.pb.h>
#include <QObject>
#include <QString>
#include <libcockatrice/utility/zone_names.h>
#include <qtmetamacros.h>
// IWYU pragma: keep
// ServerInfo_Card appears inside QList<...> in signal and slot
// signatures, which the moc-generated code needs to be complete.
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
class CardItem;
class CounterState;
class QWidget;
class ServerInfo_PlayerProperties;
struct ArrowData;
struct LoadedDeck;
template <class T> class QSharedPointer;
inline Q_LOGGING_CATEGORY(PlayerLog, "player");
namespace google
{
namespace protobuf
{
class Message;
}
} // namespace google
class AbstractCardItem;
class AbstractGame;
class ArrowItem;
class ArrowTarget;
class CardDatabase;
class CardZone;
class CommandContainer;
class GameCommand;
class GameEvent;
class PlayerInfo;
class PlayerEventHandler;
class PlayerActions;
class PlayerMenu;
class QAction;
class QMenu;
class ServerInfo_Arrow;
class ServerInfo_Card;
class ServerInfo_Counter;
class ServerInfo_Player;
class ServerInfo_User;
class TabGame;
const int MAX_TOKENS_PER_DIALOG = 99;

View File

@@ -1,8 +1,14 @@
#include "player_manager.h"
#include "../abstract_game.h"
#include "../game_state.h"
#include "player_info.h"
#include "player_logic.h"
#include <QList>
#include <QMapIterator>
#include <QSharedPointer>
PlayerManager::PlayerManager(AbstractGame *_game,
int _localPlayerId,
bool _localPlayerIsJudge,

View File

@@ -7,12 +7,17 @@
#ifndef COCKATRICE_PLAYER_MANAGER_H
#define COCKATRICE_PLAYER_MANAGER_H
#include "libcockatrice/protocol/pb/serverinfo_user.pb.h"
#include <QMap>
#include <QObject>
#include <QString>
#include <libcockatrice/protocol/pb/serverinfo_playerproperties.pb.h>
#include <qtmetamacros.h>
class AbstractGame;
class PlayerLogic;
class PlayerManager : public QObject
{
Q_OBJECT

View File

@@ -1,6 +1,13 @@
#include "replay.h"
#include "../interface/widgets/tabs/tab_game.h"
#include "game_meta_info.h"
#include "game_state.h"
#include "player/player_manager.h"
#include <QList>
class GameReplay;
class QObject;
Replay::Replay(QObject *_parent, const GameReplay *_replay, bool isLocalGame) : AbstractGame(_parent)
{

View File

@@ -10,6 +10,11 @@
#include "abstract_game.h"
#include <qtmetamacros.h>
class GameReplay;
class QObject;
class Replay : public AbstractGame
{
Q_OBJECT

View File

@@ -1,16 +1,25 @@
#include "card_zone_logic.h"
#include "../../client/translation.h"
#include "../../game_graphics/board/card_item.h"
#include "../../game_graphics/zones/card_zone.h"
#include "../../game_graphics/zones/view_zone.h"
#include "../board/card_list.h"
#include "../player/player_actions.h"
#include "../player/player_info.h"
#include "../player/player_logic.h"
#include "libcockatrice/card/database/card_database.h"
#include "view_zone_logic.h"
#include <QAction>
#include <QDebug>
#include <QMessageLogger>
#include <QSharedPointer>
#include <QVariant>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/protocol/pb/command_move_card.pb.h>
#include <libcockatrice/utility/zone_names.h>
#include <string>
/**
* @param _player the player that the zone belongs to

View File

@@ -10,17 +10,18 @@
#include "../../client/translation.h"
#include "../board/card_list.h"
#include <QList>
#include <QLoggingCategory>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
class CardItem;
inline Q_LOGGING_CATEGORY(CardZoneLogicLog, "card_zone_logic");
class PlayerLogic;
class ZoneViewZone;
class QMenu;
class QAction;
class QPainter;
class CardDragItem;
class CardZoneLogic : public QObject
{

View File

@@ -3,6 +3,9 @@
#include "../../game_graphics/board/card_item.h"
#include "card_zone_algorithms.h"
class PlayerLogic;
class QObject;
HandZoneLogic::HandZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,

View File

@@ -8,6 +8,12 @@
#define COCKATRICE_HAND_ZONE_LOGIC_H
#include "card_zone_logic.h"
#include <QString>
#include <qtmetamacros.h>
class PlayerLogic;
class QObject;
class HandZoneLogic : public CardZoneLogic
{
Q_OBJECT

View File

@@ -1,6 +1,10 @@
#include "pile_zone_logic.h"
#include "../../game_graphics/board/card_item.h"
#include "../board/card_list.h"
class PlayerLogic;
class QObject;
PileZoneLogic::PileZoneLogic(PlayerLogic *_player,
const QString &_name,

View File

@@ -8,6 +8,12 @@
#define COCKATRICE_PILE_ZONE_LOGIC_H
#include "card_zone_logic.h"
#include <QString>
#include <qtmetamacros.h>
class PlayerLogic;
class QObject;
class PileZoneLogic : public CardZoneLogic
{

View File

@@ -3,6 +3,9 @@
#include "../../game_graphics/board/card_item.h"
#include "card_zone_algorithms.h"
class PlayerLogic;
class QObject;
StackZoneLogic::StackZoneLogic(PlayerLogic *_player,
const QString &_name,
bool _hasCardAttr,

View File

@@ -8,6 +8,12 @@
#define COCKATRICE_STACK_ZONE_LOGIC_H
#include "card_zone_logic.h"
#include <QString>
#include <qtmetamacros.h>
class PlayerLogic;
class QObject;
class StackZoneLogic : public CardZoneLogic
{
Q_OBJECT

View File

@@ -1,6 +1,13 @@
#include "table_zone_logic.h"
#include "../../game_graphics/board/card_item.h"
#include "../board/card_list.h"
#include "libcockatrice/card/card_info.h"
#include <QPoint>
class PlayerLogic;
class QObject;
TableZoneLogic::TableZoneLogic(PlayerLogic *_player,
const QString &_name,

View File

@@ -8,6 +8,12 @@
#define COCKATRICE_TABLE_ZONE_LOGIC_H
#include "card_zone_logic.h"
#include <QString>
#include <qtmetamacros.h>
class PlayerLogic;
class QObject;
class TableZoneLogic : public CardZoneLogic
{
Q_OBJECT

View File

@@ -2,8 +2,14 @@
#include "../../client/settings/cache_settings.h"
#include "../../game_graphics/board/card_item.h"
#include "../board/card_list.h"
#include <QtGlobal>
#include <libcockatrice/settings/interface_settings.h>
class PlayerLogic;
class QObject;
/**
* @param _player the player that the cards are revealed to.
* @param _origZone the zone the cards were revealed from.

View File

@@ -8,6 +8,11 @@
#define COCKATRICE_VIEW_ZONE_LOGIC_H
#include "card_zone_logic.h"
#include <qtmetamacros.h>
class PlayerLogic;
class QObject;
class ZoneViewZoneLogic : public CardZoneLogic
{
Q_OBJECT

View File

@@ -2,12 +2,20 @@
#include "../../client/settings/cache_settings.h"
#include "../z_values.h"
#include "abstract_card_item.h"
#include <QBrush>
#include <QColor>
#include <QCursor>
#include <QDebug>
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
#include <QPainterPath>
#include <QTransform>
#include <QtGlobal>
#include <libcockatrice/settings/cards_display_settings.h>
#include <qnamespace.h>
class QPointF;
const QColor GHOST_MASK = QColor(255, 255, 255, 50);

View File

@@ -7,11 +7,17 @@
#ifndef ABSTRACTCARDDRAGITEM_H
#define ABSTRACTCARDDRAGITEM_H
#include "abstract_card_item.h"
#include "../card_dimensions.h"
#include "graphics_item_type.h"
class QGraphicsScene;
class CardZone;
class CardInfo;
#include <QGraphicsItem>
#include <QList>
#include <QObject>
#include <QPointF>
#include <QRectF>
#include <qtmetamacros.h>
class AbstractCardItem;
class AbstractCardDragItem : public QObject, public QGraphicsItem
{

View File

@@ -3,19 +3,42 @@
#include "../../client/settings/cache_settings.h"
#include "../../interface/card_localization.h"
#include "../../interface/card_picture_loader/card_picture_loader.h"
#include "../card_dimensions.h"
#include "../game_scene.h"
#include "../z_values.h"
#include "abstract_graphics_item.h"
#include "libcockatrice/card/card_info.h"
#include "libcockatrice/card/database/card_database_querier.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/utility/card_ref.h"
#include <QBrush>
#include <QChar>
#include <QCursor>
#include <QFlags>
#include <QFont>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QHash>
#include <QLineF>
#include <QList>
#include <QPainter>
#include <QPainterPath>
#include <QPen>
#include <QPixmap>
#include <QPointF>
#include <QRectF>
#include <QTransform>
#include <QVariant>
#include <QtGlobal>
#include <algorithm>
#include <libcockatrice/card/database/card_database.h>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/settings/appearance_settings.h>
#include <libcockatrice/settings/cards_display_settings.h>
#include <libcockatrice/settings/debug_settings.h>
#include <qnamespace.h>
class QSizeF;
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, PlayerLogic *_owner, int _id)
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),

View File

@@ -8,14 +8,22 @@
#define ABSTRACTCARDITEM_H
#include "../animated_item.h"
#include "../card_dimensions.h"
#include "arrow_target.h"
#include "graphics_item_type.h"
#include <QColor>
#include <QGraphicsItem>
#include <QSizeF>
#include <QString>
#include <QtGlobal>
#include <libcockatrice/card/printing/exact_card.h>
#include <libcockatrice/utility/card_ref.h>
#include <qtmetamacros.h>
class PlayerLogic;
class CardInfo;
class QPainter;
class QPoint;
class AbstractCardItem : public ArrowTarget, public IAnimatedItem
{

View File

@@ -2,21 +2,33 @@
#include "../../client/settings/cache_settings.h"
#include "../../client/settings/shortcuts_settings.h"
#include "../../game/board/counter_state.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_info.h"
#include "../../game/player/player_logic.h"
#include "../../game_graphics/board/translate_counter_name.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../../interface/widgets/menus/tearoff_menu.h"
#include <QAction>
#include <QApplication>
#include <QEvent>
#include <QFlags>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsView>
#include <QKeyEvent>
#include <QMenu>
#include <QKeySequence>
#include <QList>
#include <QSharedPointer>
#include <QString>
#include <QVariant>
#include <QtGlobal>
#include <libcockatrice/protocol/pb/command_inc_counter.pb.h>
#include <libcockatrice/protocol/pb/command_set_counter.pb.h>
#include <libcockatrice/utility/expression.h>
#include <qnamespace.h>
class QWidget;
AbstractCounter::AbstractCounter(CounterState *state,
PlayerLogic *_player,

View File

@@ -7,18 +7,21 @@
#ifndef COUNTER_H
#define COUNTER_H
#include "../../game/board/counter_state.h"
#include "../../interface/widgets/menus/tearoff_menu.h"
#include "../player/menu/abstract_player_component.h"
#include <QColor>
#include <QGraphicsItem>
#include <QInputDialog>
#include <QObject>
#include <QString>
#include <qtmetamacros.h>
class PlayerLogic;
class QAction;
class QKeyEvent;
class QMenu;
class QString;
class CounterState;
class QWidget;
class AbstractCounter : public QObject, public QGraphicsItem, public AbstractPlayerComponent
{

View File

@@ -1,6 +1,14 @@
#include "abstract_graphics_item.h"
#include <QBrush>
#include <QFont>
#include <QFontMetrics>
#include <QPainter>
#include <QRectF>
#include <QString>
#include <QTransform>
#include <QtGlobal>
#include <qnamespace.h>
void AbstractGraphicsItem::paintNumberEllipse(int number,
int fontSize,

View File

@@ -7,7 +7,12 @@
#ifndef ABSTRACTGRAPHICSITEM_H
#define ABSTRACTGRAPHICSITEM_H
#include <QGraphicsItem>
#include <QColor>
#include <QGraphicsObject>
#include <qtmetamacros.h>
class QGraphicsItem;
class QPainter;
/**
* Parent class of all objects that appear in a game.

View File

@@ -2,28 +2,42 @@
#include "arrow_item.h"
#include "../../client/settings/cache_settings.h"
#include "../../game/board/arrow_data.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_info.h"
#include "../../game/player/player_logic.h"
#include "../../game/zones/card_zone_logic.h"
#include "../game_scene.h"
#include "../player/player_target.h"
#include "../z_values.h"
#include "../zones/card_zone.h"
#include "card_item.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/protocol/pb/color.pb.h"
#include <QDebug>
#include <QBrush>
#include <QElapsedTimer>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QLineF>
#include <QLinearGradient>
#include <QPainter>
#include <QPen>
#include <QPoint>
#include <QString>
#include <QTransform>
#include <QtGlobal>
#include <QtMath>
#include <libcockatrice/card/card_info.h>
#include <libcockatrice/protocol/pb/command_attach_card.pb.h>
#include <libcockatrice/protocol/pb/command_create_arrow.pb.h>
#include <libcockatrice/protocol/pb/command_delete_arrow.pb.h>
#include <libcockatrice/settings/cards_display_settings.h>
#include <libcockatrice/settings/interface_settings.h>
#include <libcockatrice/utility/color.h>
#include <libcockatrice/utility/zone_names.h>
#include <math.h>
#include <qnamespace.h>
#include <string>
#include <utility>
namespace
{

View File

@@ -6,15 +6,23 @@
#include "arrow_target.h"
#include "graphics_item_type.h"
#include <QColor>
#include <QElapsedTimer>
#include <QGraphicsItem>
#include <QList>
#include <QMetaObject>
#include <QObject>
#include <QPainterPath>
#include <QPointF>
#include <QPointer>
#include <QRectF>
#include <QSharedPointer>
#include <QtGlobal>
#include <qtmetamacros.h>
class CardItem;
class QGraphicsSceneMouseEvent;
class PlayerLogic;
template <class T> class QSharedPointer;
class ArrowItem : public QObject, public QGraphicsItem, public IAnimatedItem
{

View File

@@ -1,7 +1,8 @@
#include "arrow_target.h"
#include "../../game/player/player_logic.h"
#include "arrow_item.h"
#include <QVariant>
class QGraphicsItem;
ArrowTarget::ArrowTarget(PlayerLogic *_owner, QGraphicsItem *parent) : AbstractGraphicsItem(parent), owner(_owner)
{

View File

@@ -9,10 +9,10 @@
#include "abstract_graphics_item.h"
#include <QList>
#include <qtmetamacros.h>
class PlayerLogic;
class ArrowItem;
class QGraphicsItem;
class ArrowTarget : public AbstractGraphicsItem
{

View File

@@ -6,9 +6,20 @@
#include "../zones/view_zone.h"
#include "card_item.h"
#include <QBrush>
#include <QColor>
#include <QCursor>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QList>
#include <QObject>
#include <QPainter>
#include <QPoint>
#include <QSharedPointer>
#include <qnamespace.h>
class CardZoneLogic;
CardDragItem::CardDragItem(CardItem *_item,
int _id,

View File

@@ -9,7 +9,11 @@
#include "abstract_card_drag_item.h"
#include <QPointF>
#include <qtmetamacros.h>
class CardItem;
class CardZone;
class CardDragItem : public AbstractCardDragItem
{

View File

@@ -1,26 +1,52 @@
#include "card_item.h"
#include "../../client/settings/cache_settings.h"
#include "../../client/settings/card_counter_settings.h"
#include "../../game/abstract_game.h"
#include "../../game/board/card_state.h"
#include "../../game/game_state.h"
#include "../../game/phase.h"
#include "../../game/player/player_actions.h"
#include "../../game/player/player_info.h"
#include "../../game/player/player_logic.h"
#include "../../game/player/player_manager.h"
#include "../../game/zones/card_zone_logic.h"
#include "../../game/zones/table_zone_logic.h"
#include "../../game/zones/view_zone_logic.h"
#include "../../interface/widgets/tabs/tab_game.h"
#include "../card_dimensions.h"
#include "../game_scene.h"
#include "../zones/table_zone.h"
#include "../zones/view_zone.h"
#include "arrow_item.h"
#include "card_drag_item.h"
#include "libcockatrice/card/printing/exact_card.h"
#include "libcockatrice/protocol/pb/serverinfo_cardcounter.pb.h"
#include <../../client/settings/card_counter_settings.h>
#include <QApplication>
#include <QBrush>
#include <QChar>
#include <QColor>
#include <QCursor>
#include <QFlags>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QMenu>
#include <QMap>
#include <QMapIterator>
#include <QObject>
#include <QPainter>
#include <QPen>
#include <QRectF>
#include <QSharedPointer>
#include <QSizeF>
#include <QTransform>
#include <QVariant>
#include <QtGlobal>
#include <libcockatrice/card/card_info.h>
#include <libcockatrice/protocol/pb/serverinfo_card.pb.h>
#include <libcockatrice/settings/interface_settings.h>
#include <libcockatrice/utility/card_ref.h>
#include <qnamespace.h>
struct CardRef;
CardItem::CardItem(PlayerLogic *_owner,
QGraphicsItem *parent,

View File

@@ -8,18 +8,24 @@
#define CARDITEM_H
#include "../../game/board/card_state.h"
#include "../../game/zones/card_zone_logic.h"
#include "abstract_card_item.h"
#include "graphics_item_type.h"
#include <libcockatrice/network/server/remote/game/server_card.h>
#include <QList>
#include <QPoint>
#include <QPointF>
#include <QString>
#include <QVariantList>
#include <qtmetamacros.h>
class CardDatabase;
class CardDragItem;
class CardZone;
class ServerInfo_Card;
class PlayerLogic;
class QAction;
class QColor;
class CardZoneLogic;
class QGraphicsItem;
struct CardRef;
template <class Key, class T> class QMap;
const int ROTATION_DEGREES_PER_FRAME = 10;

View File

@@ -3,7 +3,20 @@
#include "../../interface/pixel_map_generator.h"
#include "abstract_graphics_item.h"
#include <QFont>
#include <QPainter>
#include <QPixmap>
#include <QPoint>
#include <QRectF>
#include <QSizeF>
#include <QString>
#include <QTransform>
#include <QtGlobal>
#include <qnamespace.h>
class CounterState;
class PlayerLogic;
class QGraphicsItem;
GeneralCounter::GeneralCounter(CounterState *state, PlayerLogic *player, bool useNameForShortcut, QGraphicsItem *parent)
: AbstractCounter(state, player, true, useNameForShortcut, parent)

Some files were not shown because too many files have changed in this diff Show More