mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 09:33:57 -07:00
move actAddCard down
This commit is contained in:
parent
e075a9d631
commit
39fb4e70da
4 changed files with 29 additions and 17 deletions
|
|
@ -582,6 +582,31 @@ QModelIndexList DeckEditorDeckDockWidget::getSelectedCardNodes() const
|
|||
return selectedRows;
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::actAddCard(const ExactCard &card, const QString &_zoneName)
|
||||
{
|
||||
if (!card) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString zoneName = card.getInfo().getIsToken() ? DECK_ZONE_TOKENS : _zoneName;
|
||||
|
||||
emit requestDeckHistorySave(tr("Added (%1): %2 (%3) %4")
|
||||
.arg(zoneName, card.getName(), card.getPrinting().getSet()->getCorrectedShortName(),
|
||||
card.getPrinting().getProperty("num")));
|
||||
|
||||
QModelIndex newCardIndex = deckModel->addCard(card, zoneName);
|
||||
|
||||
if (!newCardIndex.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
expandAll();
|
||||
deckView->clearSelection();
|
||||
deckView->setCurrentIndex(newCardIndex);
|
||||
|
||||
emit deckModified();
|
||||
}
|
||||
|
||||
void DeckEditorDeckDockWidget::actIncrementSelection()
|
||||
{
|
||||
auto selectedRows = getSelectedCardNodes();
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public slots:
|
|||
void sortDeckModelToDeckView();
|
||||
DeckLoader *getDeckLoader();
|
||||
const DeckList &getDeckList() const;
|
||||
void actAddCard(const ExactCard &card, const QString &zoneName);
|
||||
void actIncrementSelection();
|
||||
void actDecrementCard(const ExactCard &card, QString zoneName);
|
||||
void actDecrementSelection();
|
||||
|
|
|
|||
|
|
@ -140,23 +140,9 @@ void AbstractTabDeckEditor::onDeckHistoryClearRequested()
|
|||
* @param card Card to add.
|
||||
* @param zoneName Zone to add the card to.
|
||||
*/
|
||||
void AbstractTabDeckEditor::addCardHelper(const ExactCard &card, QString zoneName)
|
||||
void AbstractTabDeckEditor::addCardHelper(const ExactCard &card, const QString &zoneName)
|
||||
{
|
||||
if (!card)
|
||||
return;
|
||||
|
||||
if (card.getInfo().getIsToken())
|
||||
zoneName = DECK_ZONE_TOKENS;
|
||||
|
||||
onDeckHistorySaveRequested(QString(tr("Added (%1): %2 (%3) %4"))
|
||||
.arg(zoneName, card.getName(), card.getPrinting().getSet()->getCorrectedShortName(),
|
||||
card.getPrinting().getProperty("num")));
|
||||
|
||||
QModelIndex newCardIndex = deckDockWidget->deckModel->addCard(card, zoneName);
|
||||
deckDockWidget->expandAll();
|
||||
deckDockWidget->deckView->clearSelection();
|
||||
deckDockWidget->deckView->setCurrentIndex(newCardIndex);
|
||||
setModified(true);
|
||||
deckDockWidget->actAddCard(card, zoneName);
|
||||
|
||||
databaseDisplayDockWidget->searchEdit->setSelection(0, databaseDisplayDockWidget->searchEdit->text().length());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ protected:
|
|||
bool isBlankNewDeck() const;
|
||||
|
||||
/** @brief Helper function to add a card to a specific deck zone. */
|
||||
void addCardHelper(const ExactCard &card, QString zoneName);
|
||||
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