[Refactor] Move AnnotationDialog and action data types into game/

Folds in the closed #7410 (Move AnnotationDialog from game/ logic to
game_graphics/) now that layers 1-2 are closed and this stack bottoms on
master directly:

- Add game_graphics/dialogs/dlg_annotation.{h,cpp} and move the
  QInputDialog subclass there; game/ no longer declares any widget type.
- Add game/player/token_info.h and game/player/move_top_cards_until_options.h.
- Move CardMenuActionType to game/player/card_menu_action_type.h.
- Graphics dialog headers include the new game/ headers instead of
  defining the structs themselves.

No behavior change.
This commit is contained in:
Lukas Brübach 2026-10-16 20:59:06 +02:00 • committed by GitHub
parent 6c660d6b21
commit c02576b827
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 89 additions and 50 deletions

View file

@ -0,0 +1,28 @@
/**
* @file card_menu_action_type.h
* @ingroup GameLogicPlayers
*/
//! \todo Document this file.
#ifndef COCKATRICE_CARD_MENU_ACTION_TYPE_H
#define COCKATRICE_CARD_MENU_ACTION_TYPE_H
enum CardMenuActionType
{
// Per-card attribute actions (must be <= cmClone for cardMenuAction() dispatch)
cmTap,
cmUntap,
cmDoesntUntap,
cmFlip,
cmPeek,
cmClone,
// Move actions (must be > cmClone for cardMenuAction() dispatch)
cmMoveToTopLibrary,
cmMoveToBottomLibrary,
cmMoveToHand,
cmMoveToGraveyard,
cmMoveToExile,
cmMoveToTable
};
#endif // COCKATRICE_CARD_MENU_ACTION_TYPE_H

View file

@ -0,0 +1,19 @@
/**
* @file move_top_cards_until_options.h
* @ingroup GameLogicPlayers
*/
//! \todo Document this file.
#ifndef COCKATRICE_MOVE_TOP_CARDS_UNTIL_OPTIONS_H
#define COCKATRICE_MOVE_TOP_CARDS_UNTIL_OPTIONS_H
#include <QStringList>
struct MoveTopCardsUntilOptions
{
QStringList exprs = {};
int numberOfHits = 1;
bool autoPlay = false;
};
#endif // COCKATRICE_MOVE_TOP_CARDS_UNTIL_OPTIONS_H

View file

@ -3,8 +3,6 @@
#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/player/card_menu_action_type.h"
#include "../../game_graphics/zones/table_zone.h"
#include "../../interface/deck_loader/loaded_deck.h"
#include "../abstract_game.h"
@ -31,8 +29,6 @@
#include <QChar>
#include <QColor>
#include <QFlags>
#include <QInputDialog>
#include <QKeyEvent>
#include <QList>
#include <QMap>
#include <QMapIterator>
@ -1495,16 +1491,6 @@ void PlayerActions::actReduceLifeByPower(QList<CardItem *> selectedCards)
sendGameCommand(prepareGameCommand(cmd));
}
void AnnotationDialog::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Return && event->modifiers() & Qt::ControlModifier) {
event->accept();
accept();
return;
}
QInputDialog::keyPressEvent(event);
}
void PlayerActions::actRequestSetAnnotationDialog(QList<CardItem *> selectedCards)
{
QString oldAnnotation;

View file

@ -9,11 +9,11 @@
#define COCKATRICE_PLAYER_ACTIONS_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 "../board/card_list.h"
#include "card_menu_action_type.h"
#include "libcockatrice/card/card_info.h"
#include "move_top_cards_until_options.h"
#include "token_info.h"
#include <QObject>
#include <QString>

View file

@ -17,7 +17,6 @@
#include "libcockatrice/utility/playmat_params.h"
#include <QColor>
#include <QInputDialog>
#include <QList>
#include <QLoggingCategory>
#include <QMap>
@ -258,15 +257,4 @@ private:
bool hasRemotePlaymat = false;
};
class AnnotationDialog : public QInputDialog
{
Q_OBJECT
void keyPressEvent(QKeyEvent *e) override;
public:
explicit AnnotationDialog(QWidget *parent = nullptr) : QInputDialog(parent)
{
}
};
#endif

View file

@ -0,0 +1,23 @@
/**
* @file token_info.h
* @ingroup GameLogicPlayers
*/
//! \todo Document this file.
#ifndef COCKATRICE_TOKEN_INFO_H
#define COCKATRICE_TOKEN_INFO_H
#include <QString>
struct TokenInfo
{
QString name;
QString color;
QString pt;
QString annotation;
bool destroy = true;
bool faceDown = false;
QString providerId;
};
#endif // COCKATRICE_TOKEN_INFO_H