/** Reload icon when theme has changed or buttons size was changed in options by one. */ void PlaybackModeWidget::adjustIcon() { SettingsPrivate *settingsPrivate = SettingsPrivate::instance(); Settings *settings = Settings::instance(); button()->setIcon(QIcon(":/player/" + settings->theme() + "/" + _playbackMode)); button()->setIconSize(QSize(settingsPrivate->buttonsSize(), settingsPrivate->buttonsSize())); }
/// FIXME: use Qt::Popup to avoir flicker effect when one clicks. The problem is to manage multiple popups on screen /// It seems difficult to handle more than one popup PlaybackModeWidget::PlaybackModeWidget(QMediaPlaylist::PlaybackMode mode, QPushButton *playbackModeButton) : QWidget(playbackModeButton, Qt::Tool | Qt::FramelessWindowHint), _mode(mode) { _animation = new QPropertyAnimation(this, "pos"); _animation->setDuration(200); QPushButton *button = new QPushButton(this); _playbackMode = PlaybackModeWidget::nameFromMode(mode); SettingsPrivate *settingsPrivate = SettingsPrivate::instance(); Settings *settings = Settings::instance(); button->setIcon(QIcon(":/player/" + settings->theme() + "/" + _playbackMode)); button->setIconSize(QSize(settingsPrivate->buttonsSize(), settingsPrivate->buttonsSize())); QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->setContentsMargins(0, 0, 0, 0); vLayout->addWidget(button); this->setLayout(vLayout); }
/** Load theme at startup. */ void CustomizeThemeDialog::loadTheme() { SettingsPrivate *settings = SettingsPrivate::instance(); customizeThemeCheckBox->setChecked(settings->isButtonThemeCustomized()); sizeButtonsSpinBox->setValue(settings->buttonsSize()); // Select the right drop-down item according to the theme int i = 0; while (Settings::instance()->theme() != themeComboBox->itemText(i).toLower()) { i++; } themeComboBox->setCurrentIndex(i); // Buttons for (MediaButton *b : _mainWindow->mediaButtons) { // Check or uncheck checkboxes in this customize interface QCheckBox *checkBox = findChild<QCheckBox *>(b->objectName().replace("Button", "CheckBox")); if (checkBox) { checkBox->setChecked(settings->isMediaButtonVisible(b->objectName())); } // Display customs icons, if any QPushButton *pushButton = findChild<QPushButton *>(b->objectName().remove("Button")); if (pushButton) { pushButton->setIcon(b->icon()); } } // Extended Search Area settings->isExtendedSearchVisible() ? radioButtonShowExtendedSearch->setChecked(true) : radioButtonHideExtendedSearch->setChecked(true); // Volume bar radioButtonShowVolume->setChecked(settings->isVolumeBarTextAlwaysVisible()); spinBoxHideVolumeLabel->setValue(settings->volumeBarHideAfter()); // Fonts fontComboBoxPlaylist->setCurrentFont(settings->font(SettingsPrivate::FF_Playlist)); fontComboBoxLibrary->setCurrentFont(settings->font(SettingsPrivate::FF_Library)); fontComboBoxMenus->setCurrentFont(settings->font(SettingsPrivate::FF_Menu)); spinBoxPlaylist->setValue(settings->fontSize(SettingsPrivate::FF_Playlist)); spinBoxLibrary->blockSignals(true); spinBoxLibrary->setValue(settings->fontSize(SettingsPrivate::FF_Library)); spinBoxLibrary->blockSignals(false); spinBoxMenus->setValue(settings->fontSize(SettingsPrivate::FF_Menu)); // Library checkBoxDisplayCovers->setChecked(settings->isCoversEnabled()); spinBoxCoverSize->blockSignals(true); spinBoxCoverSize->setValue(settings->coverSize()); spinBoxCoverSize->blockSignals(false); // Colors settings->colorsAlternateBG() ? enableAlternateBGRadioButton->setChecked(true) : disableAlternateBGRadioButton->setChecked(true); settings->isCustomColors() ? enableCustomColorsRadioButton->setChecked(true) : disableCustomColorsRadioButton->setChecked(true); this->toggleCustomColors(settings->isCustomColors()); // Covers radioButtonEnableBigCover->setChecked(settings->isBigCoverEnabled()); spinBoxBigCoverOpacity->setValue(settings->bigCoverOpacity() * 100); // Tabs radioButtonTabsRect->setChecked(settings->isRectTabs()); overlapTabsSpinBox->setValue(settings->tabsOverlappingLength()); // Articles radioButtonEnableArticles->blockSignals(true); bool isFiltered = settings->isLibraryFilteredByArticles(); radioButtonEnableArticles->setChecked(isFiltered); std::list<QWidget*> enabled = { articlesLineEdit, labelReorderArtistsArticle, labelReorderArtistsArticleExample, radioButtonEnableReorderArtistsArticle, radioButtonDisableReorderArtistsArticle }; for (QWidget *w : enabled) { w->setEnabled(isFiltered); } radioButtonEnableReorderArtistsArticle->setChecked(settings->isReorderArtistsArticle()); radioButtonEnableArticles->blockSignals(false); // Star delegate if (settings->isStarDelegates()) { radioButtonEnableStarDelegate->setChecked(true); } else { radioButtonDisableStarDelegate->setChecked(true); } if (settings->isShowNeverScored()) { radioButtonShowNeverScoredTracks->setChecked(true); } else { radioButtonHideNeverScoredTracks->setChecked(true); } }