mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
extract applyActiveGroupCriteria
This commit is contained in:
parent
8967ec6683
commit
2e5d6ccb74
2 changed files with 12 additions and 5 deletions
|
|
@ -64,6 +64,8 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
connect(deckStateManager, &DeckStateManager::focusIndexChanged, this, &DeckEditorDeckDockWidget::setSelectedIndex);
|
connect(deckStateManager, &DeckStateManager::focusIndexChanged, this, &DeckEditorDeckDockWidget::setSelectedIndex);
|
||||||
connect(deckStateManager, &DeckStateManager::deckReplaced, this,
|
connect(deckStateManager, &DeckStateManager::deckReplaced, this,
|
||||||
&DeckEditorDeckDockWidget::syncDisplayWidgetsToModel);
|
&DeckEditorDeckDockWidget::syncDisplayWidgetsToModel);
|
||||||
|
connect(deckStateManager, &DeckStateManager::deckReplaced, this,
|
||||||
|
&DeckEditorDeckDockWidget::applyActiveGroupCriteria);
|
||||||
|
|
||||||
deckView = new QTreeView();
|
deckView = new QTreeView();
|
||||||
deckView->setObjectName("deckView");
|
deckView->setObjectName("deckView");
|
||||||
|
|
@ -174,11 +176,8 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
activeGroupCriteriaComboBox->addItem(tr("Main Type"), DeckListModelGroupCriteria::MAIN_TYPE);
|
activeGroupCriteriaComboBox->addItem(tr("Main Type"), DeckListModelGroupCriteria::MAIN_TYPE);
|
||||||
activeGroupCriteriaComboBox->addItem(tr("Mana Cost"), DeckListModelGroupCriteria::MANA_COST);
|
activeGroupCriteriaComboBox->addItem(tr("Mana Cost"), DeckListModelGroupCriteria::MANA_COST);
|
||||||
activeGroupCriteriaComboBox->addItem(tr("Colors"), DeckListModelGroupCriteria::COLOR);
|
activeGroupCriteriaComboBox->addItem(tr("Colors"), DeckListModelGroupCriteria::COLOR);
|
||||||
connect(activeGroupCriteriaComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), [this]() {
|
connect(activeGroupCriteriaComboBox, &QComboBox::currentIndexChanged, this,
|
||||||
getModel()->setActiveGroupCriteria(static_cast<DeckListModelGroupCriteria::Type>(
|
&DeckEditorDeckDockWidget::applyActiveGroupCriteria);
|
||||||
activeGroupCriteriaComboBox->currentData(Qt::UserRole).toInt()));
|
|
||||||
getModel()->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());
|
|
||||||
});
|
|
||||||
|
|
||||||
aIncrement = new QAction(QString(), this);
|
aIncrement = new QAction(QString(), this);
|
||||||
aIncrement->setIcon(QPixmap("theme:icons/increment"));
|
aIncrement->setIcon(QPixmap("theme:icons/increment"));
|
||||||
|
|
@ -428,6 +427,13 @@ void DeckEditorDeckDockWidget::writeBannerCard(int index)
|
||||||
deckStateManager->setBannerCard(bannerCard);
|
deckStateManager->setBannerCard(bannerCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckEditorDeckDockWidget::applyActiveGroupCriteria()
|
||||||
|
{
|
||||||
|
getModel()->setActiveGroupCriteria(
|
||||||
|
static_cast<DeckListModelGroupCriteria::Type>(activeGroupCriteriaComboBox->currentData(Qt::UserRole).toInt()));
|
||||||
|
getModel()->sort(deckView->header()->sortIndicatorSection(), deckView->header()->sortIndicatorOrder());
|
||||||
|
}
|
||||||
|
|
||||||
void DeckEditorDeckDockWidget::updateShowBannerCardComboBox(const bool visible)
|
void DeckEditorDeckDockWidget::updateShowBannerCardComboBox(const bool visible)
|
||||||
{
|
{
|
||||||
bannerCardLabel->setHidden(!visible);
|
bannerCardLabel->setHidden(!visible);
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ private slots:
|
||||||
void writeName();
|
void writeName();
|
||||||
void writeComments();
|
void writeComments();
|
||||||
void writeBannerCard(int);
|
void writeBannerCard(int);
|
||||||
|
void applyActiveGroupCriteria();
|
||||||
void setSelectedIndex(const QModelIndex &newCardIndex);
|
void setSelectedIndex(const QModelIndex &newCardIndex);
|
||||||
void updateHash();
|
void updateHash();
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue