| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/core/articlelistnotificationmodel.cpp`/ |
| 2 | |
| 3 | #include "core/articlelistnotificationmodel.h"cxx . . $ `<file>/src/librssguard/core/articlelistnotificationmodel.h`/ |
| 4 | |
| 5 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 6 | #include "exceptions/applicationexception.h"cxx . . $ `<file>/src/librssguard/exceptions/applicationexception.h`/ |
| 7 | |
| 8 | ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#ArticleListNotificationModel(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent) |
| 9 | : QAbstractListModelcxx . . $ QAbstractListModel#(parent), m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage.(-1) {} |
| 10 | |
| 11 | ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::~cxx . . $ ArticleListNotificationModel#`~ArticleListNotificationModel`(ced63f7c635d850d).ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#() {} |
| 12 | |
| 13 | void ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::setArticlescxx . . $ ArticleListNotificationModel#setArticles(2ca5a41c5027f22d).(const QListcxx . . $ QList#<Messagecxx . . $ Message#>& msgs) { |
| 14 | m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage. = 0; |
| 15 | m_articlescxx . . $ ArticleListNotificationModel#m_articles. =cxx . . $ QList#`operator=`(cb46be8144a80dbf). msgs; |
| 16 | |
| 17 | reloadWholeLayoutcxx . . $ ArticleListNotificationModel#reloadWholeLayout(49f6e7a06ebc5aa8).(); |
| 18 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! nextPagePossibleChangedcxx . . $ ArticleListNotificationModel#nextPagePossibleChanged(b45ddcbc8423892c).(nextPageAvailablecxx . . $ ArticleListNotificationModel#nextPageAvailable(50ce9a9e25b4a850).()); |
| 19 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! previousPagePossibleChangedcxx . . $ ArticleListNotificationModel#previousPagePossibleChanged(b45ddcbc8423892c).(previousPageAvailablecxx . . $ ArticleListNotificationModel#previousPageAvailable(50ce9a9e25b4a850).()); |
| 20 | } |
| 21 | |
| 22 | Messagecxx . . $ Message# ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::messagecxx . . $ ArticleListNotificationModel#message(a029b2e5d25672da).(const QModelIndexcxx . . $ QModelIndex#& idx) const { |
| 23 | int list_position = (m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage. * NOTIFICATIONS_PAGE_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:109:9`!) + idx.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).(); |
| 24 | |
| 25 | if (list_position < 0 || list_position >= m_articlescxx . . $ ArticleListNotificationModel#m_articles..sizecxx . . $ QList#size(6b0412d51016192f).()) { |
| 26 | throw ApplicationExceptioncxx . . $ ApplicationException#(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("message cannot be loaded, wrong index")); |
| 27 | } |
| 28 | |
| 29 | return m_articlescxx . . $ ArticleListNotificationModel#m_articles..atcxx . . $ QList#at(c7965f769b39929).(list_position); |
| 30 | } |
| 31 | |
| 32 | void ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::nextPagecxx . . $ ArticleListNotificationModel#nextPage(49f6e7a06ebc5aa8).() { |
| 33 | m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage.++; |
| 34 | reloadWholeLayoutcxx . . $ ArticleListNotificationModel#reloadWholeLayout(49f6e7a06ebc5aa8).(); |
| 35 | |
| 36 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! nextPagePossibleChangedcxx . . $ ArticleListNotificationModel#nextPagePossibleChanged(b45ddcbc8423892c).(nextPageAvailablecxx . . $ ArticleListNotificationModel#nextPageAvailable(50ce9a9e25b4a850).()); |
| 37 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! previousPagePossibleChangedcxx . . $ ArticleListNotificationModel#previousPagePossibleChanged(b45ddcbc8423892c).(previousPageAvailablecxx . . $ ArticleListNotificationModel#previousPageAvailable(50ce9a9e25b4a850).()); |
| 38 | } |
| 39 | |
| 40 | void ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::previousPagecxx . . $ ArticleListNotificationModel#previousPage(49f6e7a06ebc5aa8).() { |
| 41 | m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage.--; |
| 42 | reloadWholeLayoutcxx . . $ ArticleListNotificationModel#reloadWholeLayout(49f6e7a06ebc5aa8).(); |
| 43 | |
| 44 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! nextPagePossibleChangedcxx . . $ ArticleListNotificationModel#nextPagePossibleChanged(b45ddcbc8423892c).(nextPageAvailablecxx . . $ ArticleListNotificationModel#nextPageAvailable(50ce9a9e25b4a850).()); |
| 45 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! previousPagePossibleChangedcxx . . $ ArticleListNotificationModel#previousPagePossibleChanged(b45ddcbc8423892c).(previousPageAvailablecxx . . $ ArticleListNotificationModel#previousPageAvailable(50ce9a9e25b4a850).()); |
| 46 | } |
| 47 | |
| 48 | int ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::rowCountcxx . . $ ArticleListNotificationModel#rowCount(e3878d4d6cd9529c).(const QModelIndexcxx . . $ QModelIndex#& parent) const { |
| 49 | return stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(int(m_articlescxx . . $ ArticleListNotificationModel#m_articles..sizecxx . . $ QList#size(6b0412d51016192f).() - (NOTIFICATIONS_PAGE_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:109:9`! * m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage.)), NOTIFICATIONS_PAGE_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:109:9`!); |
| 50 | } |
| 51 | |
| 52 | int ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::columnCountcxx . . $ ArticleListNotificationModel#columnCount(e3878d4d6cd9529c).(const QModelIndexcxx . . $ QModelIndex#& parent) const { |
| 53 | return 1; |
| 54 | } |
| 55 | |
| 56 | QVariantcxx . . $ QVariant# ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::datacxx . . $ ArticleListNotificationModel#data(69b5b18a001c0029).(const QModelIndexcxx . . $ QModelIndex#& index, int role) const { |
| 57 | switch (role) { |
| 58 | case Qtcxx . . $ Qt/::ItemDataRolecxx . . $ Qt/ItemDataRole#::DisplayRolecxx . . $ Qt/DisplayRole.: |
| 59 | case Qtcxx . . $ Qt/::ItemDataRolecxx . . $ Qt/ItemDataRole#::ToolTipRolecxx . . $ Qt/ToolTipRole.: |
| 60 | return m_articlescxx . . $ QVariant#QVariant(132dd6869045752b)..atcxx . . $ QList#at(c7965f769b39929).((m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage. * NOTIFICATIONS_PAGE_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:109:9`!) + index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).()).m_titlecxx . . $ Message#m_title.; |
| 61 | } |
| 62 | |
| 63 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 64 | } |
| 65 | |
| 66 | void ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::reloadWholeLayoutcxx . . $ ArticleListNotificationModel#reloadWholeLayout(49f6e7a06ebc5aa8).() { |
| 67 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! layoutAboutToBeChangedcxx . . $ QAbstractItemModel#layoutAboutToBeChanged(17ff3201f1a6fa68).(); |
| 68 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! layoutChangedcxx . . $ QAbstractItemModel#layoutChanged(17ff3201f1a6fa68).(); |
| 69 | } |
| 70 | |
| 71 | bool ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::nextPageAvailablecxx . . $ ArticleListNotificationModel#nextPageAvailable(50ce9a9e25b4a850).() const { |
| 72 | return m_articlescxx . . $ ArticleListNotificationModel#m_articles..sizecxx . . $ QList#size(6b0412d51016192f).() - (NOTIFICATIONS_PAGE_SIZEcxx . . $ `src/librssguard/definitions/definitions.h:109:9`! * (m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage. + 1)) > 0; |
| 73 | } |
| 74 | |
| 75 | bool ArticleListNotificationModelcxx . . $ ArticleListNotificationModel#::previousPageAvailablecxx . . $ ArticleListNotificationModel#previousPageAvailable(50ce9a9e25b4a850).() const { |
| 76 | return m_currentPagecxx . . $ ArticleListNotificationModel#m_currentPage. > 0; |
| 77 | } |