Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/CategoryEntriesModel.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 43 | QObject* wrapBookEntry(const BookEntry* entry) { | |||
---|---|---|---|---|---|
48 | obj->setProperty("filetitle", entry->filetitle); | 48 | obj->setProperty("filetitle", entry->filetitle); | ||
49 | obj->setProperty("created", entry->created); | 49 | obj->setProperty("created", entry->created); | ||
50 | obj->setProperty("lastOpenedTime", entry->lastOpenedTime); | 50 | obj->setProperty("lastOpenedTime", entry->lastOpenedTime); | ||
51 | obj->setProperty("publisher", entry->publisher); | 51 | obj->setProperty("publisher", entry->publisher); | ||
52 | obj->setProperty("series", entry->series); | 52 | obj->setProperty("series", entry->series); | ||
53 | obj->setProperty("title", entry->title); | 53 | obj->setProperty("title", entry->title); | ||
54 | obj->setProperty("totalPages", entry->totalPages); | 54 | obj->setProperty("totalPages", entry->totalPages); | ||
55 | obj->setProperty("thumbnail", entry->thumbnail); | 55 | obj->setProperty("thumbnail", entry->thumbnail); | ||
56 | obj->setProperty("description", entry->description); | ||||
57 | obj->setProperty("comment", entry->comment); | ||||
58 | obj->setProperty("tags", entry->tags); | ||||
59 | obj->setProperty("rating", QString::number(entry->rating)); | ||||
56 | return obj; | 60 | return obj; | ||
57 | } | 61 | } | ||
58 | }; | 62 | }; | ||
59 | 63 | | |||
60 | CategoryEntriesModel::CategoryEntriesModel(QObject* parent) | 64 | CategoryEntriesModel::CategoryEntriesModel(QObject* parent) | ||
61 | : QAbstractListModel(parent) | 65 | : QAbstractListModel(parent) | ||
62 | , d(new Private(this)) | 66 | , d(new Private(this)) | ||
63 | { | 67 | { | ||
Show All 17 Lines | 78 | { | |||
81 | roles[PublisherRole] = "publisher"; | 85 | roles[PublisherRole] = "publisher"; | ||
82 | roles[CreatedRole] = "created"; | 86 | roles[CreatedRole] = "created"; | ||
83 | roles[LastOpenedTimeRole] = "lastOpenedTime"; | 87 | roles[LastOpenedTimeRole] = "lastOpenedTime"; | ||
84 | roles[TotalPagesRole] = "totalPages"; | 88 | roles[TotalPagesRole] = "totalPages"; | ||
85 | roles[CurrentPageRole] = "currentPage"; | 89 | roles[CurrentPageRole] = "currentPage"; | ||
86 | roles[CategoryEntriesModelRole] = "categoryEntriesModel"; | 90 | roles[CategoryEntriesModelRole] = "categoryEntriesModel"; | ||
87 | roles[CategoryEntryCountRole] = "categoryEntriesCount"; | 91 | roles[CategoryEntryCountRole] = "categoryEntriesCount"; | ||
88 | roles[ThumbnailRole] = "thumbnail"; | 92 | roles[ThumbnailRole] = "thumbnail"; | ||
93 | roles[DescriptionRole] = "description"; | ||||
94 | roles[CommentRole] = "comment"; | ||||
95 | roles[TagsRole] = "tags"; | ||||
96 | roles[RatingRole] = "rating"; | ||||
89 | return roles; | 97 | return roles; | ||
90 | } | 98 | } | ||
91 | 99 | | |||
92 | QVariant CategoryEntriesModel::data(const QModelIndex& index, int role) const | 100 | QVariant CategoryEntriesModel::data(const QModelIndex& index, int role) const | ||
93 | { | 101 | { | ||
94 | QVariant result; | 102 | QVariant result; | ||
95 | if(index.isValid() && index.row() > -1) | 103 | if(index.isValid() && index.row() > -1) | ||
96 | { | 104 | { | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 161 | case CategoryEntriesModelRole: | |||
154 | // Nothing, if we're not equipped with one such... | 162 | // Nothing, if we're not equipped with one such... | ||
155 | break; | 163 | break; | ||
156 | case CategoryEntryCountRole: | 164 | case CategoryEntryCountRole: | ||
157 | result.setValue<int>(0); | 165 | result.setValue<int>(0); | ||
158 | break; | 166 | break; | ||
159 | case ThumbnailRole: | 167 | case ThumbnailRole: | ||
160 | result.setValue(entry->thumbnail); | 168 | result.setValue(entry->thumbnail); | ||
161 | break; | 169 | break; | ||
170 | case DescriptionRole: | ||||
171 | result.setValue(entry->description); | ||||
172 | break; | ||||
173 | case CommentRole: | ||||
174 | result.setValue(entry->comment); | ||||
175 | break; | ||||
176 | case TagsRole: | ||||
177 | result.setValue(entry->tags); | ||||
178 | break; | ||||
179 | case RatingRole: | ||||
180 | result.setValue(entry->rating); | ||||
181 | break; | ||||
162 | default: | 182 | default: | ||
163 | result.setValue(QString("Unknown role")); | 183 | result.setValue(QString("Unknown role")); | ||
164 | break; | 184 | break; | ||
165 | } | 185 | } | ||
166 | } | 186 | } | ||
167 | } | 187 | } | ||
168 | return result; | 188 | return result; | ||
169 | } | 189 | } | ||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 363 | if(QFileInfo::exists(filename)) { | |||
349 | if (data.hasAttribute("peruse.currentPage")) { | 369 | if (data.hasAttribute("peruse.currentPage")) { | ||
350 | int currentPage = data.attribute("peruse.currentPage").toInt(); | 370 | int currentPage = data.attribute("peruse.currentPage").toInt(); | ||
351 | obj->setProperty("currentPage", QVariant::fromValue<int>(currentPage)); | 371 | obj->setProperty("currentPage", QVariant::fromValue<int>(currentPage)); | ||
352 | } | 372 | } | ||
353 | if (data.hasAttribute("peruse.totalPages")) { | 373 | if (data.hasAttribute("peruse.totalPages")) { | ||
354 | int totalPages = data.attribute("peruse.totalPages").toInt(); | 374 | int totalPages = data.attribute("peruse.totalPages").toInt(); | ||
355 | obj->setProperty("totalPages", QVariant::fromValue<int>(totalPages)); | 375 | obj->setProperty("totalPages", QVariant::fromValue<int>(totalPages)); | ||
356 | } | 376 | } | ||
377 | obj->setProperty("rating", QVariant::fromValue<int>(data.rating())); | ||||
378 | if (!data.tags().isEmpty()) { | ||||
379 | obj->setProperty("tags", QVariant::fromValue<QStringList>(data.tags())); | ||||
380 | } | ||||
381 | if (!data.userComment().isEmpty()) { | ||||
382 | obj->setProperty("comment", QVariant::fromValue<QString>(data.userComment())); | ||||
383 | } | ||||
357 | obj->setProperty("filename", filename); | 384 | obj->setProperty("filename", filename); | ||
358 | 385 | | |||
359 | QString thumbnail; | 386 | QString thumbnail; | ||
360 | if(filename.toLower().endsWith("cbr")) { | 387 | if(filename.toLower().endsWith("cbr")) { | ||
361 | thumbnail = QString("image://comiccover/").append(filename); | 388 | thumbnail = QString("image://comiccover/").append(filename); | ||
362 | } | 389 | } | ||
363 | #ifdef USE_PERUSE_PDFTHUMBNAILER | 390 | #ifdef USE_PERUSE_PDFTHUMBNAILER | ||
364 | else if(filename.toLower().endsWith("pdf")) { | 391 | else if(filename.toLower().endsWith("pdf")) { | ||
Show All 29 Lines |