aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/themes/CatPack.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-09-16 18:22:13 +0200
committerGitHub <noreply@github.com>2023-09-16 18:22:13 +0200
commit00af385619889eb68558234895768a547079d296 (patch)
treed4d2296f44ec644b7faec29e789f0a70e5c26149 /launcher/ui/themes/CatPack.cpp
parentbf6dc10f355f95095d8b21154189257980dda4a2 (diff)
parent7e65aea2ef790d8f2e424e618d9ab9acd476f045 (diff)
downloadPrismLauncher-00af385619889eb68558234895768a547079d296.tar.gz
PrismLauncher-00af385619889eb68558234895768a547079d296.tar.bz2
PrismLauncher-00af385619889eb68558234895768a547079d296.zip
Merge pull request #1572 from Trial97/catpacks2
Diffstat (limited to 'launcher/ui/themes/CatPack.cpp')
-rw-r--r--launcher/ui/themes/CatPack.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/launcher/ui/themes/CatPack.cpp b/launcher/ui/themes/CatPack.cpp
index f0d8ddd5..bbcb58bc 100644
--- a/launcher/ui/themes/CatPack.cpp
+++ b/launcher/ui/themes/CatPack.cpp
@@ -99,18 +99,22 @@ QDate ensureDay(int year, int month, int day)
QString JsonCatPack::path()
{
- const QDate now = QDate::currentDate();
+ return path(QDate::currentDate());
+}
+
+QString JsonCatPack::path(QDate now)
+{
for (auto var : m_variants) {
QDate startDate = ensureDay(now.year(), var.startTime.month, var.startTime.day);
QDate endDate = ensureDay(now.year(), var.endTime.month, var.endTime.day);
if (startDate > endDate) { // it's spans over multiple years
- if (endDate <= now) // end date is in the past so jump one year into the future for endDate
+ if (endDate < now) // end date is in the past so jump one year into the future for endDate
endDate = endDate.addYears(1);
else // end date is in the future so jump one year into the past for startDate
startDate = startDate.addYears(-1);
}
- if (startDate >= now && now >= endDate)
+ if (startDate <= now && now <= endDate)
return var.path;
}
return m_defaultPath;