From a1d3f20439bc04a595d72ee853bbb1580c285409 Mon Sep 17 00:00:00 2001 From: Digital Artifex <7929434+DigitalArtifex@users.noreply.github.com> Date: Sat, 15 Aug 2026 09:54:01 -0400 Subject: [PATCH] Added missing page functions --- KomplexHubPlugin/featuredimagesmodel.cpp | 20 ++++++++++++++++++++ KomplexHubPlugin/featuredimagesmodel.h | 16 ++++++++++++++++ KomplexHubPlugin/featuredpacksmodel.cpp | 20 ++++++++++++++++++++ KomplexHubPlugin/featuredpacksmodel.h | 16 ++++++++++++++++ KomplexHubPlugin/featuredvideosmodel.cpp | 20 ++++++++++++++++++++ KomplexHubPlugin/featuredvideosmodel.h | 16 ++++++++++++++++ KomplexHubPlugin/newestpacksmodel.cpp | 21 +++++++++++++++++++++ KomplexHubPlugin/newestpacksmodel.h | 16 ++++++++++++++++ 8 files changed, 145 insertions(+) diff --git a/KomplexHubPlugin/featuredimagesmodel.cpp b/KomplexHubPlugin/featuredimagesmodel.cpp index 9a1e213..78998b9 100644 --- a/KomplexHubPlugin/featuredimagesmodel.cpp +++ b/KomplexHubPlugin/featuredimagesmodel.cpp @@ -343,3 +343,23 @@ auto FeaturedImagesModel::totalPages() const -> qsizetype return 0; } + +auto FeaturedImagesModel::hasNextPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() < m_paginator->totalPages(); +} + +auto FeaturedImagesModel::hasPreviousPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() > 0; +} diff --git a/KomplexHubPlugin/featuredimagesmodel.h b/KomplexHubPlugin/featuredimagesmodel.h index cf2e336..0e36785 100644 --- a/KomplexHubPlugin/featuredimagesmodel.h +++ b/KomplexHubPlugin/featuredimagesmodel.h @@ -213,6 +213,20 @@ public: */ Q_INVOKABLE auto previousPage() -> void; + /** + * @brief hasNextPage + * Calculates if there are more pages based on the current page calculation + * @return + */ + auto hasNextPage() const -> bool; + + /** + * @brief hasPreviousPage + * If page is greater than 1, returns true + * @return + */ + auto hasPreviousPage() const -> bool; + protected: /** * @brief setErrorString @@ -343,6 +357,8 @@ private: Q_PROPERTY(qsizetype resultsPerPage READ resultsPerPage WRITE setResultsPerPage NOTIFY resultsPerPageChanged FINAL) Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL) + Q_PROPERTY(bool hasNextPage READ hasNextPage NOTIFY pageChanged FINAL) + Q_PROPERTY(bool hasPreviousPage READ hasPreviousPage NOTIFY pageChanged FINAL) Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL) }; Q_DECLARE_METATYPE(FeaturedImagesModel) diff --git a/KomplexHubPlugin/featuredpacksmodel.cpp b/KomplexHubPlugin/featuredpacksmodel.cpp index de2a415..b98b700 100644 --- a/KomplexHubPlugin/featuredpacksmodel.cpp +++ b/KomplexHubPlugin/featuredpacksmodel.cpp @@ -311,6 +311,26 @@ auto FeaturedPacksModel::previousPage() -> void } } +auto FeaturedPacksModel::hasNextPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() < m_paginator->totalPages(); +} + +auto FeaturedPacksModel::hasPreviousPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() > 0; +} + qsizetype FeaturedPacksModel::page() const { if(m_paginator != nullptr) diff --git a/KomplexHubPlugin/featuredpacksmodel.h b/KomplexHubPlugin/featuredpacksmodel.h index 24ae662..b2998cc 100644 --- a/KomplexHubPlugin/featuredpacksmodel.h +++ b/KomplexHubPlugin/featuredpacksmodel.h @@ -208,6 +208,20 @@ public: */ Q_INVOKABLE auto previousPage() -> void; + /** + * @brief hasNextPage + * Calculates if there are more pages based on the current page calculation + * @return + */ + auto hasNextPage() const -> bool; + + /** + * @brief hasPreviousPage + * If page is greater than 1, returns true + * @return + */ + auto hasPreviousPage() const -> bool; + protected: /** * @brief setErrorString @@ -310,6 +324,8 @@ private: Q_PROPERTY(qsizetype resultsPerPage READ resultsPerPage WRITE setResultsPerPage NOTIFY resultsPerPageChanged FINAL) Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL) + Q_PROPERTY(bool hasNextPage READ hasNextPage NOTIFY pageChanged FINAL) + Q_PROPERTY(bool hasPreviousPage READ hasPreviousPage NOTIFY pageChanged FINAL) Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL) }; Q_DECLARE_METATYPE(FeaturedPacksModel) diff --git a/KomplexHubPlugin/featuredvideosmodel.cpp b/KomplexHubPlugin/featuredvideosmodel.cpp index b6baa12..b390e07 100644 --- a/KomplexHubPlugin/featuredvideosmodel.cpp +++ b/KomplexHubPlugin/featuredvideosmodel.cpp @@ -365,3 +365,23 @@ auto FeaturedVideosModel::totalPages() const -> qsizetype return 0; } + +auto FeaturedVideosModel::hasNextPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() < m_paginator->totalPages(); +} + +auto FeaturedVideosModel::hasPreviousPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() > 0; +} diff --git a/KomplexHubPlugin/featuredvideosmodel.h b/KomplexHubPlugin/featuredvideosmodel.h index b2546b8..c3b073d 100644 --- a/KomplexHubPlugin/featuredvideosmodel.h +++ b/KomplexHubPlugin/featuredvideosmodel.h @@ -231,6 +231,20 @@ public: */ auto setWindowSize(qsizetype size) -> void; + /** + * @brief hasNextPage + * Calculates if there are more pages based on the current page calculation + * @return + */ + auto hasNextPage() const -> bool; + + /** + * @brief hasPreviousPage + * If page is greater than 1, returns true + * @return + */ + auto hasPreviousPage() const -> bool; + protected: /** * @brief setErrorString @@ -327,6 +341,8 @@ private: Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL) Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL) + Q_PROPERTY(bool hasNextPage READ hasNextPage NOTIFY pageChanged FINAL) + Q_PROPERTY(bool hasPreviousPage READ hasPreviousPage NOTIFY pageChanged FINAL) Q_PROPERTY(VideoItemModel *itemModel READ itemModel CONSTANT FINAL) Q_PROPERTY(qsizetype windowSize READ windowSize WRITE setWindowSize NOTIFY windowSizeChanged FINAL) }; diff --git a/KomplexHubPlugin/newestpacksmodel.cpp b/KomplexHubPlugin/newestpacksmodel.cpp index 058d7d6..9614da5 100644 --- a/KomplexHubPlugin/newestpacksmodel.cpp +++ b/KomplexHubPlugin/newestpacksmodel.cpp @@ -320,3 +320,24 @@ auto NewestPacksModel::totalPages() const -> qsizetype return 0; } + +auto NewestPacksModel::hasNextPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() < m_paginator->totalPages(); + +} + +auto NewestPacksModel::hasPreviousPage() const -> bool +{ + if(m_paginator == nullptr) + { + return false; + } + + return m_paginator->page() > 0; +} diff --git a/KomplexHubPlugin/newestpacksmodel.h b/KomplexHubPlugin/newestpacksmodel.h index 70ecd71..f489f7a 100644 --- a/KomplexHubPlugin/newestpacksmodel.h +++ b/KomplexHubPlugin/newestpacksmodel.h @@ -215,6 +215,20 @@ public: */ Q_INVOKABLE auto previousPage() const -> void; + /** + * @brief hasNextPage + * Calculates if there are more pages based on the current page calculation + * @return + */ + auto hasNextPage() const -> bool; + + /** + * @brief hasPreviousPage + * If page is greater than 1, returns true + * @return + */ + auto hasPreviousPage() const -> bool; + protected: /** * @brief setErrorString @@ -321,6 +335,8 @@ private: Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL) Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL) + Q_PROPERTY(bool hasNextPage READ hasNextPage NOTIFY pageChanged FINAL) + Q_PROPERTY(bool hasPreviousPage READ hasPreviousPage NOTIFY pageChanged FINAL) }; Q_DECLARE_METATYPE(NewestPacksModel)