diff options
Diffstat (limited to 'framework/src/domain/perioddayeventmodel.cpp')
-rw-r--r-- | framework/src/domain/perioddayeventmodel.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/framework/src/domain/perioddayeventmodel.cpp b/framework/src/domain/perioddayeventmodel.cpp index 1f08fbd3..af9ca110 100644 --- a/framework/src/domain/perioddayeventmodel.cpp +++ b/framework/src/domain/perioddayeventmodel.cpp | |||
@@ -32,7 +32,9 @@ | |||
32 | #include <entitycache.h> | 32 | #include <entitycache.h> |
33 | 33 | ||
34 | PeriodDayEventModel::PeriodDayEventModel(QObject *parent) | 34 | PeriodDayEventModel::PeriodDayEventModel(QObject *parent) |
35 | : QAbstractItemModel(parent), partitionedEvents(7) | 35 | : QAbstractItemModel(parent), |
36 | partitionedEvents(7), | ||
37 | mCalendarCache{EntityCache<Calendar, Calendar::Color>::Ptr::create()} | ||
36 | { | 38 | { |
37 | updateQuery(); | 39 | updateQuery(); |
38 | } | 40 | } |
@@ -62,15 +64,11 @@ void PeriodDayEventModel::updateQuery() | |||
62 | QObject::connect(eventModel.data(), &QAbstractItemModel::rowsMoved, this, &PeriodDayEventModel::partitionData); | 64 | QObject::connect(eventModel.data(), &QAbstractItemModel::rowsMoved, this, &PeriodDayEventModel::partitionData); |
63 | QObject::connect(eventModel.data(), &QAbstractItemModel::rowsRemoved, this, &PeriodDayEventModel::partitionData); | 65 | QObject::connect(eventModel.data(), &QAbstractItemModel::rowsRemoved, this, &PeriodDayEventModel::partitionData); |
64 | 66 | ||
65 | mCalendarCache = EntityCache<Calendar, Calendar::Color>::Ptr::create(); | ||
66 | |||
67 | partitionData(); | 67 | partitionData(); |
68 | } | 68 | } |
69 | 69 | ||
70 | void PeriodDayEventModel::partitionData() | 70 | void PeriodDayEventModel::partitionData() |
71 | { | 71 | { |
72 | SinkLog() << "Partitioning event data"; | ||
73 | |||
74 | beginResetModel(); | 72 | beginResetModel(); |
75 | 73 | ||
76 | partitionedEvents = QVector<QList<QSharedPointer<Event>>>(mPeriodLength); | 74 | partitionedEvents = QVector<QList<QSharedPointer<Event>>>(mPeriodLength); |
@@ -177,7 +175,11 @@ int PeriodDayEventModel::columnCount(const QModelIndex &parent) const | |||
177 | 175 | ||
178 | QByteArray PeriodDayEventModel::getColor(const QByteArray &calendar) const | 176 | QByteArray PeriodDayEventModel::getColor(const QByteArray &calendar) const |
179 | { | 177 | { |
180 | return mCalendarCache->getProperty(calendar, "color").toByteArray(); | 178 | const auto color = mCalendarCache->getProperty(calendar, "color").toByteArray(); |
179 | if (color.isEmpty()) { | ||
180 | qWarning() << "Failed to get color for calendar " << calendar; | ||
181 | } | ||
182 | return color; | ||
181 | } | 183 | } |
182 | 184 | ||
183 | QDateTime PeriodDayEventModel::getStartTimeOfDay(const QDateTime &dateTime, int day) const | 185 | QDateTime PeriodDayEventModel::getStartTimeOfDay(const QDateTime &dateTime, int day) const |