UX tweak + formatting + added cat to wizard
Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
parent
1b80ae0fca
commit
49d317b19a
@ -1652,16 +1652,6 @@ void MainWindow::onCatToggled(bool state)
|
|||||||
APPLICATION->settings()->set("TheCat", state);
|
APPLICATION->settings()->set("TheCat", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
template <typename T>
|
|
||||||
T non_stupid_abs(T in)
|
|
||||||
{
|
|
||||||
if (in < 0)
|
|
||||||
return -in;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::setCatBackground(bool enabled)
|
void MainWindow::setCatBackground(bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
@ -1671,11 +1661,11 @@ void MainWindow::setCatBackground(bool enabled)
|
|||||||
QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0));
|
QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0));
|
||||||
QDateTime halloween(QDate(now.date().year(), 10, 31), QTime(0, 0));
|
QDateTime halloween(QDate(now.date().year(), 10, 31), QTime(0, 0));
|
||||||
QString cat = APPLICATION->settings()->get("BackgroundCat").toString();
|
QString cat = APPLICATION->settings()->get("BackgroundCat").toString();
|
||||||
if (non_stupid_abs(now.daysTo(xmas)) <= 4) {
|
if (std::abs(now.daysTo(xmas)) <= 4) {
|
||||||
cat += "-xmas";
|
cat += "-xmas";
|
||||||
} else if (non_stupid_abs(now.daysTo(halloween)) <= 4) {
|
} else if (std::abs(now.daysTo(halloween)) <= 4) {
|
||||||
cat += "-spooky";
|
cat += "-spooky";
|
||||||
} else if (non_stupid_abs(now.daysTo(birthday)) <= 12) {
|
} else if (std::abs(now.daysTo(birthday)) <= 12) {
|
||||||
cat += "-bday";
|
cat += "-bday";
|
||||||
}
|
}
|
||||||
view->setStyleSheet(QString(R"(
|
view->setStyleSheet(QString(R"(
|
||||||
|
@ -23,31 +23,31 @@
|
|||||||
#include "ui/widgets/ThemeCustomizationWidget.h"
|
#include "ui/widgets/ThemeCustomizationWidget.h"
|
||||||
#include "ui_ThemeCustomizationWidget.h"
|
#include "ui_ThemeCustomizationWidget.h"
|
||||||
|
|
||||||
ThemeWizardPage::ThemeWizardPage(QWidget *parent) :
|
ThemeWizardPage::ThemeWizardPage(QWidget* parent) : BaseWizardPage(parent), ui(new Ui::ThemeWizardPage)
|
||||||
BaseWizardPage(parent),
|
{
|
||||||
ui(new Ui::ThemeWizardPage) {
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->themeCustomizationWidget->showFeatures((ThemeFields)(ThemeFields::ICONS | ThemeFields::WIDGETS));
|
|
||||||
connect(ui->themeCustomizationWidget, QOverload<int>::of(&ThemeCustomizationWidget::currentIconThemeChanged), this, &ThemeWizardPage::updateIcons);
|
connect(ui->themeCustomizationWidget, QOverload<int>::of(&ThemeCustomizationWidget::currentIconThemeChanged), this, &ThemeWizardPage::updateIcons);
|
||||||
|
connect(ui->themeCustomizationWidget, QOverload<int>::of(&ThemeCustomizationWidget::currentCatChanged), this, &ThemeWizardPage::updateCat);
|
||||||
|
|
||||||
updateIcons();
|
updateIcons();
|
||||||
|
updateCat();
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeWizardPage::~ThemeWizardPage() {
|
ThemeWizardPage::~ThemeWizardPage()
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThemeWizardPage::initializePage()
|
|
||||||
{
|
{
|
||||||
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeWizardPage::initializePage() {}
|
||||||
|
|
||||||
bool ThemeWizardPage::validatePage()
|
bool ThemeWizardPage::validatePage()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeWizardPage::updateIcons() {
|
void ThemeWizardPage::updateIcons()
|
||||||
|
{
|
||||||
qDebug() << "Setting Icons";
|
qDebug() << "Setting Icons";
|
||||||
ui->previewIconButton0->setIcon(APPLICATION->getThemedIcon("new"));
|
ui->previewIconButton0->setIcon(APPLICATION->getThemedIcon("new"));
|
||||||
ui->previewIconButton1->setIcon(APPLICATION->getThemedIcon("centralmods"));
|
ui->previewIconButton1->setIcon(APPLICATION->getThemedIcon("centralmods"));
|
||||||
@ -64,6 +64,25 @@ void ThemeWizardPage::updateIcons() {
|
|||||||
parentWidget()->update();
|
parentWidget()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeWizardPage::updateCat()
|
||||||
|
{
|
||||||
|
qDebug() << "Setting Cat";
|
||||||
|
|
||||||
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
|
QDateTime birthday(QDate(now.date().year(), 11, 30), QTime(0, 0));
|
||||||
|
QDateTime xmas(QDate(now.date().year(), 12, 25), QTime(0, 0));
|
||||||
|
QDateTime halloween(QDate(now.date().year(), 10, 31), QTime(0, 0));
|
||||||
|
QString cat = APPLICATION->settings()->get("BackgroundCat").toString();
|
||||||
|
if (std::abs(now.daysTo(xmas)) <= 4) {
|
||||||
|
cat += "-xmas";
|
||||||
|
} else if (std::abs(now.daysTo(halloween)) <= 4) {
|
||||||
|
cat += "-spooky";
|
||||||
|
} else if (std::abs(now.daysTo(birthday)) <= 12) {
|
||||||
|
cat += "-bday";
|
||||||
|
}
|
||||||
|
ui->catImagePreviewButton->setIcon(QIcon(QString(R"(:/backgrounds/%1)").arg(cat)));
|
||||||
|
}
|
||||||
|
|
||||||
void ThemeWizardPage::retranslate()
|
void ThemeWizardPage::retranslate()
|
||||||
{
|
{
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateIcons();
|
void updateIcons();
|
||||||
|
void updateCat();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ThemeWizardPage *ui;
|
Ui::ThemeWizardPage *ui;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>510</width>
|
||||||
<height>300</height>
|
<height>552</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -309,6 +309,28 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="catImagePreviewButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>256</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>256</width>
|
||||||
|
<height>256</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -167,8 +167,6 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
|
|
||||||
if (!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) {
|
if (!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) {
|
||||||
themeWarningLog() << "couldn't create folder for theme!";
|
themeWarningLog() << "couldn't create folder for theme!";
|
||||||
m_palette = baseTheme->colorScheme();
|
|
||||||
m_styleSheet = baseTheme->appStyleSheet();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,18 +175,15 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
bool jsonDataIncomplete = false;
|
bool jsonDataIncomplete = false;
|
||||||
|
|
||||||
m_palette = baseTheme->colorScheme();
|
m_palette = baseTheme->colorScheme();
|
||||||
if (!readThemeJson(themeFilePath, m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets, m_qssFilePath, jsonDataIncomplete)) {
|
if (readThemeJson(themeFilePath, m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets, m_qssFilePath, jsonDataIncomplete)) {
|
||||||
themeDebugLog() << "Did not read theme json file correctly, writing new one to: " << themeFilePath;
|
// If theme data was found, fade "Disabled" color of each role according to FadeAmount
|
||||||
m_name = "Custom";
|
|
||||||
m_palette = baseTheme->colorScheme();
|
|
||||||
m_fadeColor = baseTheme->fadeColor();
|
|
||||||
m_fadeAmount = baseTheme->fadeAmount();
|
|
||||||
m_widgets = baseTheme->qtTheme();
|
|
||||||
m_qssFilePath = "themeStyle.css";
|
|
||||||
} else {
|
|
||||||
m_palette = fadeInactive(m_palette, m_fadeAmount, m_fadeColor);
|
m_palette = fadeInactive(m_palette, m_fadeAmount, m_fadeColor);
|
||||||
|
} else {
|
||||||
|
themeDebugLog() << "Did not read theme json file correctly, not changing theme, keeping previous.";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: This is kinda jank, it only actually checks if the qss file path is not present. It should actually check for any relevant missing data (e.g. name, colors)
|
||||||
if (jsonDataIncomplete) {
|
if (jsonDataIncomplete) {
|
||||||
writeThemeJson(fileInfo.absoluteFilePath(), m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets, m_qssFilePath);
|
writeThemeJson(fileInfo.absoluteFilePath(), m_palette, m_fadeAmount, m_fadeColor, m_name, m_widgets, m_qssFilePath);
|
||||||
}
|
}
|
||||||
@ -197,20 +192,14 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
QFileInfo info(qssFilePath);
|
QFileInfo info(qssFilePath);
|
||||||
if (info.isFile()) {
|
if (info.isFile()) {
|
||||||
try {
|
try {
|
||||||
// TODO: validate css?
|
// TODO: validate qss?
|
||||||
m_styleSheet = QString::fromUtf8(FS::read(qssFilePath));
|
m_styleSheet = QString::fromUtf8(FS::read(qssFilePath));
|
||||||
} catch (const Exception& e) {
|
} catch (const Exception& e) {
|
||||||
themeWarningLog() << "Couldn't load css:" << e.cause() << "from" << qssFilePath;
|
themeWarningLog() << "Couldn't load qss:" << e.cause() << "from" << qssFilePath;
|
||||||
m_styleSheet = baseTheme->appStyleSheet();
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
themeDebugLog() << "No theme css present.";
|
themeDebugLog() << "No theme qss present.";
|
||||||
m_styleSheet = baseTheme->appStyleSheet();
|
|
||||||
try {
|
|
||||||
FS::write(qssFilePath, m_styleSheet.toUtf8());
|
|
||||||
} catch (const Exception& e) {
|
|
||||||
themeWarningLog() << "Couldn't write css:" << e.cause() << "to" << qssFilePath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_id = fileInfo.fileName();
|
m_id = fileInfo.fileName();
|
||||||
|
@ -33,14 +33,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <QString>
|
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
class QStyle;
|
class QStyle;
|
||||||
|
|
||||||
class ITheme
|
class ITheme {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
virtual ~ITheme() {}
|
virtual ~ITheme() {}
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
virtual QString id() = 0;
|
virtual QString id() = 0;
|
||||||
@ -52,10 +51,7 @@ public:
|
|||||||
virtual QPalette colorScheme() = 0;
|
virtual QPalette colorScheme() = 0;
|
||||||
virtual QColor fadeColor() = 0;
|
virtual QColor fadeColor() = 0;
|
||||||
virtual double fadeAmount() = 0;
|
virtual double fadeAmount() = 0;
|
||||||
virtual QStringList searchPaths()
|
virtual QStringList searchPaths() { return {}; }
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
static QPalette fadeInactive(QPalette in, qreal bias, QColor color);
|
static QPalette fadeInactive(QPalette in, qreal bias, QColor color);
|
||||||
};
|
};
|
||||||
|
@ -34,24 +34,22 @@
|
|||||||
*/
|
*/
|
||||||
#include "SystemTheme.h"
|
#include "SystemTheme.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDebug>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include <QDebug>
|
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
SystemTheme::SystemTheme()
|
SystemTheme::SystemTheme()
|
||||||
{
|
{
|
||||||
themeDebugLog() << "Determining System Theme...";
|
themeDebugLog() << "Determining System Theme...";
|
||||||
const auto & style = QApplication::style();
|
const auto& style = QApplication::style();
|
||||||
systemPalette = style->standardPalette();
|
systemPalette = style->standardPalette();
|
||||||
QString lowerThemeName = style->objectName();
|
QString lowerThemeName = style->objectName();
|
||||||
themeDebugLog() << "System theme seems to be:" << lowerThemeName;
|
themeDebugLog() << "System theme seems to be:" << lowerThemeName;
|
||||||
QStringList styles = QStyleFactory::keys();
|
QStringList styles = QStyleFactory::keys();
|
||||||
for(auto &st: styles)
|
for (auto& st : styles) {
|
||||||
{
|
|
||||||
themeDebugLog() << "Considering theme from theme factory:" << st.toLower();
|
themeDebugLog() << "Considering theme from theme factory:" << st.toLower();
|
||||||
if(st.toLower() == lowerThemeName)
|
if (st.toLower() == lowerThemeName) {
|
||||||
{
|
|
||||||
systemTheme = st;
|
systemTheme = st;
|
||||||
themeDebugLog() << "System theme has been determined to be:" << systemTheme;
|
themeDebugLog() << "System theme has been determined to be:" << systemTheme;
|
||||||
return;
|
return;
|
||||||
@ -99,7 +97,7 @@ double SystemTheme::fadeAmount()
|
|||||||
|
|
||||||
QColor SystemTheme::fadeColor()
|
QColor SystemTheme::fadeColor()
|
||||||
{
|
{
|
||||||
return QColor(128,128,128);
|
return QColor(128, 128, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemTheme::hasStyleSheet()
|
bool SystemTheme::hasStyleSheet()
|
||||||
|
@ -36,9 +36,8 @@
|
|||||||
|
|
||||||
#include "ITheme.h"
|
#include "ITheme.h"
|
||||||
|
|
||||||
class SystemTheme: public ITheme
|
class SystemTheme : public ITheme {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
SystemTheme();
|
SystemTheme();
|
||||||
virtual ~SystemTheme() {}
|
virtual ~SystemTheme() {}
|
||||||
void apply() override;
|
void apply() override;
|
||||||
@ -52,7 +51,8 @@ public:
|
|||||||
QPalette colorScheme() override;
|
QPalette colorScheme() override;
|
||||||
double fadeAmount() override;
|
double fadeAmount() override;
|
||||||
QColor fadeColor() override;
|
QColor fadeColor() override;
|
||||||
private:
|
|
||||||
|
private:
|
||||||
QPalette systemPalette;
|
QPalette systemPalette;
|
||||||
QString systemTheme;
|
QString systemTheme;
|
||||||
};
|
};
|
||||||
|
@ -35,9 +35,6 @@ class ThemeManager {
|
|||||||
public:
|
public:
|
||||||
ThemeManager(MainWindow* mainWindow);
|
ThemeManager(MainWindow* mainWindow);
|
||||||
|
|
||||||
// maybe make private? Or put in ctor?
|
|
||||||
void InitializeThemes();
|
|
||||||
|
|
||||||
QList<ITheme*> getValidApplicationThemes();
|
QList<ITheme*> getValidApplicationThemes();
|
||||||
void setIconTheme(const QString& name);
|
void setIconTheme(const QString& name);
|
||||||
void applyCurrentlySelectedTheme();
|
void applyCurrentlySelectedTheme();
|
||||||
@ -48,6 +45,7 @@ class ThemeManager {
|
|||||||
MainWindow* m_mainWindow;
|
MainWindow* m_mainWindow;
|
||||||
bool m_firstThemeInitialized;
|
bool m_firstThemeInitialized;
|
||||||
|
|
||||||
|
void InitializeThemes();
|
||||||
QString AddTheme(std::unique_ptr<ITheme> theme);
|
QString AddTheme(std::unique_ptr<ITheme> theme);
|
||||||
ITheme* GetTheme(QString themeId);
|
ITheme* GetTheme(QString themeId);
|
||||||
};
|
};
|
||||||
|
@ -36,18 +36,40 @@ ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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);
|
||||||
|
/// ui->widgetStyleComboBox->setVisible(features& ThemeFields::WIDGETS);
|
||||||
|
/// 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);
|
||||||
|
/// }
|
||||||
|
/// if (!(features & ThemeFields::WIDGETS)) {
|
||||||
|
/// ui->formLayout->setRowVisible(1, false);
|
||||||
|
/// }
|
||||||
|
/// if (!(features & ThemeFields::CAT)) {
|
||||||
|
/// ui->formLayout->setRowVisible(2, false);
|
||||||
|
/// }
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="features"></param>
|
||||||
void ThemeCustomizationWidget::showFeatures(ThemeFields features) {
|
void ThemeCustomizationWidget::showFeatures(ThemeFields features) {
|
||||||
ui->iconsComboBox->setVisible(features & ThemeFields::ICONS);
|
ui->iconsComboBox->setEnabled(features & ThemeFields::ICONS);
|
||||||
ui->iconsLabel->setVisible(features & ThemeFields::ICONS);
|
ui->iconsLabel->setEnabled(features & ThemeFields::ICONS);
|
||||||
ui->widgetStyleComboBox->setVisible(features & ThemeFields::WIDGETS);
|
ui->widgetStyleComboBox->setEnabled(features & ThemeFields::WIDGETS);
|
||||||
ui->widgetThemeLabel->setVisible(features & ThemeFields::WIDGETS);
|
ui->widgetThemeLabel->setEnabled(features & ThemeFields::WIDGETS);
|
||||||
ui->backgroundCatComboBox->setVisible(features & ThemeFields::CAT);
|
ui->backgroundCatComboBox->setEnabled(features & ThemeFields::CAT);
|
||||||
ui->backgroundCatLabel->setVisible(features & ThemeFields::CAT);
|
ui->backgroundCatLabel->setEnabled(features & ThemeFields::CAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeCustomizationWidget::applyIconTheme(int index) {
|
void ThemeCustomizationWidget::applyIconTheme(int index) {
|
||||||
emit currentIconThemeChanged(index);
|
|
||||||
|
|
||||||
auto settings = APPLICATION->settings();
|
auto settings = APPLICATION->settings();
|
||||||
auto original = settings->get("IconTheme").toString();
|
auto original = settings->get("IconTheme").toString();
|
||||||
// FIXME: make generic
|
// FIXME: make generic
|
||||||
@ -56,11 +78,11 @@ void ThemeCustomizationWidget::applyIconTheme(int index) {
|
|||||||
if (original != settings->get("IconTheme")) {
|
if (original != settings->get("IconTheme")) {
|
||||||
APPLICATION->applyCurrentlySelectedTheme();
|
APPLICATION->applyCurrentlySelectedTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit currentIconThemeChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeCustomizationWidget::applyWidgetTheme(int index) {
|
void ThemeCustomizationWidget::applyWidgetTheme(int index) {
|
||||||
emit currentWidgetThemeChanged(index);
|
|
||||||
|
|
||||||
auto settings = APPLICATION->settings();
|
auto settings = APPLICATION->settings();
|
||||||
auto originalAppTheme = settings->get("ApplicationTheme").toString();
|
auto originalAppTheme = settings->get("ApplicationTheme").toString();
|
||||||
auto newAppTheme = ui->widgetStyleComboBox->currentData().toString();
|
auto newAppTheme = ui->widgetStyleComboBox->currentData().toString();
|
||||||
@ -68,26 +90,15 @@ void ThemeCustomizationWidget::applyWidgetTheme(int index) {
|
|||||||
settings->set("ApplicationTheme", newAppTheme);
|
settings->set("ApplicationTheme", newAppTheme);
|
||||||
APPLICATION->applyCurrentlySelectedTheme();
|
APPLICATION->applyCurrentlySelectedTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit currentWidgetThemeChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeCustomizationWidget::applyCatTheme(int index) {
|
void ThemeCustomizationWidget::applyCatTheme(int index) {
|
||||||
emit currentCatChanged(index);
|
|
||||||
|
|
||||||
auto settings = APPLICATION->settings();
|
auto settings = APPLICATION->settings();
|
||||||
switch (index) {
|
settings->set("BackgroundCat", m_catOptions[index]);
|
||||||
case 0: // original cat
|
|
||||||
settings->set("BackgroundCat", "kitteh");
|
emit currentCatChanged(index);
|
||||||
break;
|
|
||||||
case 1: // rory the cat
|
|
||||||
settings->set("BackgroundCat", "rory");
|
|
||||||
break;
|
|
||||||
case 2: // rory the cat flat edition
|
|
||||||
settings->set("BackgroundCat", "rory-flat");
|
|
||||||
break;
|
|
||||||
case 3: // teawie
|
|
||||||
settings->set("BackgroundCat", "teawie");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeCustomizationWidget::applySettings()
|
void ThemeCustomizationWidget::applySettings()
|
||||||
@ -101,8 +112,8 @@ void ThemeCustomizationWidget::loadSettings()
|
|||||||
auto settings = APPLICATION->settings();
|
auto settings = APPLICATION->settings();
|
||||||
|
|
||||||
// FIXME: make generic
|
// FIXME: make generic
|
||||||
auto theme = settings->get("IconTheme").toString();
|
auto iconTheme = settings->get("IconTheme").toString();
|
||||||
ui->iconsComboBox->setCurrentIndex(m_iconThemeOptions.indexOf(theme));
|
ui->iconsComboBox->setCurrentIndex(m_iconThemeOptions.indexOf(iconTheme));
|
||||||
|
|
||||||
{
|
{
|
||||||
auto currentTheme = settings->get("ApplicationTheme").toString();
|
auto currentTheme = settings->get("ApplicationTheme").toString();
|
||||||
@ -118,18 +129,10 @@ void ThemeCustomizationWidget::loadSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto cat = settings->get("BackgroundCat").toString();
|
auto cat = settings->get("BackgroundCat").toString();
|
||||||
if (cat == "kitteh") {
|
ui->backgroundCatComboBox->setCurrentIndex(m_catOptions.indexOf(cat));
|
||||||
ui->backgroundCatComboBox->setCurrentIndex(0);
|
|
||||||
} else if (cat == "rory") {
|
|
||||||
ui->backgroundCatComboBox->setCurrentIndex(1);
|
|
||||||
} else if (cat == "rory-flat") {
|
|
||||||
ui->backgroundCatComboBox->setCurrentIndex(2);
|
|
||||||
} else if (cat == "teawie") {
|
|
||||||
ui->backgroundCatComboBox->setCurrentIndex(3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeCustomizationWidget::retranslate()
|
void ThemeCustomizationWidget::retranslate()
|
||||||
{
|
{
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
@ -61,4 +61,5 @@ signals:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
QStringList m_iconThemeOptions{ "pe_colored", "pe_light", "pe_dark", "pe_blue", "breeze_light", "breeze_dark", "OSX", "iOS", "flat", "flat_white", "multimc", "custom" };
|
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" };
|
||||||
};
|
};
|
||||||
|
@ -11,9 +11,12 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string notr="true">Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user