Compare commits
72 Commits
7a7f85e5ad
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b2500c841 | |||
| c08b654f5b | |||
| 90f65a8a54 | |||
| d2821b30c3 | |||
| 541b57e5a7 | |||
| ad4119ec6c | |||
| 01716fcccf | |||
| 5dbf9a8383 | |||
| 549bf794b6 | |||
| 6d32ed6bce | |||
| 5a150c29f9 | |||
| 7854a3f440 | |||
| 827168b4a8 | |||
| 96ddc611e5 | |||
| 0b8e6c1704 | |||
| c978f4ffc7 | |||
| 69e5fb6594 | |||
| dc18e6e9b2 | |||
| e9f6ad537e | |||
| dde16907bc | |||
| 5dd894f384 | |||
| fb47b92353 | |||
| 49db588226 | |||
| f2596aaa40 | |||
| 98687febb9 | |||
| fcceb77987 | |||
| 5354103844 | |||
| bf1903ddcd | |||
| 25a51257c1 | |||
| 6a4dbced85 | |||
| 32085a6a52 | |||
| 7871f3a8cc | |||
| 0062043427 | |||
| 0a98f83a9b | |||
| d8b091d7b8 | |||
| 8a9417a5e5 | |||
| ac71b74ed0 | |||
| 3f9b33c74d | |||
| eb061e9034 | |||
| 576f9e0f29 | |||
| 5f5c2db53f | |||
| 3137318976 | |||
| 8b497d9496 | |||
| e0540e5089 | |||
| 856797e0f0 | |||
| 473defcd44 | |||
| bbaefdfe88 | |||
| d01f880338 | |||
| b3f6e55198 | |||
| b53048bebc | |||
| e95606be63 | |||
| b1270ec0f2 | |||
| 67a7d9cc8f | |||
| 2cb14c7f8a | |||
| 03295cd579 | |||
| 1dc136647a | |||
| 7bdbb40a5d | |||
| 380761988b | |||
| e51e4a4d8c | |||
| faf8aacd15 | |||
| 4955fa8793 | |||
| c92ce16e49 | |||
| 8bf00f0986 | |||
| 8aecedf669 | |||
| 34787c2d9d | |||
| 8587dfa163 | |||
| 957d3554b3 | |||
| 423afc0b50 | |||
| 733777f89e | |||
| ef36ce6ffb | |||
| 8668cc7445 | |||
| 84278ab0e1 |
@@ -0,0 +1,2 @@
|
|||||||
|
build/*
|
||||||
|
*/CMakeLists.txt.user
|
||||||
+17
-3
@@ -20,11 +20,13 @@ set(QML_IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
|
|||||||
FORCE
|
FORCE
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Widgets Qml Quick QuickControls2 QuickTimeline ShaderTools)
|
find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Widgets Qml Quick QuickControls2 QuickTimeline ShaderTools Concurrent)
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
|
|
||||||
qt_add_executable(${CMAKE_PROJECT_NAME}
|
qt_add_executable(${CMAKE_PROJECT_NAME}
|
||||||
README.md)
|
README.md
|
||||||
|
LICENSE
|
||||||
|
)
|
||||||
qt_add_resources(${CMAKE_PROJECT_NAME} "configuration"
|
qt_add_resources(${CMAKE_PROJECT_NAME} "configuration"
|
||||||
PREFIX "/"
|
PREFIX "/"
|
||||||
FILES
|
FILES
|
||||||
@@ -55,6 +57,19 @@ qt_add_resources(${CMAKE_PROJECT_NAME} "app_images"
|
|||||||
"images/icons/icons8-store.svg"
|
"images/icons/icons8-store.svg"
|
||||||
"images/icons/icons8-user-account.svg"
|
"images/icons/icons8-user-account.svg"
|
||||||
"images/icons/icons8-view-more.svg"
|
"images/icons/icons8-view-more.svg"
|
||||||
|
"images/icons/icons8-video.svg"
|
||||||
|
"images/icons/pexels-icon-filled-256.svg"
|
||||||
|
"images/icons/icons8-trash.svg"
|
||||||
|
"images/icons/icons8-download.svg"
|
||||||
|
"images/icons/icons8-play.svg"
|
||||||
|
"images/icons/icons8-stop.svg"
|
||||||
|
"images/icons/icons8-codepen.svg"
|
||||||
|
"images/icons/icons8-cube.svg"
|
||||||
|
"images/icons/icons8-camera.svg"
|
||||||
|
"images/icons/icons8-audio.svg"
|
||||||
|
"images/icons/icons8-3d-model.svg"
|
||||||
|
"images/icons/icons8-3d-glasses.svg"
|
||||||
|
"images/icons/kofi.gif"
|
||||||
"images/kero/kero_build_1.png"
|
"images/kero/kero_build_1.png"
|
||||||
"images/kero/kero_build_2.png"
|
"images/kero/kero_build_2.png"
|
||||||
"images/kero/kero_build_3.png"
|
"images/kero/kero_build_3.png"
|
||||||
@@ -71,7 +86,6 @@ qt_add_resources(${CMAKE_PROJECT_NAME} "app_images"
|
|||||||
"images/kero/kero_run_4.png"
|
"images/kero/kero_run_4.png"
|
||||||
"images/kero/kero_success.png"
|
"images/kero/kero_success.png"
|
||||||
"images/kero/kero_warning.png"
|
"images/kero/kero_warning.png"
|
||||||
"images/icons/icons8-trash.svg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
include(qds)
|
include(qds)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ qt6_add_qml_module(KomplexHubContent
|
|||||||
"pages/SettingsPage.qml"
|
"pages/SettingsPage.qml"
|
||||||
"pages/UserProfilePage.qml"
|
"pages/UserProfilePage.qml"
|
||||||
"pages/WallpaperSettingsPage.qml"
|
"pages/WallpaperSettingsPage.qml"
|
||||||
|
"pages/VideoSearchPage.qml"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ import QtQuick.Layouts
|
|||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubContent
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property MenuButton currentMenuButton
|
property MenuButton currentMenuButton
|
||||||
|
property bool popup: false
|
||||||
|
|
||||||
id: windowRoot
|
id: windowRoot
|
||||||
|
|
||||||
@@ -34,8 +36,43 @@ Rectangle {
|
|||||||
|
|
||||||
color: palette.base.lighter()
|
color: palette.base.lighter()
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout
|
||||||
|
{
|
||||||
|
height: popup ? 64 : 0
|
||||||
|
opacity: popup ? 1 : 0
|
||||||
|
|
||||||
|
MenuButton
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
height: 64
|
||||||
|
width: 100
|
||||||
|
text: qsTr("Back")
|
||||||
|
|
||||||
|
icon.height: 32
|
||||||
|
icon.width: 32
|
||||||
|
icon.url: "qrc:/images/icons/icons8-reply-arrow.svg"
|
||||||
|
|
||||||
|
onTriggered: () => {
|
||||||
|
pageLoader.item.closePopup()
|
||||||
|
selected = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
opacity: popup ? 0 : 1
|
||||||
|
visible: opacity > 0.01
|
||||||
id: windowMenuLayout
|
id: windowMenuLayout
|
||||||
|
Layout.fillHeight: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
MenuButton {
|
MenuButton {
|
||||||
@@ -53,7 +90,11 @@ Rectangle {
|
|||||||
onTriggered: () => {
|
onTriggered: () => {
|
||||||
pageLoader.page = "pages/HomePage.qml"
|
pageLoader.page = "pages/HomePage.qml"
|
||||||
|
|
||||||
currentMenuButton.selected = false
|
if(currentMenuButton !== null)
|
||||||
|
{
|
||||||
|
currentMenuButton.selected = false
|
||||||
|
}
|
||||||
|
|
||||||
currentMenuButton = this
|
currentMenuButton = this
|
||||||
|
|
||||||
searchContainer.preferredHeight = 0
|
searchContainer.preferredHeight = 0
|
||||||
@@ -81,6 +122,27 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MenuButton {
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
height: 64
|
||||||
|
width: 100
|
||||||
|
text: "Videos"
|
||||||
|
|
||||||
|
icon.height: 32
|
||||||
|
icon.width: 32
|
||||||
|
icon.url: "qrc:/images/icons/icons8-video.svg"
|
||||||
|
|
||||||
|
onTriggered: () => {
|
||||||
|
pageLoader.page = "pages/VideoSearchPage.qml"
|
||||||
|
|
||||||
|
currentMenuButton.selected = false
|
||||||
|
currentMenuButton = this
|
||||||
|
|
||||||
|
searchContainer.preferredHeight = 50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MenuButton {
|
MenuButton {
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
@@ -125,6 +187,7 @@ Rectangle {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
Layout.minimumHeight: 100
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuButton {
|
MenuButton {
|
||||||
@@ -147,6 +210,13 @@ Rectangle {
|
|||||||
searchContainer.preferredHeight = 0
|
searchContainer.preferredHeight = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +246,10 @@ Rectangle {
|
|||||||
|
|
||||||
icon: "qrc:/images/icons/icons8-search.svg"
|
icon: "qrc:/images/icons/icons8-search.svg"
|
||||||
|
|
||||||
|
onSearchTermChanged: () => {
|
||||||
|
pageLoader.setSearchTerm()
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on preferredHeight {
|
Behavior on preferredHeight {
|
||||||
NumberAnimation { duration: Constants.normalAnimationDuration }
|
NumberAnimation { duration: Constants.normalAnimationDuration }
|
||||||
}
|
}
|
||||||
@@ -212,34 +286,74 @@ Rectangle {
|
|||||||
|
|
||||||
onFinished: () => {
|
onFinished: () => {
|
||||||
if(pageLoader.loading && pageLoader.opacity === 0)
|
if(pageLoader.loading && pageLoader.opacity === 0)
|
||||||
|
{
|
||||||
pageLoader.loadPage()
|
pageLoader.loadPage()
|
||||||
|
}
|
||||||
else if(pageLoader.loading && pageLoader.opacity === 1)
|
else if(pageLoader.loading && pageLoader.opacity === 1)
|
||||||
|
{
|
||||||
pageLoader.loading = false
|
pageLoader.loading = false
|
||||||
|
pageLoader.updateSearchTerm();
|
||||||
|
popupConnection.target = pageLoader.item
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fadeOutPage() {
|
function fadeOutPage()
|
||||||
|
{
|
||||||
pageLoaderAnimation.from = 1
|
pageLoaderAnimation.from = 1
|
||||||
pageLoaderAnimation.to = 0
|
pageLoaderAnimation.to = 0
|
||||||
pageLoaderAnimation.start()
|
pageLoaderAnimation.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
function fadeInPage() {
|
function fadeInPage()
|
||||||
|
{
|
||||||
if(pageLoader.sourceComponent.status != Component.Ready)
|
if(pageLoader.sourceComponent.status != Component.Ready)
|
||||||
|
{
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
pageLoaderAnimation.from = 0
|
pageLoaderAnimation.from = 0
|
||||||
pageLoaderAnimation.to = 1
|
pageLoaderAnimation.to = 1
|
||||||
pageLoaderAnimation.start()
|
pageLoaderAnimation.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPage() {
|
function loadPage()
|
||||||
|
{
|
||||||
sourceComponent = Qt.createComponent(page)
|
sourceComponent = Qt.createComponent(page)
|
||||||
|
|
||||||
if(pageLoader.sourceComponent.status == Component.Ready)
|
if(sourceComponent.status == Component.Ready)
|
||||||
|
{
|
||||||
fadeInPage()
|
fadeInPage()
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
statusChanged.connect(fadeInPage)
|
statusChanged.connect(fadeInPage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSearchTerm()
|
||||||
|
{
|
||||||
|
if(isSearchPage())
|
||||||
|
{
|
||||||
|
searchContainer.searchTerm = pageLoader.item.query
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSearchTerm()
|
||||||
|
{
|
||||||
|
if(isSearchPage())
|
||||||
|
{
|
||||||
|
pageLoader.item.query = searchContainer.searchTerm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isSearchPage()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
pageLoader.item instanceof ImageSearchPage ||
|
||||||
|
pageLoader.item instanceof LiveSearchPage ||
|
||||||
|
pageLoader.item instanceof VideoSearchPage
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,25 +361,34 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeroBuildingAnimation {
|
KeroBuildingAnimation
|
||||||
|
{
|
||||||
id: buildingOverlay
|
id: buildingOverlay
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
KeroLoadingAnimation {
|
KeroLoadingAnimation
|
||||||
|
{
|
||||||
id: loadingAnimation
|
id: loadingAnimation
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// OpacityAnimator on opacity {
|
|
||||||
// duration: 150
|
|
||||||
// }
|
|
||||||
|
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
id: popupConnection
|
||||||
|
target: pageLoader.item
|
||||||
|
|
||||||
|
function onPopupChanged()
|
||||||
|
{
|
||||||
|
windowRoot.popup = pageLoader.item.popup
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: () => {
|
Component.onCompleted: () => {
|
||||||
homeMenubutton.selected = true
|
homeMenubutton.selected = true
|
||||||
currentMenuButton = homeMenubutton
|
currentMenuButton = homeMenubutton
|
||||||
|
|||||||
@@ -1,141 +1,357 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
readonly property bool searchable: false
|
readonly property bool searchable: false
|
||||||
property int resultsPerRow: (homePageRoot.width - (64 + Constants.largeMargin)) / (256 + Constants.largeMargin)
|
property int resultsPerRow: (homePageRoot.width - (64 + Constants.largeMargin)) / (resultWidth + Constants.largeMargin) + 1
|
||||||
|
property int resultWidth: 256
|
||||||
|
property int resultHeight: 245
|
||||||
|
property bool popup: false
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
|
||||||
id: homePageRoot
|
id: homePageRoot
|
||||||
|
|
||||||
Rectangle {
|
NewestPacksModel
|
||||||
|
{
|
||||||
|
id: packsModel
|
||||||
|
resultsPerPage: homePageRoot.resultsPerRow
|
||||||
|
}
|
||||||
|
|
||||||
|
FeaturedImagesModel
|
||||||
|
{
|
||||||
|
id: imagesModel
|
||||||
|
resultsPerPage: homePageRoot.resultsPerRow
|
||||||
|
}
|
||||||
|
|
||||||
|
FeaturedVideosModel
|
||||||
|
{
|
||||||
|
id: videosModel
|
||||||
|
resultsPerPage: homePageRoot.resultsPerRow
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: palette.base
|
color: palette.base
|
||||||
|
|
||||||
ScrollView {
|
ColumnLayout
|
||||||
|
{
|
||||||
|
id: resultsLayout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Constants.largeMargin
|
anchors.margins: Constants.mediumMargin
|
||||||
|
|
||||||
ColumnLayout {
|
Text
|
||||||
width: homePageRoot.width
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
// Featured Results
|
color: palette.text
|
||||||
ColumnLayout {
|
font.pixelSize: Constants.h2Font.pixelSize
|
||||||
width: parent.width
|
font.bold: true
|
||||||
height: 420
|
text: qsTr("Newest Wallpaper Packs")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
HorizontalPaginator
|
||||||
color: palette.text
|
{
|
||||||
font.pixelSize: Constants.largeFont.pixelSize
|
id: packsPaginator
|
||||||
text: "Featured"
|
Layout.fillWidth: true
|
||||||
}
|
Layout.preferredHeight: 245
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
RowLayout {
|
model: packsModel
|
||||||
|
delegate: ItemDelegate
|
||||||
|
{
|
||||||
|
width: resultWidth
|
||||||
|
height: resultHeight
|
||||||
|
|
||||||
Layout.fillWidth: true
|
required property string name
|
||||||
Layout.preferredHeight: 256
|
required property string author
|
||||||
Layout.alignment: Qt.AlignHCenter
|
required property string description
|
||||||
|
required property string uuid
|
||||||
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
|
required property int index
|
||||||
|
|
||||||
Repeater {
|
SearchResultItem
|
||||||
model: resultsPerRow
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
title: parent.name
|
||||||
|
author: parent.author
|
||||||
|
description: parent.description
|
||||||
|
thumbnail: parent.thumbnail
|
||||||
|
uuid: parent.uuid
|
||||||
|
|
||||||
delegate: SearchResultItem {
|
selected: packsPaginator.currentIndex === parent.index
|
||||||
|
|
||||||
}
|
onTriggered: () => packsPaginator.currentIndex = parent.index
|
||||||
}
|
|
||||||
|
|
||||||
SquareButton {
|
function onViewMoreTriggered()
|
||||||
Layout.fillHeight: true
|
{
|
||||||
Layout.preferredWidth: 64
|
|
||||||
|
|
||||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
|
||||||
icon.height: 24
|
|
||||||
icon.width: 24
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
height: Constants.largeMargin
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
width: parent.width
|
|
||||||
height: 420
|
|
||||||
|
|
||||||
Text {
|
|
||||||
color: palette.text
|
|
||||||
font.pixelSize: Constants.largeFont.pixelSize
|
|
||||||
text: "Newest"
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 256
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: resultsPerRow
|
|
||||||
|
|
||||||
delegate: SearchResultItem {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SquareButton {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.preferredWidth: 64
|
|
||||||
|
|
||||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
|
||||||
icon.height: 24
|
|
||||||
icon.width: 24
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
height: Constants.largeMargin
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
width: parent.width
|
|
||||||
height: 420
|
|
||||||
|
|
||||||
Text {
|
|
||||||
color: palette.text
|
|
||||||
font.pixelSize: Constants.largeFont.pixelSize
|
|
||||||
text: "Popular"
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 256
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: resultsPerRow
|
|
||||||
|
|
||||||
delegate: SearchResultItem {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SquareButton {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.preferredWidth: 64
|
|
||||||
|
|
||||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
|
||||||
icon.height: 24
|
|
||||||
icon.width: 24
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalPaginator
|
||||||
|
{
|
||||||
|
id: imagesPaginator
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 245
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
model: imagesModel
|
||||||
|
delegate: ItemDelegate
|
||||||
|
{
|
||||||
|
width: resultWidth
|
||||||
|
height: resultHeight
|
||||||
|
|
||||||
|
required property string author
|
||||||
|
required property string description
|
||||||
|
required property string uuid
|
||||||
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
|
required property int index
|
||||||
|
|
||||||
|
SearchResultItem
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
title: parent.author
|
||||||
|
description: parent.description
|
||||||
|
thumbnail: parent.thumbnail
|
||||||
|
uuid: parent.uuid
|
||||||
|
pexels: true
|
||||||
|
selected: imagesPaginator.currentIndex === parent.index
|
||||||
|
|
||||||
|
onTriggered: () => imagesPaginator.currentIndex = parent.index
|
||||||
|
|
||||||
|
onViewMoreTriggered: () =>
|
||||||
|
{
|
||||||
|
showImagePopup(parent.index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h2Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("Popular Videos")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalPaginator
|
||||||
|
{
|
||||||
|
id: videosPaginator
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 245
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
model: videosModel
|
||||||
|
delegate: ItemDelegate
|
||||||
|
{
|
||||||
|
width: resultWidth
|
||||||
|
height: resultHeight
|
||||||
|
|
||||||
|
required property string uuid
|
||||||
|
required property string author
|
||||||
|
required property string authorId
|
||||||
|
required property string authorUrl
|
||||||
|
required property string thumbnail
|
||||||
|
required property int index
|
||||||
|
|
||||||
|
SearchResultItem
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
title: parent.author
|
||||||
|
thumbnail: parent.thumbnail
|
||||||
|
uuid: parent.uuid
|
||||||
|
pexels: true
|
||||||
|
selected: videosPaginator.currentIndex === parent.index
|
||||||
|
|
||||||
|
onTriggered: () => packsPaginator.currentIndex = parent.index
|
||||||
|
|
||||||
|
onViewMoreTriggered:() =>
|
||||||
|
{
|
||||||
|
viewMoreImagePopup.opacity = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* spacer */
|
||||||
|
Item { Layout.fillHeight: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: () =>
|
||||||
|
{
|
||||||
|
imagesModel.nextPage()
|
||||||
|
videosModel.nextPage()
|
||||||
|
packsModel.nextPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
KeroLoadingAnimation
|
||||||
|
{
|
||||||
|
id: loadingAnimation
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
visible: opacity > 0
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: popupContainer
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
color: palette.base
|
||||||
|
|
||||||
|
ImageView
|
||||||
|
{
|
||||||
|
id: viewMoreImagePopup
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "loading"
|
||||||
|
when: packsModel.state === NewestPacksModel.Loading ||
|
||||||
|
imagesModel.state === FeaturedImagesModel.Loading ||
|
||||||
|
videosModel.state === FeaturedVideosModel.Loading;
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadingAnimation
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsLayout
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: popupContainer
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "idle"
|
||||||
|
when: packsModel.state !== NewestPacksModel.Loading &&
|
||||||
|
imagesModel.state !== FeaturedImagesModel.Loading &&
|
||||||
|
videosModel.state !== FeaturedVideosModel.Loading;
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadingAnimation
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsLayout
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "loading"
|
||||||
|
to: "idle"
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: loadingAnimation
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: resultsLayout
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
function showImagePopup(index)
|
||||||
|
{
|
||||||
|
viewMoreImagePopup.author = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.AuthorRole)
|
||||||
|
viewMoreImagePopup.authorUrl = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.AuthorUrlRole)
|
||||||
|
viewMoreImagePopup.description = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.DescriptionRole)
|
||||||
|
viewMoreImagePopup.uuid = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.UuidRole)
|
||||||
|
viewMoreImagePopup.thumbnail = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.ThumbnailRole)
|
||||||
|
viewMoreImagePopup.small = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.SmallUrlRole)
|
||||||
|
viewMoreImagePopup.medium = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.MediumUrlRole)
|
||||||
|
viewMoreImagePopup.large = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.LargeUrlRole)
|
||||||
|
viewMoreImagePopup.extraLarge = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.ExtraLargeUrlRole)
|
||||||
|
viewMoreImagePopup.original = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.OriginalUrlRole)
|
||||||
|
viewMoreImagePopup.portrait = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.PortraitUrlRole)
|
||||||
|
viewMoreImagePopup.landscape = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.LandscapeUrlRole)
|
||||||
|
viewMoreImagePopup.smallSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.SmallSizeRole)
|
||||||
|
viewMoreImagePopup.mediumSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.MediumSizeRole)
|
||||||
|
viewMoreImagePopup.largeSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.LargeSizeRole)
|
||||||
|
viewMoreImagePopup.extraLargeSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.ExtraLargeSizeRole)
|
||||||
|
viewMoreImagePopup.originalSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.OriginalSizeRole)
|
||||||
|
viewMoreImagePopup.portraitSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.PortraitSizeRole)
|
||||||
|
viewMoreImagePopup.landscapeSize = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.LandscapeSizeRole)
|
||||||
|
viewMoreImagePopup.opacity = 1
|
||||||
|
popupContainer.opacity = 1
|
||||||
|
homePageRoot.popup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePopup()
|
||||||
|
{
|
||||||
|
viewMoreImagePopup.opacity = 0
|
||||||
|
popupContainer.opacity = 0
|
||||||
|
homePageRoot.popup = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,78 +1,126 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
id: imageSearchPageRoot
|
{
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
SearchResultList {
|
property string query
|
||||||
id: searchResultList
|
readonly property bool searchable: paginator.searchable
|
||||||
anchors.fill: parent
|
property bool popup: false
|
||||||
color: palette.base
|
|
||||||
|
ImageSearchModel
|
||||||
|
{
|
||||||
|
id: searchModel
|
||||||
|
query: rootItem.query
|
||||||
|
resultsPerPage: paginator.resultsPerPage
|
||||||
}
|
}
|
||||||
|
|
||||||
KeroErrorAvatar {
|
PaginatorGrid
|
||||||
id: errorOverlay
|
{
|
||||||
|
id: paginator
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: 0
|
model: searchModel
|
||||||
}
|
loading: model.state === ImageSearchModel.Loading
|
||||||
|
|
||||||
KeroNoResultsAvatar {
|
delegate: ItemDelegate
|
||||||
id: noResultsOverlay
|
{
|
||||||
|
id: resultDelegate
|
||||||
|
|
||||||
anchors.fill: parent
|
width: 256
|
||||||
opacity: 0
|
height: 245
|
||||||
}
|
|
||||||
|
|
||||||
KeroLoadingAnimation {
|
required property string author
|
||||||
id: loadingOverlay
|
required property string description
|
||||||
|
required property string uuid
|
||||||
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
|
required property int index
|
||||||
|
|
||||||
anchors.fill: parent
|
SearchResultItem
|
||||||
opacity: 0
|
{
|
||||||
}
|
anchors.fill: parent
|
||||||
|
title: parent.author
|
||||||
|
description: parent.description
|
||||||
|
thumbnail: parent.thumbnail
|
||||||
|
uuid: parent.uuid
|
||||||
|
selected: paginator.currentIndex === parent.index
|
||||||
|
|
||||||
states: [
|
onTriggered: () => paginator.currentIndex = parent.index
|
||||||
State {
|
|
||||||
name: "loading"
|
|
||||||
when: searchResultList.state === "loading"
|
|
||||||
|
|
||||||
PropertyChanges {
|
onViewMoreTriggered: () =>
|
||||||
target: loadingOverlay
|
{
|
||||||
opacity: 1
|
showImagePopup(parent.index)
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
|
||||||
target: resultsView
|
|
||||||
opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "empty"
|
|
||||||
when: searchResultList.state === "empty"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: noResultsOverlay
|
|
||||||
opacity: 1
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
target: resultsView
|
|
||||||
opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "error"
|
|
||||||
when: searchResultList.state === "error"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: errorOverlay
|
|
||||||
opacity: 1
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
target: resultsView
|
|
||||||
opacity: 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: popupContainer
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
color: palette.base
|
||||||
|
|
||||||
|
ImageView
|
||||||
|
{
|
||||||
|
id: viewMoreImagePopup
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showImagePopup(index)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
viewMoreImagePopup.uuid = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.UuidRole)
|
||||||
|
viewMoreImagePopup.thumbnail = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ThumbnailRole)
|
||||||
|
viewMoreImagePopup.small = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.SmallUrlRole)
|
||||||
|
viewMoreImagePopup.medium = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.MediumUrlRole)
|
||||||
|
viewMoreImagePopup.large = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LargeUrlRole)
|
||||||
|
viewMoreImagePopup.extraLarge = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ExtraLargeUrlRole)
|
||||||
|
viewMoreImagePopup.original = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.OriginalUrlRole)
|
||||||
|
viewMoreImagePopup.portrait = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.PortraitUrlRole)
|
||||||
|
viewMoreImagePopup.landscape = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LandscapeUrlRole)
|
||||||
|
viewMoreImagePopup.smallSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.SmallSizeRole)
|
||||||
|
viewMoreImagePopup.mediumSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.MediumSizeRole)
|
||||||
|
viewMoreImagePopup.largeSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LargeSizeRole)
|
||||||
|
viewMoreImagePopup.extraLargeSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ExtraLargeSizeRole)
|
||||||
|
viewMoreImagePopup.originalSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.OriginalSizeRole)
|
||||||
|
viewMoreImagePopup.portraitSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.PortraitSizeRole)
|
||||||
|
viewMoreImagePopup.landscapeSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LandscapeSizeRole)
|
||||||
|
viewMoreImagePopup.opacity = 1
|
||||||
|
popupContainer.opacity = 1
|
||||||
|
rootItem.popup = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function closePopup()
|
||||||
|
{
|
||||||
|
viewMoreImagePopup.opacity = 0
|
||||||
|
popupContainer.opacity = 0
|
||||||
|
rootItem.popup = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,76 +3,59 @@ import QtQuick.Controls
|
|||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
id: imageSearchPageRoot
|
{
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
SearchResultList {
|
property string query
|
||||||
id: searchResultList
|
readonly property bool searchable: paginator.searchable
|
||||||
anchors.fill: parent
|
|
||||||
color: palette.base
|
PackSearchModel
|
||||||
|
{
|
||||||
|
id: searchModel
|
||||||
|
query: rootItem.query
|
||||||
|
resultsPerPage: paginator.resultsPerPage
|
||||||
}
|
}
|
||||||
|
|
||||||
KeroErrorAvatar {
|
PaginatorGrid
|
||||||
id: errorOverlay
|
{
|
||||||
|
id: paginator
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: 0
|
model: searchModel
|
||||||
}
|
loading: model.state === PackSearchModel.Loading
|
||||||
|
|
||||||
KeroNoResultsAvatar {
|
delegate: ItemDelegate
|
||||||
id: noResultsOverlay
|
{
|
||||||
|
id: resultDelegate
|
||||||
|
|
||||||
anchors.fill: parent
|
width: 256
|
||||||
opacity: 0
|
height: 245
|
||||||
}
|
|
||||||
|
|
||||||
KeroLoadingAnimation {
|
required property string name
|
||||||
id: loadingOverlay
|
required property string author
|
||||||
|
required property string description
|
||||||
|
required property string uuid
|
||||||
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
|
|
||||||
anchors.fill: parent
|
SearchResultItem
|
||||||
opacity: 0
|
{
|
||||||
}
|
anchors.fill: parent
|
||||||
|
title: parent.author
|
||||||
|
description: parent.description
|
||||||
|
thumbnail: parent.thumbnail
|
||||||
|
uuid: parent.uuid
|
||||||
|
|
||||||
states: [
|
selected: resultDelegate.highlighted
|
||||||
State {
|
|
||||||
name: "loading"
|
|
||||||
when: searchResultList.state === "loading"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: loadingOverlay
|
|
||||||
opacity: 1
|
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
|
||||||
target: resultsView
|
|
||||||
opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "empty"
|
|
||||||
when: searchResultList.state === "empty"
|
|
||||||
|
|
||||||
PropertyChanges {
|
MouseArea
|
||||||
target: noResultsOverlay
|
{
|
||||||
opacity: 1
|
anchors.fill: parent
|
||||||
}
|
onClicked: paginator.currentIndex = index
|
||||||
PropertyChanges {
|
|
||||||
target: resultsView
|
|
||||||
opacity: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "error"
|
|
||||||
when: searchResultList.state === "error"
|
|
||||||
|
|
||||||
PropertyChanges {
|
|
||||||
target: errorOverlay
|
|
||||||
opacity: 1
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
target: resultsView
|
|
||||||
opacity: 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
|
property string query
|
||||||
|
readonly property bool searchable: paginator.searchable
|
||||||
|
|
||||||
|
VideoSearchModel
|
||||||
|
{
|
||||||
|
id: searchModel
|
||||||
|
query: rootItem.query
|
||||||
|
resultsPerPage: paginator.resultsPerPage
|
||||||
|
}
|
||||||
|
|
||||||
|
PaginatorGrid
|
||||||
|
{
|
||||||
|
id: paginator
|
||||||
|
anchors.fill: parent
|
||||||
|
model: searchModel
|
||||||
|
loading: model.state === VideoSearchModel.Loading
|
||||||
|
|
||||||
|
delegate: ItemDelegate
|
||||||
|
{
|
||||||
|
id: resultDelegate
|
||||||
|
|
||||||
|
width: 256
|
||||||
|
height: 245
|
||||||
|
|
||||||
|
required property string author
|
||||||
|
required property string description
|
||||||
|
required property string uuid
|
||||||
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
|
required property int index
|
||||||
|
|
||||||
|
SearchResultItem
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
title: parent.author
|
||||||
|
description: parent.description
|
||||||
|
thumbnail: parent.thumbnail
|
||||||
|
uuid: parent.uuid
|
||||||
|
|
||||||
|
selected: resultDelegate.highlighted
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: paginator.currentIndex = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,5 +14,9 @@ qt6_add_qml_module(KomplexHubModule_Controls
|
|||||||
"Throbber.qml"
|
"Throbber.qml"
|
||||||
"SearchResultItem.qml"
|
"SearchResultItem.qml"
|
||||||
"SearchResultList.qml"
|
"SearchResultList.qml"
|
||||||
|
QML_FILES PaginationBox.qml
|
||||||
|
QML_FILES PaginatorGrid.qml
|
||||||
|
QML_FILES HorizontalPaginator.qml
|
||||||
|
QML_FILES ImageView.qml
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
readonly property bool searchable: false
|
||||||
|
property int resultsPerRow: (resultsContainer.width - (Constants.largeMargin * 2)) / (resultWidth + Constants.mediumMargin)
|
||||||
|
property int rows: ((resultsContainer.height - (Constants.largeMargin * 2)) / (resultHeight + Constants.mediumMargin))
|
||||||
|
property int resultsPerPage: resultsPerRow * rows
|
||||||
|
property int emptyWidth: (resultsContainer.width - (Constants.largeMargin * 2)) - (resultsPerRow * (resultWidth + Constants.mediumMargin))
|
||||||
|
property int resultWidth: 256
|
||||||
|
property int resultHeight: 245
|
||||||
|
property bool loading: false
|
||||||
|
|
||||||
|
property alias currentItem: resultsView.currentItem
|
||||||
|
property alias currentIndex: resultsView.currentIndex
|
||||||
|
|
||||||
|
property var model
|
||||||
|
|
||||||
|
property Component delegate
|
||||||
|
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: resultsContainer
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Component
|
||||||
|
{
|
||||||
|
id: highlight
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: 256
|
||||||
|
height: 245
|
||||||
|
color: palette.accent
|
||||||
|
radius: 5
|
||||||
|
// x: resultsView.currentItem.x
|
||||||
|
// y: resultsView.currentItem.y
|
||||||
|
Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } }
|
||||||
|
Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView
|
||||||
|
{
|
||||||
|
id: resultsView
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
spacing: Constants.mediumMargin
|
||||||
|
|
||||||
|
orientation: ListView.Horizontal
|
||||||
|
model: rootItem.model
|
||||||
|
|
||||||
|
delegate: rootItem.delegate
|
||||||
|
highlight: Rectangle { color: palette.accent; radius: 5 }
|
||||||
|
highlightFollowsCurrentItem: true
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
add: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x"
|
||||||
|
from: resultsContainer.width
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1.0
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
move: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x,y"
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displaced: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x,y"
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
populate: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1.0
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remove: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x"
|
||||||
|
to: 0
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "opacity"
|
||||||
|
to: 0
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredWidth: 128
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: gradientMap
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: moreButton.left
|
||||||
|
height: resultHeight
|
||||||
|
width: resultWidth / 4
|
||||||
|
|
||||||
|
gradient: Gradient
|
||||||
|
{
|
||||||
|
orientation: Gradient.Horizontal
|
||||||
|
GradientStop { position: 0.0; color: "transparent" }
|
||||||
|
GradientStop { position: 1.0; color: palette.light }
|
||||||
|
}
|
||||||
|
opacity: 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
SquareButton
|
||||||
|
{
|
||||||
|
id: moreButton
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: resultHeight
|
||||||
|
|
||||||
|
width: 64
|
||||||
|
|
||||||
|
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
||||||
|
icon.height: 24
|
||||||
|
icon.width: 24
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
property string uuid
|
||||||
|
property string author
|
||||||
|
property string authorUrl
|
||||||
|
property string description
|
||||||
|
property string thumbnail
|
||||||
|
property string portrait
|
||||||
|
property string landscape
|
||||||
|
property string small
|
||||||
|
property string original
|
||||||
|
property string medium
|
||||||
|
property string large
|
||||||
|
property string extraLarge
|
||||||
|
property string portraitSize
|
||||||
|
property string landscapeSize
|
||||||
|
property string smallSize
|
||||||
|
property string originalSize
|
||||||
|
property string mediumSize
|
||||||
|
property string largeSize
|
||||||
|
property string extraLargeSize
|
||||||
|
|
||||||
|
property int imageHeight
|
||||||
|
property int imageWidth
|
||||||
|
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
color: palette.base.alpha(1)
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Constants.largeMargin
|
||||||
|
spacing: Constants.largeMargin
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop| Qt.AlignHCenter
|
||||||
|
|
||||||
|
/** Spacer **/
|
||||||
|
Item { Layout.fillWidth: true }
|
||||||
|
|
||||||
|
Image
|
||||||
|
{
|
||||||
|
width: imageWidth
|
||||||
|
height: imageHeight
|
||||||
|
transform: Image.PreserveAspectFit
|
||||||
|
source: rootItem.large
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Spacer **/
|
||||||
|
Item { Layout.fillWidth: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: titleText
|
||||||
|
text: rootItem.author
|
||||||
|
color: palette.text
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: Constants.h3Font.pixelSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop| Qt.AlignLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: descriptionText
|
||||||
|
text: rootItem.description
|
||||||
|
color: palette.text
|
||||||
|
font.pointSize: Constants.h4Font.pixelSize
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop| Qt.AlignLeft
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Spacer **/
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
text: qsTr("Available Downloads")
|
||||||
|
color: palette.text
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: Constants.h3Font.pixelSize
|
||||||
|
elide: Text.ElideRight
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop| Qt.AlignLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
ComboBox
|
||||||
|
{
|
||||||
|
id: downloadSelector
|
||||||
|
model:[
|
||||||
|
"Small: " + smallSize,
|
||||||
|
"Medium: " + mediumSize,
|
||||||
|
"Large: " + largeSize,
|
||||||
|
"Extra Large: " + extraLargeSize,
|
||||||
|
"Portrait: " + portraitSize,
|
||||||
|
"Landscape: " + landscapeSize
|
||||||
|
]
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 36
|
||||||
|
}
|
||||||
|
SquareButton
|
||||||
|
{
|
||||||
|
Layout.preferredHeight: 36
|
||||||
|
Layout.preferredWidth: 128
|
||||||
|
text: qsTr("Download")
|
||||||
|
icon.source: "qrc:/images/icons/icons8-download.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text {
|
||||||
|
// property var texts: [
|
||||||
|
// small,
|
||||||
|
// medium,
|
||||||
|
// large,
|
||||||
|
// extraLarge,
|
||||||
|
// portrait,
|
||||||
|
// landscape
|
||||||
|
// ]
|
||||||
|
// text: texts[downloadSelector.currentIndex]
|
||||||
|
// elide: Text.ElideLeft
|
||||||
|
|
||||||
|
// Layout.fillWidth: true
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** Spacer **/
|
||||||
|
Item { Layout.fillWidth: true; Layout.fillHeight: true }
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignBottom
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("Images Provided Courtesy of Pexels")
|
||||||
|
elide: Text.ElideLeft
|
||||||
|
color: palette.text
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: Constants.h6Font.pixelSize
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignLeft
|
||||||
|
}
|
||||||
|
|
||||||
|
Image
|
||||||
|
{
|
||||||
|
transform: Image.PreserveAspectFit
|
||||||
|
source: "qrc:/images/icons/pexels-icon-filled-256.svg"
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
Layout.preferredWidth: 32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: itemRoot
|
||||||
|
|
||||||
|
property int page: 0
|
||||||
|
property int totalPages: 0
|
||||||
|
|
||||||
|
property bool enablePrevious: false
|
||||||
|
property bool enableNext: false
|
||||||
|
|
||||||
|
signal next
|
||||||
|
signal previous
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
id: buttonBoxLayout
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
SquareButton
|
||||||
|
{
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredWidth: 128
|
||||||
|
|
||||||
|
icon.source: "qrc:/images/icons/icons8-back.svg"
|
||||||
|
icon.height: 16
|
||||||
|
icon.width: 16
|
||||||
|
text: qsTr("Previous")
|
||||||
|
enabled: itemRoot.enablePrevious
|
||||||
|
|
||||||
|
onTriggered: () => itemRoot.previous()
|
||||||
|
}
|
||||||
|
|
||||||
|
Item { Layout.fillWidth: true }
|
||||||
|
|
||||||
|
SquareButton
|
||||||
|
{
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredWidth: 128
|
||||||
|
|
||||||
|
icon.source: "qrc:/images/icons/icons8-next.svg"
|
||||||
|
icon.height: 16
|
||||||
|
icon.width: 16
|
||||||
|
text: qsTr("Next")
|
||||||
|
enabled: itemRoot.enableNext
|
||||||
|
|
||||||
|
onTriggered: () => itemRoot.next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,425 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHubPlugin
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
property string query
|
||||||
|
readonly property bool searchable: true
|
||||||
|
property int resultsPerRow: (resultsContainer.width - (Constants.largeMargin * 2)) / (resultWidth + Constants.mediumMargin)
|
||||||
|
property int rows: ((resultsContainer.height - (Constants.largeMargin * 2)) / (resultHeight + Constants.mediumMargin))
|
||||||
|
property int resultsPerPage: resultsPerRow * rows
|
||||||
|
property int emptyWidth: (resultsContainer.width - (Constants.largeMargin * 2)) - (resultsPerRow * (resultWidth + Constants.mediumMargin))
|
||||||
|
property int resultWidth: 256
|
||||||
|
property int resultHeight: 245
|
||||||
|
property bool loading: false
|
||||||
|
|
||||||
|
property alias currentItem: resultsView.currentItem
|
||||||
|
property alias currentIndex: resultsView.currentIndex
|
||||||
|
|
||||||
|
property var model
|
||||||
|
|
||||||
|
property Component delegate
|
||||||
|
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
|
KeroErrorAvatar
|
||||||
|
{
|
||||||
|
id: errorOverlay
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
KeroNoResultsAvatar
|
||||||
|
{
|
||||||
|
id: noResultsOverlay
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
KeroChoiceAvatar
|
||||||
|
{
|
||||||
|
id: noSearchOverlay
|
||||||
|
|
||||||
|
title: qsTr("No Search Term")
|
||||||
|
description: qsTr("Kero needs a subject or term to search for wallpapers")
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
KeroLoadingAnimation
|
||||||
|
{
|
||||||
|
id: loadingOverlay
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: resultsContainer
|
||||||
|
anchors.fill: parent
|
||||||
|
color: palette.base
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Constants.largeMargin
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredWidth: emptyWidth / 2
|
||||||
|
Layout.maximumWidth: emptyWidth / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Component
|
||||||
|
{
|
||||||
|
id: highlight
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
width: view.cellWidth
|
||||||
|
height: view.cellHeight
|
||||||
|
color: palette.accent
|
||||||
|
radius: 5
|
||||||
|
x: view.currentItem.x
|
||||||
|
y: view.currentItem.y
|
||||||
|
Behavior on x { SpringAnimation { spring: 3; damping: 0.2 } }
|
||||||
|
Behavior on y { SpringAnimation { spring: 3; damping: 0.2 } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GridView
|
||||||
|
{
|
||||||
|
id: resultsView
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
cellWidth: 256 + Constants.mediumMargin
|
||||||
|
cellHeight: 245 + Constants.mediumMargin
|
||||||
|
model: rootItem.model
|
||||||
|
|
||||||
|
delegate: rootItem.delegate
|
||||||
|
highlight: Rectangle { color: palette.accent; radius: 5 }
|
||||||
|
highlightFollowsCurrentItem: true
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
add: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x"
|
||||||
|
from: resultsContainer.width
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1.0
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
move: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x,y"
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displaced: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x,y"
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
populate: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "opacity,scale"
|
||||||
|
to: 1.0
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
remove: Transition
|
||||||
|
{
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "x"
|
||||||
|
to: 0
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
properties: "opacity"
|
||||||
|
to: 0
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PaginationBox
|
||||||
|
{
|
||||||
|
id: buttonBoxLayout
|
||||||
|
height: 35
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.margins: Constants.largeMargin
|
||||||
|
|
||||||
|
onNext: () => model.nextPage()
|
||||||
|
onPrevious: () => model.previousPage()
|
||||||
|
|
||||||
|
enablePrevious: model.hasPreviousPage
|
||||||
|
enableNext: model.hasNextPage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "loading"
|
||||||
|
when: loading
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsContainer
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noSearchOverlay
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorOverlay
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: buttonBoxLayout
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "empty"
|
||||||
|
when: model.totalResults === 0 && model.query.length > 0
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noResultsOverlay
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noSearchOverlay
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsContainer
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: buttonBoxLayout
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "nosearch"
|
||||||
|
when: model.query.length === 0
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noResultsOverlay
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noSearchOverlay
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsContainer
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: buttonBoxLayout
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "idle"
|
||||||
|
when: model.totalResults !== 0 && !loading
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
opacity: 0.0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsContainer
|
||||||
|
opacity: 1.0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: buttonBoxLayout
|
||||||
|
visible: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "error"
|
||||||
|
when: model.errorString.length > 0
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorOverlay
|
||||||
|
opacity: 1.0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: resultsContainer
|
||||||
|
opacity: 0.0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noSearchOverlay
|
||||||
|
opacity: 0.0
|
||||||
|
}
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: noResultsOverlay
|
||||||
|
opacity: 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "empty"
|
||||||
|
to: "loading"
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: noResultsOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "nosearch"
|
||||||
|
to: "loading"
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: noSearchOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "loading"
|
||||||
|
to: "nosearch"
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: noSearchOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "loading"
|
||||||
|
to: "empty"
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: noResultsOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "loading"
|
||||||
|
to: "idle"
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: loadingOverlay
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: resultsView
|
||||||
|
duration: 250
|
||||||
|
property: "opacity";
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -52,6 +52,8 @@ Item {
|
|||||||
icon.source: searchBarRootItem.icon
|
icon.source: searchBarRootItem.icon
|
||||||
icon.width: 16
|
icon.width: 16
|
||||||
icon.height: 16
|
icon.height: 16
|
||||||
|
|
||||||
|
onTriggered: () => searchBarRootItem.searchTerm = searchEdit.text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,34 +2,63 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property string author: "Author"
|
property string author: ""
|
||||||
property string description: "This is a description of the search result item"
|
property string description: ""
|
||||||
property string title: "Wallpaper Title"
|
property string title: ""
|
||||||
property string thumbnail: ""
|
property string thumbnail: ""
|
||||||
property string url: ""
|
|
||||||
property string uuid: ""
|
property string uuid: ""
|
||||||
property bool selected: false
|
property bool selected: false
|
||||||
|
property bool pexels: false
|
||||||
|
|
||||||
signal triggered
|
signal triggered
|
||||||
|
signal viewMoreTriggered
|
||||||
|
|
||||||
id: searchResultItemRoot
|
id: searchResultItemRoot
|
||||||
width: 256
|
width: 256
|
||||||
height: 256
|
height: 256
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
id: searchResultItemContainer
|
id: searchResultItemContainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
border.color: palette.alternateBase.lighter(1.75)
|
border.color: palette.alternateBase.lighter(1.75)
|
||||||
|
|
||||||
color: palette.alternateBase.lighter(1.25)
|
color: palette.alternateBase.lighter(1.25)
|
||||||
|
|
||||||
ColumnLayout {
|
MouseArea
|
||||||
|
{
|
||||||
|
property string lastState
|
||||||
|
id: mouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onEntered: () => {
|
||||||
|
states.hovered = true
|
||||||
|
}
|
||||||
|
|
||||||
|
onExited: () => {
|
||||||
|
if(!viewMoreButton.hovered)
|
||||||
|
states.hovered = false
|
||||||
|
}
|
||||||
|
|
||||||
|
onReleased: () => {
|
||||||
|
if(!states.selected)
|
||||||
|
{
|
||||||
|
searchResultItemRoot.triggered()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Rectangle {
|
Rectangle
|
||||||
|
{
|
||||||
Layout.preferredWidth: 250
|
Layout.preferredWidth: 250
|
||||||
Layout.preferredHeight: 141
|
Layout.preferredHeight: 141
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||||
@@ -38,9 +67,34 @@ Item {
|
|||||||
border.color: palette.alternateBase.lighter(1.75)
|
border.color: palette.alternateBase.lighter(1.75)
|
||||||
|
|
||||||
color: palette.base.lighter(1.25)
|
color: palette.base.lighter(1.25)
|
||||||
|
|
||||||
|
Image
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
id: thumnailImage
|
||||||
|
source: searchResultItemRoot.thumbnail
|
||||||
|
}
|
||||||
|
|
||||||
|
Image
|
||||||
|
{
|
||||||
|
antialiasing: true
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.margins: Constants.mediumMargin
|
||||||
|
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
transform: Image.PreserveAspectFit
|
||||||
|
opacity: 0.5
|
||||||
|
source: "qrc:/images/icons/pexels-icon-filled-256.svg"
|
||||||
|
|
||||||
|
visible: searchResultItemRoot.pexels
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text
|
||||||
|
{
|
||||||
color: palette.text
|
color: palette.text
|
||||||
text: searchResultItemRoot.title
|
text: searchResultItemRoot.title
|
||||||
|
|
||||||
@@ -52,7 +106,10 @@ Item {
|
|||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Item { Layout.fillHeight: true }
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
color: palette.text
|
color: palette.text
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
text: "By: " + searchResultItemRoot.author
|
text: "By: " + searchResultItemRoot.author
|
||||||
@@ -60,75 +117,73 @@ Item {
|
|||||||
|
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
||||||
Layout.preferredWidth: 250
|
Layout.preferredWidth: 250
|
||||||
|
visible: !searchResultItemRoot.pexels
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text
|
||||||
|
{
|
||||||
|
id: descriptionText
|
||||||
|
clip: true
|
||||||
color: palette.text
|
color: palette.text
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
text: searchResultItemRoot.description
|
text: searchResultItemRoot.description
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
textFormat: Text.PlainText
|
||||||
|
elide: Text.ElideRight
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||||
|
Layout.maximumHeight: 32
|
||||||
|
Layout.preferredHeight: 32
|
||||||
Layout.preferredWidth: 236
|
Layout.preferredWidth: 236
|
||||||
|
Layout.maximumWidth: 236
|
||||||
Layout.bottomMargin: 3
|
Layout.bottomMargin: 3
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
SquareButton
|
||||||
ColorAnimation { duration: 200 }
|
{
|
||||||
}
|
id: viewMoreButton
|
||||||
}
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||||
|
Layout.maximumHeight: 50
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
Layout.preferredWidth: 236
|
||||||
|
Layout.maximumWidth: 236
|
||||||
|
Layout.bottomMargin: 3
|
||||||
|
|
||||||
MouseArea {
|
text: qsTr("View More")
|
||||||
property string lastState
|
opacity: 0
|
||||||
id: mouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
onTriggered: () => {
|
||||||
hoverEnabled: true
|
searchResultItemRoot.viewMoreTriggered()
|
||||||
|
}
|
||||||
onEntered: () => {
|
|
||||||
if(!selected)
|
|
||||||
searchResultItemRoot.state = "hovered"
|
|
||||||
}
|
|
||||||
|
|
||||||
onExited: () => {
|
|
||||||
lastState = ""
|
|
||||||
|
|
||||||
if(selected)
|
|
||||||
searchResultItemRoot.state = "selected"
|
|
||||||
else
|
|
||||||
searchResultItemRoot.state = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressed: () => {
|
|
||||||
if(!selected) {
|
|
||||||
lastState = searchResultItemRoot.state
|
|
||||||
searchResultItemRoot.state = "clicked"
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onReleased: () => {
|
Item { Layout.fillHeight: true }
|
||||||
if(!mouseArea.containsMouse)
|
|
||||||
return;
|
|
||||||
|
|
||||||
selected = !selected
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectedChanged: () => {
|
QtObject
|
||||||
if(selected) {
|
{
|
||||||
searchResultItemRoot.triggered()
|
id: states
|
||||||
searchResultItemRoot.state = "selected"
|
property bool clicked: false
|
||||||
}
|
property bool hovered: false
|
||||||
else {
|
property alias selected: searchResultItemRoot.selected
|
||||||
searchResultItemRoot.state = ""
|
property bool idle: true
|
||||||
|
|
||||||
|
onIdleChanged: () =>
|
||||||
|
{
|
||||||
|
if(idle)
|
||||||
|
{
|
||||||
|
clicked = false
|
||||||
|
hovered = false
|
||||||
|
selected = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "hovered"
|
name: "hovered"
|
||||||
|
when: states.hovered && !states.selected
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: searchResultItemContainer
|
target: searchResultItemContainer
|
||||||
@@ -138,14 +193,140 @@ Item {
|
|||||||
0.5, // Set custom lightness
|
0.5, // Set custom lightness
|
||||||
1.0)
|
1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: viewMoreButton
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
Layout.preferredHeight: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: descriptionText
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "selected"
|
name: "selected"
|
||||||
|
when: states.selected && !states.hovered
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges
|
||||||
|
{
|
||||||
target: searchResultItemContainer
|
target: searchResultItemContainer
|
||||||
color: palette.accent
|
color: palette.accent
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "view_more"
|
||||||
|
when: states.selected && states.hovered
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: viewMoreButton
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: descriptionText
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
Layout.preferredHeight: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "default"
|
||||||
|
when: states.idle
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: viewMoreButton
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
Layout.preferredHeight: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: descriptionText
|
||||||
|
opacity: 1
|
||||||
|
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions:
|
||||||
|
[
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
to: "selected"
|
||||||
|
|
||||||
|
ColorAnimation
|
||||||
|
{
|
||||||
|
target: searchResultItemContainer
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "selected"
|
||||||
|
to: "view_more"
|
||||||
|
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: viewMoreButton
|
||||||
|
property: "opacity"
|
||||||
|
duration: 250
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
from: "view_more"
|
||||||
|
to: "selected"
|
||||||
|
|
||||||
|
NumberAnimation
|
||||||
|
{
|
||||||
|
target: descriptionText
|
||||||
|
property: "opacity"
|
||||||
|
duration: 250
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
to: "default"
|
||||||
|
|
||||||
|
ColorAnimation
|
||||||
|
{
|
||||||
|
target: searchResultItemContainer
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Transition
|
||||||
|
{
|
||||||
|
to: "hovered"
|
||||||
|
|
||||||
|
ColorAnimation
|
||||||
|
{
|
||||||
|
target: searchResultItemContainer
|
||||||
|
duration: 250
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Item {
|
|||||||
property color color: palette.button
|
property color color: palette.button
|
||||||
property Gradient gradient: defaultGradient
|
property Gradient gradient: defaultGradient
|
||||||
property BorderSettings border: BorderSettings {}
|
property BorderSettings border: BorderSettings {}
|
||||||
|
readonly property bool hovered: state === "hovered"
|
||||||
|
|
||||||
signal triggered
|
signal triggered
|
||||||
|
|
||||||
@@ -106,10 +107,6 @@ Item {
|
|||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation { duration: 250 }
|
ColorAnimation { duration: 250 }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Behavior on gradient {
|
|
||||||
// PropertyAnimation { duration: 250 }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -216,7 +213,5 @@ Item {
|
|||||||
color: palette.text.darker()
|
color: palette.text.darker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,21 +19,51 @@ qt_add_qml_module(
|
|||||||
newestpacksmodel.cpp
|
newestpacksmodel.cpp
|
||||||
common/komplex_global.h
|
common/komplex_global.h
|
||||||
common/slidingcachecontroller.h
|
common/slidingcachecontroller.h
|
||||||
common/slidingcachecontroller.cpp
|
|
||||||
common/paginator.h
|
common/paginator.h
|
||||||
common/paginator.cpp
|
|
||||||
common/coreservices.h
|
common/coreservices.h
|
||||||
common/coreservices.cpp
|
common/coreservices.cpp
|
||||||
common/logging.h
|
common/logging.h
|
||||||
common/fetchresult.h
|
common/fetchresult.h
|
||||||
paginators/newestpackspaginator.h
|
paginators/newestpackspaginator.h
|
||||||
paginators/newestpackspaginator.cpp
|
SOURCES paginators/featuredpackspaginator.h
|
||||||
|
SOURCES paginators/featuredimagespaginator.h
|
||||||
|
SOURCES paginators/wallpaperpaginator.h
|
||||||
|
SOURCES paginators/packsearchpaginator.h
|
||||||
|
SOURCES paginators/imagesearchpaginator.h
|
||||||
|
SOURCES paginators/newestshaderspaginator.h
|
||||||
|
SOURCES paginators/newestcubemapspaginator.h
|
||||||
|
SOURCES paginators/featuredshaderspaginator.h
|
||||||
|
SOURCES paginators/featuredcubemapspaginator.h
|
||||||
|
SOURCES paginators/searchshaderspaginator.h
|
||||||
|
SOURCES paginators/searchcubemapspaginator.h
|
||||||
|
SOURCES paginators/videosearchpaginator.h
|
||||||
|
SOURCES featuredpacksmodel.h
|
||||||
|
SOURCES featuredpacksmodel.cpp
|
||||||
|
SOURCES featuredimagesmodel.h
|
||||||
|
SOURCES featuredimagesmodel.cpp
|
||||||
|
SOURCES featuredvideosmodel.h
|
||||||
|
SOURCES featuredvideosmodel.cpp
|
||||||
|
SOURCES paginators/featuredvideospaginator.h
|
||||||
|
SOURCES common/imagecache.h
|
||||||
|
SOURCES paginators/imagepaginator.h
|
||||||
|
SOURCES common/videocache.h
|
||||||
|
SOURCES paginators/videopaginator.h
|
||||||
|
SOURCES imagesearchmodel.cpp
|
||||||
|
SOURCES imagesearchmodel.h
|
||||||
|
SOURCES videosearchmodel.h
|
||||||
|
SOURCES videosearchmodel.cpp
|
||||||
|
SOURCES
|
||||||
|
SOURCES
|
||||||
|
SOURCES packsearchmodel.cpp
|
||||||
|
SOURCES packsearchmodel.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
KomplexHubPlugin
|
KomplexHubPlugin
|
||||||
PUBLIC
|
PUBLIC
|
||||||
KOMPLEX_PLUGIN
|
KOMPLEX_PLUGIN
|
||||||
|
KOMPLEX_LOCAL_DEV
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_ASAN)
|
if(ENABLE_ASAN)
|
||||||
|
|||||||
@@ -1,18 +1,52 @@
|
|||||||
#include "coreservices.h"
|
#include "coreservices.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
QNetworkAccessManager *CoreServices::m_networkAccessManager = new QNetworkAccessManager();
|
QNetworkAccessManager *CoreServices::s_networkAccessManager = new QNetworkAccessManager();
|
||||||
|
QMutex CoreServices::s_networkAccessMutex;
|
||||||
|
QSharedPointer<QNetworkAccessManager> CoreServices::s_networkAccessPointer;
|
||||||
|
|
||||||
auto CoreServices::networkAccessManager() -> QNetworkAccessManager *
|
auto CoreServices::networkAccessManager() -> QWeakPointer<QNetworkAccessManager>
|
||||||
{
|
{
|
||||||
return m_networkAccessManager;
|
QMutexLocker locker(&s_networkAccessMutex);
|
||||||
|
|
||||||
|
if(!s_networkAccessPointer)
|
||||||
|
{
|
||||||
|
s_networkAccessManager = new QNetworkAccessManager;
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
s_networkAccessManager,
|
||||||
|
&QNetworkAccessManager::sslErrors,
|
||||||
|
s_networkAccessManager,
|
||||||
|
[] (QNetworkReply *reply, const QList<QSslError> &errors)
|
||||||
|
{
|
||||||
|
for(const auto &error : errors)
|
||||||
|
{
|
||||||
|
LOG_ERROR(
|
||||||
|
"CoreServices::networkAccessManager",
|
||||||
|
error.errorString().toStdString().c_str()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef KOMPLEX_LOCAL_DEV
|
||||||
|
reply->ignoreSslErrors();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
s_networkAccessPointer = QSharedPointer<QNetworkAccessManager>(
|
||||||
|
s_networkAccessManager,
|
||||||
|
&QNetworkAccessManager::deleteLater
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_networkAccessPointer.toWeakRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto CoreServices::sessionToken() -> QByteArray
|
auto CoreServices::sessionToken() -> QByteArray
|
||||||
{
|
{
|
||||||
LOG_ERROR_X(true,
|
LOG_ERROR_X(true,
|
||||||
"CoreServices::sessionToken",
|
"CoreServices::sessionToken",
|
||||||
"User services not yet implements",
|
"User services not yet implemented",
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef CORESERVICES_H
|
#ifndef CORESERVICES_H
|
||||||
#define CORESERVICES_H
|
#define CORESERVICES_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
#include <QWeakPointer>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
|
||||||
class CoreServices
|
class CoreServices
|
||||||
{
|
{
|
||||||
@@ -13,7 +36,7 @@ public:
|
|||||||
* Plugin-wide QNetworkAccessManager
|
* Plugin-wide QNetworkAccessManager
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static auto networkAccessManager() -> QNetworkAccessManager*;
|
static auto networkAccessManager() -> QWeakPointer<QNetworkAccessManager>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getSessionToken
|
* @brief getSessionToken
|
||||||
@@ -23,6 +46,14 @@ public:
|
|||||||
static auto sessionToken() -> QByteArray;
|
static auto sessionToken() -> QByteArray;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QNetworkAccessManager *m_networkAccessManager;
|
|
||||||
|
CoreServices() = default;
|
||||||
|
~CoreServices() = default;
|
||||||
|
CoreServices(const CoreServices&) = delete;
|
||||||
|
CoreServices& operator=(const CoreServices&) = delete;
|
||||||
|
|
||||||
|
static QMutex s_networkAccessMutex;
|
||||||
|
static QNetworkAccessManager *s_networkAccessManager;
|
||||||
|
static QSharedPointer<QNetworkAccessManager> s_networkAccessPointer;
|
||||||
};
|
};
|
||||||
#endif // CORESERVICES_H
|
#endif // CORESERVICES_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef FETCHRESULT_H
|
#ifndef FETCHRESULT_H
|
||||||
#define FETCHRESULT_H
|
#define FETCHRESULT_H
|
||||||
#include <qtypes.h>
|
#include <qtypes.h>
|
||||||
@@ -22,7 +40,14 @@ struct FetchResult
|
|||||||
* @brief results
|
* @brief results
|
||||||
* Results list
|
* Results list
|
||||||
*/
|
*/
|
||||||
QList<T*> data;
|
QList<T> data;
|
||||||
|
|
||||||
|
auto operator=(const FetchResult<T> &other) -> FetchResult<T>
|
||||||
|
{
|
||||||
|
total = other.total;
|
||||||
|
count = other.count;
|
||||||
|
data = other.data;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FETCHRESULT_H
|
#endif // FETCHRESULT_H
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef IMAGECACHE_H
|
||||||
|
#define IMAGECACHE_H
|
||||||
|
|
||||||
|
#include "komplex_global.h"
|
||||||
|
#include <QObject>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
struct KOMPLEX_EXPORT ImageCache
|
||||||
|
{
|
||||||
|
QString altText;
|
||||||
|
QByteArray averageColor;
|
||||||
|
qsizetype height;
|
||||||
|
qsizetype width;
|
||||||
|
qint64 id;
|
||||||
|
bool liked; //probably not needed
|
||||||
|
QString photographer;
|
||||||
|
QString photographerUrl;
|
||||||
|
qint64 photographerId;
|
||||||
|
QMap<QString, QString> sources;
|
||||||
|
QMap<QString, QString> sourceSizes;
|
||||||
|
QString url;
|
||||||
|
|
||||||
|
auto operator == (const ImageCache &other) const -> bool
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
other.altText == altText &&
|
||||||
|
other.averageColor == averageColor &&
|
||||||
|
other.height == height &&
|
||||||
|
other.width == width &&
|
||||||
|
other.id == id &&
|
||||||
|
other.liked == liked &&
|
||||||
|
other.photographer == photographer &&
|
||||||
|
other.photographerUrl == photographerUrl &&
|
||||||
|
other.photographerId == photographerId &&
|
||||||
|
other.sources == sources &&
|
||||||
|
other.sourceSizes == sourceSizes &&
|
||||||
|
other.url == url
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator != (const ImageCache &other) const -> bool
|
||||||
|
{
|
||||||
|
return !(other == *this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(ImageCache)
|
||||||
|
|
||||||
|
|
||||||
|
#endif // IMAGECACHE_H
|
||||||
@@ -1,5 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef KOMPLEX_GLOBAL_H
|
#ifndef KOMPLEX_GLOBAL_H
|
||||||
#define KOMPLEX_GLOBAL_H
|
#define KOMPLEX_GLOBAL_H
|
||||||
|
#include <QtTypes>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#ifdef KOMPLEX_PLUGIN
|
#ifdef KOMPLEX_PLUGIN
|
||||||
#define KOMPLEX_EXPORT Q_DECL_EXPORT
|
#define KOMPLEX_EXPORT Q_DECL_EXPORT
|
||||||
@@ -12,4 +32,38 @@
|
|||||||
|
|
||||||
#define NETWORK_TIMEOUT 10000
|
#define NETWORK_TIMEOUT 10000
|
||||||
|
|
||||||
|
#ifdef KOMPLEX_LOCAL_DEV
|
||||||
|
#define KOMPLEX_API_HOST "https://komplexapi.hlab"
|
||||||
|
#else
|
||||||
|
#define KOMPLEX_API_HOST "https://komplex.digitalartifex.dev"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define KOMPLEX_API_VERSION "v2"
|
||||||
|
|
||||||
|
#define KOMPLEX_ENDPOINT_IMAGES_SEARCH "images/search"
|
||||||
|
#define KOMPLEX_ENDPOINT_IMAGES_FEATURED "featured/images"
|
||||||
|
#define KOMPLEX_ENDPOINT_IMAGES_ITEM "images/item"
|
||||||
|
|
||||||
|
#define KOMPLEX_ENDPOINT_VIDEOS_SEARCH "videos/search"
|
||||||
|
#define KOMPLEX_ENDPOINT_VIDEOS_FEATURED "featured/videos"
|
||||||
|
#define KOMPLEX_ENDPOINT_VIDEOS_ITEM "videos/item"
|
||||||
|
|
||||||
|
#define KOMPLEX_ENDPOINT_SHADERS_SEARCH "shaders/search"
|
||||||
|
#define KOMPLEX_ENDPOINT_SHADERS_FEATURED "shaders/featured"
|
||||||
|
#define KOMPLEX_ENDPOINT_SHADERS_ITEM "shaders/item"
|
||||||
|
#define KOMPLEX_ENDPOINT_SHADERS_NEWEST "shaders/newest"
|
||||||
|
|
||||||
|
#define KOMPLEX_ENDPOINT_CUBEMAPS_SEARCH "cubemaps/search"
|
||||||
|
#define KOMPLEX_ENDPOINT_CUBEMAPS_FEATURED "cubemaps/featured"
|
||||||
|
#define KOMPLEX_ENDPOINT_CUBEMAPS_ITEM "cubemaps/item"
|
||||||
|
#define KOMPLEX_ENDPOINT_CUBEMAPS_NEWEST "cubemaps/newest"
|
||||||
|
|
||||||
|
#define KOMPLEX_ENDPOINT_PACKS_SEARCH "packs/search"
|
||||||
|
#define KOMPLEX_ENDPOINT_PACKS_FEATURED "packs/featured"
|
||||||
|
#define KOMPLEX_ENDPOINT_PACKS_ITEM "packs/item"
|
||||||
|
#define KOMPLEX_ENDPOINT_PACKS_NEWEST "packs/newest"
|
||||||
|
|
||||||
|
inline static qsizetype nullsize = std::numeric_limits<qsizetype>::min();
|
||||||
|
inline static std::chrono::milliseconds KOMPLEX_RATE_LIMIT(500);
|
||||||
|
|
||||||
#endif // KOMPLEX_GLOBAL_H
|
#endif // KOMPLEX_GLOBAL_H
|
||||||
|
|||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef LOGGING_H
|
#ifndef LOGGING_H
|
||||||
#define LOGGING_H
|
#define LOGGING_H
|
||||||
// clazy:exclude=clazy-unused-headers
|
// clazy:exclude=clazy-unused-headers
|
||||||
@@ -13,20 +31,27 @@
|
|||||||
* @param where
|
* @param where
|
||||||
* @param what
|
* @param what
|
||||||
*/
|
*/
|
||||||
#define LOG_ERROR(cond, where, what) \
|
#define LOG_ERROR(where, what) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond)) { \
|
std::cerr << "Error Occurred:\n" \
|
||||||
std::cerr << "Assertion failed: (" << #cond << ")\n" \
|
|
||||||
<< " Location: " << (where) << "\n" \
|
<< " Location: " << (where) << "\n" \
|
||||||
<< " Message: " << (what) << "\n" \
|
<< " Message: " << (what) << "\n" \
|
||||||
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
||||||
} \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LOG_ERROR_X
|
||||||
|
*
|
||||||
|
* When cond is true, logs where and what as an error and returns the ret value
|
||||||
|
* @param cond
|
||||||
|
* @param where
|
||||||
|
* @param what
|
||||||
|
* @param ret
|
||||||
|
*/
|
||||||
#define LOG_ERROR_X(cond, where, what, ret) \
|
#define LOG_ERROR_X(cond, where, what, ret) \
|
||||||
do { \
|
do { \
|
||||||
if ((cond)) { \
|
if ((cond)) { \
|
||||||
std::cout << "Assertion failed: (" << #cond << ")\n" \
|
std::cerr << "Error Occurred: (" << #cond << ")\n" \
|
||||||
<< " Location: " << (where) << "\n" \
|
<< " Location: " << (where) << "\n" \
|
||||||
<< " Message: " << (what) << "\n" \
|
<< " Message: " << (what) << "\n" \
|
||||||
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
||||||
@@ -38,7 +63,7 @@
|
|||||||
#define ASSERT_X(cond, where, what) \
|
#define ASSERT_X(cond, where, what) \
|
||||||
do { \
|
do { \
|
||||||
if (!(cond)) { \
|
if (!(cond)) { \
|
||||||
std::cout << "Assertion failed: (" << #cond << ")\n" \
|
std::cerr << "Assertion failed: (" << #cond << ")\n" \
|
||||||
<< " Location: " << (where) << "\n" \
|
<< " Location: " << (where) << "\n" \
|
||||||
<< " Message: " << (what) << "\n" \
|
<< " Message: " << (what) << "\n" \
|
||||||
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
<< " File: " << __FILE__ << ":" << __LINE__ << "\n"; \
|
||||||
|
|||||||
@@ -1,85 +1,382 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef PAGINATOR_H
|
#ifndef PAGINATOR_H
|
||||||
#define PAGINATOR_H
|
#define PAGINATOR_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
#include <qdebug.h>
|
||||||
|
|
||||||
#include "komplex_global.h"
|
#include "komplex_global.h"
|
||||||
#include "slidingcachecontroller.h"
|
#include "slidingcachecontroller.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PaginationNotifier class
|
||||||
|
*
|
||||||
|
* Qt does not support templated QObjects. Pushing it to a notifier class
|
||||||
|
* that the template can inherit fixes this
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT PaginationNotifier : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
protected:
|
||||||
|
explicit PaginationNotifier(QObject *parent = nullptr) : QObject(parent) {}
|
||||||
|
signals:
|
||||||
|
auto fetchComplete() -> void;
|
||||||
|
auto fetching() -> void;
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
auto countChanged() -> void;
|
||||||
|
auto queryChanged() -> void;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Paginator class is a type agnostic pagination controller that uses
|
||||||
|
* the SlidingCacheController as it's backend
|
||||||
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class KOMPLEX_EXPORT Paginator
|
class KOMPLEX_EXPORT Paginator : public PaginationNotifier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Paginator() = default;
|
explicit Paginator(QObject *parent = nullptr) : PaginationNotifier(parent)
|
||||||
~Paginator() = default;
|
|
||||||
|
|
||||||
auto next() const -> void
|
|
||||||
{
|
{
|
||||||
setOffset(m_offset + m_resultsPerPage);
|
QObject::connect
|
||||||
|
(
|
||||||
|
&m_cacheController,
|
||||||
|
&SlidingCacheNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&PaginationNotifier::fetchComplete
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect
|
||||||
|
(
|
||||||
|
&m_cacheController,
|
||||||
|
&SlidingCacheNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&PaginationNotifier::fetching
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto previous() const -> void
|
/**
|
||||||
|
* @brief next
|
||||||
|
*
|
||||||
|
* Attempts to get the next page and notifies pageChanged
|
||||||
|
*/
|
||||||
|
auto next() -> void
|
||||||
{
|
{
|
||||||
setOffset(m_offset - m_resultsPerPage);
|
if(m_offset != nullsize)
|
||||||
|
{
|
||||||
|
setOffset(m_offset + m_resultsPerPage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
controller()->init();
|
||||||
|
setOffset(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previous
|
||||||
|
*
|
||||||
|
* Attempts to get the previous page and notifies pageChanged
|
||||||
|
*/
|
||||||
|
auto previous() -> void
|
||||||
|
{
|
||||||
|
if(m_offset != nullsize && m_offset > m_resultsPerPage)
|
||||||
|
{
|
||||||
|
setOffset(m_offset - m_resultsPerPage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
controller()->init();
|
||||||
|
setOffset(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
auto resultsPerPage() const -> qsizetype
|
auto resultsPerPage() const -> qsizetype
|
||||||
{
|
{
|
||||||
return m_resultsPerPage;
|
return m_resultsPerPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
auto setResultsPerPage(qsizetype resultsPerPage) -> void
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
{
|
{
|
||||||
m_resultsPerPage = resultsPerPage;
|
if(resultsPerPage == m_resultsPerPage)
|
||||||
m_data = m_cacheController.chunk(m_offset, m_resultsPerPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto data() const -> QList<T*>
|
|
||||||
{
|
|
||||||
return m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto count() const -> qsizetype
|
|
||||||
{
|
|
||||||
return m_data.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto at(qsizetype index) const -> T*
|
|
||||||
{
|
|
||||||
if(index < 0 || index >= m_data.count())
|
|
||||||
{
|
{
|
||||||
return nullptr;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_data.at(index);
|
m_resultsPerPage = resultsPerPage;
|
||||||
|
Q_EMIT static_cast<PaginationNotifier*>(this)->resultsPerPageChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief query
|
||||||
|
* Current query string, if the API Endpoint supports queries
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto query() const -> QString
|
||||||
|
{
|
||||||
|
return m_query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setQuery
|
||||||
|
* Sets the new query string and updates the controller
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
auto setQuery(const QString &query) -> void
|
||||||
|
{
|
||||||
|
if(query == m_query)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset();
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
Q_EMIT queryChanged();
|
||||||
|
|
||||||
|
controller()->init();
|
||||||
|
setOffset(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data() const -> const QList<T>
|
||||||
|
{
|
||||||
|
if(boundaryCheck(m_resultsPerPage))
|
||||||
|
{
|
||||||
|
return m_cacheController.chunk(m_offset, m_resultsPerPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype count = (m_cacheController.totalCount() - m_offset);
|
||||||
|
return m_cacheController.chunk(m_offset, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief count
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto count() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_offset == nullsize)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(boundaryCheck(m_resultsPerPage))
|
||||||
|
{
|
||||||
|
return m_resultsPerPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype count = (m_cacheController.totalCount() - m_offset);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief at
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto at(qsizetype index) const -> const T&
|
||||||
|
{
|
||||||
|
return m_cacheController.at(m_offset + index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
*
|
||||||
|
* The total number of results as reported by the controller
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
return m_cacheController.totalCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* Calculates the current page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype
|
||||||
|
{
|
||||||
|
return std::floor(
|
||||||
|
static_cast<qreal>(m_offset) / m_resultsPerPage
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Calculates the total number of pages available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
return std::ceil(
|
||||||
|
static_cast<qreal>(totalResults()) / m_resultsPerPage
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
auto queryable() const -> bool
|
||||||
|
{
|
||||||
|
return m_queryable;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto setQueryable(bool queryable) -> void
|
||||||
|
{
|
||||||
|
m_queryable = queryable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief controller
|
||||||
|
* Reference to the underlying cache controller
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
auto controller() -> SlidingCacheController<T>*
|
auto controller() -> SlidingCacheController<T>*
|
||||||
{
|
{
|
||||||
return &m_cacheController;
|
return &m_cacheController;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto offset() const -> qsizetype
|
/**
|
||||||
{
|
* @brief setOffset
|
||||||
return m_offset;
|
* Sets the dataset to the specified offset
|
||||||
}
|
* @param offset
|
||||||
|
*/
|
||||||
auto setOffset(qsizetype offset) -> void
|
auto setOffset(qsizetype offset) -> void
|
||||||
{
|
{
|
||||||
|
if(offset == m_offset)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_offset = offset;
|
m_offset = offset;
|
||||||
|
|
||||||
if(m_offset < 0 || m_offset == std::numeric_limits<qsizetype>::max())
|
if(m_offset >= totalResults())
|
||||||
m_offset = 0;
|
{
|
||||||
|
m_offset = totalResults() - m_resultsPerPage;
|
||||||
|
}
|
||||||
|
|
||||||
m_data = m_cacheController.chunk(m_offset, m_resultsPerPage);
|
if(m_offset < 0)
|
||||||
|
{
|
||||||
|
m_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_cacheController.focus(offset, m_resultsPerPage);
|
||||||
|
|
||||||
|
Q_EMIT totalResultsChanged();
|
||||||
|
Q_EMIT totalPagesChanged();
|
||||||
|
Q_EMIT pageChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onControllerTotalResultsChanged
|
||||||
|
* Slot used to forward totalResultsChanged signal
|
||||||
|
*/
|
||||||
|
auto onControllerTotalResultsChanged() -> void
|
||||||
|
{
|
||||||
|
Q_EMIT this->totalResultsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief reset
|
||||||
|
* Resets the paginator and underlying controller
|
||||||
|
*/
|
||||||
|
auto reset() -> void
|
||||||
|
{
|
||||||
|
m_query.clear();
|
||||||
|
m_offset = nullsize;
|
||||||
|
controller()->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qsizetype m_offset = 0;
|
|
||||||
|
/**
|
||||||
|
* @brief boundaryCheck
|
||||||
|
* Checks if the index is within the bounds of the dataset
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto boundaryCheck(qsizetype index) const -> bool
|
||||||
|
{
|
||||||
|
if(index < 0 || (m_offset + index) >= m_cacheController.totalCount())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_offset
|
||||||
|
* Current absolute offset. Used in fetch operations
|
||||||
|
*/
|
||||||
|
mutable qsizetype m_offset = nullsize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_resultsPerPage
|
||||||
|
* Results per page to use when calculating current and total pages.
|
||||||
|
* Needs to be set by the view
|
||||||
|
*/
|
||||||
qsizetype m_resultsPerPage = 0;
|
qsizetype m_resultsPerPage = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_cacheController
|
||||||
|
* Internal cache controller.
|
||||||
|
*
|
||||||
|
* TODO: make the cache controller generic so it can be used in other projects
|
||||||
|
* and with other cache methods
|
||||||
|
*/
|
||||||
SlidingCacheController<T> m_cacheController;
|
SlidingCacheController<T> m_cacheController;
|
||||||
QList<T*> m_data;
|
|
||||||
|
/**
|
||||||
|
* @brief m_dataMutex
|
||||||
|
*/
|
||||||
|
mutable QMutex m_dataMutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_query
|
||||||
|
* The query string used in fetch operations
|
||||||
|
*/
|
||||||
|
QString m_query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_queryable
|
||||||
|
* Controls the queryable state of the paginator
|
||||||
|
*/
|
||||||
|
bool m_queryable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PAGINATOR_H
|
#endif // PAGINATOR_H
|
||||||
|
|||||||
@@ -1,18 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef SLIDINGCACHECONTROLLER_H
|
#ifndef SLIDINGCACHECONTROLLER_H
|
||||||
#define SLIDINGCACHECONTROLLER_H
|
#define SLIDINGCACHECONTROLLER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "fetchresult.h"
|
#include "fetchresult.h"
|
||||||
#include "komplex_global.h"
|
#include "komplex_global.h"
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
template <typename T>
|
/**
|
||||||
class KOMPLEX_EXPORT SlidingCacheController
|
* @brief The SlidingCacheNotifier class
|
||||||
|
*
|
||||||
|
* Qt does not support templated QObjects. Pushing it to a notifier class
|
||||||
|
* that the template can inherit fixes this
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT SlidingCacheNotifier : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
signals:
|
||||||
|
auto countChanged() -> void;
|
||||||
|
auto fetching() -> void;
|
||||||
|
auto fetchComplete() -> void;
|
||||||
|
auto windowSizeChanged() -> void;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The SlidingCacheController class is a type and endpoint agnostic sliding window
|
||||||
|
* cache controller. It pre-fetches a larger data set that a paginator works on top of.
|
||||||
|
* This minimizes the number of API calls required to serve paged data
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class KOMPLEX_EXPORT SlidingCacheController : public SlidingCacheNotifier
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief FetchFunction
|
||||||
|
* Convenience def used by setFetch
|
||||||
|
*/
|
||||||
|
typedef std::function<FetchResult<T> (qsizetype offset, qsizetype limit)> FetchFunction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit SlidingCacheController()
|
explicit SlidingCacheController() : SlidingCacheNotifier{}
|
||||||
{
|
{
|
||||||
m_cache.reserve(SLIDING_CACHE_WINDOW_SIZE);
|
m_cache.reserve(SLIDING_CACHE_WINDOW_SIZE);
|
||||||
}
|
}
|
||||||
@@ -24,15 +74,13 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief setFetch
|
* @brief setFetch
|
||||||
|
*
|
||||||
* Used to set the fetch method for the cache controller. Method should return a QList
|
* Used to set the fetch method for the cache controller. Method should return a QList
|
||||||
* of CacheObjects based on the offset and limit provided. CacheObject must derive from
|
* of CacheObjects based on the offset and limit provided. CacheObject must derive from
|
||||||
* QObject
|
* QObject
|
||||||
*
|
|
||||||
* @param fetch
|
* @param fetch
|
||||||
*/
|
*/
|
||||||
auto setFetch(
|
auto setFetch(const FetchFunction &fetch) -> void
|
||||||
const std::function<FetchResult<T> (qsizetype offset, qsizetype limit)> &fetch
|
|
||||||
) -> void
|
|
||||||
{
|
{
|
||||||
m_fetch = std::move(fetch);
|
m_fetch = std::move(fetch);
|
||||||
}
|
}
|
||||||
@@ -45,38 +93,26 @@ public:
|
|||||||
* @return CacheObject* or nullptr
|
* @return CacheObject* or nullptr
|
||||||
*/
|
*/
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
auto at(qsizetype index) const -> T*
|
auto at(qsizetype index) const -> const T&
|
||||||
{
|
{
|
||||||
//OOB check for expected index
|
QMutexLocker cacheLocker(&m_cacheMutex);
|
||||||
if (index < 0 ||
|
T defaultValue;
|
||||||
(m_totalCount != std::numeric_limits<qsizetype>::infinity() &&
|
|
||||||
index >= m_totalCount))
|
if(!externalBoundaryCheck(index))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (index >= m_windowOffset + (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD))
|
if(!const_cast<SlidingCacheController*>(this)->slideWindow(index))
|
||||||
{
|
{
|
||||||
if(!slideForward())
|
return defaultValue;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (index <= m_windowOffset - (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD))
|
qsizetype internalIndex = this->internalIndex(index);
|
||||||
{
|
|
||||||
if(!slideBackward())
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
index = trueIndex(index);
|
if(!internalBoundaryCheck(index))
|
||||||
|
|
||||||
//OOB check for actual index
|
|
||||||
if(index < 0 || index >= m_cache.count())
|
|
||||||
{
|
{
|
||||||
return nullptr;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_cache.at(index);
|
return m_cache.at(index);
|
||||||
@@ -91,33 +127,48 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
auto chunk(qsizetype index, qsizetype count) -> QList<T*>
|
auto chunk(qsizetype index, qsizetype count) const -> QList<T>
|
||||||
{
|
{
|
||||||
QList<T*> dataChunk;
|
QMutexLocker cacheLocker(&m_cacheMutex);
|
||||||
|
|
||||||
for(qsizetype i = index; i < count; ++i)
|
if(!externalBoundaryCheck(index))
|
||||||
{
|
{
|
||||||
T* data = at(i);
|
return {};
|
||||||
|
|
||||||
if(data == nullptr)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dataChunk.append(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dataChunk;
|
if(!const_cast<SlidingCacheController*>(this)->slideWindow(index))
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype internalIndex = this->internalIndex(index);
|
||||||
|
|
||||||
|
if(!internalBoundaryCheck(index))
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!internalBoundaryCheck(count - 1))
|
||||||
|
{
|
||||||
|
count = m_cache.count() - index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_cache.mid(index, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief count
|
* @brief totalCount
|
||||||
*
|
*
|
||||||
* @return The total number of results available
|
* @return The total number of results available
|
||||||
*/
|
*/
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
auto count() const -> qsizetype
|
auto totalCount() const -> qsizetype
|
||||||
{
|
{
|
||||||
|
if(m_totalCount == nullsize)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return m_totalCount;
|
return m_totalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,16 +178,184 @@ public:
|
|||||||
*/
|
*/
|
||||||
auto clear() -> void
|
auto clear() -> void
|
||||||
{
|
{
|
||||||
while(!m_cache.isEmpty())
|
QMutexLocker cacheLocker(&m_cacheMutex);
|
||||||
|
|
||||||
|
m_cache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief reset
|
||||||
|
* Resets the current cache model
|
||||||
|
*/
|
||||||
|
auto reset() -> void
|
||||||
|
{
|
||||||
|
QMutexLocker cacheLocker(&m_cacheMutex);
|
||||||
|
|
||||||
|
m_cache.clear();
|
||||||
|
setTotalCount(nullsize);
|
||||||
|
m_windowOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto focus(qsizetype index, qsizetype count) -> void
|
||||||
|
{
|
||||||
|
if(inFocus(index, count) || !externalBoundaryCheck(index))
|
||||||
{
|
{
|
||||||
T *object = m_cache.takeFirst();
|
return;
|
||||||
delete object;
|
}
|
||||||
|
|
||||||
|
if(!externalBoundaryCheck(index + count))
|
||||||
|
{
|
||||||
|
slideWindow(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
auto init() -> bool
|
||||||
|
{
|
||||||
|
if(m_totalCount != nullsize)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return slideForward();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto windowSize() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_windowSize == nullsize)
|
||||||
|
{
|
||||||
|
return SLIDING_CACHE_WINDOW_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_windowSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto setWindowSize(qsizetype windowSize) -> void
|
||||||
|
{
|
||||||
|
if(windowSize == m_windowSize)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief setTotalCount
|
||||||
|
* Sets the total count and notifies countChanged
|
||||||
|
* @param count
|
||||||
|
*/
|
||||||
|
auto setTotalCount(qsizetype count) -> void
|
||||||
|
{
|
||||||
|
if(count == m_totalCount)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_totalCount = count;
|
||||||
|
Q_EMIT static_cast<SlidingCacheNotifier*>(this)->countChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
auto inFocus(qsizetype index, qsizetype count) -> bool
|
||||||
|
{
|
||||||
|
qsizetype internalIndex = this->internalIndex(index);
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
internalBoundaryCheck(internalIndex, internalIndex + count)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief externalBoundaryCheck
|
||||||
|
*
|
||||||
|
* Checks if the index is within the known bounds of the external
|
||||||
|
* dataset
|
||||||
|
* @param index
|
||||||
|
* @return True if index is within the external dataset boundary
|
||||||
|
* OR an initial fetch has not been performed.
|
||||||
|
*/
|
||||||
|
template<typename... Ts>
|
||||||
|
auto externalBoundaryCheck(Ts... index) const -> bool
|
||||||
|
{
|
||||||
|
static_assert
|
||||||
|
(
|
||||||
|
(std::is_same_v<Ts, qsizetype> && ...),
|
||||||
|
"All arguments must be qsizetype"
|
||||||
|
);
|
||||||
|
|
||||||
|
bool safe = false;
|
||||||
|
|
||||||
|
((safe = externalBoundaryCheckHelper(index)),...);
|
||||||
|
|
||||||
|
return safe;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto externalBoundaryCheckHelper(qsizetype index) const -> bool
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
index >= 0 &&
|
||||||
|
(
|
||||||
|
m_totalCount == nullsize ||
|
||||||
|
index < m_totalCount
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief internalBoundaryCheck
|
||||||
|
*
|
||||||
|
* Checks if the index is within the currently cached dataset
|
||||||
|
* @param index
|
||||||
|
* @return True if index is within the internal dataset boundary
|
||||||
|
*/
|
||||||
|
template<typename... Ts>
|
||||||
|
auto internalBoundaryCheck(Ts... index) const -> bool
|
||||||
|
{
|
||||||
|
static_assert
|
||||||
|
(
|
||||||
|
(std::is_same_v<Ts, qsizetype> && ...),
|
||||||
|
"All arguments must be qsizetype"
|
||||||
|
);
|
||||||
|
|
||||||
|
bool safe = false;
|
||||||
|
((safe = index >= 0 && index < m_cache.count()), ...);
|
||||||
|
return safe;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief slideWindow
|
||||||
|
*
|
||||||
|
* Slides the current data window to the provided index
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto slideWindow(qsizetype index) -> bool
|
||||||
|
{
|
||||||
|
if (!externalBoundaryCheck(index))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (index >= m_windowOffset + (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD))
|
||||||
|
{
|
||||||
|
if(!slideForward())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (index <= m_windowOffset - (SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD))
|
||||||
|
{
|
||||||
|
if(!slideBackward())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief slideForward
|
* @brief slideForward
|
||||||
* Attempts to slide the cache window forward
|
* Attempts to slide the cache window forward
|
||||||
@@ -144,47 +363,94 @@ private:
|
|||||||
*/
|
*/
|
||||||
auto slideForward() -> bool
|
auto slideForward() -> bool
|
||||||
{
|
{
|
||||||
|
LOG_ERROR_X(!m_fetch,
|
||||||
|
"SlidingCacheController::slideForward",
|
||||||
|
"Fetch function not set",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
Q_EMIT fetching();
|
||||||
|
|
||||||
qsizetype movementSize = SLIDING_CACHE_WINDOW_SIZE;
|
qsizetype movementSize = SLIDING_CACHE_WINDOW_SIZE;
|
||||||
|
qsizetype prefetchThreshold = SLIDING_CACHE_PREFETCH_THRESHOLD;
|
||||||
|
|
||||||
|
if(m_windowSize != nullsize)
|
||||||
|
{
|
||||||
|
movementSize = m_windowSize;
|
||||||
|
|
||||||
|
if(prefetchThreshold >= m_windowSize)
|
||||||
|
{
|
||||||
|
prefetchThreshold = std::floor(
|
||||||
|
static_cast<qreal>(movementSize) * 0.8
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR_X(movementSize <= 0 || prefetchThreshold <= 0,
|
||||||
|
"SlidingCacheController::slideForward",
|
||||||
|
"Invalid movement size",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
//after initial inflation we should only arrive here when the prefetch threshold is reached
|
//after initial inflation we should only arrive here when the prefetch threshold is reached
|
||||||
if(!m_cache.isEmpty())
|
if(!m_cache.isEmpty())
|
||||||
{
|
{
|
||||||
movementSize -= SLIDING_CACHE_PREFETCH_THRESHOLD;
|
movementSize -= prefetchThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_windowOffset += movementSize;
|
if(m_totalCount != nullsize)
|
||||||
|
{
|
||||||
|
m_windowOffset += movementSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_windowOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
QList<T*> newCache = m_fetch(
|
QThread::sleep(KOMPLEX_RATE_LIMIT);
|
||||||
|
|
||||||
|
FetchResult<T> result = m_fetch(
|
||||||
m_windowOffset,
|
m_windowOffset,
|
||||||
movementSize
|
movementSize
|
||||||
);
|
);
|
||||||
|
|
||||||
if(newCache.isEmpty())
|
if(result.count == 0)
|
||||||
{
|
{
|
||||||
m_windowOffset -= movementSize;
|
m_windowOffset += movementSize;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(!newCache.isEmpty() && !m_cache.isEmpty())
|
setTotalCount(result.total);
|
||||||
{
|
|
||||||
T *object = newCache.takeFirst();
|
|
||||||
T *oldObject = m_cache.takeFirst();
|
|
||||||
|
|
||||||
delete oldObject;
|
if(result.data.isEmpty())
|
||||||
m_cache.append(object);
|
{
|
||||||
|
m_windowOffset -= movementSize;
|
||||||
|
|
||||||
|
Q_EMIT fetchComplete();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!newCache.isEmpty())
|
while(!result.data.isEmpty() && !m_cache.isEmpty())
|
||||||
{
|
{
|
||||||
LOG_ERROR_X((newCache.count() + m_cache.count()) > SLIDING_CACHE_WINDOW_SIZE,
|
T object = result.data.takeFirst();
|
||||||
"SlidingCacheController::slideForward",
|
m_cache.removeFirst();
|
||||||
"Cache size imbalance",
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
m_cache.append(newCache);
|
m_cache.append(std::move(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!result.data.isEmpty())
|
||||||
|
{
|
||||||
|
LOG_ERROR_X((result.data.count() + m_cache.count()) > SLIDING_CACHE_WINDOW_SIZE,
|
||||||
|
"SlidingCacheController::slideForward",
|
||||||
|
"Cache size imbalance",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
m_cache.append(std::move(result.data));
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EMIT fetchComplete();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,12 +462,36 @@ private:
|
|||||||
auto slideBackward() -> bool
|
auto slideBackward() -> bool
|
||||||
{
|
{
|
||||||
LOG_ERROR_X(!m_fetch,
|
LOG_ERROR_X(!m_fetch,
|
||||||
"SlidingCacheController::slideBackward",
|
"SlidingCacheController::slideBackward",
|
||||||
"Fetch function not set",
|
"Fetch function not set",
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Q_EMIT fetching();
|
||||||
|
|
||||||
|
qsizetype movementSize = SLIDING_CACHE_WINDOW_SIZE;
|
||||||
|
qsizetype prefetchThreshold = SLIDING_CACHE_PREFETCH_THRESHOLD;
|
||||||
|
|
||||||
|
if(m_windowSize != nullsize)
|
||||||
|
{
|
||||||
|
movementSize = m_windowSize;
|
||||||
|
|
||||||
|
if(prefetchThreshold >= m_windowSize)
|
||||||
|
{
|
||||||
|
prefetchThreshold = std::floor(
|
||||||
|
static_cast<qreal>(movementSize) * 0.8
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR_X(movementSize <= 0 || prefetchThreshold <= 0,
|
||||||
|
"SlidingCacheController::slideBackward",
|
||||||
|
"Invalid movement size",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
QThread::sleep(KOMPLEX_RATE_LIMIT);
|
||||||
|
|
||||||
qsizetype movementSize = SLIDING_CACHE_WINDOW_SIZE - SLIDING_CACHE_PREFETCH_THRESHOLD;
|
|
||||||
m_windowOffset -= movementSize;
|
m_windowOffset -= movementSize;
|
||||||
|
|
||||||
if(m_windowOffset < 0)
|
if(m_windowOffset < 0)
|
||||||
@@ -212,44 +502,53 @@ private:
|
|||||||
FetchResult<T> result = m_fetch(
|
FetchResult<T> result = m_fetch(
|
||||||
m_windowOffset,
|
m_windowOffset,
|
||||||
movementSize
|
movementSize
|
||||||
);
|
);
|
||||||
|
|
||||||
if(result.count == 0)
|
if(result.count == 0)
|
||||||
{
|
{
|
||||||
m_windowOffset += movementSize;
|
m_windowOffset += movementSize;
|
||||||
|
|
||||||
|
Q_EMIT fetchComplete();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTotalCount(result.total);
|
||||||
|
|
||||||
while(!result.data.isEmpty() && !m_cache.isEmpty())
|
while(!result.data.isEmpty() && !m_cache.isEmpty())
|
||||||
{
|
{
|
||||||
T *object = result.data.takeLast();
|
T object = result.data.takeLast();
|
||||||
T *oldObject = m_cache.takeLast();
|
m_cache.removeLast();
|
||||||
|
|
||||||
delete oldObject;
|
m_cache.push_front(std::move(object));
|
||||||
m_cache.push_front(object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result.results.isEmpty())
|
if(!result.data.isEmpty())
|
||||||
{
|
{
|
||||||
LOG_ERROR_X((result.count + m_cache.count()) > SLIDING_CACHE_WINDOW_SIZE,
|
LOG_ERROR_X((result.count + m_cache.count()) > SLIDING_CACHE_WINDOW_SIZE,
|
||||||
"SlidingCacheController::slideBackward",
|
"SlidingCacheController::slideBackward",
|
||||||
"Cache size imbalance",
|
"Cache size imbalance",
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
m_cache.push_front(std::move(result.data));
|
while(!result.data.isEmpty())
|
||||||
|
{
|
||||||
|
T object = result.data.takeLast();
|
||||||
|
m_cache.push_front(std::move(object));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_EMIT fetchComplete();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief trueIndex
|
* @brief internalIndex
|
||||||
* Translates the global object index to the current cache index
|
* Translates the global object index to the current cache index
|
||||||
* @param index Global object index
|
* @param index Global object index
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
auto trueIndex(qsizetype index) -> qsizetype
|
auto internalIndex(qsizetype index) const -> qsizetype
|
||||||
{
|
{
|
||||||
return index - m_windowOffset;
|
return index - m_windowOffset;
|
||||||
}
|
}
|
||||||
@@ -265,7 +564,7 @@ private:
|
|||||||
* Total number of results available. Data comes from the return data of
|
* Total number of results available. Data comes from the return data of
|
||||||
* m_fetch
|
* m_fetch
|
||||||
*/
|
*/
|
||||||
qsizetype m_totalCount = std::numeric_limits<qsizetype>::infinity();
|
qsizetype m_totalCount = nullsize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief m_fetch
|
* @brief m_fetch
|
||||||
@@ -278,7 +577,18 @@ private:
|
|||||||
* @brief m_cache
|
* @brief m_cache
|
||||||
* The working cache
|
* The working cache
|
||||||
*/
|
*/
|
||||||
QVector<T*> m_cache;
|
QVector<T> m_cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_cacheMutex
|
||||||
|
*/
|
||||||
|
mutable QMutex m_cacheMutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_windowSize
|
||||||
|
* Override for window size
|
||||||
|
*/
|
||||||
|
qsizetype m_windowSize = nullsize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SLIDINGCACHECONTROLLER_H
|
#endif // SLIDINGCACHECONTROLLER_H
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
#ifndef VIDEOCACHE_H
|
||||||
|
#define VIDEOCACHE_H
|
||||||
|
|
||||||
|
#include "komplex_global.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
struct KOMPLEX_EXPORT VideoEntry
|
||||||
|
{
|
||||||
|
QString type;
|
||||||
|
qint64 fps = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 height = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 width = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 size = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 id = std::numeric_limits<qint64>::infinity();
|
||||||
|
QString url;
|
||||||
|
QString quality;
|
||||||
|
|
||||||
|
auto operator == (const VideoEntry &other) const -> bool
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
other.fps == fps &&
|
||||||
|
other.height == height &&
|
||||||
|
other.id == id &&
|
||||||
|
other.quality == quality &&
|
||||||
|
other.size == size &&
|
||||||
|
other.type == type &&
|
||||||
|
other.url == url &&
|
||||||
|
other.width == width
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator != (const VideoEntry &other) const -> bool
|
||||||
|
{
|
||||||
|
return !(other == *this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(VideoEntry)
|
||||||
|
|
||||||
|
struct KOMPLEX_EXPORT VideoCache
|
||||||
|
{
|
||||||
|
QString averageColor;
|
||||||
|
qint64 duration = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 height = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 width = std::numeric_limits<qint64>::infinity();
|
||||||
|
qint64 id = std::numeric_limits<qint64>::infinity();
|
||||||
|
QString thumbnail;
|
||||||
|
QString url;
|
||||||
|
QString author;
|
||||||
|
QString authorUrl;
|
||||||
|
qint64 authorId;
|
||||||
|
QList<VideoEntry> files;
|
||||||
|
|
||||||
|
auto operator == (const VideoCache &other) const -> bool
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
other.averageColor == averageColor &&
|
||||||
|
other.duration == duration &&
|
||||||
|
other.height == height &&
|
||||||
|
other.width == width &&
|
||||||
|
other.id == id &&
|
||||||
|
other.thumbnail == thumbnail &&
|
||||||
|
other.url == url &&
|
||||||
|
other.author == author &&
|
||||||
|
other.authorUrl == authorUrl &&
|
||||||
|
other.authorId == authorId &&
|
||||||
|
other.files == files
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator != (const VideoCache &other) const -> bool
|
||||||
|
{
|
||||||
|
return !(other == *this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VIDEOCACHE_H
|
||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef WALLPAPERCACHE_H
|
#ifndef WALLPAPERCACHE_H
|
||||||
#define WALLPAPERCACHE_H
|
#define WALLPAPERCACHE_H
|
||||||
|
|
||||||
@@ -21,7 +39,7 @@ Q_DECLARE_METATYPE(WallpaperInstallData)
|
|||||||
|
|
||||||
struct KOMPLEX_EXPORT WallpaperCache
|
struct KOMPLEX_EXPORT WallpaperCache
|
||||||
{
|
{
|
||||||
QString uri;
|
QString uuid;
|
||||||
QString name;
|
QString name;
|
||||||
QString author;
|
QString author;
|
||||||
QString authorId;
|
QString authorId;
|
||||||
@@ -32,6 +50,28 @@ struct KOMPLEX_EXPORT WallpaperCache
|
|||||||
QString currency;
|
QString currency;
|
||||||
quint64 downloadCount = 0;
|
quint64 downloadCount = 0;
|
||||||
qint8 type = -1;
|
qint8 type = -1;
|
||||||
|
|
||||||
|
auto operator == (const WallpaperCache &other) const -> bool
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
other.uuid == uuid &&
|
||||||
|
other.name == name &&
|
||||||
|
other.author == author &&
|
||||||
|
other.authorId == authorId &&
|
||||||
|
other.description == description &&
|
||||||
|
other.thumbnail == thumbnail &&
|
||||||
|
other.createdDate == createdDate &&
|
||||||
|
other.price == price &&
|
||||||
|
other.currency == currency &&
|
||||||
|
other.downloadCount == downloadCount &&
|
||||||
|
other.type == type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto operator != (const WallpaperCache &other) const -> bool
|
||||||
|
{
|
||||||
|
return !(other == *this);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(WallpaperCache)
|
Q_DECLARE_METATYPE(WallpaperCache)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,321 @@
|
|||||||
|
#include "featuredimagesmodel.h"
|
||||||
|
|
||||||
|
FeaturedImagesModel::FeaturedImagesModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
|
{
|
||||||
|
m_paginator = new FeaturedImagesPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&FeaturedImagesModel::onPaginatorFetching
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::rowCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
|
{
|
||||||
|
if(!boundaryCheck(index.row()))
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
|
QVariant data;
|
||||||
|
|
||||||
|
switch(static_cast<DataRole>(role))
|
||||||
|
{
|
||||||
|
case UuidRole:
|
||||||
|
data = dataPoint.id;
|
||||||
|
break;
|
||||||
|
case AuthorRole:
|
||||||
|
data = dataPoint.photographer;
|
||||||
|
break;
|
||||||
|
case AuthorIdRole:
|
||||||
|
data = dataPoint.photographerId;
|
||||||
|
break;
|
||||||
|
case AuthorUrlRole:
|
||||||
|
data = dataPoint.photographerUrl;
|
||||||
|
break;
|
||||||
|
case DescriptionRole:
|
||||||
|
data = dataPoint.altText;
|
||||||
|
break;
|
||||||
|
case ThumbnailRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("tiny"));
|
||||||
|
break;
|
||||||
|
case PortraitUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("portrait"));
|
||||||
|
break;
|
||||||
|
case LandscapeUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("landscape"));
|
||||||
|
break;
|
||||||
|
case SmallUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("small"));
|
||||||
|
break;
|
||||||
|
case OriginalUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("original"));
|
||||||
|
break;
|
||||||
|
case MediumUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("medium"));
|
||||||
|
break;
|
||||||
|
case LargeUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("large"));
|
||||||
|
break;
|
||||||
|
case ExtraLargeUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("large2x"));
|
||||||
|
break;
|
||||||
|
case PortraitSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("portrait"));
|
||||||
|
break;
|
||||||
|
case LandscapeSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("landscape"));
|
||||||
|
break;
|
||||||
|
case SmallSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("small"));
|
||||||
|
break;
|
||||||
|
case OriginalSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("original"));
|
||||||
|
break;
|
||||||
|
case MediumSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("medium"));
|
||||||
|
break;
|
||||||
|
case LargeSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("large"));
|
||||||
|
break;
|
||||||
|
case ExtraLargeSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("large2x"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::index(int row, int column, const QModelIndex &parent) const -> QModelIndex
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if(!boundaryCheck(row))
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::columnCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::parent(const QModelIndex &) const -> QModelIndex
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::state() const -> FeaturedImagesModel::State
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::setState(State state) -> void
|
||||||
|
{
|
||||||
|
if (m_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_state = state;
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::resetState() -> void
|
||||||
|
{
|
||||||
|
setState(Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::boundaryCheck(qsizetype index) const -> bool
|
||||||
|
{
|
||||||
|
if(index < 0 || m_paginator == nullptr || index >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
|
{
|
||||||
|
return m_dataRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::errorString() const -> QString
|
||||||
|
{
|
||||||
|
return m_errorString;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::setErrorString(const QString &errorString) -> void
|
||||||
|
{
|
||||||
|
if (m_errorString == errorString)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorString = errorString;
|
||||||
|
emit errorStringChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, resultsPerPage]
|
||||||
|
{
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::nextPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::previousPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype FeaturedImagesModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedImagesModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,370 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FeaturedImagesModel_H
|
||||||
|
#define FeaturedImagesModel_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QList>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
|
#include "paginators/featuredimagespaginator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FeaturedImagesModel class
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT FeaturedImagesModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
|
enum DataRole {
|
||||||
|
UuidRole = Qt::UserRole + 1,
|
||||||
|
AuthorRole,
|
||||||
|
AuthorIdRole,
|
||||||
|
AuthorUrlRole,
|
||||||
|
DescriptionRole,
|
||||||
|
ThumbnailRole,
|
||||||
|
PortraitUrlRole,
|
||||||
|
LandscapeUrlRole,
|
||||||
|
SmallUrlRole,
|
||||||
|
OriginalUrlRole,
|
||||||
|
MediumUrlRole,
|
||||||
|
LargeUrlRole,
|
||||||
|
ExtraLargeUrlRole,
|
||||||
|
PortraitSizeRole,
|
||||||
|
LandscapeSizeRole,
|
||||||
|
SmallSizeRole,
|
||||||
|
OriginalSizeRole,
|
||||||
|
MediumSizeRole,
|
||||||
|
LargeSizeRole,
|
||||||
|
ExtraLargeSizeRole
|
||||||
|
};
|
||||||
|
Q_ENUM(DataRole)
|
||||||
|
|
||||||
|
explicit FeaturedImagesModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto index(
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto columnCount(
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
|
auto setData(
|
||||||
|
const QModelIndex &index,
|
||||||
|
const QVariant &value,
|
||||||
|
int role = Qt::EditRole
|
||||||
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto state() const -> State;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* User-friendly error string to be reported to the user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* Total number of results available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Total pages based on the current resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief setErrorString
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetDataModel
|
||||||
|
* Clears the data model and creates a new one if data exists
|
||||||
|
*/
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onPaginatorFetching
|
||||||
|
* Sets current state to loading. Triggered when paginator's cache controller
|
||||||
|
* needs to fetch data from the remote endpoint.
|
||||||
|
*/
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
auto stateChanged() -> void;
|
||||||
|
auto errorStringChanged() -> void;
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief boundaryCheck
|
||||||
|
* Helper function to check the requested index boundary
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto boundaryCheck(qsizetype index) const -> bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_dataRoles
|
||||||
|
* Data role map that connects ImageSearchModel::DataRole to it's QML accessor name
|
||||||
|
*/
|
||||||
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static_cast<int>(UuidRole),
|
||||||
|
QByteArray("uuid")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorRole),
|
||||||
|
QByteArray("author")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorUrlRole),
|
||||||
|
QByteArray("authorUrl")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DescriptionRole),
|
||||||
|
QByteArray("description")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ThumbnailRole),
|
||||||
|
QByteArray("thumbnail")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(PortraitUrlRole),
|
||||||
|
QByteArray("portrait")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LandscapeUrlRole),
|
||||||
|
QByteArray("landscape")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(SmallUrlRole),
|
||||||
|
QByteArray("small")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(OriginalUrlRole),
|
||||||
|
QByteArray("original")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(MediumUrlRole),
|
||||||
|
QByteArray("medium")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LargeUrlRole),
|
||||||
|
QByteArray("large")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ExtraLargeUrlRole),
|
||||||
|
QByteArray("extraLarge")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(PortraitSizeRole),
|
||||||
|
QByteArray("portraitSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LandscapeSizeRole),
|
||||||
|
QByteArray("landscapeSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(SmallSizeRole),
|
||||||
|
QByteArray("smallSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(OriginalSizeRole),
|
||||||
|
QByteArray("originalSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(MediumSizeRole),
|
||||||
|
QByteArray("mediumSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LargeSizeRole),
|
||||||
|
QByteArray("largeSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ExtraLargeSizeRole),
|
||||||
|
QByteArray("extraLargeSize")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
State m_state = Idle;
|
||||||
|
|
||||||
|
QString m_errorString = QString();
|
||||||
|
|
||||||
|
FeaturedImagesPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(qsizetype page READ page NOTIFY pageChanged FINAL)
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(FeaturedImagesModel)
|
||||||
|
|
||||||
|
#endif // FeaturedImagesModel_H
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
#include "featuredpacksmodel.h"
|
||||||
|
#include "common/wallpapercache.h"
|
||||||
|
|
||||||
|
FeaturedPacksModel::FeaturedPacksModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
|
{
|
||||||
|
m_paginator = new FeaturedPacksPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&FeaturedPacksModel::onPaginatorFetching
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::rowCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
|
{
|
||||||
|
if(index.row() < 0 || m_paginator == nullptr || index.row() >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
WallpaperCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
|
QVariant data;
|
||||||
|
|
||||||
|
switch(static_cast<DataRole>(role))
|
||||||
|
{
|
||||||
|
case UuidRole:
|
||||||
|
data = dataPoint.uuid;
|
||||||
|
break;
|
||||||
|
case AuthorRole:
|
||||||
|
data = dataPoint.author;
|
||||||
|
break;
|
||||||
|
case DescriptionRole:
|
||||||
|
data = dataPoint.description;
|
||||||
|
break;
|
||||||
|
case NameRole:
|
||||||
|
data = dataPoint.name;
|
||||||
|
break;
|
||||||
|
case ThumbnailRole:
|
||||||
|
data = dataPoint.thumbnail;
|
||||||
|
break;
|
||||||
|
case CreatedDateRole:
|
||||||
|
data = dataPoint.createdDate;
|
||||||
|
break;
|
||||||
|
case AuthorIdRole:
|
||||||
|
data = dataPoint.authorId;
|
||||||
|
break;
|
||||||
|
case PriceRole:
|
||||||
|
data = dataPoint.price;
|
||||||
|
break;
|
||||||
|
case CurrencyRole:
|
||||||
|
data = dataPoint.currency;
|
||||||
|
break;
|
||||||
|
case DownloadCountRole:
|
||||||
|
data = dataPoint.downloadCount;
|
||||||
|
break;
|
||||||
|
case TypeRole:
|
||||||
|
data = dataPoint.type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::index(int row, int column, const QModelIndex &parent) const -> QModelIndex
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if(row < 0 || row >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::columnCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::parent(const QModelIndex &) const -> QModelIndex
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::state() const -> FeaturedPacksModel::State
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::setState(State state) -> void
|
||||||
|
{
|
||||||
|
if (m_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_state = state;
|
||||||
|
Q_EMIT stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::resetState() -> void
|
||||||
|
{
|
||||||
|
setState(Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
|
{
|
||||||
|
return m_dataRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::errorString() const -> QString
|
||||||
|
{
|
||||||
|
return m_errorString;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::setErrorString(const QString &errorString) -> void
|
||||||
|
{
|
||||||
|
if (m_errorString == errorString)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorString = errorString;
|
||||||
|
Q_EMIT errorStringChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, resultsPerPage]
|
||||||
|
{
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::nextPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::previousPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype FeaturedPacksModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedPacksModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,308 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDPACKSMODEL_H
|
||||||
|
#define FEATUREDPACKSMODEL_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QList>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
|
#include "paginators/featuredpackspaginator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FeaturedPacksModel class
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT FeaturedPacksModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
|
enum DataRole {
|
||||||
|
UuidRole = Qt::UserRole + 1,
|
||||||
|
AuthorRole,
|
||||||
|
AuthorIdRole,
|
||||||
|
DescriptionRole,
|
||||||
|
NameRole,
|
||||||
|
ThumbnailRole,
|
||||||
|
CreatedDateRole,
|
||||||
|
PriceRole,
|
||||||
|
CurrencyRole,
|
||||||
|
DownloadCountRole,
|
||||||
|
TypeRole
|
||||||
|
};
|
||||||
|
Q_ENUM(DataRole)
|
||||||
|
|
||||||
|
explicit FeaturedPacksModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto index(
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto columnCount(
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
|
auto setData(
|
||||||
|
const QModelIndex &index,
|
||||||
|
const QVariant &value,
|
||||||
|
int role = Qt::EditRole
|
||||||
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto state() const -> State;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* User-friendly error string to be reported to the user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* Total number of results available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Total pages based on the current resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief setErrorString
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
auto stateChanged() -> void;
|
||||||
|
auto errorStringChanged() -> void;
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief m_dataRoles
|
||||||
|
* Data role map that connects ImageSearchModel::DataRole to it's QML accessor name
|
||||||
|
*/
|
||||||
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static_cast<int>(UuidRole),
|
||||||
|
QByteArray("uuid")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorRole),
|
||||||
|
QByteArray("author")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DescriptionRole),
|
||||||
|
QByteArray("description")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(NameRole),
|
||||||
|
QByteArray("name")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ThumbnailRole),
|
||||||
|
QByteArray("thumbnail")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(CreatedDateRole),
|
||||||
|
QByteArray("createdDate")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(PriceRole),
|
||||||
|
QByteArray("price")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(CurrencyRole),
|
||||||
|
QByteArray("currency")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DownloadCountRole),
|
||||||
|
QByteArray("downloadCount")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(TypeRole),
|
||||||
|
QByteArray("type")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
State m_state = Idle;
|
||||||
|
|
||||||
|
QString m_errorString = QString();
|
||||||
|
|
||||||
|
FeaturedPacksPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(qsizetype page READ page NOTIFY pageChanged FINAL)
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(FeaturedPacksModel)
|
||||||
|
|
||||||
|
#endif // FEATUREDPACKSMODEL_H
|
||||||
@@ -0,0 +1,284 @@
|
|||||||
|
#include "featuredvideosmodel.h"
|
||||||
|
#include "common/videocache.h"
|
||||||
|
|
||||||
|
FeaturedVideosModel::FeaturedVideosModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
|
{
|
||||||
|
m_paginator = new FeaturedVideosPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&FeaturedVideosModel::onPaginatorFetching
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::rowCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
|
{
|
||||||
|
if(index.row() < 0 || m_paginator == nullptr || index.row() >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
|
QVariant data;
|
||||||
|
|
||||||
|
switch(static_cast<DataRole>(role))
|
||||||
|
{
|
||||||
|
case UuidRole:
|
||||||
|
data = dataPoint.id;
|
||||||
|
break;
|
||||||
|
case AuthorRole:
|
||||||
|
data = dataPoint.author;
|
||||||
|
break;
|
||||||
|
case AuthorIdRole:
|
||||||
|
data = dataPoint.authorId;
|
||||||
|
break;
|
||||||
|
case AuthorUrlRole:
|
||||||
|
data = dataPoint.authorUrl;
|
||||||
|
break;
|
||||||
|
case DurationRole:
|
||||||
|
data = dataPoint.duration;
|
||||||
|
break;
|
||||||
|
case ThumbnailRole:
|
||||||
|
data = dataPoint.thumbnail;
|
||||||
|
break;
|
||||||
|
case UrlRole:
|
||||||
|
data = dataPoint.url;
|
||||||
|
break;
|
||||||
|
case HeightRole:
|
||||||
|
data = dataPoint.height;
|
||||||
|
break;
|
||||||
|
case WidthRole:
|
||||||
|
data = dataPoint.width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::index(int row, int column, const QModelIndex &parent) const -> QModelIndex
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if(m_paginator == nullptr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(row < 0 || row >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::columnCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::parent(const QModelIndex &) const -> QModelIndex
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::state() const -> FeaturedVideosModel::State
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::setState(State state) -> void
|
||||||
|
{
|
||||||
|
if (m_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_state = state;
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::resetState() -> void
|
||||||
|
{
|
||||||
|
setState(Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
|
{
|
||||||
|
return m_dataRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::errorString() const -> QString
|
||||||
|
{
|
||||||
|
return m_errorString;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::setErrorString(const QString &errorString) -> void
|
||||||
|
{
|
||||||
|
if (m_errorString == errorString)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorString = errorString;
|
||||||
|
emit errorStringChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, resultsPerPage]
|
||||||
|
{
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::nextPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::previousPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype FeaturedVideosModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto FeaturedVideosModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDVIDEOSMODEL_H
|
||||||
|
#define FEATUREDVIDEOSMODEL_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QList>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
|
#include "paginators/featuredvideospaginator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FeaturedVideosModel class
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT FeaturedVideosModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
|
enum DataRole {
|
||||||
|
UuidRole = Qt::UserRole + 1,
|
||||||
|
AuthorRole,
|
||||||
|
AuthorIdRole,
|
||||||
|
AuthorUrlRole,
|
||||||
|
DurationRole,
|
||||||
|
ThumbnailRole,
|
||||||
|
UrlRole,
|
||||||
|
HeightRole,
|
||||||
|
WidthRole
|
||||||
|
};
|
||||||
|
Q_ENUM(DataRole)
|
||||||
|
|
||||||
|
explicit FeaturedVideosModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto index(
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto columnCount(
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
|
auto setData(
|
||||||
|
const QModelIndex &index,
|
||||||
|
const QVariant &value,
|
||||||
|
int role = Qt::EditRole
|
||||||
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto state() const -> State;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* User-friendly error string to be reported to the user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* Total number of results available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Total pages based on the current resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief setErrorString
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
auto stateChanged() -> void;
|
||||||
|
auto errorStringChanged() -> void;
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief m_dataRoles
|
||||||
|
* Data role map that connects ImageSearchModel::DataRole to it's QML accessor name
|
||||||
|
*/
|
||||||
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static_cast<int>(UuidRole),
|
||||||
|
QByteArray("uuid")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorRole),
|
||||||
|
QByteArray("author")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorUrlRole),
|
||||||
|
QByteArray("authorUrl")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DurationRole),
|
||||||
|
QByteArray("duration")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ThumbnailRole),
|
||||||
|
QByteArray("thumbnail")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(UrlRole),
|
||||||
|
QByteArray("url")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(HeightRole),
|
||||||
|
QByteArray("height")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(WidthRole),
|
||||||
|
QByteArray("width")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
State m_state = Idle;
|
||||||
|
|
||||||
|
QString m_errorString = QString();
|
||||||
|
|
||||||
|
FeaturedVideosPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(qsizetype page READ page NOTIFY pageChanged FINAL)
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(FeaturedVideosModel)
|
||||||
|
|
||||||
|
#endif // FEATUREDVIDEOSMODEL_H
|
||||||
@@ -0,0 +1,389 @@
|
|||||||
|
#include "imagesearchmodel.h"
|
||||||
|
|
||||||
|
ImageSearchModel::ImageSearchModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
|
{
|
||||||
|
m_paginator = new ImageSearchPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::onPaginatorFetching
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
m_paginator,
|
||||||
|
&ImageSearchPaginator::queryChanged,
|
||||||
|
this,
|
||||||
|
&ImageSearchModel::queryChanged
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageSearchModel::~ImageSearchModel()
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
delete m_paginator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::rowCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
|
{
|
||||||
|
if(index.row() < 0 || m_paginator == nullptr || index.row() >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
|
QVariant data;
|
||||||
|
|
||||||
|
switch(static_cast<DataRole>(role))
|
||||||
|
{
|
||||||
|
case UuidRole:
|
||||||
|
data = dataPoint.id;
|
||||||
|
break;
|
||||||
|
case AuthorRole:
|
||||||
|
data = dataPoint.photographer;
|
||||||
|
break;
|
||||||
|
case AuthorIdRole:
|
||||||
|
data = dataPoint.photographerId;
|
||||||
|
break;
|
||||||
|
case AuthorUrlRole:
|
||||||
|
data = dataPoint.photographerUrl;
|
||||||
|
break;
|
||||||
|
case DescriptionRole:
|
||||||
|
data = dataPoint.altText;
|
||||||
|
break;
|
||||||
|
case ThumbnailRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("tiny"));
|
||||||
|
break;
|
||||||
|
case PortraitUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("portrait"));
|
||||||
|
break;
|
||||||
|
case LandscapeUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("landscape"));
|
||||||
|
break;
|
||||||
|
case SmallUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("small"));
|
||||||
|
break;
|
||||||
|
case OriginalUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("original"));
|
||||||
|
break;
|
||||||
|
case MediumUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("medium"));
|
||||||
|
break;
|
||||||
|
case LargeUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("large"));
|
||||||
|
break;
|
||||||
|
case ExtraLargeUrlRole:
|
||||||
|
data = dataPoint.sources.value(QString::fromUtf8("large2x"));
|
||||||
|
break;
|
||||||
|
case PortraitSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("portrait"));
|
||||||
|
break;
|
||||||
|
case LandscapeSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("landscape"));
|
||||||
|
break;
|
||||||
|
case SmallSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("small"));
|
||||||
|
break;
|
||||||
|
case OriginalSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("original"));
|
||||||
|
break;
|
||||||
|
case MediumSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("medium"));
|
||||||
|
break;
|
||||||
|
case LargeSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("large"));
|
||||||
|
break;
|
||||||
|
case ExtraLargeSizeRole:
|
||||||
|
data = dataPoint.sourceSizes.value(QString::fromUtf8("large2x"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::index(int row, int column, const QModelIndex &parent) const -> QModelIndex
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if(row < 0 || row >= m_paginator->count())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator->at(row));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::columnCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::parent(const QModelIndex &) const -> QModelIndex
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::state() const -> ImageSearchModel::State
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::setState(State state) -> void
|
||||||
|
{
|
||||||
|
if (m_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_state = state;
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::resetState() -> void
|
||||||
|
{
|
||||||
|
setState(Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::hasNextPage() const -> bool
|
||||||
|
{
|
||||||
|
return m_paginator->page() < m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::hasPreviousPage() const -> bool
|
||||||
|
{
|
||||||
|
return m_paginator->page() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
|
{
|
||||||
|
return m_dataRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::errorString() const -> QString
|
||||||
|
{
|
||||||
|
return m_errorString;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::setErrorString(const QString &errorString) -> void
|
||||||
|
{
|
||||||
|
if (m_errorString == errorString)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorString = errorString;
|
||||||
|
emit errorStringChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, resultsPerPage]
|
||||||
|
{
|
||||||
|
qsizetype difference = resultsPerPage - m_paginator->resultsPerPage();
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
|
||||||
|
if(difference > 0)
|
||||||
|
{
|
||||||
|
qsizetype firstIndex = m_paginator->resultsPerPage() - difference;
|
||||||
|
|
||||||
|
beginInsertRows
|
||||||
|
(
|
||||||
|
QModelIndex(),
|
||||||
|
firstIndex,
|
||||||
|
m_paginator->count() - 1
|
||||||
|
);
|
||||||
|
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(difference < 0)
|
||||||
|
{
|
||||||
|
qsizetype firstIndex = m_paginator->resultsPerPage();
|
||||||
|
|
||||||
|
beginRemoveRows
|
||||||
|
(
|
||||||
|
QModelIndex(),
|
||||||
|
firstIndex,
|
||||||
|
firstIndex - difference
|
||||||
|
);
|
||||||
|
|
||||||
|
endRemoveRows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::nextPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::previousPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::query() const -> QString
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::setQuery(const QString &query) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, query]
|
||||||
|
{
|
||||||
|
m_paginator->setQuery(query);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype ImageSearchModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ImageSearchModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,430 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef ImageSearchModel_H
|
||||||
|
#define ImageSearchModel_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QList>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
|
#include "paginators/imagesearchpaginator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The ImageSearchModel class
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT ImageSearchModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
|
enum DataRole {
|
||||||
|
UuidRole = Qt::UserRole + 1,
|
||||||
|
AuthorRole,
|
||||||
|
AuthorIdRole,
|
||||||
|
AuthorUrlRole,
|
||||||
|
DescriptionRole,
|
||||||
|
ThumbnailRole,
|
||||||
|
PortraitUrlRole,
|
||||||
|
LandscapeUrlRole,
|
||||||
|
SmallUrlRole,
|
||||||
|
OriginalUrlRole,
|
||||||
|
MediumUrlRole,
|
||||||
|
LargeUrlRole,
|
||||||
|
ExtraLargeUrlRole,
|
||||||
|
PortraitSizeRole,
|
||||||
|
LandscapeSizeRole,
|
||||||
|
SmallSizeRole,
|
||||||
|
OriginalSizeRole,
|
||||||
|
MediumSizeRole,
|
||||||
|
LargeSizeRole,
|
||||||
|
ExtraLargeSizeRole
|
||||||
|
};
|
||||||
|
Q_ENUM(DataRole)
|
||||||
|
|
||||||
|
explicit ImageSearchModel(QObject *parent = nullptr);
|
||||||
|
~ImageSearchModel();
|
||||||
|
|
||||||
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto index(
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto columnCount(
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
|
auto setData(
|
||||||
|
const QModelIndex &index,
|
||||||
|
const QVariant &value,
|
||||||
|
int role = Qt::EditRole
|
||||||
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto state() const -> State;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* User-friendly error string to be reported to the user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* Total number of results available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Total pages based on the current resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief query
|
||||||
|
* Current search query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto query() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setQuery
|
||||||
|
* Sets the current search query
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
auto setQuery(const QString &query) -> 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
|
||||||
|
* Sets the error string to be displayed to the user
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* Sets the current state for QML
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetDataModel
|
||||||
|
* Clears the data model and creates a new one if data exists
|
||||||
|
*/
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief onPaginatorFetching
|
||||||
|
* Sets current state to loading. Triggered when paginator's cache controller
|
||||||
|
* needs to fetch data from the remote endpoint.
|
||||||
|
*/
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief stateChanged
|
||||||
|
* Signaled when reported state changes
|
||||||
|
*/
|
||||||
|
auto stateChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorStringChanged
|
||||||
|
* Signaled when reported error message changes
|
||||||
|
*/
|
||||||
|
auto errorStringChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto queryChanged() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief m_dataRoles
|
||||||
|
* Data role map that connects ImageSearchModel::DataRole to it's QML accessor name
|
||||||
|
*/
|
||||||
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static_cast<int>(UuidRole),
|
||||||
|
QByteArray("uuid")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorRole),
|
||||||
|
QByteArray("author")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorUrlRole),
|
||||||
|
QByteArray("authorUrl")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DescriptionRole),
|
||||||
|
QByteArray("description")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ThumbnailRole),
|
||||||
|
QByteArray("thumbnail")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(PortraitUrlRole),
|
||||||
|
QByteArray("portrait")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LandscapeUrlRole),
|
||||||
|
QByteArray("landscape")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(SmallUrlRole),
|
||||||
|
QByteArray("small")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(OriginalUrlRole),
|
||||||
|
QByteArray("original")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(MediumUrlRole),
|
||||||
|
QByteArray("medium")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LargeUrlRole),
|
||||||
|
QByteArray("large")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ExtraLargeUrlRole),
|
||||||
|
QByteArray("extraLarge")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(PortraitSizeRole),
|
||||||
|
QByteArray("portraitSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LandscapeSizeRole),
|
||||||
|
QByteArray("landscapeSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(SmallSizeRole),
|
||||||
|
QByteArray("smallSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(OriginalSizeRole),
|
||||||
|
QByteArray("originalSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(MediumSizeRole),
|
||||||
|
QByteArray("mediumSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(LargeSizeRole),
|
||||||
|
QByteArray("largeSize")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ExtraLargeSizeRole),
|
||||||
|
QByteArray("extraLargeSize")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
State m_state = Idle;
|
||||||
|
|
||||||
|
QString m_errorString = QString();
|
||||||
|
|
||||||
|
ImageSearchPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(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(QString query READ query WRITE setQuery NOTIFY queryChanged FINAL)
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(ImageSearchModel)
|
||||||
|
|
||||||
|
#endif // ImageSearchModel_H
|
||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef INSTALLEDPACKMANAGER_H
|
#ifndef INSTALLEDPACKMANAGER_H
|
||||||
#define INSTALLEDPACKMANAGER_H
|
#define INSTALLEDPACKMANAGER_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,67 +1,118 @@
|
|||||||
#include "newestpacksmodel.h"
|
#include "newestpacksmodel.h"
|
||||||
#include "common/coreservices.h"
|
#include "common/wallpapercache.h"
|
||||||
#include "common/logging.h"
|
|
||||||
|
|
||||||
NewestPacksModel::NewestPacksModel(QObject *parent) : QAbstractListModel{parent}
|
NewestPacksModel::NewestPacksModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
{
|
{
|
||||||
|
setState(Loading);
|
||||||
|
|
||||||
|
m_paginator = new NewestPacksPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&NewestPacksModel::onPaginatorFetching
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto NewestPacksModel::rowCount(const QModelIndex &) const -> int
|
auto NewestPacksModel::rowCount(const QModelIndex &) const -> int
|
||||||
{
|
{
|
||||||
return m_wallpaperCache.count();
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto NewestPacksModel::data(const QModelIndex &index, int role) const -> QVariant
|
auto NewestPacksModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
{
|
{
|
||||||
if(index.row() < 0)
|
if(index.row() < 0 || m_paginator == nullptr || index.row() >= m_paginator->count())
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
WallpaperCache *dataPoint = m_wallpaperCache.at(index.row());
|
WallpaperCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
if(dataPoint == nullptr)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant data;
|
QVariant data;
|
||||||
|
|
||||||
switch(static_cast<DataRole>(role))
|
switch(static_cast<DataRole>(role))
|
||||||
{
|
{
|
||||||
case UriRole:
|
case UuidRole:
|
||||||
data = dataPoint->uri;
|
data = dataPoint.uuid;
|
||||||
break;
|
break;
|
||||||
case AuthorRole:
|
case AuthorRole:
|
||||||
data = dataPoint->author;
|
data = dataPoint.author;
|
||||||
break;
|
break;
|
||||||
case DescriptionRole:
|
case DescriptionRole:
|
||||||
data = dataPoint->description;
|
data = dataPoint.description;
|
||||||
break;
|
break;
|
||||||
case NameRole:
|
case NameRole:
|
||||||
data = dataPoint->name;
|
data = dataPoint.name;
|
||||||
break;
|
break;
|
||||||
case ThumbnailRole:
|
case ThumbnailRole:
|
||||||
data = dataPoint->thumbnail;
|
data = dataPoint.thumbnail;
|
||||||
break;
|
break;
|
||||||
case CreatedDateRole:
|
case CreatedDateRole:
|
||||||
data = dataPoint->createdDate;
|
data = dataPoint.createdDate;
|
||||||
break;
|
break;
|
||||||
case AuthorIdRole:
|
case AuthorIdRole:
|
||||||
data = dataPoint->authorId;
|
data = dataPoint.authorId;
|
||||||
break;
|
break;
|
||||||
case PriceRole:
|
case PriceRole:
|
||||||
data = dataPoint->price;
|
data = dataPoint.price;
|
||||||
break;
|
break;
|
||||||
case CurrencyRole:
|
case CurrencyRole:
|
||||||
data = dataPoint->currency;
|
data = dataPoint.currency;
|
||||||
break;
|
break;
|
||||||
case DownloadCountRole:
|
case DownloadCountRole:
|
||||||
data = dataPoint->downloadCount;
|
data = dataPoint.downloadCount;
|
||||||
break;
|
break;
|
||||||
case TypeRole:
|
case TypeRole:
|
||||||
data = dataPoint->type;
|
data = dataPoint.type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +123,10 @@ auto NewestPacksModel::index(int row, int column, const QModelIndex &parent) con
|
|||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
return createIndex(row, column, m_wallpaperCache.at(row));
|
if(row < 0 || row >= m_paginator->count())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator[row]);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto NewestPacksModel::columnCount(const QModelIndex &) const -> int
|
auto NewestPacksModel::columnCount(const QModelIndex &) const -> int
|
||||||
@@ -87,7 +141,7 @@ auto NewestPacksModel::parent(const QModelIndex &) const -> QModelIndex
|
|||||||
|
|
||||||
auto NewestPacksModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
auto NewestPacksModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto NewestPacksModel::state() const -> NewestPacksModel::State
|
auto NewestPacksModel::state() const -> NewestPacksModel::State
|
||||||
@@ -111,6 +165,22 @@ auto NewestPacksModel::resetState() -> void
|
|||||||
setState(Idle);
|
setState(Idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
auto NewestPacksModel::roleNames() const -> QHash<int, QByteArray>
|
auto NewestPacksModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
{
|
{
|
||||||
return m_dataRoles;
|
return m_dataRoles;
|
||||||
@@ -131,3 +201,79 @@ auto NewestPacksModel::setErrorString(const QString &errorString) -> void
|
|||||||
m_errorString = errorString;
|
m_errorString = errorString;
|
||||||
emit errorStringChanged();
|
emit errorStringChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::nextPage() const -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::previousPage() const -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype NewestPacksModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto NewestPacksModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef NEWESTPACKSMODEL_H
|
#ifndef NEWESTPACKSMODEL_H
|
||||||
#define NEWESTPACKSMODEL_H
|
#define NEWESTPACKSMODEL_H
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -17,16 +35,22 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
#include "paginators/newestpackspaginator.h"
|
#include "paginators/newestpackspaginator.h"
|
||||||
#include "common/wallpapercache.h"
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The NewestPacksModel class
|
||||||
|
*/
|
||||||
class KOMPLEX_EXPORT NewestPacksModel : public QAbstractListModel
|
class KOMPLEX_EXPORT NewestPacksModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QML_ELEMENT
|
QML_ELEMENT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
enum State
|
enum State
|
||||||
{
|
{
|
||||||
Idle,
|
Idle,
|
||||||
@@ -35,8 +59,11 @@ public:
|
|||||||
};
|
};
|
||||||
Q_ENUM(State)
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
enum DataRole {
|
enum DataRole {
|
||||||
UriRole = Qt::UserRole + 1,
|
UuidRole = Qt::UserRole + 1,
|
||||||
AuthorRole,
|
AuthorRole,
|
||||||
AuthorIdRole,
|
AuthorIdRole,
|
||||||
DescriptionRole,
|
DescriptionRole,
|
||||||
@@ -52,53 +79,190 @@ public:
|
|||||||
|
|
||||||
explicit NewestPacksModel(QObject *parent = nullptr);
|
explicit NewestPacksModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief rowCount
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
auto data(const QModelIndex &index, int role = Qt::DisplayRole) const -> QVariant override;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto index(
|
auto index(
|
||||||
int row,
|
int row,
|
||||||
int column,
|
int column,
|
||||||
const QModelIndex &parent = QModelIndex()
|
const QModelIndex &parent = QModelIndex()
|
||||||
) const -> QModelIndex override;
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto columnCount(
|
auto columnCount(
|
||||||
const QModelIndex &parent = QModelIndex()
|
const QModelIndex &parent = QModelIndex()
|
||||||
) const -> int override;
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
auto setData(
|
auto setData(
|
||||||
const QModelIndex &index,
|
const QModelIndex &index,
|
||||||
const QVariant &value,
|
const QVariant &value,
|
||||||
int role = Qt::EditRole
|
int role = Qt::EditRole
|
||||||
) -> bool override;
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
auto state() const -> State;
|
auto state() const -> State;
|
||||||
auto setState(State state) -> void;
|
|
||||||
auto resetState() -> void;
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto roleNames() const -> QHash<int, QByteArray> override;
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
auto errorString() const -> QString;
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() const -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() const -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief setErrorString
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
auto setErrorString(const QString &errorString) -> void;
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetDataModel
|
||||||
|
*/
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
auto installedWallpapersChanged() -> void;
|
|
||||||
|
|
||||||
auto stateChanged() -> void;
|
auto stateChanged() -> void;
|
||||||
|
|
||||||
auto errorStringChanged() -> void;
|
auto errorStringChanged() -> void;
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline const QHash<int, QByteArray> m_dataRoles =
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
static_cast<int>(UriRole),
|
static_cast<int>(UuidRole),
|
||||||
QByteArray("uri")
|
QByteArray("uuid")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
static_cast<int>(AuthorRole),
|
static_cast<int>(AuthorRole),
|
||||||
QByteArray("author")
|
QByteArray("author")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
{
|
{
|
||||||
static_cast<int>(DescriptionRole),
|
static_cast<int>(DescriptionRole),
|
||||||
QByteArray("description")
|
QByteArray("description")
|
||||||
@@ -132,21 +296,18 @@ private:
|
|||||||
QByteArray("type")
|
QByteArray("type")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline const QString m_endpointUri = QString("");
|
|
||||||
State m_state = Idle;
|
State m_state = Idle;
|
||||||
|
|
||||||
QString m_errorString = QString();
|
QString m_errorString = QString();
|
||||||
|
|
||||||
QString m_installDirectoryUri;
|
NewestPacksPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
qint64 m_page = 0;
|
|
||||||
qint64 m_resultsPerPage = 0;
|
|
||||||
|
|
||||||
NewestPacksPaginator m_wallpaperCache;
|
|
||||||
|
|
||||||
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(qsizetype page READ page NOTIFY pageChanged FINAL)
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(NewestPacksModel)
|
Q_DECLARE_METATYPE(NewestPacksModel)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,328 @@
|
|||||||
|
#include "packsearchmodel.h"
|
||||||
|
|
||||||
|
PackSearchModel::PackSearchModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
|
{
|
||||||
|
m_paginator = new PackSearchPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::onPaginatorFetching
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
m_paginator,
|
||||||
|
&PaginationNotifier::queryChanged,
|
||||||
|
this,
|
||||||
|
&PackSearchModel::queryChanged
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::rowCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
|
{
|
||||||
|
if(m_paginator == nullptr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(index.row() < 0 || index.row() >= m_paginator->count() )
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
WallpaperCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
|
QVariant data;
|
||||||
|
|
||||||
|
switch(static_cast<DataRole>(role))
|
||||||
|
{
|
||||||
|
case UuidRole:
|
||||||
|
data = dataPoint.uuid;
|
||||||
|
break;
|
||||||
|
case AuthorRole:
|
||||||
|
data = dataPoint.author;
|
||||||
|
break;
|
||||||
|
case DescriptionRole:
|
||||||
|
data = dataPoint.description;
|
||||||
|
break;
|
||||||
|
case NameRole:
|
||||||
|
data = dataPoint.name;
|
||||||
|
break;
|
||||||
|
case ThumbnailRole:
|
||||||
|
data = dataPoint.thumbnail;
|
||||||
|
break;
|
||||||
|
case CreatedDateRole:
|
||||||
|
data = dataPoint.createdDate;
|
||||||
|
break;
|
||||||
|
case AuthorIdRole:
|
||||||
|
data = dataPoint.authorId;
|
||||||
|
break;
|
||||||
|
case PriceRole:
|
||||||
|
data = dataPoint.price;
|
||||||
|
break;
|
||||||
|
case CurrencyRole:
|
||||||
|
data = dataPoint.currency;
|
||||||
|
break;
|
||||||
|
case DownloadCountRole:
|
||||||
|
data = dataPoint.downloadCount;
|
||||||
|
break;
|
||||||
|
case TypeRole:
|
||||||
|
data = dataPoint.type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::index(int row, int column, const QModelIndex &parent) const -> QModelIndex
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if(row < 0 || row >= m_paginator->count())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::columnCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::parent(const QModelIndex &) const -> QModelIndex
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::state() const -> PackSearchModel::State
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::setState(State state) -> void
|
||||||
|
{
|
||||||
|
if (m_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_state = state;
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::resetState() -> void
|
||||||
|
{
|
||||||
|
setState(Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::hasNextPage() const -> bool
|
||||||
|
{
|
||||||
|
return m_paginator->page() < m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::hasPreviousPage() const -> bool
|
||||||
|
{
|
||||||
|
return m_paginator->page() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
|
{
|
||||||
|
return m_dataRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::errorString() const -> QString
|
||||||
|
{
|
||||||
|
return m_errorString;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::setErrorString(const QString &errorString) -> void
|
||||||
|
{
|
||||||
|
if (m_errorString == errorString)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorString = errorString;
|
||||||
|
emit errorStringChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, resultsPerPage]
|
||||||
|
{
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::nextPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::previousPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::query() const -> QString
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::setQuery(const QString &query) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, query]
|
||||||
|
{
|
||||||
|
m_paginator->setQuery(query);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype PackSearchModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PackSearchModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef PackSearchModel_H
|
||||||
|
#define PackSearchModel_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QList>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
|
#include "paginators/packsearchpaginator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The PackSearchModel class
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT PackSearchModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
|
enum DataRole {
|
||||||
|
UuidRole = Qt::UserRole + 1,
|
||||||
|
AuthorRole,
|
||||||
|
AuthorIdRole,
|
||||||
|
DescriptionRole,
|
||||||
|
NameRole,
|
||||||
|
ThumbnailRole,
|
||||||
|
CreatedDateRole,
|
||||||
|
PriceRole,
|
||||||
|
CurrencyRole,
|
||||||
|
DownloadCountRole,
|
||||||
|
TypeRole
|
||||||
|
};
|
||||||
|
Q_ENUM(DataRole)
|
||||||
|
|
||||||
|
explicit PackSearchModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto index(
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto columnCount(
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
|
auto setData(
|
||||||
|
const QModelIndex &index,
|
||||||
|
const QVariant &value,
|
||||||
|
int role = Qt::EditRole
|
||||||
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto state() const -> State;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* User-friendly error string to be reported to the user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* Total number of results available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Total pages based on the current resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief query
|
||||||
|
* Current search query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto query() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setQuery
|
||||||
|
* Sets the current search query
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
auto setQuery(const QString &query) -> 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 onPaginatorFetching
|
||||||
|
* Sets current state to loading. Triggered when paginator's cache controller
|
||||||
|
* needs to fetch data from the remote endpoint.
|
||||||
|
*/
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setErrorString
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetDataModel
|
||||||
|
* Clears the data model and creates a new one if data exists
|
||||||
|
*/
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief stateChanged
|
||||||
|
* Signaled when reported state changes
|
||||||
|
*/
|
||||||
|
auto stateChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorStringChanged
|
||||||
|
* Signaled when reported error message changes
|
||||||
|
*/
|
||||||
|
auto errorStringChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto queryChanged() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Data role map that connects PackSearchModel::DataRole to it's QML accessor name
|
||||||
|
*/
|
||||||
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static_cast<int>(UuidRole),
|
||||||
|
QByteArray("uuid")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorRole),
|
||||||
|
QByteArray("author")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DescriptionRole),
|
||||||
|
QByteArray("description")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(NameRole),
|
||||||
|
QByteArray("name")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ThumbnailRole),
|
||||||
|
QByteArray("thumbnail")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(CreatedDateRole),
|
||||||
|
QByteArray("createdDate")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(PriceRole),
|
||||||
|
QByteArray("price")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(CurrencyRole),
|
||||||
|
QByteArray("currency")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DownloadCountRole),
|
||||||
|
QByteArray("downloadCount")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(TypeRole),
|
||||||
|
QByteArray("type")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
State m_state = Idle;
|
||||||
|
|
||||||
|
QString m_errorString = QString();
|
||||||
|
|
||||||
|
PackSearchPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(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(QString query READ query WRITE setQuery NOTIFY queryChanged FINAL)
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(PackSearchModel)
|
||||||
|
|
||||||
|
#endif // PackSearchModel_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDCUBEMAPSPAGINATOR_H
|
||||||
|
#define FEATUREDCUBEMAPSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT FeaturedCubemapsPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FeaturedCubemapsPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_CUBEMAPS_FEATURED)
|
||||||
|
);
|
||||||
|
|
||||||
|
controller()->setWindowSize(20);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FEATUREDCUBEMAPSPAGINATOR_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDIMAGESPAGINATOR_H
|
||||||
|
#define FEATUREDIMAGESPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "imagepaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT FeaturedImagesPaginator : public ImagePaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FeaturedImagesPaginator(QObject *parent = nullptr) : ImagePaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_IMAGES_FEATURED)
|
||||||
|
);
|
||||||
|
|
||||||
|
controller()->setWindowSize(20);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FEATUREDIMAGESPAGINATOR_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDPACKSPAGINATOR_H
|
||||||
|
#define FEATUREDPACKSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT FeaturedPacksPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FeaturedPacksPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_FEATURED)
|
||||||
|
);
|
||||||
|
|
||||||
|
controller()->setWindowSize(20);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FEATUREDPACKSPAGINATOR_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDSHADERSPAGINATOR_H
|
||||||
|
#define FEATUREDSHADERSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT FeaturedShadersPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FeaturedShadersPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_SHADERS_FEATURED)
|
||||||
|
);
|
||||||
|
|
||||||
|
controller()->setWindowSize(20);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FEATUREDSHADERSPAGINATOR_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef FEATUREDVIDEOSPAGINATOR_H
|
||||||
|
#define FEATUREDVIDEOSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "videopaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT FeaturedVideosPaginator : public VideoPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FeaturedVideosPaginator(QObject *parent = nullptr) : VideoPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_VIDEOS_FEATURED)
|
||||||
|
);
|
||||||
|
|
||||||
|
controller()->setWindowSize(20);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FEATUREDVIDEOSPAGINATOR_H
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef IMAGEPAGINATOR_H
|
||||||
|
#define IMAGEPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "common/logging.h"
|
||||||
|
#include "common/paginator.h"
|
||||||
|
#include "common/imagecache.h"
|
||||||
|
#include "common/coreservices.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The ImagePaginator class
|
||||||
|
* Most of the media endpoints for the Komplex API have the same data structure so
|
||||||
|
* child classes can make use of this generic controller where possible
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT ImagePaginator : public Paginator<ImageCache>
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit ImagePaginator(QObject *parent = nullptr) : Paginator<ImageCache>(parent)
|
||||||
|
{
|
||||||
|
SlidingCacheController<ImageCache> *controller = this->controller();
|
||||||
|
controller->setFetch(
|
||||||
|
std::bind(&ImagePaginator::fetch, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief uri
|
||||||
|
* URI of the API Endpoint. This is set by the child class
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto uri() const -> QString
|
||||||
|
{
|
||||||
|
return m_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief uriChanged
|
||||||
|
*/
|
||||||
|
auto uriChanged() -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief fetch
|
||||||
|
* Used to fetch results from the API endpoint
|
||||||
|
* for the CacheController. It is intended to be passed
|
||||||
|
* to the Cache Controller not meant to be called directly.
|
||||||
|
* @param offset Offset index to start the results from
|
||||||
|
* @param limit Number of results to attempt to fetch
|
||||||
|
* @return FetchResult<ImageCache>
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto fetch(
|
||||||
|
qsizetype offset,
|
||||||
|
qsizetype limit
|
||||||
|
) const -> FetchResult<ImageCache>
|
||||||
|
{
|
||||||
|
LOG_ERROR_X(m_uri.isEmpty(),
|
||||||
|
"ImagePaginator::fetch",
|
||||||
|
"Uri not set",
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(queryable() && query().isEmpty())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl url(
|
||||||
|
QString::fromUtf8("%1/%2/%3").arg(
|
||||||
|
KOMPLEX_API_HOST,
|
||||||
|
KOMPLEX_API_VERSION,
|
||||||
|
m_uri
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
request.setHeaders(
|
||||||
|
QHttpHeaders::fromMultiMap(
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QByteArray("query"),
|
||||||
|
query().toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("offset"),
|
||||||
|
QString::number(offset).toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("limit"),
|
||||||
|
QString::number(limit).toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("session_token"),
|
||||||
|
CoreServices::sessionToken()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkReply *reply = getNetworkReply(request);
|
||||||
|
|
||||||
|
if(reply == nullptr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument document = getDocument(reply);
|
||||||
|
|
||||||
|
QJsonObject rootObject = document.object();
|
||||||
|
const QJsonArray resultsArray = rootObject.value(QString::fromUtf8("photos")).toArray();
|
||||||
|
|
||||||
|
QList<ImageCache> fetchedResults;
|
||||||
|
|
||||||
|
for(const auto result : resultsArray)
|
||||||
|
{
|
||||||
|
if(!result.isObject())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject resultObject = result.toObject();
|
||||||
|
|
||||||
|
const QVariantMap sources = resultObject.value(QString::fromUtf8("src")).toObject().toVariantMap();
|
||||||
|
QMap<QString, QString> sourceMap;
|
||||||
|
QMap<QString, QString> sizeMap;
|
||||||
|
|
||||||
|
QMapIterator<QString,QVariant> sourceIterator(sources);
|
||||||
|
|
||||||
|
while(sourceIterator.hasNext())
|
||||||
|
{
|
||||||
|
sourceIterator.next();
|
||||||
|
|
||||||
|
QString url = sourceIterator.value().toString();
|
||||||
|
sourceMap.insert(sourceIterator.key(), url);
|
||||||
|
|
||||||
|
auto matches = s_sizeExpression.match(url);
|
||||||
|
|
||||||
|
if(matches.hasMatch())
|
||||||
|
{
|
||||||
|
QString size = matches.captured();
|
||||||
|
size.remove(QString::fromUtf8("w="));
|
||||||
|
size.remove(QString::fromUtf8("h="));
|
||||||
|
size.replace(QLatin1Char('&'), QLatin1Char('x'));
|
||||||
|
|
||||||
|
sizeMap.insert(sourceIterator.key(), std::move(size));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchedResults.append(
|
||||||
|
{
|
||||||
|
resultObject.value(QString::fromUtf8("alt")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("avg_color")).toString().toUtf8(),
|
||||||
|
resultObject.value(QString::fromUtf8("height")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("width")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("id")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("liked")).toBool(),
|
||||||
|
resultObject.value(QString::fromUtf8("photographer")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("photographer_url")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("photographer_id")).toInteger(),
|
||||||
|
std::move(sourceMap),
|
||||||
|
std::move(sizeMap),
|
||||||
|
resultObject.value(QString::fromUtf8("url")).toString()
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
FetchResult<ImageCache> result
|
||||||
|
{
|
||||||
|
static_cast<qsizetype>(rootObject.value(QString::fromUtf8("total_results")).toInteger()),
|
||||||
|
fetchedResults.count(),
|
||||||
|
std::move(fetchedResults)
|
||||||
|
};
|
||||||
|
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getNetworkReply
|
||||||
|
* Processes the request and blocks until completion.
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto getNetworkReply(const QNetworkRequest &request) const -> QNetworkReply*
|
||||||
|
{
|
||||||
|
QEventLoop loop;
|
||||||
|
QWeakPointer<QNetworkAccessManager> managerReference = CoreServices::networkAccessManager();
|
||||||
|
|
||||||
|
QSharedPointer<QNetworkAccessManager> manager = managerReference.toStrongRef();
|
||||||
|
|
||||||
|
LOG_ERROR_X(!manager,
|
||||||
|
"NewestPacksPaginator::getNetworkReply",
|
||||||
|
"Network manager reference has already been deleted",
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkReply *reply = manager->post(request, nullptr);
|
||||||
|
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||||
|
QObject::connect(reply, &QNetworkReply::errorOccurred, &loop,
|
||||||
|
[&loop](QNetworkReply::NetworkError error) -> void
|
||||||
|
{
|
||||||
|
loop.quit();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!reply->isFinished())
|
||||||
|
{
|
||||||
|
loop.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
|
||||||
|
"NewestPacksPaginator::getNetworkReply",
|
||||||
|
reply->errorString().toStdString().c_str(),
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getDocument
|
||||||
|
* Extracts the JSON document from the server reply
|
||||||
|
* @param reply
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto getDocument(QNetworkReply *reply) const -> QJsonDocument
|
||||||
|
{
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
QJsonParseError documentError;
|
||||||
|
QJsonDocument document = QJsonDocument::fromJson(data, &documentError);
|
||||||
|
|
||||||
|
LOG_ERROR_X(documentError.error != QJsonParseError::NoError,
|
||||||
|
"NewestPacksPaginator::getDocument",
|
||||||
|
documentError.errorString().toStdString().c_str(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setUri
|
||||||
|
* Sets the API Endpoint URI to fetch from
|
||||||
|
* @param uri
|
||||||
|
*/
|
||||||
|
auto setUri(const QString &uri) -> void
|
||||||
|
{
|
||||||
|
if(uri == m_uri)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_uri = uri;
|
||||||
|
|
||||||
|
Q_EMIT uriChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief m_uri
|
||||||
|
* API Endpoint URI
|
||||||
|
*/
|
||||||
|
QString m_uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief s_sizeExpression
|
||||||
|
* Regular expression used to extract size data from the url
|
||||||
|
*/
|
||||||
|
inline static QRegularExpression s_sizeExpression = QRegularExpression
|
||||||
|
(
|
||||||
|
QString::fromUtf8("[h]\\=\\d{1,}\\&[w]\\=\\d{1,}")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMAGEPAGINATOR_H
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef IMAGESEARCHPAGINATOR_H
|
||||||
|
#define IMAGESEARCHPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "imagepaginator.h"
|
||||||
|
|
||||||
|
#include "common/komplex_global.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT ImageSearchPaginator : public ImagePaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ImageSearchPaginator(QObject *parent = nullptr) : ImagePaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_IMAGES_SEARCH)
|
||||||
|
);
|
||||||
|
|
||||||
|
setQueryable(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IMAGESEARCHPAGINATOR_H
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef NEWESTCUBEMAPSPAGINATOR_H
|
||||||
|
#define NEWESTCUBEMAPSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT NewestCubemapsPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NewestCubemapsPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_CUBEMAPS_NEWEST)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NEWESTCUBEMAPSPAGINATOR_H
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#include "newestpackspaginator.h"
|
|
||||||
#include "common/coreservices.h"
|
|
||||||
#include "common/logging.h"
|
|
||||||
|
|
||||||
NewestPacksPaginator::NewestPacksPaginator() : Paginator<WallpaperCache>()
|
|
||||||
{
|
|
||||||
SlidingCacheController<WallpaperCache> *controller = this->controller();
|
|
||||||
controller->setFetch(
|
|
||||||
std::bind(&NewestPacksPaginator::fetch, this, std::placeholders::_1, std::placeholders::_2)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
#ifndef NEWESTPACKSPAGINATOR_H
|
#ifndef NEWESTPACKSPAGINATOR_H
|
||||||
#define NEWESTPACKSPAGINATOR_H
|
#define NEWESTPACKSPAGINATOR_H
|
||||||
|
|
||||||
@@ -11,152 +29,18 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
#include "common/logging.h"
|
#include "wallpaperpaginator.h"
|
||||||
#include "common/paginator.h"
|
|
||||||
#include "common/wallpapercache.h"
|
|
||||||
#include "common/coreservices.h"
|
|
||||||
|
|
||||||
class KOMPLEX_EXPORT NewestPacksPaginator : public Paginator<WallpaperCache>
|
class KOMPLEX_EXPORT NewestPacksPaginator : public WallpaperPaginator
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NewestPacksPaginator();
|
explicit NewestPacksPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief fetch
|
|
||||||
* Used to fetch results from the API endpoint
|
|
||||||
* for the CacheController. It is intended to be passed
|
|
||||||
* to the Cache Controller not meant to be called directly.
|
|
||||||
* @param offset Offset index to start the results from
|
|
||||||
* @param limit Number of results to attempt to fetch
|
|
||||||
* @return FetchResult<WallpaperCache>
|
|
||||||
*/
|
|
||||||
auto fetch(
|
|
||||||
qsizetype offset,
|
|
||||||
qsizetype limit
|
|
||||||
) const -> FetchResult<WallpaperCache>
|
|
||||||
{
|
{
|
||||||
QUrl url(
|
setUri(
|
||||||
"https://www.digitalartifex.dev/v2/packs/newest/"
|
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_NEWEST)
|
||||||
);
|
);
|
||||||
|
|
||||||
QNetworkRequest request(url);
|
controller()->setWindowSize(20);
|
||||||
request.setHeaders(
|
|
||||||
QHttpHeaders::fromMultiMap(
|
|
||||||
{
|
|
||||||
{
|
|
||||||
QByteArray("Offset"),
|
|
||||||
QString::number(offset).toUtf8()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
QByteArray("Limit"),
|
|
||||||
QString::number(limit).toUtf8()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
QByteArray("SessionToken"),
|
|
||||||
CoreServices::sessionToken()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
QNetworkReply *reply = getNetworkReply(request);
|
|
||||||
|
|
||||||
if(reply == nullptr)
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonDocument document = getDocument(reply);
|
|
||||||
|
|
||||||
QJsonObject rootObject = document.object();
|
|
||||||
const QJsonArray resultsArray = rootObject.value(QString::fromUtf8("results")).toArray();
|
|
||||||
|
|
||||||
QList<WallpaperCache*> fetchedResults;
|
|
||||||
|
|
||||||
for(const auto result : resultsArray)
|
|
||||||
{
|
|
||||||
if(!result.isObject())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject resultObject = result.toObject();
|
|
||||||
|
|
||||||
fetchedResults.append(
|
|
||||||
new WallpaperCache
|
|
||||||
{
|
|
||||||
resultObject.value(QString::fromUtf8("uri")).toString(),
|
|
||||||
resultObject.value(QString::fromUtf8("name")).toString(),
|
|
||||||
resultObject.value(QString::fromUtf8("author")).toString(),
|
|
||||||
resultObject.value(QString::fromUtf8("authorId")).toString(),
|
|
||||||
resultObject.value(QString::fromUtf8("description")).toString(),
|
|
||||||
resultObject.value(QString::fromUtf8("thumbnail")).toString(),
|
|
||||||
QDateTime::fromString(
|
|
||||||
resultObject.value(QString::fromUtf8("createdDate")).toString()
|
|
||||||
),
|
|
||||||
resultObject.value(QString::fromUtf8("price")).toDouble(),
|
|
||||||
resultObject.value(QString::fromUtf8("currency")).toString(),
|
|
||||||
static_cast<quint64>(resultObject.value(QString::fromUtf8("downloadCount")).toInteger()),
|
|
||||||
static_cast<qint8>(resultObject.value(QString::fromUtf8("description")).toInt()),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
{
|
|
||||||
static_cast<qsizetype>(rootObject.value(QString::fromUtf8("total_results")).toInteger()),
|
|
||||||
fetchedResults.count(),
|
|
||||||
std::move(fetchedResults)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief getNetworkReply
|
|
||||||
* Processes the request and blocks until completion.
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
auto getNetworkReply(const QNetworkRequest &request) const -> QNetworkReply*
|
|
||||||
{
|
|
||||||
QEventLoop loop;
|
|
||||||
QNetworkAccessManager *manager = CoreServices::networkAccessManager();
|
|
||||||
QNetworkReply *reply = manager->post(request, nullptr);
|
|
||||||
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
|
||||||
QObject::connect(reply, &QNetworkReply::errorOccurred, &loop,
|
|
||||||
[&loop](QNetworkReply::NetworkError error) -> void
|
|
||||||
{
|
|
||||||
loop.quit();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if(!reply->isFinished())
|
|
||||||
{
|
|
||||||
loop.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
|
|
||||||
"NewestPacksPaginator::getNetworkReply",
|
|
||||||
reply->errorString().toStdString().c_str(),
|
|
||||||
nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
return reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto getDocument(QNetworkReply *reply) const -> QJsonDocument
|
|
||||||
{
|
|
||||||
QJsonParseError documentError;
|
|
||||||
QJsonDocument document = QJsonDocument::fromJson(reply->readAll(), &documentError);
|
|
||||||
|
|
||||||
LOG_ERROR_X(documentError.error != QJsonParseError::NoError,
|
|
||||||
"NewestPacksPaginator::getDocument",
|
|
||||||
documentError.errorString().toStdString().c_str(),
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
|
|
||||||
return document;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef NEWESTSHADERSPAGINATOR_H
|
||||||
|
#define NEWESTSHADERSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT NewestShadersPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NewestShadersPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_SHADERS_NEWEST)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NEWESTSHADERSPAGINATOR_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef PACKSEARCHPAGINATOR_H
|
||||||
|
#define PACKSEARCHPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT PackSearchPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit PackSearchPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_PACKS_SEARCH)
|
||||||
|
);
|
||||||
|
|
||||||
|
setQueryable(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PACKSEARCHPAGINATOR_H
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef SEARCHCUBEMAPSPAGINATOR_H
|
||||||
|
#define SEARCHCUBEMAPSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT SearchCubemapsPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit SearchCubemapsPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_CUBEMAPS_SEARCH)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SEARCHCUBEMAPSPAGINATOR_H
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef SEARCHSHADERSPAGINATOR_H
|
||||||
|
#define SEARCHSHADERSPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "wallpaperpaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT SearchShadersPaginator : public WallpaperPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit SearchShadersPaginator(QObject *parent = nullptr) : WallpaperPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_SHADERS_SEARCH)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SEARCHSHADERSPAGINATOR_H
|
||||||
@@ -0,0 +1,310 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef VIDEOPAGINATOR_H
|
||||||
|
#define VIDEOPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "common/logging.h"
|
||||||
|
#include "common/paginator.h"
|
||||||
|
#include "common/videocache.h"
|
||||||
|
#include "common/coreservices.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The VideoPaginator class
|
||||||
|
* Most of the media endpoints for the Komplex API have the same data structure so
|
||||||
|
* child classes can make use of this generic controller where possible
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT VideoPaginator : public Paginator<VideoCache>
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit VideoPaginator(QObject *parent = nullptr) : Paginator<VideoCache>(parent)
|
||||||
|
{
|
||||||
|
SlidingCacheController<VideoCache> *controller = this->controller();
|
||||||
|
controller->setFetch(
|
||||||
|
std::bind(&VideoPaginator::fetch, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief uri
|
||||||
|
* URI of the API Endpoint. This is set by the child class
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto uri() const -> QString
|
||||||
|
{
|
||||||
|
return m_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief uriChanged
|
||||||
|
*/
|
||||||
|
auto uriChanged() -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief fetch
|
||||||
|
* Used to fetch results from the API endpoint
|
||||||
|
* for the CacheController. It is intended to be passed
|
||||||
|
* to the Cache Controller not meant to be called directly.
|
||||||
|
* @param offset Offset index to start the results from
|
||||||
|
* @param limit Number of results to attempt to fetch
|
||||||
|
* @return FetchResult<ImageCache>
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto fetch(
|
||||||
|
qsizetype offset,
|
||||||
|
qsizetype limit
|
||||||
|
) const -> FetchResult<VideoCache>
|
||||||
|
{
|
||||||
|
LOG_ERROR_X(m_uri.isEmpty(),
|
||||||
|
"VideoPaginator::fetch",
|
||||||
|
"Uri not set",
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(queryable() && query().isEmpty())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl url(
|
||||||
|
QString::fromUtf8("%1/%2/%3").arg(
|
||||||
|
KOMPLEX_API_HOST,
|
||||||
|
KOMPLEX_API_VERSION,
|
||||||
|
m_uri
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
request.setHeaders(
|
||||||
|
QHttpHeaders::fromMultiMap(
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QByteArray("query"),
|
||||||
|
query().toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("offset"),
|
||||||
|
QString::number(offset).toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("limit"),
|
||||||
|
QString::number(limit).toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("session_token"),
|
||||||
|
CoreServices::sessionToken()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkReply *reply = getNetworkReply(request);
|
||||||
|
|
||||||
|
if(reply == nullptr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument document = getDocument(reply);
|
||||||
|
|
||||||
|
QJsonObject rootObject = document.object();
|
||||||
|
const QJsonArray resultsArray = rootObject.value(QString::fromUtf8("videos")).toArray();
|
||||||
|
|
||||||
|
QList<VideoCache> fetchedResults;
|
||||||
|
|
||||||
|
for(const QJsonValue &result : resultsArray)
|
||||||
|
{
|
||||||
|
if(!result.isObject())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject resultObject = result.toObject();
|
||||||
|
|
||||||
|
QJsonObject userObject = resultObject.value(QString::fromUtf8("user")).toObject();
|
||||||
|
QList<VideoEntry> videos;
|
||||||
|
const QJsonArray videosArray = resultObject.value(QString::fromUtf8("video_files")).toArray();
|
||||||
|
|
||||||
|
for(const QJsonValue &entry : videosArray)
|
||||||
|
{
|
||||||
|
if(!entry.isObject())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject videoObject = entry.toObject();
|
||||||
|
|
||||||
|
videos.append
|
||||||
|
(
|
||||||
|
{
|
||||||
|
videoObject.value(QString::fromUtf8("file_type")).toString(),
|
||||||
|
videoObject.value(QString::fromUtf8("fps")).toInteger(),
|
||||||
|
videoObject.value(QString::fromUtf8("height")).toInteger(),
|
||||||
|
videoObject.value(QString::fromUtf8("width")).toInteger(),
|
||||||
|
videoObject.value(QString::fromUtf8("size")).toInteger(),
|
||||||
|
videoObject.value(QString::fromUtf8("id")).toInteger(),
|
||||||
|
videoObject.value(QString::fromUtf8("link")).toString(),
|
||||||
|
videoObject.value(QString::fromUtf8("quality")).toString()
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchedResults.append
|
||||||
|
(
|
||||||
|
{
|
||||||
|
resultObject.value(QString::fromUtf8("avg_color")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("duration")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("height")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("width")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("id")).toInteger(),
|
||||||
|
resultObject.value(QString::fromUtf8("image")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("url")).toString(),
|
||||||
|
userObject.value(QString::fromUtf8("name")).toString(),
|
||||||
|
userObject.value(QString::fromUtf8("url")).toString(),
|
||||||
|
userObject.value(QString::fromUtf8("id")).toInteger(),
|
||||||
|
std::move(videos)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
FetchResult<VideoCache> result
|
||||||
|
{
|
||||||
|
static_cast<qsizetype>(rootObject.value(QString::fromUtf8("total_results")).toInteger()),
|
||||||
|
fetchedResults.count(),
|
||||||
|
std::move(fetchedResults)
|
||||||
|
};
|
||||||
|
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getNetworkReply
|
||||||
|
* Processes the request and blocks until completion.
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto getNetworkReply(const QNetworkRequest &request) const -> QNetworkReply*
|
||||||
|
{
|
||||||
|
QEventLoop loop;
|
||||||
|
QWeakPointer<QNetworkAccessManager> managerReference = CoreServices::networkAccessManager();
|
||||||
|
|
||||||
|
QSharedPointer<QNetworkAccessManager> manager = managerReference.toStrongRef();
|
||||||
|
|
||||||
|
LOG_ERROR_X(!manager,
|
||||||
|
"NewestPacksPaginator::getNetworkReply",
|
||||||
|
"Network manager reference has already been deleted",
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkReply *reply = manager->post(request, nullptr);
|
||||||
|
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||||
|
|
||||||
|
QObject::connect
|
||||||
|
(
|
||||||
|
reply,
|
||||||
|
&QNetworkReply::errorOccurred,
|
||||||
|
&loop,
|
||||||
|
[&loop](QNetworkReply::NetworkError error) -> void
|
||||||
|
{
|
||||||
|
loop.quit();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!reply->isFinished())
|
||||||
|
{
|
||||||
|
loop.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
|
||||||
|
"NewestPacksPaginator::getNetworkReply",
|
||||||
|
reply->errorString().toStdString().c_str(),
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getDocument
|
||||||
|
* Extracts the JSON document from the server reply
|
||||||
|
* @param reply
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto getDocument(QNetworkReply *reply) const -> QJsonDocument
|
||||||
|
{
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
QJsonParseError documentError;
|
||||||
|
QJsonDocument document = QJsonDocument::fromJson(data, &documentError);
|
||||||
|
|
||||||
|
LOG_ERROR_X(documentError.error != QJsonParseError::NoError,
|
||||||
|
"NewestPacksPaginator::getDocument",
|
||||||
|
documentError.errorString().toStdString().c_str(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setUri
|
||||||
|
* Sets the API Endpoint URI to fetch from
|
||||||
|
* @param uri
|
||||||
|
*/
|
||||||
|
auto setUri(const QString &uri) -> void
|
||||||
|
{
|
||||||
|
if(uri == m_uri)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_uri = uri;
|
||||||
|
|
||||||
|
Q_EMIT uriChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief m_uri
|
||||||
|
* API Endpoint URI
|
||||||
|
*/
|
||||||
|
QString m_uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_query
|
||||||
|
* The query string used in fetch operations
|
||||||
|
*/
|
||||||
|
QString m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VIDEOPAGINATOR_H
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef VIDEOSEARCHPAGINATOR_H
|
||||||
|
#define VIDEOSEARCHPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "videopaginator.h"
|
||||||
|
|
||||||
|
class KOMPLEX_EXPORT VideoSearchPaginator : public VideoPaginator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit VideoSearchPaginator(QObject *parent = nullptr) : VideoPaginator(parent)
|
||||||
|
{
|
||||||
|
setUri(
|
||||||
|
QString::fromUtf8(KOMPLEX_ENDPOINT_VIDEOS_SEARCH)
|
||||||
|
);
|
||||||
|
|
||||||
|
setQueryable(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VIDEOSEARCHPAGINATOR_H
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef WALLPAPERPAGINATOR_H
|
||||||
|
#define WALLPAPERPAGINATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "common/logging.h"
|
||||||
|
#include "common/paginator.h"
|
||||||
|
#include "common/wallpapercache.h"
|
||||||
|
#include "common/coreservices.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The WallpaperPaginator class
|
||||||
|
* Most of the media endpoints for the Komplex API have the same data structure so
|
||||||
|
* child classes can make use of this generic controller where possible
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT WallpaperPaginator : public Paginator<WallpaperCache>
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit WallpaperPaginator(QObject *parent = nullptr) : Paginator<WallpaperCache>(parent)
|
||||||
|
{
|
||||||
|
SlidingCacheController<WallpaperCache> *controller = this->controller();
|
||||||
|
controller->setFetch(
|
||||||
|
std::bind(&WallpaperPaginator::fetch, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief uri
|
||||||
|
* URI of the API Endpoint. This is set by the child class
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto uri() const -> QString
|
||||||
|
{
|
||||||
|
return m_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief query
|
||||||
|
* Current query string, if the API Endpoint supports queries
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto query() const -> QString
|
||||||
|
{
|
||||||
|
return m_query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setQuery
|
||||||
|
* Sets the new query string and updates the controller
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
auto setQuery(const QString &query) -> void
|
||||||
|
{
|
||||||
|
if(query == m_query)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_query = query;
|
||||||
|
Q_EMIT queryChanged();
|
||||||
|
|
||||||
|
reset();
|
||||||
|
setOffset(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief uriChanged
|
||||||
|
*/
|
||||||
|
auto uriChanged() -> void;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief fetch
|
||||||
|
* Used to fetch results from the API endpoint
|
||||||
|
* for the CacheController. It is intended to be passed
|
||||||
|
* to the Cache Controller not meant to be called directly.
|
||||||
|
* @param offset Offset index to start the results from
|
||||||
|
* @param limit Number of results to attempt to fetch
|
||||||
|
* @return FetchResult<WallpaperCache>
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto fetch(
|
||||||
|
qsizetype offset,
|
||||||
|
qsizetype limit
|
||||||
|
) const -> FetchResult<WallpaperCache>
|
||||||
|
{
|
||||||
|
LOG_ERROR_X(m_uri.isEmpty(),
|
||||||
|
"WallpaperPaginator::fetch",
|
||||||
|
"Uri not set",
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(queryable() && query().isEmpty())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl url(
|
||||||
|
QString::fromUtf8("%1/%2/%3").arg(
|
||||||
|
KOMPLEX_API_HOST,
|
||||||
|
KOMPLEX_API_VERSION,
|
||||||
|
m_uri
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
request.setHeaders(
|
||||||
|
QHttpHeaders::fromMultiMap(
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QByteArray("query"),
|
||||||
|
m_query.toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("offset"),
|
||||||
|
QString::number(offset).toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("limit"),
|
||||||
|
QString::number(limit).toUtf8()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
QByteArray("session_token"),
|
||||||
|
CoreServices::sessionToken()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkReply *reply = getNetworkReply(request);
|
||||||
|
|
||||||
|
if(reply == nullptr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonDocument document = getDocument(reply);
|
||||||
|
|
||||||
|
QJsonObject rootObject = document.object();
|
||||||
|
const QJsonArray resultsArray = rootObject.value(QString::fromUtf8("results")).toArray();
|
||||||
|
|
||||||
|
QList<WallpaperCache> fetchedResults;
|
||||||
|
|
||||||
|
for(const auto result : resultsArray)
|
||||||
|
{
|
||||||
|
if(!result.isObject())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject resultObject = result.toObject();
|
||||||
|
|
||||||
|
fetchedResults.append(
|
||||||
|
{
|
||||||
|
resultObject.value(QString::fromUtf8("uuid")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("title")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("author")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("author_id")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("description")).toString(),
|
||||||
|
resultObject.value(QString::fromUtf8("thumbnail")).toString(),
|
||||||
|
QDateTime::fromString(
|
||||||
|
resultObject.value(QString::fromUtf8("creation")).toString(),
|
||||||
|
QString::fromUtf8("yyyy-MM-dd HH:mm:ss")
|
||||||
|
),
|
||||||
|
resultObject.value(QString::fromUtf8("price")).toDouble(),
|
||||||
|
resultObject.value(QString::fromUtf8("currency")).toString(),
|
||||||
|
static_cast<quint64>(
|
||||||
|
resultObject.value(QString::fromUtf8("downloadCount")
|
||||||
|
).toInteger()),
|
||||||
|
static_cast<qint8>(
|
||||||
|
resultObject.value(QString::fromUtf8("description")
|
||||||
|
).toInt()),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
FetchResult<WallpaperCache> result
|
||||||
|
{
|
||||||
|
static_cast<qsizetype>(rootObject.value(QString::fromUtf8("total_results")).toInteger()),
|
||||||
|
fetchedResults.count(),
|
||||||
|
std::move(fetchedResults)
|
||||||
|
};
|
||||||
|
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getNetworkReply
|
||||||
|
* Processes the request and blocks until completion.
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto getNetworkReply(const QNetworkRequest &request) const -> QNetworkReply*
|
||||||
|
{
|
||||||
|
QEventLoop loop;
|
||||||
|
QWeakPointer<QNetworkAccessManager> managerReference = CoreServices::networkAccessManager();
|
||||||
|
|
||||||
|
QSharedPointer<QNetworkAccessManager> manager = managerReference.toStrongRef();
|
||||||
|
|
||||||
|
LOG_ERROR_X(!manager,
|
||||||
|
"NewestPacksPaginator::getNetworkReply",
|
||||||
|
"Network manager reference has already been deleted",
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
QNetworkReply *reply = manager->post(request, nullptr);
|
||||||
|
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
|
||||||
|
QObject::connect(reply, &QNetworkReply::errorOccurred, &loop,
|
||||||
|
[&loop](QNetworkReply::NetworkError error) -> void
|
||||||
|
{
|
||||||
|
loop.quit();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!reply->isFinished())
|
||||||
|
{
|
||||||
|
loop.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR_X(reply->error() != QNetworkReply::NoError,
|
||||||
|
"NewestPacksPaginator::getNetworkReply",
|
||||||
|
reply->errorString().toStdString().c_str(),
|
||||||
|
nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getDocument
|
||||||
|
* Extracts the JSON document from the server reply
|
||||||
|
* @param reply
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
[[nodiscard]]
|
||||||
|
auto getDocument(QNetworkReply *reply) const -> QJsonDocument
|
||||||
|
{
|
||||||
|
QByteArray data = reply->readAll();
|
||||||
|
QJsonParseError documentError;
|
||||||
|
QJsonDocument document = QJsonDocument::fromJson(data, &documentError);
|
||||||
|
|
||||||
|
LOG_ERROR_X(documentError.error != QJsonParseError::NoError,
|
||||||
|
"NewestPacksPaginator::getDocument",
|
||||||
|
documentError.errorString().toStdString().c_str(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setUri
|
||||||
|
* Sets the API Endpoint URI to fetch from
|
||||||
|
* @param uri
|
||||||
|
*/
|
||||||
|
auto setUri(const QString &uri) -> void
|
||||||
|
{
|
||||||
|
if(uri == m_uri)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_uri = uri;
|
||||||
|
|
||||||
|
Q_EMIT uriChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief m_uri
|
||||||
|
* API Endpoint URI
|
||||||
|
*/
|
||||||
|
QString m_uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief m_query
|
||||||
|
* The query string used in fetch operations
|
||||||
|
*/
|
||||||
|
QString m_query;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WALLPAPERPAGINATOR_H
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
SettingsManager::SettingsManager(QObject *parent) : QObject(parent)
|
SettingsManager::SettingsManager(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
m_homeLocation = QStandardPaths::writableLocation(QStandardPaths::HomeLocation).at(0);
|
m_homeLocation = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||||
|
|
||||||
m_shaderPackLocation = m_homeLocation + QString("/.local/share/komplex/packs");
|
m_shaderPackLocation = m_homeLocation + QString("/.local/share/komplex/packs");
|
||||||
m_configLocation = m_homeLocation + QString("/.config/plasma-org.kde.plasma.desktop-appletsrc");
|
m_configLocation = m_homeLocation + QString("/.config/plasma-org.kde.plasma.desktop-appletsrc");
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Komplex Wallpaper Engine
|
* Komplex Wallpaper Engine
|
||||||
* Copyright (C) 2026 @DigitalArtifex | github.com/DigitalArtifex
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
*
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
* SettingsManager.h
|
|
||||||
*
|
|
||||||
* This class provides access to Komplex Wallpaper settings via kwrite/
|
|
||||||
* kreadconfig
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -0,0 +1,322 @@
|
|||||||
|
#include "videosearchmodel.h"
|
||||||
|
|
||||||
|
VideoSearchModel::VideoSearchModel(QObject *parent) : QAbstractListModel{parent}
|
||||||
|
{
|
||||||
|
m_paginator = new VideoSearchPaginator(this);
|
||||||
|
PaginationNotifier *notifier = static_cast<PaginationNotifier*>(m_paginator);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::resultsPerPageChanged,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::resultsPerPageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalResultsChanged,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::totalResultsChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::totalPagesChanged,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::totalPagesChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::pageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::pageChanged,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::resetDataModel
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetchComplete,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::resetState
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
notifier,
|
||||||
|
&PaginationNotifier::fetching,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::onPaginatorFetching
|
||||||
|
);
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
m_paginator,
|
||||||
|
&VideoSearchPaginator::queryChanged,
|
||||||
|
this,
|
||||||
|
&VideoSearchModel::queryChanged
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::rowCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::data(const QModelIndex &index, int role) const -> QVariant
|
||||||
|
{
|
||||||
|
if(m_paginator == nullptr)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(index.row() < 0 || index.row() >= m_paginator->count() )
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoCache dataPoint = m_paginator->at(index.row());
|
||||||
|
|
||||||
|
QVariant data;
|
||||||
|
|
||||||
|
switch(static_cast<DataRole>(role))
|
||||||
|
{
|
||||||
|
case UuidRole:
|
||||||
|
data = dataPoint.id;
|
||||||
|
break;
|
||||||
|
case AuthorRole:
|
||||||
|
data = dataPoint.author;
|
||||||
|
break;
|
||||||
|
case AuthorIdRole:
|
||||||
|
data = dataPoint.authorId;
|
||||||
|
break;
|
||||||
|
case AuthorUrlRole:
|
||||||
|
data = dataPoint.authorUrl;
|
||||||
|
break;
|
||||||
|
case DurationRole:
|
||||||
|
data = dataPoint.duration;
|
||||||
|
break;
|
||||||
|
case ThumbnailRole:
|
||||||
|
data = dataPoint.thumbnail;
|
||||||
|
break;
|
||||||
|
case UrlRole:
|
||||||
|
data = dataPoint.url;
|
||||||
|
break;
|
||||||
|
case HeightRole:
|
||||||
|
data = dataPoint.height;
|
||||||
|
break;
|
||||||
|
case WidthRole:
|
||||||
|
data = dataPoint.width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::index(int row, int column, const QModelIndex &parent) const -> QModelIndex
|
||||||
|
{
|
||||||
|
Q_UNUSED(parent)
|
||||||
|
|
||||||
|
if(row < 0 || row >= m_paginator->count())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return createIndex(row, column, &m_paginator[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::columnCount(const QModelIndex &) const -> int
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::parent(const QModelIndex &) const -> QModelIndex
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::setData(const QModelIndex &, const QVariant &, int) -> bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::state() const -> VideoSearchModel::State
|
||||||
|
{
|
||||||
|
return m_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::setState(State state) -> void
|
||||||
|
{
|
||||||
|
if (m_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_state = state;
|
||||||
|
emit stateChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::resetState() -> void
|
||||||
|
{
|
||||||
|
setState(Idle);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::resetDataModel() -> void
|
||||||
|
{
|
||||||
|
//invalidate previous model data
|
||||||
|
beginRemoveRows(QModelIndex(), 0, m_paginator->count());
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
|
//signal new data
|
||||||
|
beginInsertRows(QModelIndex(), 0, m_paginator->count() - 1);
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::hasNextPage() const -> bool
|
||||||
|
{
|
||||||
|
return m_paginator->page() < m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::hasPreviousPage() const -> bool
|
||||||
|
{
|
||||||
|
return m_paginator->page() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::onPaginatorFetching() -> void
|
||||||
|
{
|
||||||
|
setState(Loading);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::roleNames() const -> QHash<int, QByteArray>
|
||||||
|
{
|
||||||
|
return m_dataRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::errorString() const -> QString
|
||||||
|
{
|
||||||
|
return m_errorString;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::setErrorString(const QString &errorString) -> void
|
||||||
|
{
|
||||||
|
if (m_errorString == errorString)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorString = errorString;
|
||||||
|
emit errorStringChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::resultsPerPage() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->resultsPerPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::setResultsPerPage(qsizetype resultsPerPage) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, resultsPerPage]
|
||||||
|
{
|
||||||
|
m_paginator->setResultsPerPage(resultsPerPage);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::totalResults() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::nextPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->next();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::previousPage() -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this]
|
||||||
|
{
|
||||||
|
m_paginator->previous();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::query() const -> QString
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->query();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::setQuery(const QString &query) -> void
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
QFuture<void> future = QtConcurrent::run
|
||||||
|
(
|
||||||
|
[this, query]
|
||||||
|
{
|
||||||
|
m_paginator->setQuery(query);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qsizetype VideoSearchModel::page() const
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->page();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto VideoSearchModel::totalPages() const -> qsizetype
|
||||||
|
{
|
||||||
|
if(m_paginator != nullptr)
|
||||||
|
{
|
||||||
|
return m_paginator->totalPages();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
/*
|
||||||
|
* Komplex Wallpaper Engine
|
||||||
|
* Copyright (C) 2026 @DigitalArtifex
|
||||||
|
* https://digitalartifex.dev - https://github.com/DigitalArtifex
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
#ifndef VideoSearchModel_H
|
||||||
|
#define VideoSearchModel_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
#include <QList>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QEventLoop>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
|
#include "paginators/videosearchpaginator.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The VideoSearchModel class
|
||||||
|
*/
|
||||||
|
class KOMPLEX_EXPORT VideoSearchModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_ELEMENT
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to control the UI state
|
||||||
|
*/
|
||||||
|
enum State
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Loading,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
Q_ENUM(State)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Data roles used by the view to request data
|
||||||
|
*/
|
||||||
|
enum DataRole {
|
||||||
|
UuidRole = Qt::UserRole + 1,
|
||||||
|
AuthorRole,
|
||||||
|
AuthorIdRole,
|
||||||
|
AuthorUrlRole,
|
||||||
|
DurationRole,
|
||||||
|
ThumbnailRole,
|
||||||
|
UrlRole,
|
||||||
|
HeightRole,
|
||||||
|
WidthRole
|
||||||
|
};
|
||||||
|
Q_ENUM(DataRole)
|
||||||
|
|
||||||
|
explicit VideoSearchModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
auto rowCount(const QModelIndex &parent = QModelIndex()) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief data
|
||||||
|
* Used by the view to pull data from the model.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param index
|
||||||
|
* @param role
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto data(
|
||||||
|
const QModelIndex &index,
|
||||||
|
int role = Qt::DisplayRole
|
||||||
|
) const -> QVariant override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief index
|
||||||
|
* Used by the view to create an index for the data point.
|
||||||
|
* Required by QAbstractListModel
|
||||||
|
* @param row
|
||||||
|
* @param column
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto index(
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief columnCount
|
||||||
|
* Required by QAbstractListModel, but just returns 0
|
||||||
|
* since we dont use cols
|
||||||
|
* @param parent
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto columnCount(
|
||||||
|
const QModelIndex &parent = QModelIndex()
|
||||||
|
) const -> int override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief parent
|
||||||
|
* @param index
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto parent(const QModelIndex &index) const -> QModelIndex override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setData
|
||||||
|
* Required by QAbstractListModel but not used
|
||||||
|
* @param index
|
||||||
|
* @param value
|
||||||
|
* @param role
|
||||||
|
* @return true always
|
||||||
|
*/
|
||||||
|
auto setData(
|
||||||
|
const QModelIndex &index,
|
||||||
|
const QVariant &value,
|
||||||
|
int role = Qt::EditRole
|
||||||
|
) -> bool override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief state
|
||||||
|
* Current Model State
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto state() const -> State;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief roleNames
|
||||||
|
* Used to tell the view what data roles are available
|
||||||
|
* and their QML friendly names
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto roleNames() const -> QHash<int, QByteArray> override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorString
|
||||||
|
* User-friendly error string to be reported to the user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto errorString() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto resultsPerPage() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setResultsPerPage
|
||||||
|
* @param resultsPerPage
|
||||||
|
*/
|
||||||
|
auto setResultsPerPage(qsizetype resultsPerPage) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalResults
|
||||||
|
* Total number of results available
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalResults() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto page() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief totalPages
|
||||||
|
* Total pages based on the current resultsPerPage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto totalPages() const -> qsizetype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief nextPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto nextPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief previousPage
|
||||||
|
* Function for the QML frontend
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE auto previousPage() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief query
|
||||||
|
* Current search query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
auto query() const -> QString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setQuery
|
||||||
|
* Sets the current search query
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
|
auto setQuery(const QString &query) -> 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 onPaginatorFetching
|
||||||
|
* Sets current state to loading. Triggered when paginator's cache controller
|
||||||
|
* needs to fetch data from the remote endpoint.
|
||||||
|
*/
|
||||||
|
auto onPaginatorFetching() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setErrorString
|
||||||
|
* @param errorString
|
||||||
|
*/
|
||||||
|
auto setErrorString(const QString &errorString) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief setState
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
auto setState(State state) -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetState
|
||||||
|
*/
|
||||||
|
auto resetState() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief resetDataModel
|
||||||
|
* Clears the data model and creates a new one if data exists
|
||||||
|
*/
|
||||||
|
auto resetDataModel() -> void;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**
|
||||||
|
* @brief stateChanged
|
||||||
|
* Signaled when reported state changes
|
||||||
|
*/
|
||||||
|
auto stateChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief errorStringChanged
|
||||||
|
* Signaled when reported error message changes
|
||||||
|
*/
|
||||||
|
auto errorStringChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto resultsPerPageChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto pageChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto totalResultsChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto totalPagesChanged() -> void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief pageChanged
|
||||||
|
* Forwarding signal connected in constructor
|
||||||
|
*/
|
||||||
|
auto queryChanged() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Data role map that connects VideoSearchModel::DataRole to it's QML accessor name
|
||||||
|
*/
|
||||||
|
static inline const QHash<int, QByteArray> m_dataRoles =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
static_cast<int>(UuidRole),
|
||||||
|
QByteArray("uuid")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorRole),
|
||||||
|
QByteArray("author")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorIdRole),
|
||||||
|
QByteArray("authorId")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(AuthorUrlRole),
|
||||||
|
QByteArray("authorUrl")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(DurationRole),
|
||||||
|
QByteArray("duration")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(ThumbnailRole),
|
||||||
|
QByteArray("thumbnail")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(UrlRole),
|
||||||
|
QByteArray("url")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(HeightRole),
|
||||||
|
QByteArray("height")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
static_cast<int>(WidthRole),
|
||||||
|
QByteArray("width")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
State m_state = Idle;
|
||||||
|
|
||||||
|
QString m_errorString = QString();
|
||||||
|
|
||||||
|
VideoSearchPaginator *m_paginator = nullptr;
|
||||||
|
|
||||||
|
Q_PROPERTY(State state READ state WRITE setState RESET resetState NOTIFY stateChanged FINAL)
|
||||||
|
Q_PROPERTY(QString errorString READ errorString WRITE setErrorString NOTIFY errorStringChanged FINAL)
|
||||||
|
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(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(QString query READ query WRITE setQuery NOTIFY queryChanged FINAL)
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(VideoSearchModel)
|
||||||
|
|
||||||
|
#endif // VideoSearchModel_H
|
||||||
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
@@ -2,12 +2,76 @@
|
|||||||
|
|
||||||
> Media Hub and Settings Manager for the Komplex Wallpaper Plugin
|
> Media Hub and Settings Manager for the Komplex Wallpaper Plugin
|
||||||
|
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<img src="https://git.digitalartifex.dev/digitalartifex/komplex-hub/raw/branch/main/images/screenshots/screenshot_01_home.png" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="https://git.digitalartifex.dev/digitalartifex/komplex-hub/raw/branch/main/images/screenshots/screenshot_02_no_results.png" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img src="https://git.digitalartifex.dev/digitalartifex/komplex-hub/raw/branch/main/images/screenshots/screenshot_03_images.png" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="https://git.digitalartifex.dev/digitalartifex/komplex-hub/raw/branch/main/images/screenshots/screenshot_04_videos.png" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img src="" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="https://git.digitalartifex.dev/digitalartifex/komplex-hub/raw/branch/main/images/screenshots/screenshot_06_installed.png" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img src="https://git.digitalartifex.dev/digitalartifex/komplex-hub/raw/branch/main/images/screenshots/screenshot_07_settings.png" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
Most of the development of Komplex and it's associated apps will now happen here, instead of Github.
|
Most of the development of Komplex and it's associated apps will now happen here, instead of Github.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Requirements
|
#### Requirements
|
||||||
|
|
||||||
- Qt 6.10+
|
- Qt 6.10+ -- May work with previous versions, but currently untested
|
||||||
|
- Qt6 Core
|
||||||
|
- Qt6 Gui
|
||||||
|
- Qt6 Widgets
|
||||||
|
- Qt6 Networking
|
||||||
|
- Qt6 Quick
|
||||||
|
- Qt6 Quick Effects
|
||||||
|
- Qt6 Quick Controls
|
||||||
|
- Qt6 Shader Tools
|
||||||
|
- CMake
|
||||||
|
- clang
|
||||||
|
|
||||||
This app is currently under development and is pre-alpha
|
#### Build
|
||||||
|
```console
|
||||||
|
$ git clone gitea@git.digitalartifex.dev:digitalartifex/komplex-hub.git
|
||||||
|
$ mkdir build
|
||||||
|
$ cmake -S ./ -B ./build/
|
||||||
|
$ cmake --build ./build
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Install
|
||||||
|
```console
|
||||||
|
$ cmake --install ./build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Accounts
|
||||||
|
|
||||||
|
Accounts are not an integral part of Komplex. They do not enable any "pro" benefits, they do not cost anything and will not be required to use the millions of free wallpaper, image and video offerings available.
|
||||||
|
|
||||||
|
Accounts ***will*** be required to view any content that gets flagged as ***Not Safe For Work*** and any content submitted by an artist for sale.
|
||||||
|
Content purchases will be processed through the website using Paypal as will artist payouts.
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
This app is currently under development and is pre-alpha. During this phase, the new API is only hosted locally and not yet available on digitalartifex.dev
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" :
|
|
||||||
[
|
|
||||||
"install"
|
|
||||||
],
|
|
||||||
"files" :
|
|
||||||
[
|
|
||||||
"CMakeLists.txt"
|
|
||||||
],
|
|
||||||
"nodes" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"file" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 0,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 42,
|
|
||||||
"parent" : 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 1,
|
|
||||||
"component" : "Unspecified",
|
|
||||||
"destination" : "bin",
|
|
||||||
"paths" :
|
|
||||||
[
|
|
||||||
"KomplexHub"
|
|
||||||
],
|
|
||||||
"targetId" : "KomplexHub::@6890427a1f51a3e7e1df",
|
|
||||||
"targetIndex" : 14,
|
|
||||||
"type" : "target"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : ".",
|
|
||||||
"source" : "."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "App",
|
|
||||||
"source" : "App"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies",
|
|
||||||
"source" : "Dependencies"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components",
|
|
||||||
"source" : "Dependencies/Components"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports",
|
|
||||||
"source" : "Dependencies/Components/imports"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/application",
|
|
||||||
"source" : "Dependencies/Components/imports/application"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/compat",
|
|
||||||
"source" : "Dependencies/Components/imports/compat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/compat/Components",
|
|
||||||
"source" : "Dependencies/Components/imports/compat/Components"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/compat/Extras",
|
|
||||||
"source" : "Dependencies/Components/imports/compat/Extras"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/compat/Layers",
|
|
||||||
"source" : "Dependencies/Components/imports/compat/Layers"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/compat/Profiling",
|
|
||||||
"source" : "Dependencies/Components/imports/compat/Profiling"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/components",
|
|
||||||
"source" : "Dependencies/Components/imports/components"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/designeffects",
|
|
||||||
"source" : "Dependencies/Components/imports/designeffects"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/effects_qt6",
|
|
||||||
"source" : "Dependencies/Components/imports/effects_qt6"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/flowview",
|
|
||||||
"source" : "Dependencies/Components/imports/flowview"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/logichelper",
|
|
||||||
"source" : "Dependencies/Components/imports/logichelper"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/multitext",
|
|
||||||
"source" : "Dependencies/Components/imports/multitext"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/tools",
|
|
||||||
"source" : "Dependencies/Components/imports/tools"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/tools/eventsimulator",
|
|
||||||
"source" : "Dependencies/Components/imports/tools/eventsimulator"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/tools/eventsystem",
|
|
||||||
"source" : "Dependencies/Components/imports/tools/eventsystem"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/utils",
|
|
||||||
"source" : "Dependencies/Components/imports/utils"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "KomplexHubContent",
|
|
||||||
"source" : "KomplexHubContent"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "KomplexHubModule",
|
|
||||||
"source" : "KomplexHubModule"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "KomplexHubModule/Controls",
|
|
||||||
"source" : "KomplexHubModule/Controls"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "KomplexHubModule/Kero",
|
|
||||||
"source" : "KomplexHubModule/Kero"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" : [],
|
|
||||||
"nodes" : []
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"installers" : [],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "KomplexHubPlugin",
|
|
||||||
"source" : "KomplexHubPlugin"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
{
|
|
||||||
"cmake" :
|
|
||||||
{
|
|
||||||
"generator" :
|
|
||||||
{
|
|
||||||
"multiConfig" : false,
|
|
||||||
"name" : "Ninja"
|
|
||||||
},
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"cmake" : "/usr/bin/cmake",
|
|
||||||
"cpack" : "/usr/bin/cpack",
|
|
||||||
"ctest" : "/usr/bin/ctest",
|
|
||||||
"root" : "/usr/share/cmake"
|
|
||||||
},
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"isDirty" : false,
|
|
||||||
"major" : 4,
|
|
||||||
"minor" : 2,
|
|
||||||
"patch" : 3,
|
|
||||||
"string" : "4.2.3",
|
|
||||||
"suffix" : ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"objects" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"jsonFile" : "codemodel-v2-19eca749bc09da50b78d.json",
|
|
||||||
"kind" : "codemodel",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonFile" : "cache-v2-856cdb4409780bdf0382.json",
|
|
||||||
"kind" : "cache",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonFile" : "cmakeFiles-v1-90c3ac7e899815994aee.json",
|
|
||||||
"kind" : "cmakeFiles",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 1,
|
|
||||||
"minor" : 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonFile" : "toolchains-v1-d46c98fd007cec87b83c.json",
|
|
||||||
"kind" : "toolchains",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 1,
|
|
||||||
"minor" : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"reply" :
|
|
||||||
{
|
|
||||||
"client-vscode" :
|
|
||||||
{
|
|
||||||
"query.json" :
|
|
||||||
{
|
|
||||||
"requests" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"kind" : "cache",
|
|
||||||
"version" : 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind" : "codemodel",
|
|
||||||
"version" : 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind" : "toolchains",
|
|
||||||
"version" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind" : "cmakeFiles",
|
|
||||||
"version" : 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"jsonFile" : "cache-v2-856cdb4409780bdf0382.json",
|
|
||||||
"kind" : "cache",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonFile" : "codemodel-v2-19eca749bc09da50b78d.json",
|
|
||||||
"kind" : "codemodel",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonFile" : "toolchains-v1-d46c98fd007cec87b83c.json",
|
|
||||||
"kind" : "toolchains",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 1,
|
|
||||||
"minor" : 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jsonFile" : "cmakeFiles-v1-90c3ac7e899815994aee.json",
|
|
||||||
"kind" : "cmakeFiles",
|
|
||||||
"version" :
|
|
||||||
{
|
|
||||||
"major" : 1,
|
|
||||||
"minor" : 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,945 +0,0 @@
|
|||||||
{
|
|
||||||
"archive" : {},
|
|
||||||
"artifacts" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/libFlowView.a"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"backtrace" : 4,
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" :
|
|
||||||
[
|
|
||||||
"add_library",
|
|
||||||
"_qt_internal_add_library",
|
|
||||||
"qt6_add_library",
|
|
||||||
"qt_add_library",
|
|
||||||
"add_dependencies",
|
|
||||||
"_qt_internal_write_deferred_qmlls_build_ini_file",
|
|
||||||
"_qt_internal_qml_copy_files_to_build_dir",
|
|
||||||
"qt6_add_qml_module",
|
|
||||||
"target_link_libraries",
|
|
||||||
"__qt_internal_propagate_object_library",
|
|
||||||
"__qt_propagate_generated_resource",
|
|
||||||
"_qt_internal_process_resource",
|
|
||||||
"qt6_add_resources",
|
|
||||||
"qt6_target_qml_sources",
|
|
||||||
"add_custom_command",
|
|
||||||
"qt6_extract_metatypes",
|
|
||||||
"_qt_internal_qml_type_registration",
|
|
||||||
"_qt_internal_ensure_tooling_target",
|
|
||||||
"target_include_directories",
|
|
||||||
"target_sources",
|
|
||||||
"_qt_internal_expose_deferred_files_to_ide",
|
|
||||||
"qt6_finalize_target"
|
|
||||||
],
|
|
||||||
"files" :
|
|
||||||
[
|
|
||||||
"/usr/lib/cmake/Qt6Core/Qt6CoreMacros.cmake",
|
|
||||||
"Dependencies/Components/imports/flowview/CMakeLists.txt",
|
|
||||||
"/usr/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake",
|
|
||||||
"/usr/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:1099:EVAL",
|
|
||||||
"CMakeLists.txt",
|
|
||||||
"/usr/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:923:EVAL"
|
|
||||||
],
|
|
||||||
"nodes" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"file" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 3,
|
|
||||||
"file" : 1,
|
|
||||||
"line" : 6,
|
|
||||||
"parent" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 2,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2920,
|
|
||||||
"parent" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 1,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2806,
|
|
||||||
"parent" : 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 0,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2893,
|
|
||||||
"parent" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file" : 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file" : 4,
|
|
||||||
"line" : -1,
|
|
||||||
"parent" : 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 5,
|
|
||||||
"file" : 3,
|
|
||||||
"line" : 1,
|
|
||||||
"parent" : 6
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 4,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 1387,
|
|
||||||
"parent" : 7
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 7,
|
|
||||||
"file" : 1,
|
|
||||||
"line" : 7,
|
|
||||||
"parent" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 6,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 970,
|
|
||||||
"parent" : 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 4,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3083,
|
|
||||||
"parent" : 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 6,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 976,
|
|
||||||
"parent" : 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 4,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3083,
|
|
||||||
"parent" : 12
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 8,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 618,
|
|
||||||
"parent" : 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 13,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 960,
|
|
||||||
"parent" : 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 12,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3839,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 11,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 405,
|
|
||||||
"parent" : 16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 10,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2625,
|
|
||||||
"parent" : 17
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 9,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2156,
|
|
||||||
"parent" : 18
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 8,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2094,
|
|
||||||
"parent" : 19
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 12,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3857,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 11,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 405,
|
|
||||||
"parent" : 21
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 10,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2625,
|
|
||||||
"parent" : 22
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 9,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2156,
|
|
||||||
"parent" : 23
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 8,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2094,
|
|
||||||
"parent" : 24
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 16,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 835,
|
|
||||||
"parent" : 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 15,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 4041,
|
|
||||||
"parent" : 26
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 14,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 1542,
|
|
||||||
"parent" : 27
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 14,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2564,
|
|
||||||
"parent" : 17
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 14,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 1484,
|
|
||||||
"parent" : 27
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 14,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 4146,
|
|
||||||
"parent" : 26
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 17,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 956,
|
|
||||||
"parent" : 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 4,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3105,
|
|
||||||
"parent" : 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 18,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 4246,
|
|
||||||
"parent" : 26
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 1579,
|
|
||||||
"parent" : 27
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 4207,
|
|
||||||
"parent" : 26
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 2,
|
|
||||||
"line" : 3554,
|
|
||||||
"parent" : 15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2165,
|
|
||||||
"parent" : 18
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2165,
|
|
||||||
"parent" : 23
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file" : 1,
|
|
||||||
"line" : -1,
|
|
||||||
"parent" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 21,
|
|
||||||
"file" : 5,
|
|
||||||
"line" : 1,
|
|
||||||
"parent" : 62
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 20,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 873,
|
|
||||||
"parent" : 63
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 19,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 2290,
|
|
||||||
"parent" : 64
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"compileDependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"id" : "Qt6::Qml::@6890427a1f51a3e7e1df"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"compileGroups" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"compileCommandFragments" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"fragment" : "-g -std=gnu++20"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"fragment" : "-fno-direct-access-external-data"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"defines" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"define" : "QT_CORE_LIB"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"define" : "QT_NETWORK_LIB"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"define" : "QT_QMLINTEGRATION_LIB"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"define" : "QT_QML_LIB"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"includes" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"path" : "/home/parametheus/Projects/QtDesigner/KomplexHub/build/Dependencies/Components/imports/flowview"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path" : "/home/parametheus/Projects/QtDesigner/KomplexHub/Dependencies/Components/imports/flowview"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"path" : "/home/parametheus/Projects/QtDesigner/KomplexHub/build/Dependencies/Components/imports/flowview/FlowView_autogen/include"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 34,
|
|
||||||
"isSystem" : true,
|
|
||||||
"path" : "/usr/include/qt6/QtQml"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 34,
|
|
||||||
"isSystem" : true,
|
|
||||||
"path" : "/usr/include/qt6"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 34,
|
|
||||||
"isSystem" : true,
|
|
||||||
"path" : "/usr/include/qt6/QtCore"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 34,
|
|
||||||
"isSystem" : true,
|
|
||||||
"path" : "/usr/lib/qt6/mkspecs/linux-g++"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 34,
|
|
||||||
"isSystem" : true,
|
|
||||||
"path" : "/usr/include/qt6/QtQmlIntegration"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 34,
|
|
||||||
"isSystem" : true,
|
|
||||||
"path" : "/usr/include/qt6/QtNetwork"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"language" : "CXX",
|
|
||||||
"languageStandard" :
|
|
||||||
{
|
|
||||||
"backtraces" :
|
|
||||||
[
|
|
||||||
14,
|
|
||||||
14
|
|
||||||
],
|
|
||||||
"standard" : "20"
|
|
||||||
},
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
2,
|
|
||||||
26,
|
|
||||||
27
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 8,
|
|
||||||
"id" : "generate_qmlls_build_ini_file::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 11,
|
|
||||||
"id" : "FlowView_copy_qml::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 13,
|
|
||||||
"id" : "FlowView_copy_res::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id" : "FlowView_autogen_timestamp_deps::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "FlowView_autogen::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"id" : "FlowView::@f8214a2e873271944316",
|
|
||||||
"interfaceCompileDependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 20,
|
|
||||||
"id" : "FlowView_resources_1::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 25,
|
|
||||||
"id" : "FlowView_resources_2::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"interfaceLinkLibraries" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"id" : "Qt6::Qml::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 20,
|
|
||||||
"id" : "FlowView_resources_1::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 25,
|
|
||||||
"id" : "FlowView_resources_2::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"linkLibraries" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"id" : "Qt6::Qml::@6890427a1f51a3e7e1df"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name" : "FlowView",
|
|
||||||
"nameOnDisk" : "libFlowView.a",
|
|
||||||
"orderDependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 28,
|
|
||||||
"id" : "Qt6::moc::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 29,
|
|
||||||
"id" : "Qt6::rcc::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 30,
|
|
||||||
"id" : "Qt6::cmake_automoc_parser::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id" : "Qt6::uic::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 31,
|
|
||||||
"id" : "Qt6::qmltyperegistrar::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 8,
|
|
||||||
"id" : "generate_qmlls_build_ini_file::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 33,
|
|
||||||
"id" : "FlowView_tooling::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id" : "FlowView_autogen_timestamp_deps::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "FlowView_autogen::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/flowview",
|
|
||||||
"source" : "Dependencies/Components/imports/flowview"
|
|
||||||
},
|
|
||||||
"sourceGroups" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name" : "Source Files\\Generated",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
26,
|
|
||||||
27,
|
|
||||||
28,
|
|
||||||
29,
|
|
||||||
31
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Source Files",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8,
|
|
||||||
9,
|
|
||||||
10,
|
|
||||||
11,
|
|
||||||
12,
|
|
||||||
13,
|
|
||||||
14,
|
|
||||||
15,
|
|
||||||
16,
|
|
||||||
17,
|
|
||||||
18,
|
|
||||||
19,
|
|
||||||
20,
|
|
||||||
21,
|
|
||||||
22,
|
|
||||||
23,
|
|
||||||
24,
|
|
||||||
25
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "Resources",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
30
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "CMake Rules",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
32,
|
|
||||||
33,
|
|
||||||
34,
|
|
||||||
35,
|
|
||||||
36,
|
|
||||||
37
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
38,
|
|
||||||
39,
|
|
||||||
40
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"sources" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"compileGroupIndex" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/FlowView_autogen/mocs_compilation.cpp",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 35,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/meta_types/qt6flowview_metatypes.json.gen",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 36,
|
|
||||||
"compileGroupIndex" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/flowview_qmltyperegistrations.cpp",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 37,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/DefaultFlowEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 38,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/SwipeInteraction.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 39,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 40,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowFadeEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 41,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowPushLeftEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 42,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowPushRightEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 43,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowSlideDownEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 44,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowSlideLeftEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 45,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowSlideRightEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 46,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowSlideUpEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 47,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowMoveEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 48,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowPushEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 49,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowTransition.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 50,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowTransitionList.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 51,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowView.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 52,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowPushUpEffect.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 53,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowItem.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 54,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowDecision.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 55,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowWildcard.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 56,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowActionArea.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 57,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/FlowState.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 58,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/+DesignMode/FlowItem.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 59,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/+DesignMode/FlowView.qml",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 60,
|
|
||||||
"compileGroupIndex" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/.qt/rcc/qrc_FlowView_raw_qml_0.cpp",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 61,
|
|
||||||
"compileGroupIndex" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/.qt/rcc/qrc_FlowView_raw_res_0.cpp",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 65,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/.qt/rcc/FlowView_raw_qml_0.qrc",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 65,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/.qt/rcc/FlowView_raw_res_0.qrc",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 65,
|
|
||||||
"path" : "Dependencies/Components/imports/flowview/qmldir",
|
|
||||||
"sourceGroupIndex" : 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/FlowView_autogen/timestamp",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/meta_types/qt6flowview_metatypes.json.gen.rule",
|
|
||||||
"sourceGroupIndex" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/flowview_qmltyperegistrations.cpp.rule",
|
|
||||||
"sourceGroupIndex" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/.qt/rcc/qrc_FlowView_raw_qml_0.cpp.rule",
|
|
||||||
"sourceGroupIndex" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/.qt/rcc/qrc_FlowView_raw_res_0.cpp.rule",
|
|
||||||
"sourceGroupIndex" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/FlowView_autogen/timestamp.rule",
|
|
||||||
"sourceGroupIndex" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/meta_types/FlowView_json_file_list.txt.rule",
|
|
||||||
"sourceGroupIndex" : 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"path" : "/usr/lib/qt6/metatypes/qt6qml_metatypes.json",
|
|
||||||
"sourceGroupIndex" : 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"path" : "/usr/lib/qt6/metatypes/qt6core_metatypes.json",
|
|
||||||
"sourceGroupIndex" : 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 14,
|
|
||||||
"path" : "/usr/lib/qt6/metatypes/qt6network_metatypes.json",
|
|
||||||
"sourceGroupIndex" : 4
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"type" : "STATIC_LIBRARY"
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" : [],
|
|
||||||
"files" :
|
|
||||||
[
|
|
||||||
"Dependencies/Components/imports/flowview/CMakeLists.txt"
|
|
||||||
],
|
|
||||||
"nodes" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"file" : 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"dependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"id" : "FlowView_autogen_timestamp_deps::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"folder" :
|
|
||||||
{
|
|
||||||
"name" : "QtInternalTargets"
|
|
||||||
},
|
|
||||||
"id" : "FlowView_autogen::@f8214a2e873271944316",
|
|
||||||
"isGeneratorProvided" : true,
|
|
||||||
"name" : "FlowView_autogen",
|
|
||||||
"orderDependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"id" : "Qt6::moc::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id" : "Qt6::uic::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id" : "FlowView_autogen_timestamp_deps::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/flowview",
|
|
||||||
"source" : "Dependencies/Components/imports/flowview"
|
|
||||||
},
|
|
||||||
"sourceGroups" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name" : "",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
0
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name" : "CMake Rules",
|
|
||||||
"sourceIndexes" :
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
2
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"sources" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/CMakeFiles/FlowView_autogen",
|
|
||||||
"sourceGroupIndex" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/CMakeFiles/FlowView_autogen.rule",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"isGenerated" : true,
|
|
||||||
"path" : "build/Dependencies/Components/imports/flowview/FlowView_autogen/timestamp.rule",
|
|
||||||
"sourceGroupIndex" : 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"type" : "UTILITY"
|
|
||||||
}
|
|
||||||
-110
@@ -1,110 +0,0 @@
|
|||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"backtraceGraph" :
|
|
||||||
{
|
|
||||||
"commands" :
|
|
||||||
[
|
|
||||||
"add_dependencies",
|
|
||||||
"_qt_internal_qml_copy_files_to_build_dir",
|
|
||||||
"qt6_add_qml_module"
|
|
||||||
],
|
|
||||||
"files" :
|
|
||||||
[
|
|
||||||
"Dependencies/Components/imports/flowview/CMakeLists.txt",
|
|
||||||
"/usr/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake"
|
|
||||||
],
|
|
||||||
"nodes" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"file" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 2,
|
|
||||||
"file" : 0,
|
|
||||||
"line" : 7,
|
|
||||||
"parent" : 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 1,
|
|
||||||
"file" : 1,
|
|
||||||
"line" : 970,
|
|
||||||
"parent" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 0,
|
|
||||||
"file" : 1,
|
|
||||||
"line" : 3083,
|
|
||||||
"parent" : 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 1,
|
|
||||||
"file" : 1,
|
|
||||||
"line" : 976,
|
|
||||||
"parent" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command" : 0,
|
|
||||||
"file" : 1,
|
|
||||||
"line" : 3083,
|
|
||||||
"parent" : 4
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"codemodelVersion" :
|
|
||||||
{
|
|
||||||
"major" : 2,
|
|
||||||
"minor" : 9
|
|
||||||
},
|
|
||||||
"dependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "generate_qmlls_build_ini_file::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 3,
|
|
||||||
"id" : "FlowView_copy_qml::@f8214a2e873271944316"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 5,
|
|
||||||
"id" : "FlowView_copy_res::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"folder" :
|
|
||||||
{
|
|
||||||
"name" : "QtInternalTargets"
|
|
||||||
},
|
|
||||||
"id" : "FlowView_autogen_timestamp_deps::@f8214a2e873271944316",
|
|
||||||
"isGeneratorProvided" : true,
|
|
||||||
"name" : "FlowView_autogen_timestamp_deps",
|
|
||||||
"orderDependencies" :
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "Qt6::moc::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "Qt6::uic::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "Qt6::Qml::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "generate_qmlls_build_ini_file::@6890427a1f51a3e7e1df"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"backtrace" : 0,
|
|
||||||
"id" : "FlowView_tooling::@f8214a2e873271944316"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"paths" :
|
|
||||||
{
|
|
||||||
"build" : "Dependencies/Components/imports/flowview",
|
|
||||||
"source" : "Dependencies/Components/imports/flowview"
|
|
||||||
},
|
|
||||||
"sources" : [],
|
|
||||||
"type" : "UTILITY"
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user