mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 19:47:46 -07:00
Add the option to hide banner card and tags in deck editor. (#5857)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
39f87a5e78
commit
81a911dc11
6 changed files with 89 additions and 0 deletions
|
|
@ -58,6 +58,28 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
nameEdit->setObjectName("nameEdit");
|
nameEdit->setObjectName("nameEdit");
|
||||||
nameLabel->setBuddy(nameEdit);
|
nameLabel->setBuddy(nameEdit);
|
||||||
connect(nameEdit, &LineEditUnfocusable::textChanged, this, &DeckEditorDeckDockWidget::updateName);
|
connect(nameEdit, &LineEditUnfocusable::textChanged, this, &DeckEditorDeckDockWidget::updateName);
|
||||||
|
|
||||||
|
quickSettingsWidget = new SettingsButtonWidget(this);
|
||||||
|
|
||||||
|
showBannerCardCheckBox = new QCheckBox();
|
||||||
|
showBannerCardCheckBox->setObjectName("showBannerCardCheckBox");
|
||||||
|
showBannerCardCheckBox->setChecked(SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||||
|
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||||
|
&SettingsCache::setDeckEditorBannerCardComboBoxVisible);
|
||||||
|
connect(&SettingsCache::instance(), &SettingsCache::deckEditorBannerCardComboBoxVisibleChanged, this,
|
||||||
|
&DeckEditorDeckDockWidget::updateShowBannerCardComboBox);
|
||||||
|
|
||||||
|
showTagsWidgetCheckBox = new QCheckBox();
|
||||||
|
showTagsWidgetCheckBox->setObjectName("showTagsWidgetCheckBox");
|
||||||
|
showTagsWidgetCheckBox->setChecked(SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
||||||
|
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||||
|
&SettingsCache::setDeckEditorTagsWidgetVisible);
|
||||||
|
connect(&SettingsCache::instance(), &SettingsCache::deckEditorTagsWidgetVisibleChanged, this,
|
||||||
|
&DeckEditorDeckDockWidget::updateShowTagsWidget);
|
||||||
|
|
||||||
|
quickSettingsWidget->addSettingsWidget(showBannerCardCheckBox);
|
||||||
|
quickSettingsWidget->addSettingsWidget(showTagsWidgetCheckBox);
|
||||||
|
|
||||||
commentsLabel = new QLabel();
|
commentsLabel = new QLabel();
|
||||||
commentsLabel->setObjectName("commentsLabel");
|
commentsLabel->setObjectName("commentsLabel");
|
||||||
commentsEdit = new QTextEdit;
|
commentsEdit = new QTextEdit;
|
||||||
|
|
@ -69,6 +91,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
bannerCardLabel = new QLabel();
|
bannerCardLabel = new QLabel();
|
||||||
bannerCardLabel->setObjectName("bannerCardLabel");
|
bannerCardLabel->setObjectName("bannerCardLabel");
|
||||||
bannerCardLabel->setText(tr("Banner Card"));
|
bannerCardLabel->setText(tr("Banner Card"));
|
||||||
|
bannerCardLabel->setHidden(SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||||
bannerCardComboBox = new QComboBox(this);
|
bannerCardComboBox = new QComboBox(this);
|
||||||
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
||||||
// Delay the update to avoid race conditions
|
// Delay the update to avoid race conditions
|
||||||
|
|
@ -76,8 +99,10 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
});
|
});
|
||||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&DeckEditorDeckDockWidget::setBannerCard);
|
&DeckEditorDeckDockWidget::setBannerCard);
|
||||||
|
bannerCardComboBox->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||||
|
|
||||||
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, deckModel->getDeckList());
|
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, deckModel->getDeckList());
|
||||||
|
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
||||||
|
|
||||||
aIncrement = new QAction(QString(), this);
|
aIncrement = new QAction(QString(), this);
|
||||||
aIncrement->setIcon(QPixmap("theme:icons/increment"));
|
aIncrement->setIcon(QPixmap("theme:icons/increment"));
|
||||||
|
|
@ -109,6 +134,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||||
|
|
||||||
upperLayout->addWidget(nameLabel, 0, 0);
|
upperLayout->addWidget(nameLabel, 0, 0);
|
||||||
upperLayout->addWidget(nameEdit, 0, 1);
|
upperLayout->addWidget(nameEdit, 0, 1);
|
||||||
|
upperLayout->addWidget(quickSettingsWidget, 0, 2);
|
||||||
|
|
||||||
upperLayout->addWidget(commentsLabel, 1, 0);
|
upperLayout->addWidget(commentsLabel, 1, 0);
|
||||||
upperLayout->addWidget(commentsEdit, 1, 1);
|
upperLayout->addWidget(commentsEdit, 1, 1);
|
||||||
|
|
@ -291,6 +317,17 @@ void DeckEditorDeckDockWidget::setBannerCard(int /* changedIndex */)
|
||||||
emit deckChanged();
|
emit deckChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckEditorDeckDockWidget::updateShowBannerCardComboBox(const bool visible)
|
||||||
|
{
|
||||||
|
bannerCardLabel->setHidden(!visible);
|
||||||
|
bannerCardComboBox->setHidden(!visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeckEditorDeckDockWidget::updateShowTagsWidget(const bool visible)
|
||||||
|
{
|
||||||
|
deckTagsDisplayWidget->setHidden(!visible);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the currently active deck for this tab
|
* Sets the currently active deck for this tab
|
||||||
* @param _deck The deck. Takes ownership of the object
|
* @param _deck The deck. Takes ownership of the object
|
||||||
|
|
@ -526,6 +563,8 @@ void DeckEditorDeckDockWidget::retranslateUi()
|
||||||
setWindowTitle(tr("Deck"));
|
setWindowTitle(tr("Deck"));
|
||||||
|
|
||||||
nameLabel->setText(tr("Deck &name:"));
|
nameLabel->setText(tr("Deck &name:"));
|
||||||
|
showBannerCardCheckBox->setText(tr("Show banner card selection menu"));
|
||||||
|
showTagsWidgetCheckBox->setText(tr("Show tags selection menu"));
|
||||||
commentsLabel->setText(tr("&Comments:"));
|
commentsLabel->setText(tr("&Comments:"));
|
||||||
hashLabel1->setText(tr("Hash:"));
|
hashLabel1->setText(tr("Hash:"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,9 @@ private:
|
||||||
KeySignals deckViewKeySignals;
|
KeySignals deckViewKeySignals;
|
||||||
QLabel *nameLabel;
|
QLabel *nameLabel;
|
||||||
LineEditUnfocusable *nameEdit;
|
LineEditUnfocusable *nameEdit;
|
||||||
|
SettingsButtonWidget *quickSettingsWidget;
|
||||||
|
QCheckBox *showBannerCardCheckBox;
|
||||||
|
QCheckBox *showTagsWidgetCheckBox;
|
||||||
QLabel *commentsLabel;
|
QLabel *commentsLabel;
|
||||||
QTextEdit *commentsEdit;
|
QTextEdit *commentsEdit;
|
||||||
QLabel *bannerCardLabel;
|
QLabel *bannerCardLabel;
|
||||||
|
|
@ -77,6 +80,8 @@ private slots:
|
||||||
void setBannerCard(int);
|
void setBannerCard(int);
|
||||||
void updateHash();
|
void updateHash();
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
|
void updateShowBannerCardComboBox(bool visible);
|
||||||
|
void updateShowTagsWidget(bool visible);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H
|
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,9 @@ SettingsCache::SettingsCache()
|
||||||
includeRebalancedCards = settings->value("cards/includerebalancedcards", true).toBool();
|
includeRebalancedCards = settings->value("cards/includerebalancedcards", true).toBool();
|
||||||
printingSelectorNavigationButtonsVisible =
|
printingSelectorNavigationButtonsVisible =
|
||||||
settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool();
|
settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool();
|
||||||
|
deckEditorBannerCardComboBoxVisible =
|
||||||
|
settings->value("interface/deckeditorbannercardcomboboxvisible", true).toBool();
|
||||||
|
deckEditorTagsWidgetVisible = settings->value("interface/deckeditortagswidgetvisible", true).toBool();
|
||||||
visualDeckStorageCardSize = settings->value("interface/visualdeckstoragecardsize", 100).toInt();
|
visualDeckStorageCardSize = settings->value("interface/visualdeckstoragecardsize", 100).toInt();
|
||||||
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
|
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
|
||||||
visualDeckStorageShowFolders = settings->value("interface/visualdeckstorageshowfolders", true).toBool();
|
visualDeckStorageShowFolders = settings->value("interface/visualdeckstorageshowfolders", true).toBool();
|
||||||
|
|
@ -681,6 +684,20 @@ void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED
|
||||||
emit printingSelectorNavigationButtonsVisibleChanged();
|
emit printingSelectorNavigationButtonsVisibleChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setDeckEditorBannerCardComboBoxVisible(QT_STATE_CHANGED_T _deckEditorBannerCardComboBoxVisible)
|
||||||
|
{
|
||||||
|
deckEditorBannerCardComboBoxVisible = _deckEditorBannerCardComboBoxVisible;
|
||||||
|
settings->setValue("interface/deckeditorbannercardcomboboxvisible", deckEditorBannerCardComboBoxVisible);
|
||||||
|
emit deckEditorBannerCardComboBoxVisibleChanged(deckEditorBannerCardComboBoxVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setDeckEditorTagsWidgetVisible(QT_STATE_CHANGED_T _deckEditorTagsWidgetVisible)
|
||||||
|
{
|
||||||
|
deckEditorTagsWidgetVisible = _deckEditorTagsWidgetVisible;
|
||||||
|
settings->setValue("interface/deckeditortagswidgetvisible", deckEditorTagsWidgetVisible);
|
||||||
|
emit deckEditorTagsWidgetVisibleChanged(deckEditorTagsWidgetVisible);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder)
|
void SettingsCache::setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder)
|
||||||
{
|
{
|
||||||
visualDeckStorageSortingOrder = _visualDeckStorageSortingOrder;
|
visualDeckStorageSortingOrder = _visualDeckStorageSortingOrder;
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,8 @@ signals:
|
||||||
void printingSelectorCardSizeChanged();
|
void printingSelectorCardSizeChanged();
|
||||||
void includeRebalancedCardsChanged(bool _includeRebalancedCards);
|
void includeRebalancedCardsChanged(bool _includeRebalancedCards);
|
||||||
void printingSelectorNavigationButtonsVisibleChanged();
|
void printingSelectorNavigationButtonsVisibleChanged();
|
||||||
|
void deckEditorBannerCardComboBoxVisibleChanged(bool _visible);
|
||||||
|
void deckEditorTagsWidgetVisibleChanged(bool _visible);
|
||||||
void visualDeckStorageShowTagFilterChanged(bool _visible);
|
void visualDeckStorageShowTagFilterChanged(bool _visible);
|
||||||
void visualDeckStorageShowBannerCardComboBoxChanged(bool _visible);
|
void visualDeckStorageShowBannerCardComboBoxChanged(bool _visible);
|
||||||
void visualDeckStorageShowTagsOnDeckPreviewsChanged(bool _visible);
|
void visualDeckStorageShowTagsOnDeckPreviewsChanged(bool _visible);
|
||||||
|
|
@ -134,6 +136,8 @@ private:
|
||||||
int printingSelectorCardSize;
|
int printingSelectorCardSize;
|
||||||
bool includeRebalancedCards;
|
bool includeRebalancedCards;
|
||||||
bool printingSelectorNavigationButtonsVisible;
|
bool printingSelectorNavigationButtonsVisible;
|
||||||
|
bool deckEditorBannerCardComboBoxVisible;
|
||||||
|
bool deckEditorTagsWidgetVisible;
|
||||||
int visualDeckStorageSortingOrder;
|
int visualDeckStorageSortingOrder;
|
||||||
bool visualDeckStorageShowFolders;
|
bool visualDeckStorageShowFolders;
|
||||||
bool visualDeckStorageShowBannerCardComboBox;
|
bool visualDeckStorageShowBannerCardComboBox;
|
||||||
|
|
@ -420,6 +424,14 @@ public:
|
||||||
{
|
{
|
||||||
return printingSelectorNavigationButtonsVisible;
|
return printingSelectorNavigationButtonsVisible;
|
||||||
}
|
}
|
||||||
|
bool getDeckEditorBannerCardComboBoxVisible() const
|
||||||
|
{
|
||||||
|
return deckEditorBannerCardComboBoxVisible;
|
||||||
|
}
|
||||||
|
bool getDeckEditorTagsWidgetVisible() const
|
||||||
|
{
|
||||||
|
return deckEditorTagsWidgetVisible;
|
||||||
|
}
|
||||||
int getVisualDeckStorageSortingOrder() const
|
int getVisualDeckStorageSortingOrder() const
|
||||||
{
|
{
|
||||||
return visualDeckStorageSortingOrder;
|
return visualDeckStorageSortingOrder;
|
||||||
|
|
@ -800,6 +812,8 @@ public slots:
|
||||||
void setPrintingSelectorCardSize(int _printingSelectorCardSize);
|
void setPrintingSelectorCardSize(int _printingSelectorCardSize);
|
||||||
void setIncludeRebalancedCards(bool _includeRebalancedCards);
|
void setIncludeRebalancedCards(bool _includeRebalancedCards);
|
||||||
void setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T _navigationButtonsVisible);
|
void setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T _navigationButtonsVisible);
|
||||||
|
void setDeckEditorBannerCardComboBoxVisible(QT_STATE_CHANGED_T _deckEditorBannerCardComboBoxVisible);
|
||||||
|
void setDeckEditorTagsWidgetVisible(QT_STATE_CHANGED_T _deckEditorTagsWidgetVisible);
|
||||||
void setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder);
|
void setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder);
|
||||||
void setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T value);
|
void setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T value);
|
||||||
void setVisualDeckStorageShowTagFilter(QT_STATE_CHANGED_T _showTags);
|
void setVisualDeckStorageShowTagFilter(QT_STATE_CHANGED_T _showTags);
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,13 @@ void SettingsCache::setIncludeRebalancedCards(bool /* _includeRebalancedCards */
|
||||||
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T /* _navigationButtonsVisible */)
|
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T /* _navigationButtonsVisible */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setDeckEditorBannerCardComboBoxVisible(
|
||||||
|
QT_STATE_CHANGED_T /* _deckEditorBannerCardComboBoxVisible */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDeckEditorTagsWidgetVisible(QT_STATE_CHANGED_T /* _deckEditorTagsWidgetVisible */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSortingOrder */)
|
void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSortingOrder */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,13 @@ void SettingsCache::setIncludeRebalancedCards(bool /* _includeRebalancedCards */
|
||||||
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T /* _navigationButtonsVisible */)
|
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T /* _navigationButtonsVisible */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setDeckEditorBannerCardComboBoxVisible(
|
||||||
|
QT_STATE_CHANGED_T /* _deckEditorBannerCardComboBoxVisible */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setDeckEditorTagsWidgetVisible(QT_STATE_CHANGED_T /* _deckEditorTagsWidgetVisible */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSortingOrder */)
|
void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSortingOrder */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue