Fixed Featured views
This commit is contained in:
@@ -11,7 +11,8 @@ Rectangle
|
|||||||
{
|
{
|
||||||
id: rootItem
|
id: rootItem
|
||||||
|
|
||||||
readonly property bool searchable: false
|
property string query
|
||||||
|
readonly property bool searchable: paginator.searchable
|
||||||
property bool popup: false
|
property bool popup: false
|
||||||
property int resultWidth: 256
|
property int resultWidth: 256
|
||||||
property int resultHeight: 245
|
property int resultHeight: 245
|
||||||
@@ -20,18 +21,54 @@ Rectangle
|
|||||||
|
|
||||||
FeaturedImagesModel
|
FeaturedImagesModel
|
||||||
{
|
{
|
||||||
id: imagesModel
|
id: searchModel
|
||||||
|
//query: rootItem.query
|
||||||
resultsPerPage: paginator.resultsPerPage
|
resultsPerPage: paginator.resultsPerPage
|
||||||
// windowSize: 80
|
|
||||||
|
Component.onCompleted: () => nextPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
id: resultsLayout
|
||||||
|
visible: opacity > 0.01
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Constants.mediumMargin
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h2Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("Featured Images")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h4Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("A specially curated collection of images, courtesy of Pexels")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
}
|
}
|
||||||
|
|
||||||
PaginatorGrid
|
PaginatorGrid
|
||||||
{
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
id: paginator
|
id: paginator
|
||||||
anchors.fill: parent
|
model: searchModel
|
||||||
model: imagesModel
|
loading: model.state === FeaturedImagesModel.Loading
|
||||||
loading: imagesModel.state === FeaturedImagesModel.Loading
|
|
||||||
visible: opacity > 0.01
|
|
||||||
|
|
||||||
delegate: ItemDelegate
|
delegate: ItemDelegate
|
||||||
{
|
{
|
||||||
@@ -40,18 +77,18 @@ Rectangle
|
|||||||
width: resultWidth
|
width: resultWidth
|
||||||
height: resultHeight
|
height: resultHeight
|
||||||
|
|
||||||
required property string uuid
|
|
||||||
required property string author
|
required property string author
|
||||||
required property string authorId
|
required property string description
|
||||||
required property string authorUrl
|
required property string uuid
|
||||||
required property string thumbnail
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
required property int index
|
required property int index
|
||||||
|
|
||||||
SearchResultItem
|
SearchResultItem
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
author: parent.author
|
title: parent.author
|
||||||
description: qsTr("No description available")
|
description: parent.description
|
||||||
thumbnail: parent.thumbnail
|
thumbnail: parent.thumbnail
|
||||||
uuid: parent.uuid
|
uuid: parent.uuid
|
||||||
pexels: true
|
pexels: true
|
||||||
@@ -61,7 +98,8 @@ Rectangle
|
|||||||
|
|
||||||
onViewMoreTriggered: () =>
|
onViewMoreTriggered: () =>
|
||||||
{
|
{
|
||||||
showVideoPopup(parent.index)
|
showImagePopup(parent.index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,12 +115,12 @@ Rectangle
|
|||||||
|
|
||||||
ImageView
|
ImageView
|
||||||
{
|
{
|
||||||
id: imageDetailsPopup
|
id: viewMoreImagePopup
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
|
||||||
Behavior on opacity
|
Behavior on opacity {
|
||||||
{
|
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -90,8 +128,7 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on opacity
|
Behavior on opacity {
|
||||||
{
|
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -99,31 +136,33 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: () =>
|
function showImagePopup(index)
|
||||||
{
|
{
|
||||||
imagesModel.nextPage()
|
viewMoreImagePopup.author = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.AuthorRole)
|
||||||
}
|
viewMoreImagePopup.authorUrl = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.AuthorUrlRole)
|
||||||
|
viewMoreImagePopup.description = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.DescriptionRole)
|
||||||
function showVideoPopup(index)
|
viewMoreImagePopup.uuid = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.UuidRole)
|
||||||
{
|
viewMoreImagePopup.thumbnail = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LargeThumbnailRole)
|
||||||
imagesModel.setItem(index)
|
viewMoreImagePopup.original = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.OriginalUrlRole)
|
||||||
imageDetailsPopup.author = searchModel.data(searchModel.index(index,0), ImageSearchModel.AuthorRole)
|
viewMoreImagePopup.portrait = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.PortraitUrlRole)
|
||||||
imageDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), ImageSearchModel.AuthorUrlRole)
|
viewMoreImagePopup.landscape = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LandscapeUrlRole)
|
||||||
imageDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), ImageSearchModel.UuidRole)
|
viewMoreImagePopup.backgroundPortrait = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.BackgroundPortraitRole)
|
||||||
imageDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), ImageSearchModel.ThumbnailRole)
|
viewMoreImagePopup.backgroundLandscape = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.BackgroundLandscapeRole)
|
||||||
imageDetailsPopup.modelIndex = index
|
viewMoreImagePopup.fullScreen = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ScreenUrlRole)
|
||||||
imageDetailsPopup.model = searchModel.itemModel
|
viewMoreImagePopup.portraitSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.PortraitSizeRole)
|
||||||
imageDetailsPopup.opacity = 1
|
viewMoreImagePopup.landscapeSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.LandscapeSizeRole)
|
||||||
paginator.opacity = 0
|
viewMoreImagePopup.fullScreenSize = searchModel.data(searchModel.index(index,0), FeaturedImagesModel.ScreenSizeRole)
|
||||||
|
viewMoreImagePopup.opacity = 1
|
||||||
popupContainer.opacity = 1
|
popupContainer.opacity = 1
|
||||||
|
resultsLayout.opacity = 0
|
||||||
rootItem.popup = true
|
rootItem.popup = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function closePopup()
|
function closePopup()
|
||||||
{
|
{
|
||||||
imageDetailsPopup.opacity = 0
|
viewMoreImagePopup.opacity = 0
|
||||||
popupContainer.opacity = 0
|
popupContainer.opacity = 0
|
||||||
paginator.opacity = 1
|
resultsLayout.opacity = 1
|
||||||
rootItem.popup = false
|
rootItem.popup = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
id: rootItem
|
id: rootItem
|
||||||
|
|
||||||
|
property string query
|
||||||
readonly property bool searchable: false
|
readonly property bool searchable: false
|
||||||
property bool popup: false
|
property bool popup: false
|
||||||
property int resultWidth: 256
|
property int resultWidth: 256
|
||||||
@@ -18,20 +19,55 @@ Rectangle
|
|||||||
|
|
||||||
color: palette.base
|
color: palette.base
|
||||||
|
|
||||||
FeaturedPacksModel
|
NewestPacksModel
|
||||||
{
|
{
|
||||||
id: packsModel
|
id: packsModel
|
||||||
resultsPerPage: paginator.resultsPerPage
|
resultsPerPage: paginator.resultsPerPage
|
||||||
// windowSize: 80
|
|
||||||
|
Component.onCompleted: () => nextPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
id: resultsLayout
|
||||||
|
visible: opacity > 0.01
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Constants.mediumMargin
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h2Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("Featured Images")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h4Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("Newest packs submitted to Komplex.dev")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
}
|
}
|
||||||
|
|
||||||
PaginatorGrid
|
PaginatorGrid
|
||||||
{
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
id: paginator
|
id: paginator
|
||||||
anchors.fill: parent
|
|
||||||
model: packsModel
|
model: packsModel
|
||||||
loading: packsModel.state === FeaturedPacksModel.Loading
|
loading: model.state === NewestPacksModel.Loading
|
||||||
visible: opacity > 0.01
|
|
||||||
|
|
||||||
delegate: ItemDelegate
|
delegate: ItemDelegate
|
||||||
{
|
{
|
||||||
@@ -40,28 +76,30 @@ Rectangle
|
|||||||
width: resultWidth
|
width: resultWidth
|
||||||
height: resultHeight
|
height: resultHeight
|
||||||
|
|
||||||
required property string uuid
|
required property string name
|
||||||
required property string author
|
required property string author
|
||||||
required property string authorId
|
required property string description
|
||||||
required property string authorUrl
|
required property string uuid
|
||||||
required property string thumbnail
|
required property string thumbnail
|
||||||
|
required property string authorId
|
||||||
required property int index
|
required property int index
|
||||||
|
|
||||||
SearchResultItem
|
SearchResultItem
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
title: parent.name
|
||||||
author: parent.author
|
author: parent.author
|
||||||
description: qsTr("No description available")
|
description: parent.description
|
||||||
thumbnail: parent.thumbnail
|
thumbnail: parent.thumbnail
|
||||||
uuid: parent.uuid
|
uuid: parent.uuid
|
||||||
pexels: true
|
|
||||||
selected: paginator.currentIndex === parent.index
|
selected: paginator.currentIndex === parent.index
|
||||||
|
|
||||||
onTriggered: () => paginator.currentIndex = parent.index
|
onTriggered: () => paginator.currentIndex = parent.index
|
||||||
|
|
||||||
onViewMoreTriggered: () =>
|
onViewMoreTriggered: () =>
|
||||||
{
|
{
|
||||||
showVideoPopup(parent.index)
|
showWallpaperPopup(parent.index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,12 +115,12 @@ Rectangle
|
|||||||
|
|
||||||
PackView
|
PackView
|
||||||
{
|
{
|
||||||
id: packDetailsPopup
|
id: viewMoreWallpaperPopup
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
|
||||||
Behavior on opacity
|
Behavior on opacity {
|
||||||
{
|
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -90,8 +128,7 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on opacity
|
Behavior on opacity {
|
||||||
{
|
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -99,31 +136,23 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: () =>
|
|
||||||
{
|
|
||||||
packsModel.nextPage()
|
|
||||||
}
|
|
||||||
|
|
||||||
function showVideoPopup(index)
|
|
||||||
{
|
|
||||||
packsModel.setItem(index)
|
|
||||||
packDetailsPopup.author = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorRole)
|
|
||||||
packDetailsPopup.authorUrl = searchModel.data(searchModel.index(index,0), VideoSearchModel.AuthorUrlRole)
|
|
||||||
packDetailsPopup.uuid = searchModel.data(searchModel.index(index,0), VideoSearchModel.UuidRole)
|
|
||||||
packDetailsPopup.thumbnail = searchModel.data(searchModel.index(index,0), VideoSearchModel.ThumbnailRole)
|
|
||||||
packDetailsPopup.modelIndex = index
|
|
||||||
packDetailsPopup.model = searchModel.itemModel
|
|
||||||
packDetailsPopup.opacity = 1
|
|
||||||
paginator.opacity = 0
|
|
||||||
popupContainer.opacity = 1
|
|
||||||
rootItem.popup = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function closePopup()
|
function closePopup()
|
||||||
{
|
{
|
||||||
packDetailsPopup.opacity = 0
|
viewMoreWallpaperPopup.opacity = 0
|
||||||
popupContainer.opacity = 0
|
popupContainer.opacity = 0
|
||||||
paginator.opacity = 1
|
resultsLayout.opacity = 1
|
||||||
rootItem.popup = false
|
rootItem.popup = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showWallpaperPopup(index)
|
||||||
|
{
|
||||||
|
viewMoreWallpaperPopup.author = packsModel.data(packsModel.index(index,0), NewestPacksModel.AuthorRole)
|
||||||
|
viewMoreWallpaperPopup.authorId = packsModel.data(packsModel.index(index,0), NewestPacksModel.AuthorIdRole)
|
||||||
|
viewMoreWallpaperPopup.description = packsModel.data(packsModel.index(index,0), NewestPacksModel.DescriptionRole)
|
||||||
|
viewMoreWallpaperPopup.thumbnail = packsModel.data(packsModel.index(index,0), NewestPacksModel.ThumbnailRole)
|
||||||
|
viewMoreWallpaperPopup.opacity = 1
|
||||||
|
popupContainer.opacity = 1
|
||||||
|
resultsLayout.opacity = 0
|
||||||
|
rootItem.popup = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,45 @@ Rectangle
|
|||||||
windowSize: 80
|
windowSize: 80
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
id: resultsLayout
|
||||||
|
visible: opacity > 0.01
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Constants.mediumMargin
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h2Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("Most Popular Videos")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.preferredHeight: 50
|
||||||
|
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: Constants.h4Font.pixelSize
|
||||||
|
font.bold: true
|
||||||
|
text: qsTr("Most popular videos, provided courtesy of Pexels")
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
}
|
||||||
|
|
||||||
PaginatorGrid
|
PaginatorGrid
|
||||||
{
|
{
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
id: paginator
|
id: paginator
|
||||||
anchors.fill: parent
|
|
||||||
model: videosModel
|
model: videosModel
|
||||||
loading: videosModel.state === FeaturedVideosModel.Loading
|
loading: videosModel.state === FeaturedVideosModel.Loading
|
||||||
visible: opacity > 0.01
|
visible: opacity > 0.01
|
||||||
@@ -51,7 +86,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
author: parent.author
|
author: parent.author
|
||||||
description: qsTr("No description available")
|
description: qsTr("")
|
||||||
thumbnail: parent.thumbnail
|
thumbnail: parent.thumbnail
|
||||||
uuid: parent.uuid
|
uuid: parent.uuid
|
||||||
pexels: true
|
pexels: true
|
||||||
@@ -66,6 +101,7 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
@@ -80,6 +116,7 @@ Rectangle
|
|||||||
id: videoDetailsPopup
|
id: videoDetailsPopup
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
|
||||||
Behavior on opacity
|
Behavior on opacity
|
||||||
{
|
{
|
||||||
@@ -114,7 +151,7 @@ Rectangle
|
|||||||
videoDetailsPopup.modelIndex = index
|
videoDetailsPopup.modelIndex = index
|
||||||
videoDetailsPopup.model = searchModel.itemModel
|
videoDetailsPopup.model = searchModel.itemModel
|
||||||
videoDetailsPopup.opacity = 1
|
videoDetailsPopup.opacity = 1
|
||||||
paginator.opacity = 0
|
resultsLayout.opacity = 0
|
||||||
popupContainer.opacity = 1
|
popupContainer.opacity = 1
|
||||||
rootItem.popup = true
|
rootItem.popup = true
|
||||||
}
|
}
|
||||||
@@ -123,7 +160,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
videoDetailsPopup.opacity = 0
|
videoDetailsPopup.opacity = 0
|
||||||
popupContainer.opacity = 0
|
popupContainer.opacity = 0
|
||||||
paginator.opacity = 1
|
resultsLayout.opacity = 1
|
||||||
rootItem.popup = false
|
rootItem.popup = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user