mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 03:23:24 -08:00
[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:
parent
6c660d6b21
commit
c02576b827
14 changed files with 89 additions and 50 deletions
28
cockatrice/src/game/player/card_menu_action_type.h
Normal file
28
cockatrice/src/game/player/card_menu_action_type.h
Normal 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
|
||||
19
cockatrice/src/game/player/move_top_cards_until_options.h
Normal file
19
cockatrice/src/game/player/move_top_cards_until_options.h
Normal 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
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
23
cockatrice/src/game/player/token_info.h
Normal file
23
cockatrice/src/game/player/token_info.h
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue