From 7d440402ade59fd38b6f1d6b70fb51449cc57e5d Mon Sep 17 00:00:00 2001 From: Tayou <31988415+TayouVR@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:30:25 +0100 Subject: [PATCH] Update launcher/Application.cpp with suggestion from scrumplex Co-authored-by: Sefa Eyeoglu Signed-off-by: Tayou --- launcher/Application.cpp | 2 +- launcher/ui/themes/ThemeManager.cpp | 4 ++-- launcher/ui/themes/ThemeManager.h | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index f2cc7bfb..ed8d8d2c 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -498,7 +498,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // Theming m_settings->registerSetting("IconTheme", QString("pe_colored")); - m_settings->registerSetting("ApplicationTheme"); + m_settings->registerSetting("ApplicationTheme", QString()); m_settings->registerSetting("BackgroundCat", QString("kitteh")); // Remembered state diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp index 44c13f40..7ccc946a 100644 --- a/launcher/ui/themes/ThemeManager.cpp +++ b/launcher/ui/themes/ThemeManager.cpp @@ -143,7 +143,7 @@ QString ThemeManager::getCatImage(QString catName) 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 = catName == "" ? APPLICATION->settings()->get("BackgroundCat").toString() : catName; + QString cat = !catName.isEmpty() ? catName : APPLICATION->settings()->get("BackgroundCat").toString(); if (std::abs(now.daysTo(xmas)) <= 4) { cat += "-xmas"; } else if (std::abs(now.daysTo(halloween)) <= 4) { @@ -152,4 +152,4 @@ QString ThemeManager::getCatImage(QString catName) cat += "-bday"; } return cat; -} \ No newline at end of file +} diff --git a/launcher/ui/themes/ThemeManager.h b/launcher/ui/themes/ThemeManager.h index 4f36bffa..d5e73bb8 100644 --- a/launcher/ui/themes/ThemeManager.h +++ b/launcher/ui/themes/ThemeManager.h @@ -40,6 +40,11 @@ class ThemeManager { void applyCurrentlySelectedTheme(); void setApplicationTheme(const QString& name); + /// + /// Returns the cat based on selected cat and with events (Birthday, XMas, etc.) + /// + /// Optional, if you need a specific cat. + /// static QString getCatImage(QString catName = ""); private: