aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--launcher/ui/themes/CatPack.cpp10
-rw-r--r--launcher/ui/themes/CatPack.h4
-rw-r--r--launcher/ui/themes/ThemeManager.cpp2
3 files changed, 9 insertions, 7 deletions
diff --git a/launcher/ui/themes/CatPack.cpp b/launcher/ui/themes/CatPack.cpp
index 2d5653a6..a0b06a60 100644
--- a/launcher/ui/themes/CatPack.cpp
+++ b/launcher/ui/themes/CatPack.cpp
@@ -99,11 +99,13 @@ JsonCatPack::JsonCatPack(QFileInfo& manifestInfo) : BasicCatPack(manifestInfo.di
QString JsonCatPack::path()
{
- const QDateTime now = QDateTime::currentDateTime();
+ const QDate now = QDate::currentDate();
for (auto var : m_variants) {
- QDateTime startDate(QDate(now.date().year(), var.startTime.mounth, var.startTime.day), QTime(0, 0));
- QDateTime endDate(QDate(now.date().year(), var.endTime.mounth, var.endTime.day), QTime(0, 0));
- if (startDate.daysTo(now) > 0 && now.daysTo(endDate) > 0)
+ QDate startDate(now.year(), var.startTime.month, var.startTime.day);
+ QDate endDate(now.year(), var.endTime.month, var.endTime.day);
+ if (startDate.daysTo(endDate) < 0) // in this case end date should be next year
+ endDate = endDate.addYears(1);
+ if (startDate.daysTo(now) >= 0 && now.daysTo(endDate) >= 0)
return var.path;
}
return m_defaultPath;
diff --git a/launcher/ui/themes/CatPack.h b/launcher/ui/themes/CatPack.h
index 9f288d3d..e22df1f4 100644
--- a/launcher/ui/themes/CatPack.h
+++ b/launcher/ui/themes/CatPack.h
@@ -79,9 +79,9 @@ class JsonCatPack : public BasicCatPack {
auto sp = d.split("-");
day = sp[0].toInt();
if (sp.length() >= 2)
- mounth = sp[1].toInt();
+ month = sp[1].toInt();
}
- int mounth;
+ int month;
int day;
};
struct Variant {
diff --git a/launcher/ui/themes/ThemeManager.cpp b/launcher/ui/themes/ThemeManager.cpp
index bfd0550a..d00b3a99 100644
--- a/launcher/ui/themes/ThemeManager.cpp
+++ b/launcher/ui/themes/ThemeManager.cpp
@@ -189,7 +189,7 @@ void ThemeManager::initializeCatPacks()
while (ImageFileIterator.hasNext()) {
QFile customCatFile(ImageFileIterator.next());
QFileInfo customCatFileInfo(customCatFile);
- themeDebugLog() << "Loading QSS Theme from:" << customCatFileInfo.absoluteFilePath();
+ themeDebugLog() << "Loading CatPack from:" << customCatFileInfo.absoluteFilePath();
addCatPack(std::unique_ptr<CatPack>(new FileCatPack(customCatFileInfo)));
}
};