diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2023-07-21 11:11:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-21 11:11:12 +0200 |
commit | 821dd8400b1a27ab1f932200bfa77d7a04edef5d (patch) | |
tree | c30d09e1b72e74fae3830fbbec514b236cc0bf51 /launcher/ui/widgets/ThemeCustomizationWidget.cpp | |
parent | 593f45298614843c14acb11994320f90a474c750 (diff) | |
parent | b7bccb905829eebea039a32edf93606f5fc5defa (diff) | |
download | PrismLauncher-821dd8400b1a27ab1f932200bfa77d7a04edef5d.tar.gz PrismLauncher-821dd8400b1a27ab1f932200bfa77d7a04edef5d.tar.bz2 PrismLauncher-821dd8400b1a27ab1f932200bfa77d7a04edef5d.zip |
Merge pull request #1253 from Trial97/catpacks
Diffstat (limited to 'launcher/ui/widgets/ThemeCustomizationWidget.cpp')
-rw-r--r-- | launcher/ui/widgets/ThemeCustomizationWidget.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/launcher/ui/widgets/ThemeCustomizationWidget.cpp b/launcher/ui/widgets/ThemeCustomizationWidget.cpp index 3bfcd821..291f8ed9 100644 --- a/launcher/ui/widgets/ThemeCustomizationWidget.cpp +++ b/launcher/ui/widgets/ThemeCustomizationWidget.cpp @@ -95,9 +95,14 @@ void ThemeCustomizationWidget::applyWidgetTheme(int index) { emit currentWidgetThemeChanged(index); } -void ThemeCustomizationWidget::applyCatTheme(int index) { +void ThemeCustomizationWidget::applyCatTheme(int index) +{ auto settings = APPLICATION->settings(); - settings->set("BackgroundCat", m_catOptions[index].first); + auto originalCat = settings->get("BackgroundCat").toString(); + auto newCat = ui->backgroundCatComboBox->currentData().toString(); + if (originalCat != newCat) { + settings->set("BackgroundCat", newCat); + } emit currentCatChanged(index); } @@ -135,10 +140,10 @@ void ThemeCustomizationWidget::loadSettings() } auto cat = settings->get("BackgroundCat").toString(); - for (auto& catFromList : m_catOptions) { - QIcon catIcon = QIcon(QString(":/backgrounds/%1").arg(ThemeManager::getCatImage(catFromList.first))); - ui->backgroundCatComboBox->addItem(catIcon, catFromList.second); - if (cat == catFromList.first) { + for (auto& catFromList : APPLICATION->getValidCatPacks()) { + QIcon catIcon = QIcon(QString("%1").arg(catFromList->path())); + ui->backgroundCatComboBox->addItem(catIcon, catFromList->name(), catFromList->id()); + if (cat == catFromList->id()) { ui->backgroundCatComboBox->setCurrentIndex(ui->backgroundCatComboBox->count() - 1); } } |