mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 15:49:28 -08: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:
@@ -58,6 +58,28 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
nameEdit->setObjectName("nameEdit");
|
||||
nameLabel->setBuddy(nameEdit);
|
||||
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->setObjectName("commentsLabel");
|
||||
commentsEdit = new QTextEdit;
|
||||
@@ -69,6 +91,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
bannerCardLabel = new QLabel();
|
||||
bannerCardLabel->setObjectName("bannerCardLabel");
|
||||
bannerCardLabel->setText(tr("Banner Card"));
|
||||
bannerCardLabel->setHidden(SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||
bannerCardComboBox = new QComboBox(this);
|
||||
connect(deckModel, &DeckListModel::dataChanged, this, [this]() {
|
||||
// Delay the update to avoid race conditions
|
||||
@@ -76,8 +99,10 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
});
|
||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DeckEditorDeckDockWidget::setBannerCard);
|
||||
bannerCardComboBox->setHidden(!SettingsCache::instance().getDeckEditorBannerCardComboBoxVisible());
|
||||
|
||||
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, deckModel->getDeckList());
|
||||
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().getDeckEditorTagsWidgetVisible());
|
||||
|
||||
aIncrement = new QAction(QString(), this);
|
||||
aIncrement->setIcon(QPixmap("theme:icons/increment"));
|
||||
@@ -109,6 +134,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
|
||||
upperLayout->addWidget(nameLabel, 0, 0);
|
||||
upperLayout->addWidget(nameEdit, 0, 1);
|
||||
upperLayout->addWidget(quickSettingsWidget, 0, 2);
|
||||
|
||||
upperLayout->addWidget(commentsLabel, 1, 0);
|
||||
upperLayout->addWidget(commentsEdit, 1, 1);
|
||||
@@ -291,6 +317,17 @@ void DeckEditorDeckDockWidget::setBannerCard(int /* changedIndex */)
|
||||
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
|
||||
* @param _deck The deck. Takes ownership of the object
|
||||
@@ -526,6 +563,8 @@ void DeckEditorDeckDockWidget::retranslateUi()
|
||||
setWindowTitle(tr("Deck"));
|
||||
|
||||
nameLabel->setText(tr("Deck &name:"));
|
||||
showBannerCardCheckBox->setText(tr("Show banner card selection menu"));
|
||||
showTagsWidgetCheckBox->setText(tr("Show tags selection menu"));
|
||||
commentsLabel->setText(tr("&Comments:"));
|
||||
hashLabel1->setText(tr("Hash:"));
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ private:
|
||||
KeySignals deckViewKeySignals;
|
||||
QLabel *nameLabel;
|
||||
LineEditUnfocusable *nameEdit;
|
||||
SettingsButtonWidget *quickSettingsWidget;
|
||||
QCheckBox *showBannerCardCheckBox;
|
||||
QCheckBox *showTagsWidgetCheckBox;
|
||||
QLabel *commentsLabel;
|
||||
QTextEdit *commentsEdit;
|
||||
QLabel *bannerCardLabel;
|
||||
@@ -77,6 +80,8 @@ private slots:
|
||||
void setBannerCard(int);
|
||||
void updateHash();
|
||||
void refreshShortcuts();
|
||||
void updateShowBannerCardComboBox(bool visible);
|
||||
void updateShowTagsWidget(bool visible);
|
||||
};
|
||||
|
||||
#endif // DECK_EDITOR_DECK_DOCK_WIDGET_H
|
||||
|
||||
@@ -263,6 +263,9 @@ SettingsCache::SettingsCache()
|
||||
includeRebalancedCards = settings->value("cards/includerebalancedcards", true).toBool();
|
||||
printingSelectorNavigationButtonsVisible =
|
||||
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();
|
||||
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
|
||||
visualDeckStorageShowFolders = settings->value("interface/visualdeckstorageshowfolders", true).toBool();
|
||||
@@ -681,6 +684,20 @@ void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED
|
||||
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)
|
||||
{
|
||||
visualDeckStorageSortingOrder = _visualDeckStorageSortingOrder;
|
||||
|
||||
@@ -61,6 +61,8 @@ signals:
|
||||
void printingSelectorCardSizeChanged();
|
||||
void includeRebalancedCardsChanged(bool _includeRebalancedCards);
|
||||
void printingSelectorNavigationButtonsVisibleChanged();
|
||||
void deckEditorBannerCardComboBoxVisibleChanged(bool _visible);
|
||||
void deckEditorTagsWidgetVisibleChanged(bool _visible);
|
||||
void visualDeckStorageShowTagFilterChanged(bool _visible);
|
||||
void visualDeckStorageShowBannerCardComboBoxChanged(bool _visible);
|
||||
void visualDeckStorageShowTagsOnDeckPreviewsChanged(bool _visible);
|
||||
@@ -134,6 +136,8 @@ private:
|
||||
int printingSelectorCardSize;
|
||||
bool includeRebalancedCards;
|
||||
bool printingSelectorNavigationButtonsVisible;
|
||||
bool deckEditorBannerCardComboBoxVisible;
|
||||
bool deckEditorTagsWidgetVisible;
|
||||
int visualDeckStorageSortingOrder;
|
||||
bool visualDeckStorageShowFolders;
|
||||
bool visualDeckStorageShowBannerCardComboBox;
|
||||
@@ -420,6 +424,14 @@ public:
|
||||
{
|
||||
return printingSelectorNavigationButtonsVisible;
|
||||
}
|
||||
bool getDeckEditorBannerCardComboBoxVisible() const
|
||||
{
|
||||
return deckEditorBannerCardComboBoxVisible;
|
||||
}
|
||||
bool getDeckEditorTagsWidgetVisible() const
|
||||
{
|
||||
return deckEditorTagsWidgetVisible;
|
||||
}
|
||||
int getVisualDeckStorageSortingOrder() const
|
||||
{
|
||||
return visualDeckStorageSortingOrder;
|
||||
@@ -800,6 +812,8 @@ public slots:
|
||||
void setPrintingSelectorCardSize(int _printingSelectorCardSize);
|
||||
void setIncludeRebalancedCards(bool _includeRebalancedCards);
|
||||
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 setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T value);
|
||||
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::setDeckEditorBannerCardComboBoxVisible(
|
||||
QT_STATE_CHANGED_T /* _deckEditorBannerCardComboBoxVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setDeckEditorTagsWidgetVisible(QT_STATE_CHANGED_T /* _deckEditorTagsWidgetVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSortingOrder */)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -212,6 +212,13 @@ void SettingsCache::setIncludeRebalancedCards(bool /* _includeRebalancedCards */
|
||||
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 */)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user