mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
[DeckEditor] Refactor: clean up addCardHelper (#6939)
* [DeckEditor] Refactor: clean up addCardHelper * remove setSaveStatus
This commit is contained in:
parent
6de55e9096
commit
c5372a9e92
2 changed files with 28 additions and 16 deletions
|
|
@ -129,16 +129,16 @@ void AbstractTabDeckEditor::onDeckModified()
|
|||
emit tabTextChanged(this, getTabText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper for adding a card to a deck zone.
|
||||
* @param card Card to add.
|
||||
* @param zoneName Zone to add the card to.
|
||||
*/
|
||||
void AbstractTabDeckEditor::addCardHelper(const ExactCard &card, const QString &zoneName)
|
||||
void AbstractTabDeckEditor::addCard(const ExactCard &card, const QString &zoneName)
|
||||
{
|
||||
deckStateManager->addCard(card, zoneName);
|
||||
}
|
||||
|
||||
void AbstractTabDeckEditor::decrementCard(const ExactCard &card, const QString &zoneName)
|
||||
{
|
||||
deckStateManager->decrementCard(card, zoneName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds a card to the main deck or sideboard depending on Ctrl key.
|
||||
*/
|
||||
|
|
@ -147,29 +147,26 @@ void AbstractTabDeckEditor::actAddCard(const ExactCard &card)
|
|||
if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
|
||||
actAddCardToSideboard(card);
|
||||
} else {
|
||||
addCardHelper(card, DECK_ZONE_MAIN);
|
||||
addCard(card, DECK_ZONE_MAIN);
|
||||
}
|
||||
|
||||
deckMenu->setSaveStatus(true);
|
||||
}
|
||||
|
||||
/** @brief Adds a card to the sideboard explicitly. */
|
||||
void AbstractTabDeckEditor::actAddCardToSideboard(const ExactCard &card)
|
||||
{
|
||||
addCardHelper(card, DECK_ZONE_SIDE);
|
||||
deckMenu->setSaveStatus(true);
|
||||
addCard(card, DECK_ZONE_SIDE);
|
||||
}
|
||||
|
||||
/** @brief Decrements a card from the main deck. */
|
||||
void AbstractTabDeckEditor::actDecrementCard(const ExactCard &card)
|
||||
{
|
||||
deckStateManager->decrementCard(card, DECK_ZONE_MAIN);
|
||||
decrementCard(card, DECK_ZONE_MAIN);
|
||||
}
|
||||
|
||||
/** @brief Decrements a card from the sideboard. */
|
||||
void AbstractTabDeckEditor::actDecrementCardFromSideboard(const ExactCard &card)
|
||||
{
|
||||
deckStateManager->decrementCard(card, DECK_ZONE_SIDE);
|
||||
decrementCard(card, DECK_ZONE_SIDE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -145,6 +145,24 @@ public slots:
|
|||
*/
|
||||
void updateCard(const ExactCard &card);
|
||||
|
||||
/**
|
||||
* @brief Adds a card to the given zone
|
||||
* @param card Card to add.
|
||||
* @param zoneName Zone to add the card to.
|
||||
*/
|
||||
void addCard(const ExactCard &card, const QString &zoneName);
|
||||
|
||||
/**
|
||||
* @brief Decrements a card from the given zone
|
||||
*
|
||||
* Use an ExactCard with empty PrintingInfo if you want to remove a card by name regardless of printing.
|
||||
* Otherwise, it won't remove anything unless there's an exact printing match.
|
||||
*
|
||||
* @param card Card to decrement.
|
||||
* @param zoneName Zone to decrement from.
|
||||
*/
|
||||
void decrementCard(const ExactCard &card, const QString &zoneName);
|
||||
|
||||
/** @brief Adds a card to the main deck or sideboard based on Ctrl key. */
|
||||
void actAddCard(const ExactCard &card);
|
||||
|
||||
|
|
@ -293,9 +311,6 @@ protected:
|
|||
*/
|
||||
QMessageBox *createSaveConfirmationWindow();
|
||||
|
||||
/** @brief Helper function to add a card to a specific deck zone. */
|
||||
void addCardHelper(const ExactCard &card, const QString &zoneName);
|
||||
|
||||
/** @brief Opens a deck from a file. */
|
||||
virtual void openDeckFromFile(const QString &fileName, DeckOpenLocation deckOpenLocation);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue