Compare commits

11 Commits

Author SHA1 Message Date
Digital Artifex a776997119 General update 2026-08-15 10:01:22 -04:00
Digital Artifex f69ba41046 Removed unused code 2026-08-15 10:00:44 -04:00
Digital Artifex 6b7812fa50 Fixed Featured views 2026-08-15 09:59:58 -04:00
Digital Artifex bb58c8a9d2 Fixed dangling shared pointer 2026-08-15 09:59:05 -04:00
Digital Artifex 4a7960177d Changed queryable visibility 2026-08-15 09:58:35 -04:00
Digital Artifex 9fbf90b0c9 Updated endpoint references 2026-08-15 09:57:30 -04:00
Digital Artifex bb4e3c7562 Added missing setErrorString 2026-08-15 09:56:08 -04:00
Digital Artifex 7f86e1105d Fixed hex reference 2026-08-15 09:55:46 -04:00
Digital Artifex 0f2e237fe6 Added sessionToken reference 2026-08-15 09:55:17 -04:00
Digital Artifex 5deb869c2c Fixed window size math for non-default sizes 2026-08-15 09:54:51 -04:00
Digital Artifex a1d3f20439 Added missing page functions 2026-08-15 09:54:01 -04:00
28 changed files with 488 additions and 227 deletions
+74 -35
View File
@@ -11,7 +11,8 @@ Rectangle
{ {
id: rootItem id: rootItem
readonly property bool searchable: false property string query
readonly property bool searchable: paginator.searchable
property bool popup: false property bool popup: false
property int resultWidth: 256 property int resultWidth: 256
property int resultHeight: 245 property int resultHeight: 245
@@ -20,18 +21,54 @@ Rectangle
FeaturedImagesModel FeaturedImagesModel
{ {
id: imagesModel id: searchModel
//query: rootItem.query
resultsPerPage: paginator.resultsPerPage resultsPerPage: paginator.resultsPerPage
// windowSize: 80
Component.onCompleted: () => nextPage()
}
ColumnLayout
{
id: resultsLayout
visible: opacity > 0.01
anchors.fill: parent
anchors.margins: Constants.mediumMargin
Text
{
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
color: palette.text
font.pixelSize: Constants.h2Font.pixelSize
font.bold: true
text: qsTr("Featured Images")
verticalAlignment: Qt.AlignVCenter
}
Text
{
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
color: palette.text
font.pixelSize: Constants.h4Font.pixelSize
font.bold: true
text: qsTr("A specially curated collection of images, courtesy of Pexels")
verticalAlignment: Qt.AlignVCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
} }
PaginatorGrid PaginatorGrid
{ {
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.fillWidth: true
id: paginator id: paginator
anchors.fill: parent model: searchModel
model: imagesModel loading: model.state === FeaturedImagesModel.Loading
loading: imagesModel.state === FeaturedImagesModel.Loading
visible: opacity > 0.01
delegate: ItemDelegate delegate: ItemDelegate
{ {
@@ -40,18 +77,18 @@ Rectangle
width: resultWidth width: resultWidth
height: resultHeight height: resultHeight
required property string uuid
required property string author required property string author
required property string authorId required property string description
required property string authorUrl required property string uuid
required property string thumbnail required property string thumbnail
required property string authorId
required property int index required property int index
SearchResultItem SearchResultItem
{ {
anchors.fill: parent anchors.fill: parent
author: parent.author title: parent.author
description: qsTr("No description available") description: parent.description
thumbnail: parent.thumbnail thumbnail: parent.thumbnail
uuid: parent.uuid uuid: parent.uuid
pexels: true pexels: true
@@ -61,7 +98,8 @@ Rectangle
onViewMoreTriggered: () => onViewMoreTriggered: () =>
{ {
showVideoPopup(parent.index) showImagePopup(parent.index)
}
} }
} }
} }
@@ -77,12 +115,12 @@ Rectangle
ImageView ImageView
{ {
id: imageDetailsPopup id: viewMoreImagePopup
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01
Behavior on opacity Behavior on opacity {
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
@@ -90,8 +128,7 @@ Rectangle
} }
} }
Behavior on opacity Behavior on opacity {
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
@@ -99,31 +136,33 @@ Rectangle
} }
} }
Component.onCompleted: () => function showImagePopup(index)
{ {
imagesModel.nextPage() viewMoreImagePopup.author = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.AuthorRole)
} viewMoreImagePopup.authorUrl = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.AuthorUrlRole)
viewMoreImagePopup.description = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.DescriptionRole)
function showVideoPopup(index) viewMoreImagePopup.uuid = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.UuidRole)
{ viewMoreImagePopup.thumbnail = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LargeThumbnailRole)
imagesModel.setItem(index) viewMoreImagePopup.original = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.OriginalUrlRole)
imageDetailsPopup.author = searchModel.data(searchModel.index(index,0), ImageSearchModel.AuthorRole) viewMoreImagePopup.portrait = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.PortraitUrlRole)
imageDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), ImageSearchModel.AuthorUrlRole) viewMoreImagePopup.landscape = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LandscapeUrlRole)
imageDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), ImageSearchModel.UuidRole) viewMoreImagePopup.backgroundPortrait = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.BackgroundPortraitRole)
imageDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), ImageSearchModel.ThumbnailRole) viewMoreImagePopup.backgroundLandscape = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.BackgroundLandscapeRole)
imageDetailsPopup.modelIndex = index viewMoreImagePopup.fullScreen = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ScreenUrlRole)
imageDetailsPopup.model = searchModel.itemModel viewMoreImagePopup.portraitSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.PortraitSizeRole)
imageDetailsPopup.opacity = 1 viewMoreImagePopup.landscapeSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LandscapeSizeRole)
paginator.opacity = 0 viewMoreImagePopup.fullScreenSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ScreenSizeRole)
viewMoreImagePopup.opacity = 1
popupContainer.opacity = 1 popupContainer.opacity = 1
resultsLayout.opacity = 0
rootItem.popup = true rootItem.popup = true
} }
function closePopup() function closePopup()
{ {
imageDetailsPopup.opacity = 0 viewMoreImagePopup.opacity = 0
popupContainer.opacity = 0 popupContainer.opacity = 0
paginator.opacity = 1 resultsLayout.opacity = 1
rootItem.popup = false rootItem.popup = false
} }
} }
+67 -38
View File
@@ -11,6 +11,7 @@ Rectangle
{ {
id: rootItem id: rootItem
property string query
readonly property bool searchable: false readonly property bool searchable: false
property bool popup: false property bool popup: false
property int resultWidth: 256 property int resultWidth: 256
@@ -18,20 +19,55 @@ Rectangle
color: palette.base color: palette.base
FeaturedPacksModel NewestPacksModel
{ {
id: packsModel id: packsModel
resultsPerPage: paginator.resultsPerPage resultsPerPage: paginator.resultsPerPage
// windowSize: 80
Component.onCompleted: () => nextPage()
}
ColumnLayout
{
id: resultsLayout
visible: opacity > 0.01
anchors.fill: parent
anchors.margins: Constants.mediumMargin
Text
{
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
color: palette.text
font.pixelSize: Constants.h2Font.pixelSize
font.bold: true
text: qsTr("Featured Images")
verticalAlignment: Qt.AlignVCenter
}
Text
{
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
color: palette.text
font.pixelSize: Constants.h4Font.pixelSize
font.bold: true
text: qsTr("Newest packs submitted to Komplex.dev")
verticalAlignment: Qt.AlignVCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
} }
PaginatorGrid PaginatorGrid
{ {
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.fillWidth: true
id: paginator id: paginator
anchors.fill: parent
model: packsModel model: packsModel
loading: packsModel.state === FeaturedPacksModel.Loading loading: model.state === NewestPacksModel.Loading
visible: opacity > 0.01
delegate: ItemDelegate delegate: ItemDelegate
{ {
@@ -40,28 +76,30 @@ Rectangle
width: resultWidth width: resultWidth
height: resultHeight height: resultHeight
required property string uuid required property string name
required property string author required property string author
required property string authorId required property string description
required property string authorUrl required property string uuid
required property string thumbnail required property string thumbnail
required property string authorId
required property int index required property int index
SearchResultItem SearchResultItem
{ {
anchors.fill: parent anchors.fill: parent
title: parent.name
author: parent.author author: parent.author
description: qsTr("No description available") description: parent.description
thumbnail: parent.thumbnail thumbnail: parent.thumbnail
uuid: parent.uuid uuid: parent.uuid
pexels: true
selected: paginator.currentIndex === parent.index selected: paginator.currentIndex === parent.index
onTriggered: () => paginator.currentIndex = parent.index onTriggered: () => paginator.currentIndex = parent.index
onViewMoreTriggered: () => onViewMoreTriggered: () =>
{ {
showVideoPopup(parent.index) showWallpaperPopup(parent.index)
}
} }
} }
} }
@@ -77,12 +115,12 @@ Rectangle
PackView PackView
{ {
id: packDetailsPopup id: viewMoreWallpaperPopup
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01
Behavior on opacity Behavior on opacity {
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
@@ -90,8 +128,7 @@ Rectangle
} }
} }
Behavior on opacity Behavior on opacity {
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
@@ -99,31 +136,23 @@ Rectangle
} }
} }
Component.onCompleted: () =>
{
packsModel.nextPage()
}
function showVideoPopup(index)
{
packsModel.setItem(index)
packDetailsPopup.author = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorRole)
packDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorUrlRole)
packDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), VideoSearchModel.UuidRole)
packDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), VideoSearchModel.ThumbnailRole)
packDetailsPopup.modelIndex = index
packDetailsPopup.model = searchModel.itemModel
packDetailsPopup.opacity = 1
paginator.opacity = 0
popupContainer.opacity = 1
rootItem.popup = true
}
function closePopup() function closePopup()
{ {
packDetailsPopup.opacity = 0 viewMoreWallpaperPopup.opacity = 0
popupContainer.opacity = 0 popupContainer.opacity = 0
paginator.opacity = 1 resultsLayout.opacity = 1
rootItem.popup = false rootItem.popup = false
} }
function showWallpaperPopup(index)
{
viewMoreWallpaperPopup.author = packsModel.data(packsModel.index(index,0), NewestPacksModel.AuthorRole)
viewMoreWallpaperPopup.authorId = packsModel.data(packsModel.index(index,0), NewestPacksModel.AuthorIdRole)
viewMoreWallpaperPopup.description = packsModel.data(packsModel.index(index,0), NewestPacksModel.DescriptionRole)
viewMoreWallpaperPopup.thumbnail = packsModel.data(packsModel.index(index,0), NewestPacksModel.ThumbnailRole)
viewMoreWallpaperPopup.opacity = 1
popupContainer.opacity = 1
resultsLayout.opacity = 0
rootItem.popup = true
}
} }
+41 -4
View File
@@ -25,10 +25,45 @@ Rectangle
windowSize: 80 windowSize: 80
} }
ColumnLayout
{
id: resultsLayout
visible: opacity > 0.01
anchors.fill: parent
anchors.margins: Constants.mediumMargin
Text
{
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
color: palette.text
font.pixelSize: Constants.h2Font.pixelSize
font.bold: true
text: qsTr("Most Popular Videos")
verticalAlignment: Qt.AlignVCenter
}
Text
{
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: 50
color: palette.text
font.pixelSize: Constants.h4Font.pixelSize
font.bold: true
text: qsTr("Most popular videos, provided courtesy of Pexels")
verticalAlignment: Qt.AlignVCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
PaginatorGrid PaginatorGrid
{ {
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.fillWidth: true
id: paginator id: paginator
anchors.fill: parent
model: videosModel model: videosModel
loading: videosModel.state === FeaturedVideosModel.Loading loading: videosModel.state === FeaturedVideosModel.Loading
visible: opacity > 0.01 visible: opacity > 0.01
@@ -51,7 +86,7 @@ Rectangle
{ {
anchors.fill: parent anchors.fill: parent
author: parent.author author: parent.author
description: qsTr("No description available") description: qsTr("")
thumbnail: parent.thumbnail thumbnail: parent.thumbnail
uuid: parent.uuid uuid: parent.uuid
pexels: true pexels: true
@@ -66,6 +101,7 @@ Rectangle
} }
} }
} }
}
Rectangle Rectangle
{ {
@@ -80,6 +116,7 @@ Rectangle
id: videoDetailsPopup id: videoDetailsPopup
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01
Behavior on opacity Behavior on opacity
{ {
@@ -114,7 +151,7 @@ Rectangle
videoDetailsPopup.modelIndex = index videoDetailsPopup.modelIndex = index
videoDetailsPopup.model = searchModel.itemModel videoDetailsPopup.model = searchModel.itemModel
videoDetailsPopup.opacity = 1 videoDetailsPopup.opacity = 1
paginator.opacity = 0 resultsLayout.opacity = 0
popupContainer.opacity = 1 popupContainer.opacity = 1
rootItem.popup = true rootItem.popup = true
} }
@@ -123,7 +160,7 @@ Rectangle
{ {
videoDetailsPopup.opacity = 0 videoDetailsPopup.opacity = 0
popupContainer.opacity = 0 popupContainer.opacity = 0
paginator.opacity = 1 resultsLayout.opacity = 1
rootItem.popup = false rootItem.popup = false
} }
} }
+49 -25
View File
@@ -282,7 +282,6 @@ Item
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01 visible: opacity > 0.01
//model: videosModel.itemModel
Behavior on opacity { Behavior on opacity {
NumberAnimation NumberAnimation
@@ -298,7 +297,6 @@ Item
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01 visible: opacity > 0.01
//model: videosModel.itemModel
Behavior on opacity { Behavior on opacity {
NumberAnimation NumberAnimation
@@ -316,12 +314,15 @@ Item
} }
} }
Component
{
id: featuredVideosComponent
FeaturedVideosPage FeaturedVideosPage
{ {
id: featuredVideosPage id: featuredVideosPage
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01
Behavior on opacity { Behavior on opacity {
NumberAnimation NumberAnimation
@@ -329,36 +330,68 @@ Item
duration: 250 duration: 250
} }
} }
Component.onCompleted: () => featuredVideosPage.opacity = 1
} }
}
Component
{
id: featuredPacksComponent
FeaturedPacksPage FeaturedPacksPage
{ {
id: featuredPacksPage id: featuredPacksPage
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01
Behavior on opacity { Behavior on opacity
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
} }
} }
Component.onCompleted: () => featuredPacksPage.opacity = 1
} }
}
Component
{
id: featuredImagesComponent
FeaturedImagesPage FeaturedImagesPage
{ {
id: featuredImagesPage id: featuredImagesPage
anchors.fill: parent anchors.fill: parent
opacity: 0 opacity: 0
visible: opacity > 0.01
Behavior on opacity { Behavior on opacity
{
NumberAnimation NumberAnimation
{ {
duration: 250 duration: 250
} }
} }
Component.onCompleted: () => featuredImagesPage.opacity = 1
}
}
Item
{
id: featuredLoaderItem
anchors.fill: parent
opacity: 0
visible: opacity > 0.01
enabled: visible
Loader
{
id: featuredLoader
anchors.fill: parent
}
} }
states: [ states: [
@@ -427,21 +460,24 @@ Item
function showFeaturedVideosPage() function showFeaturedVideosPage()
{ {
resultsLayout.opacity = 0 resultsLayout.opacity = 0
featuredVideosPage.opacity = 1 featuredLoaderItem.opacity = 1
featuredLoader.sourceComponent = featuredVideosComponent
popup = true popup = true
} }
function showFeaturedPacksPage() function showFeaturedPacksPage()
{ {
resultsLayout.opacity = 0 resultsLayout.opacity = 0
featuredPacksPage.opacity = 1 featuredLoaderItem.opacity = 1
featuredLoader.sourceComponent = featuredPacksComponent
popup = true popup = true
} }
function showFeaturedImagesPage() function showFeaturedImagesPage()
{ {
resultsLayout.opacity = 0 resultsLayout.opacity = 0
featuredImagesPage.opacity = 1 featuredLoaderItem.opacity = 1
featuredLoader.sourceComponent = featuredImagesComponent
popup = true popup = true
} }
@@ -496,25 +532,13 @@ Item
function closePopup() function closePopup()
{ {
if(featuredVideosPage.popup) if(featuredLoader.item && featuredLoader.item.popup)
{ {
featuredVideosPage.closePopup() featuredLoader.item.closePopup()
return
}
if(featuredImagesPage.popup)
{
featuredImagesPage.closePopup()
return
}
if(featuredPacksPage.popup)
{
featuredPacksPage.closePopup()
return return
} }
featuredVideosPage.opacity = 0 featuredLoaderItem.opacity = 0
featuredImagesPage.opacity = 0
featuredPacksPage.opacity = 0
viewMoreImagePopup.opacity = 0 viewMoreImagePopup.opacity = 0
viewMoreVideoPopup.opacity = 0 viewMoreVideoPopup.opacity = 0
viewMoreWallpaperPopup.opacity = 0 viewMoreWallpaperPopup.opacity = 0
+4 -3
View File
@@ -33,8 +33,8 @@ Item
{ {
id: resultDelegate id: resultDelegate
width: 256 width: resultWidth
height: 245 height: resultHeight
required property string name required property string name
required property string author required property string author
@@ -47,7 +47,8 @@ Item
SearchResultItem SearchResultItem
{ {
anchors.fill: parent anchors.fill: parent
title: parent.author title: parent.name
author: parent.author
description: parent.description description: parent.description
thumbnail: parent.thumbnail thumbnail: parent.thumbnail
uuid: parent.uuid uuid: parent.uuid
@@ -47,8 +47,6 @@ Item
height: 245 height: 245
color: palette.accent color: palette.accent
radius: 5 radius: 5
// x: resultsView.currentItem.x
// y: resultsView.currentItem.y
Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } } Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } }
Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } } Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } }
} }
+2 -5
View File
@@ -1,5 +1,6 @@
#include "coreservices.h" #include "coreservices.h"
#include "logging.h" #include "logging.h"
#include "userservices.h"
QNetworkAccessManager *CoreServices::s_networkAccessManager = nullptr; QNetworkAccessManager *CoreServices::s_networkAccessManager = nullptr;
QMutex CoreServices::s_networkAccessMutex; QMutex CoreServices::s_networkAccessMutex;
@@ -45,11 +46,7 @@ auto CoreServices::networkAccessManager() -> QWeakPointer<QNetworkAccessManager>
auto CoreServices::sessionToken() -> QByteArray auto CoreServices::sessionToken() -> QByteArray
{ {
LOG_ERROR_X(true, return UserServices::userCredentials().sessionToken;
"CoreServices::sessionToken",
"User services not yet implemented",
{}
);
} }
auto CoreServices::screenSize() -> QSize auto CoreServices::screenSize() -> QSize
+5
View File
@@ -133,3 +133,8 @@ auto QWallet::errorString() const -> const QString &
{ {
return m_errorString; return m_errorString;
} }
auto QWallet::setErrorString(const QString &errorString) const -> void
{
m_errorString = errorString;
}
@@ -337,14 +337,17 @@ private:
return false; return false;
} }
qsizetype windowSize = this->windowSize(); qsizetype prefetchThreshold = SLIDING_CACHE_PREFETCH_THRESHOLD;
if(windowSize == 0) if(prefetchThreshold >= windowSize())
{ {
windowSize = SLIDING_CACHE_WINDOW_SIZE; prefetchThreshold = std::floor
(
static_cast<qreal>(windowSize()) * 0.8
);
} }
while (index >= m_windowOffset + (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD)) while (index >= m_windowOffset + (windowSize() - prefetchThreshold))
{ {
if(!slideForward()) if(!slideForward())
{ {
@@ -414,7 +417,7 @@ private:
m_windowOffset = 0; m_windowOffset = 0;
} }
QThread::sleep(KOMPLEX_RATE_LIMIT); // QThread::sleep(KOMPLEX_RATE_LIMIT);
FetchResult<T> result = m_fetch( FetchResult<T> result = m_fetch(
m_windowOffset, m_windowOffset,
@@ -497,7 +500,7 @@ private:
false false
); );
QThread::sleep(KOMPLEX_RATE_LIMIT); // QThread::sleep(KOMPLEX_RATE_LIMIT);
m_windowOffset -= movementSize; m_windowOffset -= movementSize;
+1 -1
View File
@@ -83,7 +83,7 @@ private:
QString m_errorString; QString m_errorString;
inline static UserCredentials s_userCredentials; inline static UserCredentials s_userCredentials;
inline const static char PART_SEPARATOR = static_cast<char>('\0x1f'); inline const static char PART_SEPARATOR = static_cast<char>('\x1f');
Q_PROPERTY(UserCredentials userCredentials READ userCredentials NOTIFY userCredentialsChanged FINAL) Q_PROPERTY(UserCredentials userCredentials READ userCredentials NOTIFY userCredentialsChanged FINAL)
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL) Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
+20
View File
@@ -343,3 +343,23 @@ auto FeaturedImagesModel::totalPages() const -> qsizetype
return 0; 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;
}
+16
View File
@@ -213,6 +213,20 @@ public:
*/ */
Q_INVOKABLE auto previousPage() -> void; 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: protected:
/** /**
* @brief setErrorString * @brief setErrorString
@@ -343,6 +357,8 @@ private:
Q_PROPERTY(qsizetype resultsPerPage READ resultsPerPage WRITE setResultsPerPage NOTIFY resultsPerPageChanged FINAL) Q_PROPERTY(qsizetype resultsPerPage READ resultsPerPage WRITE setResultsPerPage NOTIFY resultsPerPageChanged FINAL)
Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL)
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged 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_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL)
}; };
Q_DECLARE_METATYPE(FeaturedImagesModel) Q_DECLARE_METATYPE(FeaturedImagesModel)
+20
View File
@@ -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 qsizetype FeaturedPacksModel::page() const
{ {
if(m_paginator != nullptr) if(m_paginator != nullptr)
+16
View File
@@ -208,6 +208,20 @@ public:
*/ */
Q_INVOKABLE auto previousPage() -> void; 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: protected:
/** /**
* @brief setErrorString * @brief setErrorString
@@ -310,6 +324,8 @@ private:
Q_PROPERTY(qsizetype resultsPerPage READ resultsPerPage WRITE setResultsPerPage NOTIFY resultsPerPageChanged FINAL) Q_PROPERTY(qsizetype resultsPerPage READ resultsPerPage WRITE setResultsPerPage NOTIFY resultsPerPageChanged FINAL)
Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL)
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged 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_PROPERTY(qsizetype page READ page NOTIFY pageChanged FINAL)
}; };
Q_DECLARE_METATYPE(FeaturedPacksModel) Q_DECLARE_METATYPE(FeaturedPacksModel)
+20
View File
@@ -365,3 +365,23 @@ auto FeaturedVideosModel::totalPages() const -> qsizetype
return 0; 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;
}
+16
View File
@@ -231,6 +231,20 @@ public:
*/ */
auto setWindowSize(qsizetype size) -> void; 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: protected:
/** /**
* @brief setErrorString * @brief setErrorString
@@ -327,6 +341,8 @@ private:
Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL)
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL) Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL)
Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged 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(VideoItemModel *itemModel READ itemModel CONSTANT FINAL)
Q_PROPERTY(qsizetype windowSize READ windowSize WRITE setWindowSize NOTIFY windowSizeChanged FINAL) Q_PROPERTY(qsizetype windowSize READ windowSize WRITE setWindowSize NOTIFY windowSizeChanged FINAL)
}; };
+21
View File
@@ -320,3 +320,24 @@ auto NewestPacksModel::totalPages() const -> qsizetype
return 0; 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;
}
+16
View File
@@ -215,6 +215,20 @@ public:
*/ */
Q_INVOKABLE auto previousPage() const -> void; 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: protected:
/** /**
* @brief setErrorString * @brief setErrorString
@@ -321,6 +335,8 @@ private:
Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL) Q_PROPERTY(qsizetype totalResults READ totalResults NOTIFY totalResultsChanged FINAL)
Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL) Q_PROPERTY(qsizetype totalPages READ totalPages NOTIFY totalPagesChanged FINAL)
Q_PROPERTY(qsizetype page READ page NOTIFY pageChanged 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) Q_DECLARE_METATYPE(NewestPacksModel)
@@ -36,11 +36,8 @@ class KOMPLEX_EXPORT FeaturedImagesPaginator : public ImagePaginator
public: public:
explicit FeaturedImagesPaginator(QObject *parent = nullptr) : ImagePaginator(parent) explicit FeaturedImagesPaginator(QObject *parent = nullptr) : ImagePaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_IMAGES_FEATURED);
QString::fromUtf8(KOMPLEX_ENDPOINT_IMAGES_FEATURED) controller()->setWindowSize(32);
);
controller()->setWindowSize(20);
} }
}; };
@@ -36,10 +36,7 @@ class KOMPLEX_EXPORT FeaturedPacksPaginator : public WallpaperPaginator
public: public:
explicit FeaturedPacksPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent) explicit FeaturedPacksPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_PACKS_FEATURED);
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_FEATURED)
);
controller()->setWindowSize(32); controller()->setWindowSize(32);
} }
}; };
@@ -36,11 +36,8 @@ class KOMPLEX_EXPORT FeaturedVideosPaginator : public VideoPaginator
public: public:
explicit FeaturedVideosPaginator(QObject *parent = nullptr) : VideoPaginator(parent) explicit FeaturedVideosPaginator(QObject *parent = nullptr) : VideoPaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_VIDEOS_FEATURED);
QString::fromUtf8(KOMPLEX_ENDPOINT_VIDEOS_FEATURED) controller()->setWindowSize(32);
);
controller()->setWindowSize(20);
} }
}; };
@@ -38,10 +38,7 @@ class KOMPLEX_EXPORT ImageSearchPaginator : public ImagePaginator
public: public:
explicit ImageSearchPaginator(QObject *parent = nullptr) : ImagePaginator(parent) explicit ImageSearchPaginator(QObject *parent = nullptr) : ImagePaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_IMAGES_SEARCH);
QString::fromUtf8(KOMPLEX_ENDPOINT_IMAGES_SEARCH)
);
setQueryable(true); setQueryable(true);
} }
}; };
@@ -36,10 +36,7 @@ class KOMPLEX_EXPORT NewestPacksPaginator : public WallpaperPaginator
public: public:
explicit NewestPacksPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent) explicit NewestPacksPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_PACKS_NEWEST);
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_NEWEST)
);
controller()->setWindowSize(20); controller()->setWindowSize(20);
} }
}; };
@@ -36,10 +36,7 @@ class KOMPLEX_EXPORT PackSearchPaginator : public WallpaperPaginator
public: public:
explicit PackSearchPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent) explicit PackSearchPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_PACKS_SEARCH);
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_SEARCH)
);
setQueryable(true); setQueryable(true);
} }
}; };
+2 -2
View File
@@ -303,13 +303,13 @@ public:
return m_cacheController.windowSize(); return m_cacheController.windowSize();
} }
protected:
auto queryable() const -> bool auto queryable() const -> bool
{ {
return m_queryable; return m_queryable;
} }
protected:
auto setQueryable(bool queryable) -> void auto setQueryable(bool queryable) -> void
{ {
m_queryable = queryable; m_queryable = queryable;
@@ -245,6 +245,8 @@ protected:
loop.exec(); loop.exec();
} }
manager.clear();
LOG_ERROR_X(reply->error() != QNetworkReply::NoError, LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
"NewestPacksPaginator::getNetworkReply", "NewestPacksPaginator::getNetworkReply",
reply->errorString().toStdString().c_str(), reply->errorString().toStdString().c_str(),
@@ -36,10 +36,7 @@ class KOMPLEX_EXPORT VideoSearchPaginator : public VideoPaginator
public: public:
explicit VideoSearchPaginator(QObject *parent = nullptr) : VideoPaginator(parent) explicit VideoSearchPaginator(QObject *parent = nullptr) : VideoPaginator(parent)
{ {
setUri( setUri(KOMPLEX_ENDPOINT_VIDEOS_SEARCH);
QString::fromUtf8(KOMPLEX_ENDPOINT_VIDEOS_SEARCH)
);
setQueryable(true); setQueryable(true);
} }
}; };
@@ -248,6 +248,8 @@ protected:
loop.exec(); loop.exec();
} }
manager.clear();
LOG_ERROR_X(reply->error() != QNetworkReply::NoError, LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
"NewestPacksPaginator::getNetworkReply", "NewestPacksPaginator::getNetworkReply",
reply->errorString().toStdString().c_str(), reply->errorString().toStdString().c_str(),