mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
[Home Tab] Disable random art crop shuffle if frequency is set to 0. (#6153)
* Disable shuffle if frequency is set to 0. Took 13 minutes Took 26 seconds * Set special value text. Took 12 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
4b58060ab6
commit
54095b9a89
3 changed files with 17 additions and 0 deletions
|
|
@ -45,6 +45,8 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
|||
connect(tabSupervisor->getClient(), &RemoteClient::statusChanged, this, &HomeWidget::updateConnectButton);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabBackgroundSourceChanged, this,
|
||||
&HomeWidget::initializeBackgroundFromSource);
|
||||
connect(&SettingsCache::instance(), &SettingsCache::homeTabBackgroundShuffleFrequencyChanged, this,
|
||||
&HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||
}
|
||||
|
||||
void HomeWidget::initializeBackgroundFromSource()
|
||||
|
|
@ -118,6 +120,19 @@ void HomeWidget::updateRandomCard()
|
|||
connect(newCard.getCardPtr().data(), &CardInfo::pixmapUpdated, this, &HomeWidget::updateBackgroundProperties);
|
||||
backgroundSourceCard->setCard(newCard);
|
||||
background = backgroundSourceCard->getProcessedBackground(size());
|
||||
|
||||
if (SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() <= 0) {
|
||||
cardChangeTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void HomeWidget::onBackgroundShuffleFrequencyChanged()
|
||||
{
|
||||
cardChangeTimer->stop();
|
||||
if (SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() <= 0) {
|
||||
return;
|
||||
}
|
||||
cardChangeTimer->start(SettingsCache::instance().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
}
|
||||
|
||||
void HomeWidget::updateBackgroundProperties()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public:
|
|||
public slots:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void initializeBackgroundFromSource();
|
||||
void onBackgroundShuffleFrequencyChanged();
|
||||
void updateBackgroundProperties();
|
||||
void updateButtonsToBackgroundColor();
|
||||
QGroupBox *createButtons();
|
||||
|
|
|
|||
|
|
@ -685,6 +685,7 @@ void AppearanceSettingsPage::retranslateUi()
|
|||
openThemeButton.setText(tr("Open themes folder"));
|
||||
homeTabBackgroundSourceLabel.setText(tr("Home tab background source:"));
|
||||
homeTabBackgroundShuffleFrequencyLabel.setText(tr("Home tab background shuffle frequency:"));
|
||||
homeTabBackgroundShuffleFrequencySpinBox.setSpecialValueText(tr("Disabled"));
|
||||
|
||||
menuGroupBox->setTitle(tr("Menu settings"));
|
||||
showShortcutsCheckBox.setText(tr("Show keyboard shortcuts in right-click menus"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue