Update launcher/Application.cpp with suggestion from scrumplex

Co-authored-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
Tayou 2023-01-04 14:30:25 +01:00 committed by Tayou
parent 6daa457838
commit 7d440402ad
No known key found for this signature in database
GPG Key ID: 02CA43C1CB6E9887
3 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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) {

View File

@ -40,6 +40,11 @@ class ThemeManager {
void applyCurrentlySelectedTheme();
void setApplicationTheme(const QString& name);
/// <summary>
/// Returns the cat based on selected cat and with events (Birthday, XMas, etc.)
/// </summary>
/// <param name="catName">Optional, if you need a specific cat.</param>
/// <returns></returns>
static QString getCatImage(QString catName = "");
private: