Implement Suggestions from flow & Scrumplex
Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
|
||||
#include "Application.h"
|
||||
#include "ui/themes/ITheme.h"
|
||||
#include "ui/themes/ThemeManager.h"
|
||||
|
||||
ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ThemeCustomizationWidget)
|
||||
{
|
||||
@ -72,8 +73,7 @@ void ThemeCustomizationWidget::showFeatures(ThemeFields features) {
|
||||
void ThemeCustomizationWidget::applyIconTheme(int index) {
|
||||
auto settings = APPLICATION->settings();
|
||||
auto original = settings->get("IconTheme").toString();
|
||||
// FIXME: make generic
|
||||
settings->set("IconTheme", m_iconThemeOptions[index]);
|
||||
settings->set("IconTheme", m_iconThemeOptions[index].first);
|
||||
|
||||
if (original != settings->get("IconTheme")) {
|
||||
APPLICATION->applyCurrentlySelectedTheme();
|
||||
@ -96,7 +96,7 @@ void ThemeCustomizationWidget::applyWidgetTheme(int index) {
|
||||
|
||||
void ThemeCustomizationWidget::applyCatTheme(int index) {
|
||||
auto settings = APPLICATION->settings();
|
||||
settings->set("BackgroundCat", m_catOptions[index]);
|
||||
settings->set("BackgroundCat", m_catOptions[index].first);
|
||||
|
||||
emit currentCatChanged(index);
|
||||
}
|
||||
@ -111,9 +111,13 @@ void ThemeCustomizationWidget::loadSettings()
|
||||
{
|
||||
auto settings = APPLICATION->settings();
|
||||
|
||||
// FIXME: make generic
|
||||
auto iconTheme = settings->get("IconTheme").toString();
|
||||
ui->iconsComboBox->setCurrentIndex(m_iconThemeOptions.indexOf(iconTheme));
|
||||
for (auto& iconThemeFromList : m_iconThemeOptions) {
|
||||
ui->iconsComboBox->addItem(QIcon(QString(":/icons/%1/scalable/settings").arg(iconThemeFromList.first)), iconThemeFromList.second);
|
||||
if (iconTheme == iconThemeFromList.first) {
|
||||
ui->iconsComboBox->setCurrentIndex(ui->iconsComboBox->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto currentTheme = settings->get("ApplicationTheme").toString();
|
||||
@ -129,7 +133,13 @@ void ThemeCustomizationWidget::loadSettings()
|
||||
}
|
||||
|
||||
auto cat = settings->get("BackgroundCat").toString();
|
||||
ui->backgroundCatComboBox->setCurrentIndex(m_catOptions.indexOf(cat));
|
||||
for (auto& catFromList : m_catOptions) {
|
||||
ui->backgroundCatComboBox->addItem(QIcon(QString(":/backgrounds/%1").arg(ThemeManager::getCatImage(catFromList.first))),
|
||||
catFromList.second);
|
||||
if (cat == catFromList.first) {
|
||||
ui->backgroundCatComboBox->setCurrentIndex(ui->backgroundCatComboBox->count() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeCustomizationWidget::retranslate()
|
||||
|
@ -18,25 +18,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <translations/TranslationsModel.h>
|
||||
#include "translations/TranslationsModel.h"
|
||||
|
||||
enum ThemeFields {
|
||||
NONE = 0b0000,
|
||||
ICONS = 0b0001,
|
||||
WIDGETS = 0b0010,
|
||||
CAT = 0b0100
|
||||
};
|
||||
enum ThemeFields { NONE = 0b0000, ICONS = 0b0001, WIDGETS = 0b0010, CAT = 0b0100 };
|
||||
|
||||
namespace Ui {
|
||||
class ThemeCustomizationWidget;
|
||||
}
|
||||
|
||||
class ThemeCustomizationWidget : public QWidget
|
||||
{
|
||||
class ThemeCustomizationWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ThemeCustomizationWidget(QWidget *parent = nullptr);
|
||||
public:
|
||||
explicit ThemeCustomizationWidget(QWidget* parent = nullptr);
|
||||
~ThemeCustomizationWidget();
|
||||
|
||||
void showFeatures(ThemeFields features);
|
||||
@ -45,21 +39,39 @@ public:
|
||||
|
||||
void loadSettings();
|
||||
void retranslate();
|
||||
|
||||
Ui::ThemeCustomizationWidget *ui;
|
||||
|
||||
private slots:
|
||||
private slots:
|
||||
void applyIconTheme(int index);
|
||||
void applyWidgetTheme(int index);
|
||||
void applyCatTheme(int index);
|
||||
|
||||
signals:
|
||||
signals:
|
||||
int currentIconThemeChanged(int index);
|
||||
int currentWidgetThemeChanged(int index);
|
||||
int currentCatChanged(int index);
|
||||
|
||||
private:
|
||||
private:
|
||||
Ui::ThemeCustomizationWidget* ui;
|
||||
|
||||
QStringList m_iconThemeOptions{ "pe_colored", "pe_light", "pe_dark", "pe_blue", "breeze_light", "breeze_dark", "OSX", "iOS", "flat", "flat_white", "multimc", "custom" };
|
||||
QStringList m_catOptions{ "kitteh", "rory", "rory-flat" };
|
||||
};
|
||||
//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") }
|
||||
};
|
||||
QList<std::pair<QString, QString>> m_catOptions{
|
||||
{ "kitteh", QObject::tr("Background Cat (from MultiMC)") },
|
||||
{ "rory", QObject::tr("Rory ID 11 (drawn by Ashtaka)") },
|
||||
{ "rory-flat", QObject::tr("Rory ID 11 (flat edition, drawn by Ashtaka)") },
|
||||
{ "teawie", QObject::tr("Teawie (drawn by SympathyTea)") }
|
||||
};
|
||||
};
|
@ -50,66 +50,6 @@
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Simple (Colored Icons)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Simple (Light Icons)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Simple (Dark Icons)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Simple (Blue Icons)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Breeze Light</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Breeze Dark</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">OSX</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">iOS</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flat</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flat (White)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Legacy</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -156,26 +96,6 @@
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Background Cat (from MultiMC)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rory ID 11 (drawn by Ashtaka)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Rory ID 11 (flat edition, drawn by Ashtaka)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Teawie (drawn by SympathyTea)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Reference in New Issue
Block a user