diff --git a/cockatrice/src/client/ui/widgets/general/home_widget.cpp b/cockatrice/src/client/ui/widgets/general/home_widget.cpp index 407c7e3cb..717bbbf75 100644 --- a/cockatrice/src/client/ui/widgets/general/home_widget.cpp +++ b/cockatrice/src/client/ui/widgets/general/home_widget.cpp @@ -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() diff --git a/cockatrice/src/client/ui/widgets/general/home_widget.h b/cockatrice/src/client/ui/widgets/general/home_widget.h index 3a465bcdc..b8ec1408b 100644 --- a/cockatrice/src/client/ui/widgets/general/home_widget.h +++ b/cockatrice/src/client/ui/widgets/general/home_widget.h @@ -22,6 +22,7 @@ public: public slots: void paintEvent(QPaintEvent *event) override; void initializeBackgroundFromSource(); + void onBackgroundShuffleFrequencyChanged(); void updateBackgroundProperties(); void updateButtonsToBackgroundColor(); QGroupBox *createButtons(); diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/dialogs/dlg_settings.cpp index c9982efae..4efe44021 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/dialogs/dlg_settings.cpp @@ -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"));