aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/widgets')
-rw-r--r--launcher/ui/widgets/ThemeCustomizationWidget.cpp55
-rw-r--r--launcher/ui/widgets/ThemeCustomizationWidget.h16
-rw-r--r--launcher/ui/widgets/ThemeCustomizationWidget.ui98
3 files changed, 105 insertions, 64 deletions
diff --git a/launcher/ui/widgets/ThemeCustomizationWidget.cpp b/launcher/ui/widgets/ThemeCustomizationWidget.cpp
index 291f8ed9..c999ac92 100644
--- a/launcher/ui/widgets/ThemeCustomizationWidget.cpp
+++ b/launcher/ui/widgets/ThemeCustomizationWidget.cpp
@@ -19,17 +19,23 @@
#include "ui_ThemeCustomizationWidget.h"
#include "Application.h"
+#include "DesktopServices.h"
#include "ui/themes/ITheme.h"
#include "ui/themes/ThemeManager.h"
-ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ThemeCustomizationWidget)
+ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget* parent) : QWidget(parent), ui(new Ui::ThemeCustomizationWidget)
{
ui->setupUi(this);
loadSettings();
connect(ui->iconsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyIconTheme);
- connect(ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyWidgetTheme);
+ connect(ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
+ &ThemeCustomizationWidget::applyWidgetTheme);
connect(ui->backgroundCatComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyCatTheme);
+
+ connect(ui->iconsFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getIconThemesFolder().path()); });
+ connect(ui->widgetStyleFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
+ connect(ui->catPackFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getCatPacksFolder().path()); });
}
ThemeCustomizationWidget::~ThemeCustomizationWidget()
@@ -40,7 +46,7 @@ ThemeCustomizationWidget::~ThemeCustomizationWidget()
/// <summary>
/// The layout was not quite right, so currently this just disables the UI elements, which should be hidden instead
/// TODO FIXME
-///
+///
/// Original Method One:
/// ui->iconsComboBox->setVisible(features& ThemeFields::ICONS);
/// ui->iconsLabel->setVisible(features& ThemeFields::ICONS);
@@ -48,7 +54,7 @@ ThemeCustomizationWidget::~ThemeCustomizationWidget()
/// ui->widgetThemeLabel->setVisible(features& ThemeFields::WIDGETS);
/// ui->backgroundCatComboBox->setVisible(features& ThemeFields::CAT);
/// ui->backgroundCatLabel->setVisible(features& ThemeFields::CAT);
-///
+///
/// original Method Two:
/// if (!(features & ThemeFields::ICONS)) {
/// ui->formLayout->setRowVisible(0, false);
@@ -61,35 +67,37 @@ ThemeCustomizationWidget::~ThemeCustomizationWidget()
/// }
/// </summary>
/// <param name="features"></param>
-void ThemeCustomizationWidget::showFeatures(ThemeFields features) {
+void ThemeCustomizationWidget::showFeatures(ThemeFields features)
+{
ui->iconsComboBox->setEnabled(features & ThemeFields::ICONS);
ui->iconsLabel->setEnabled(features & ThemeFields::ICONS);
ui->widgetStyleComboBox->setEnabled(features & ThemeFields::WIDGETS);
- ui->widgetThemeLabel->setEnabled(features & ThemeFields::WIDGETS);
+ ui->widgetStyleLabel->setEnabled(features & ThemeFields::WIDGETS);
ui->backgroundCatComboBox->setEnabled(features & ThemeFields::CAT);
ui->backgroundCatLabel->setEnabled(features & ThemeFields::CAT);
}
-void ThemeCustomizationWidget::applyIconTheme(int index) {
+void ThemeCustomizationWidget::applyIconTheme(int index)
+{
auto settings = APPLICATION->settings();
auto originalIconTheme = settings->get("IconTheme").toString();
- auto& newIconTheme = m_iconThemeOptions[index].first;
- settings->set("IconTheme", newIconTheme);
-
+ auto newIconTheme = ui->iconsComboBox->currentData().toString();
if (originalIconTheme != newIconTheme) {
- APPLICATION->applyCurrentlySelectedTheme();
+ settings->set("IconTheme", newIconTheme);
+ APPLICATION->themeManager()->applyCurrentlySelectedTheme();
}
emit currentIconThemeChanged(index);
}
-void ThemeCustomizationWidget::applyWidgetTheme(int index) {
+void ThemeCustomizationWidget::applyWidgetTheme(int index)
+{
auto settings = APPLICATION->settings();
auto originalAppTheme = settings->get("ApplicationTheme").toString();
auto newAppTheme = ui->widgetStyleComboBox->currentData().toString();
if (originalAppTheme != newAppTheme) {
settings->set("ApplicationTheme", newAppTheme);
- APPLICATION->applyCurrentlySelectedTheme();
+ APPLICATION->themeManager()->applyCurrentlySelectedTheme();
}
emit currentWidgetThemeChanged(index);
@@ -117,18 +125,23 @@ void ThemeCustomizationWidget::loadSettings()
{
auto settings = APPLICATION->settings();
- auto iconTheme = settings->get("IconTheme").toString();
- for (auto& iconThemeFromList : m_iconThemeOptions) {
- QIcon iconForComboBox = QIcon(QString(":/icons/%1/scalable/settings").arg(iconThemeFromList.first));
- ui->iconsComboBox->addItem(iconForComboBox, iconThemeFromList.second);
- if (iconTheme == iconThemeFromList.first) {
- ui->iconsComboBox->setCurrentIndex(ui->iconsComboBox->count() - 1);
+ {
+ auto currentIconTheme = settings->get("IconTheme").toString();
+ auto iconThemes = APPLICATION->themeManager()->getValidIconThemes();
+ int idx = 0;
+ for (auto iconTheme : iconThemes) {
+ QIcon iconForComboBox = QIcon(iconTheme->path() + "/scalable/settings");
+ ui->iconsComboBox->addItem(iconForComboBox, iconTheme->name(), iconTheme->id());
+ if (currentIconTheme == iconTheme->id()) {
+ ui->iconsComboBox->setCurrentIndex(idx);
+ }
+ idx++;
}
}
{
auto currentTheme = settings->get("ApplicationTheme").toString();
- auto themes = APPLICATION->getValidApplicationThemes();
+ auto themes = APPLICATION->themeManager()->getValidApplicationThemes();
int idx = 0;
for (auto& theme : themes) {
ui->widgetStyleComboBox->addItem(theme->name(), theme->id());
@@ -140,7 +153,7 @@ void ThemeCustomizationWidget::loadSettings()
}
auto cat = settings->get("BackgroundCat").toString();
- for (auto& catFromList : APPLICATION->getValidCatPacks()) {
+ for (auto& catFromList : APPLICATION->themeManager()->getValidCatPacks()) {
QIcon catIcon = QIcon(QString("%1").arg(catFromList->path()));
ui->backgroundCatComboBox->addItem(catIcon, catFromList->name(), catFromList->id());
if (cat == catFromList->id()) {
diff --git a/launcher/ui/widgets/ThemeCustomizationWidget.h b/launcher/ui/widgets/ThemeCustomizationWidget.h
index af47c788..cef5fb6c 100644
--- a/launcher/ui/widgets/ThemeCustomizationWidget.h
+++ b/launcher/ui/widgets/ThemeCustomizationWidget.h
@@ -31,7 +31,7 @@ class ThemeCustomizationWidget : public QWidget {
public:
explicit ThemeCustomizationWidget(QWidget* parent = nullptr);
- ~ThemeCustomizationWidget();
+ ~ThemeCustomizationWidget() override;
void showFeatures(ThemeFields features);
@@ -52,18 +52,4 @@ class ThemeCustomizationWidget : public QWidget {
private:
Ui::ThemeCustomizationWidget* ui;
-
- // TODO finish implementing
- QList<std::pair<QString, QString>> m_iconThemeOptions{ { "pe_colored", QObject::tr("Simple (Colored Icons)") },
- { "pe_light", QObject::tr("Simple (Light Icons)") },
- { "pe_dark", QObject::tr("Simple (Dark Icons)") },
- { "pe_blue", QObject::tr("Simple (Blue Icons)") },
- { "breeze_light", QObject::tr("Breeze Light") },
- { "breeze_dark", QObject::tr("Breeze Dark") },
- { "OSX", QObject::tr("OSX") },
- { "iOS", QObject::tr("iOS") },
- { "flat", QObject::tr("Flat") },
- { "flat_white", QObject::tr("Flat (White)") },
- { "multimc", QObject::tr("Legacy") },
- { "custom", QObject::tr("Custom") } };
};
diff --git a/launcher/ui/widgets/ThemeCustomizationWidget.ui b/launcher/ui/widgets/ThemeCustomizationWidget.ui
index f216a610..4503181c 100644
--- a/launcher/ui/widgets/ThemeCustomizationWidget.ui
+++ b/launcher/ui/widgets/ThemeCustomizationWidget.ui
@@ -40,22 +40,43 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QComboBox" name="iconsComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="iconsLayout">
+ <item>
+ <widget class="QComboBox" name="iconsComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::StrongFocus</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="iconsFolder">
+ <property name="toolTip">
+ <string>View icon themes folder.</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="viewfolder">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="1" column="0">
- <widget class="QLabel" name="widgetThemeLabel">
+ <widget class="QLabel" name="widgetStyleLabel">
<property name="text">
- <string>&amp;Colors</string>
+ <string>&amp;Widgets</string>
</property>
<property name="buddy">
<cstring>widgetStyleComboBox</cstring>
@@ -63,17 +84,38 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QComboBox" name="widgetStyleComboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="focusPolicy">
- <enum>Qt::StrongFocus</enum>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="widgetStyleLayout">
+ <item>
+ <widget class="QComboBox" name="widgetStyleComboBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::StrongFocus</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="widgetStyleFolder">
+ <property name="toolTip">
+ <string>View widget themes folder.</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset theme="viewfolder">
+ <normaloff>.</normaloff>.</iconset>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="backgroundCatLabel">
@@ -89,7 +131,7 @@
</widget>
</item>
<item row="2" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="catLayout">
<item>
<widget class="QComboBox" name="backgroundCatComboBox">
<property name="sizePolicy">
@@ -107,15 +149,15 @@
</widget>
</item>
<item>
- <widget class="QPushButton" name="catInfoLabel">
+ <widget class="QPushButton" name="catPackFolder">
<property name="toolTip">
- <string>The cat appears in the background and is not shown by default. It is only made visible when pressing the Cat button in the Toolbar.</string>
+ <string>View cat packs folder.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
- <iconset theme="about">
+ <iconset theme="viewfolder">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">