mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 18:43:26 -08:00
[Refactor] Move AnnotationDialog from game/ logic to game_graphics/
AnnotationDialog is a QInputDialog subclass that was declared at the
bottom of game/player/player_logic.h and implemented inside
game/player/player_actions.cpp, while its only consumer is the graphics
layer (PlayerDialogs::onSetAnnotationDialogRequested).
Adds game_graphics/dialogs/dlg_annotation.{h,cpp} and moves the class
there, letting player_logic.h drop its QInputDialog include and
player_actions.cpp drop its QKeyEvent include. game/ no longer declares
any widget type.
No behavior change.
This commit is contained in:
parent
1a4d89ff8f
commit
d79dc8ae63
6 changed files with 37 additions and 24 deletions
|
|
@ -86,6 +86,7 @@ set(cockatrice_SOURCES
|
|||
src/game_graphics/deckview/deck_view.cpp
|
||||
src/game_graphics/deckview/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_move_top_cards_until.cpp
|
||||
src/game_graphics/dialogs/dlg_roll_dice.cpp
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@
|
|||
#include <QChar>
|
||||
#include <QColor>
|
||||
#include <QFlags>
|
||||
#include <QInputDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMapIterator>
|
||||
|
|
@ -1495,16 +1493,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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
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,7 @@
|
|||
#include "../../interface/widgets/utility/get_text_with_max.h"
|
||||
#include "../board/abstract_counter.h"
|
||||
#include "../board/card_item.h"
|
||||
#include "../dialogs/dlg_annotation.h"
|
||||
#include "../dialogs/dlg_create_token.h"
|
||||
#include "../dialogs/dlg_move_top_cards_until.h"
|
||||
#include "../dialogs/dlg_roll_dice.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue