diff --git a/KomplexHubContent/pages/FeaturedImagesPage.qml b/KomplexHubContent/pages/FeaturedImagesPage.qml new file mode 100644 index 0000000..20fe056 --- /dev/null +++ b/KomplexHubContent/pages/FeaturedImagesPage.qml @@ -0,0 +1,129 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero +import KomplexHubPlugin + +Rectangle +{ + id: rootItem + + readonly property bool searchable: false + property bool popup: false + property int resultWidth: 256 + property int resultHeight: 245 + + color: palette.base + + FeaturedImagesModel + { + id: imagesModel + resultsPerPage: paginator.resultsPerPage + // windowSize: 80 + } + + PaginatorGrid + { + id: paginator + anchors.fill: parent + model: imagesModel + loading: imagesModel.state === FeaturedImagesModel.Loading + visible: opacity > 0.01 + + delegate: ItemDelegate + { + id: resultDelegate + + 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 + author: parent.author + description: qsTr("No description available") + thumbnail: parent.thumbnail + uuid: parent.uuid + pexels: true + selected: paginator.currentIndex === parent.index + + onTriggered: () => paginator.currentIndex = parent.index + + onViewMoreTriggered: () => + { + showVideoPopup(parent.index) + } + } + } + } + + Rectangle + { + id: popupContainer + anchors.fill: parent + opacity: 0 + visible: opacity > 0.01 + color: palette.base + + ImageView + { + id: imageDetailsPopup + anchors.fill: parent + opacity: 0 + + Behavior on opacity + { + NumberAnimation + { + duration: 250 + } + } + } + + Behavior on opacity + { + NumberAnimation + { + duration: 250 + } + } + } + + Component.onCompleted: () => + { + imagesModel.nextPage() + } + + function showVideoPopup(index) + { + imagesModel.setItem(index) + imageDetailsPopup.author = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorRole) + imageDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorUrlRole) + imageDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), VideoSearchModel.UuidRole) + imageDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), VideoSearchModel.ThumbnailRole) + imageDetailsPopup.modelIndex = index + imageDetailsPopup.model = searchModel.itemModel + imageDetailsPopup.opacity = 1 + paginator.opacity = 0 + popupContainer.opacity = 1 + rootItem.popup = true + } + + function closePopup() + { + imageDetailsPopup.opacity = 0 + popupContainer.opacity = 0 + paginator.opacity = 1 + rootItem.popup = false + } +} diff --git a/KomplexHubContent/pages/FeaturedPacksPage.qml b/KomplexHubContent/pages/FeaturedPacksPage.qml new file mode 100644 index 0000000..e08ebd1 --- /dev/null +++ b/KomplexHubContent/pages/FeaturedPacksPage.qml @@ -0,0 +1,129 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero +import KomplexHubPlugin + +Rectangle +{ + id: rootItem + + readonly property bool searchable: false + property bool popup: false + property int resultWidth: 256 + property int resultHeight: 245 + + color: palette.base + + FeaturedPacksModel + { + id: packsModel + resultsPerPage: paginator.resultsPerPage + // windowSize: 80 + } + + PaginatorGrid + { + id: paginator + anchors.fill: parent + model: packsModel + loading: packsModel.state === FeaturedPacksModel.Loading + visible: opacity > 0.01 + + delegate: ItemDelegate + { + id: resultDelegate + + 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 + author: parent.author + description: qsTr("No description available") + thumbnail: parent.thumbnail + uuid: parent.uuid + pexels: true + selected: paginator.currentIndex === parent.index + + onTriggered: () => paginator.currentIndex = parent.index + + onViewMoreTriggered: () => + { + showVideoPopup(parent.index) + } + } + } + } + + Rectangle + { + id: popupContainer + anchors.fill: parent + opacity: 0 + visible: opacity > 0.01 + color: palette.base + + PackView + { + id: packDetailsPopup + anchors.fill: parent + opacity: 0 + + Behavior on opacity + { + NumberAnimation + { + duration: 250 + } + } + } + + Behavior on opacity + { + NumberAnimation + { + duration: 250 + } + } + } + + Component.onCompleted: () => + { + packsModel.nextPage() + } + + function showVideoPopup(index) + { + packsModel.setItem(index) + packDetailsPopup.author = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorRole) + packDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorUrlRole) + packDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), VideoSearchModel.UuidRole) + packDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), VideoSearchModel.ThumbnailRole) + packDetailsPopup.modelIndex = index + packDetailsPopup.model = searchModel.itemModel + packDetailsPopup.opacity = 1 + paginator.opacity = 0 + popupContainer.opacity = 1 + rootItem.popup = true + } + + function closePopup() + { + packDetailsPopup.opacity = 0 + popupContainer.opacity = 0 + paginator.opacity = 1 + rootItem.popup = false + } +} diff --git a/KomplexHubContent/pages/FeaturedVideosPage.qml b/KomplexHubContent/pages/FeaturedVideosPage.qml new file mode 100644 index 0000000..95358df --- /dev/null +++ b/KomplexHubContent/pages/FeaturedVideosPage.qml @@ -0,0 +1,129 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import KomplexHub +import KomplexHub.Controls +import KomplexHub.Kero +import KomplexHubPlugin + +Rectangle +{ + id: rootItem + + readonly property bool searchable: false + property bool popup: false + property int resultWidth: 256 + property int resultHeight: 245 + + color: palette.base + + FeaturedVideosModel + { + id: videosModel + resultsPerPage: paginator.resultsPerPage + windowSize: 80 + } + + PaginatorGrid + { + id: paginator + anchors.fill: parent + model: videosModel + loading: videosModel.state === FeaturedVideosModel.Loading + visible: opacity > 0.01 + + delegate: ItemDelegate + { + id: resultDelegate + + 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 + author: parent.author + description: qsTr("No description available") + thumbnail: parent.thumbnail + uuid: parent.uuid + pexels: true + selected: paginator.currentIndex === parent.index + + onTriggered: () => paginator.currentIndex = parent.index + + onViewMoreTriggered: () => + { + showVideoPopup(parent.index) + } + } + } + } + + Rectangle + { + id: popupContainer + anchors.fill: parent + opacity: 0 + visible: opacity > 0.01 + color: palette.base + + VideoView + { + id: videoDetailsPopup + anchors.fill: parent + opacity: 0 + + Behavior on opacity + { + NumberAnimation + { + duration: 250 + } + } + } + + Behavior on opacity + { + NumberAnimation + { + duration: 250 + } + } + } + + Component.onCompleted: () => + { + videosModel.nextPage() + } + + function showVideoPopup(index) + { + videosModel.setItem(index) + videoDetailsPopup.author = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorRole) + videoDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorUrlRole) + videoDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), VideoSearchModel.UuidRole) + videoDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), VideoSearchModel.ThumbnailRole) + videoDetailsPopup.modelIndex = index + videoDetailsPopup.model = searchModel.itemModel + videoDetailsPopup.opacity = 1 + paginator.opacity = 0 + popupContainer.opacity = 1 + rootItem.popup = true + } + + function closePopup() + { + videoDetailsPopup.opacity = 0 + popupContainer.opacity = 0 + paginator.opacity = 1 + rootItem.popup = false + } +}