Skip to content

Commit

Permalink
Update launcher/Application.cpp with suggestion from scrumplex
Browse files Browse the repository at this point in the history
Co-authored-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Tayou <tayou@gmx.net>
  • Loading branch information
2 people authored and Tayou committed Jan 4, 2023
1 parent d472776 commit 9fbf70c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion launcher/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,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
Expand Down
4 changes: 2 additions & 2 deletions launcher/ui/themes/ThemeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,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) {
Expand All @@ -170,4 +170,4 @@ QString ThemeManager::getCatImage(QString catName)
cat += "-bday";
}
return cat;
}
}
5 changes: 5 additions & 0 deletions launcher/ui/themes/ThemeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9fbf70c

Please sign in to comment.