mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Refactor] Move AnnotationDialog and action data types into game/ (#7411)
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. Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
bbc7e462ff
commit
d30d275296
14 changed files with 89 additions and 50 deletions
|
|
@ -89,6 +89,7 @@ set(cockatrice_SOURCES
|
||||||
src/game_graphics/deckview/deck_view.cpp
|
src/game_graphics/deckview/deck_view.cpp
|
||||||
src/game_graphics/deckview/deck_view_container.cpp
|
src/game_graphics/deckview/deck_view_container.cpp
|
||||||
src/game_graphics/deckview/tabbed_deck_view_container.cpp
|
src/game_graphics/deckview/tabbed_deck_view_container.cpp
|
||||||
|
src/game_graphics/dialogs/dlg_annotation.cpp
|
||||||
src/game_graphics/dialogs/dlg_create_token.cpp
|
src/game_graphics/dialogs/dlg_create_token.cpp
|
||||||
src/game_graphics/dialogs/dlg_move_top_cards_until.cpp
|
src/game_graphics/dialogs/dlg_move_top_cards_until.cpp
|
||||||
src/game_graphics/dialogs/dlg_roll_dice.cpp
|
src/game_graphics/dialogs/dlg_roll_dice.cpp
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @file card_menu_action_type.h
|
* @file card_menu_action_type.h
|
||||||
* @ingroup GameMenusPlayers
|
* @ingroup GameLogicPlayers
|
||||||
*/
|
*/
|
||||||
//! \todo Document this file.
|
//! \todo Document this file.
|
||||||
|
|
||||||
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 "../../client/settings/cache_settings.h"
|
||||||
#include "../../game_graphics/board/card_item.h"
|
#include "../../game_graphics/board/card_item.h"
|
||||||
#include "../../game_graphics/dialogs/dlg_create_token.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 "../../game_graphics/zones/table_zone.h"
|
||||||
#include "../../interface/deck_loader/loaded_deck.h"
|
#include "../../interface/deck_loader/loaded_deck.h"
|
||||||
#include "../abstract_game.h"
|
#include "../abstract_game.h"
|
||||||
|
|
@ -31,8 +29,6 @@
|
||||||
#include <QChar>
|
#include <QChar>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QInputDialog>
|
|
||||||
#include <QKeyEvent>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMapIterator>
|
#include <QMapIterator>
|
||||||
|
|
@ -1495,16 +1491,6 @@ void PlayerActions::actReduceLifeByPower(QList<CardItem *> selectedCards)
|
||||||
sendGameCommand(prepareGameCommand(cmd));
|
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)
|
void PlayerActions::actRequestSetAnnotationDialog(QList<CardItem *> selectedCards)
|
||||||
{
|
{
|
||||||
QString oldAnnotation;
|
QString oldAnnotation;
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@
|
||||||
#define COCKATRICE_PLAYER_ACTIONS_H
|
#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/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 "../board/card_list.h"
|
||||||
|
#include "card_menu_action_type.h"
|
||||||
#include "libcockatrice/card/card_info.h"
|
#include "libcockatrice/card/card_info.h"
|
||||||
|
#include "move_top_cards_until_options.h"
|
||||||
|
#include "token_info.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
#include "libcockatrice/utility/playmat_params.h"
|
#include "libcockatrice/utility/playmat_params.h"
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QInputDialog>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
@ -258,15 +257,4 @@ private:
|
||||||
bool hasRemotePlaymat = false;
|
bool hasRemotePlaymat = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnnotationDialog : public QInputDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
void keyPressEvent(QKeyEvent *e) override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit AnnotationDialog(QWidget *parent = nullptr) : QInputDialog(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#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
|
||||||
13
cockatrice/src/game_graphics/dialogs/dlg_annotation.cpp
Normal file
13
cockatrice/src/game_graphics/dialogs/dlg_annotation.cpp
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "dlg_annotation.h"
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
void AnnotationDialog::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if (event->key() == Qt::Key_Return && event->modifiers() & Qt::ControlModifier) {
|
||||||
|
event->accept();
|
||||||
|
accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QInputDialog::keyPressEvent(event);
|
||||||
|
}
|
||||||
22
cockatrice/src/game_graphics/dialogs/dlg_annotation.h
Normal file
22
cockatrice/src/game_graphics/dialogs/dlg_annotation.h
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* @file dlg_annotation.h
|
||||||
|
* @ingroup GameDialogs
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COCKATRICE_DLG_ANNOTATION_H
|
||||||
|
#define COCKATRICE_DLG_ANNOTATION_H
|
||||||
|
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
|
class AnnotationDialog : public QInputDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AnnotationDialog(QWidget *parent = nullptr) : QInputDialog(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COCKATRICE_DLG_ANNOTATION_H
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
#ifndef DLG_CREATETOKEN_H
|
#ifndef DLG_CREATETOKEN_H
|
||||||
#define DLG_CREATETOKEN_H
|
#define DLG_CREATETOKEN_H
|
||||||
|
|
||||||
|
#include "../../game/player/token_info.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
@ -25,17 +27,6 @@ class CardInfoPictureWidget;
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
struct TokenInfo
|
|
||||||
{
|
|
||||||
QString name;
|
|
||||||
QString color;
|
|
||||||
QString pt;
|
|
||||||
QString annotation;
|
|
||||||
bool destroy = true;
|
|
||||||
bool faceDown = false;
|
|
||||||
QString providerId;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DlgCreateToken : public QDialog
|
class DlgCreateToken : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
#ifndef DLG_MOVE_TOP_CARDS_UNTIL_H
|
#ifndef DLG_MOVE_TOP_CARDS_UNTIL_H
|
||||||
#define DLG_MOVE_TOP_CARDS_UNTIL_H
|
#define DLG_MOVE_TOP_CARDS_UNTIL_H
|
||||||
|
|
||||||
|
#include "../../game/player/move_top_cards_until_options.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
@ -21,13 +23,6 @@ class QLabel;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
struct MoveTopCardsUntilOptions
|
|
||||||
{
|
|
||||||
QStringList exprs = {};
|
|
||||||
int numberOfHits = 1;
|
|
||||||
bool autoPlay = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DlgMoveTopCardsUntil : public QDialog
|
class DlgMoveTopCardsUntil : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../../../client/settings/card_counter_settings.h"
|
#include "../../../client/settings/card_counter_settings.h"
|
||||||
#include "../../../client/settings/shortcuts_settings.h"
|
#include "../../../client/settings/shortcuts_settings.h"
|
||||||
#include "../../../game/abstract_game.h"
|
#include "../../../game/abstract_game.h"
|
||||||
|
#include "../../../game/player/card_menu_action_type.h"
|
||||||
#include "../../../game/player/player_info.h"
|
#include "../../../game/player/player_info.h"
|
||||||
#include "../../../game/player/player_manager.h"
|
#include "../../../game/player/player_manager.h"
|
||||||
#include "../../../game/zones/card_zone_logic.h"
|
#include "../../../game/zones/card_zone_logic.h"
|
||||||
|
|
@ -12,7 +13,6 @@
|
||||||
#include "../../game/player/player_logic.h"
|
#include "../../game/player/player_logic.h"
|
||||||
#include "../../game/zones/view_zone_logic.h"
|
#include "../../game/zones/view_zone_logic.h"
|
||||||
#include "../../game_scene.h"
|
#include "../../game_scene.h"
|
||||||
#include "../card_menu_action_type.h"
|
|
||||||
#include "../player_graphics_item.h"
|
#include "../player_graphics_item.h"
|
||||||
#include "libcockatrice/card/card_info.h"
|
#include "libcockatrice/card/card_info.h"
|
||||||
#include "libcockatrice/card/database/card_database_querier.h"
|
#include "libcockatrice/card/database/card_database_querier.h"
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
#include "../../../client/settings/cache_settings.h"
|
#include "../../../client/settings/cache_settings.h"
|
||||||
#include "../../../client/settings/shortcuts_settings.h"
|
#include "../../../client/settings/shortcuts_settings.h"
|
||||||
|
#include "../../../game/player/card_menu_action_type.h"
|
||||||
#include "../../game/player/player_actions.h"
|
#include "../../game/player/player_actions.h"
|
||||||
#include "../../game/player/player_logic.h"
|
#include "../../game/player/player_logic.h"
|
||||||
#include "../../game_scene.h"
|
#include "../../game_scene.h"
|
||||||
#include "../card_menu_action_type.h"
|
|
||||||
#include "../player_graphics_item.h"
|
#include "../player_graphics_item.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../../interface/widgets/utility/get_text_with_max.h"
|
#include "../../interface/widgets/utility/get_text_with_max.h"
|
||||||
#include "../board/abstract_counter.h"
|
#include "../board/abstract_counter.h"
|
||||||
#include "../board/card_item.h"
|
#include "../board/card_item.h"
|
||||||
|
#include "../dialogs/dlg_annotation.h"
|
||||||
#include "../dialogs/dlg_create_token.h"
|
#include "../dialogs/dlg_create_token.h"
|
||||||
#include "../dialogs/dlg_move_top_cards_until.h"
|
#include "../dialogs/dlg_move_top_cards_until.h"
|
||||||
#include "../dialogs/dlg_roll_dice.h"
|
#include "../dialogs/dlg_roll_dice.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue