Various visual improvements
This commit is contained in:
@@ -54,7 +54,11 @@ Rectangle {
|
||||
onTriggered: () => {
|
||||
pageLoader.page = "pages/HomePage.qml"
|
||||
|
||||
if(currentMenuButton !== null)
|
||||
{
|
||||
currentMenuButton.selected = false
|
||||
}
|
||||
|
||||
currentMenuButton = this
|
||||
|
||||
searchContainer.preferredHeight = 0
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Effects
|
||||
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
@@ -8,7 +10,9 @@ import KomplexHubPlugin
|
||||
|
||||
Item {
|
||||
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: 256
|
||||
|
||||
id: homePageRoot
|
||||
|
||||
@@ -30,42 +34,67 @@ Item {
|
||||
resultsPerPage: homePageRoot.resultsPerRow
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: palette.base
|
||||
|
||||
ScrollView {
|
||||
ScrollView
|
||||
{
|
||||
id: newPacksView
|
||||
anchors.fill: parent
|
||||
anchors.margins: Constants.largeMargin
|
||||
|
||||
ColumnLayout {
|
||||
width: homePageRoot.width
|
||||
ColumnLayout
|
||||
{
|
||||
width: newPacksView.width
|
||||
|
||||
// Featured Results
|
||||
ColumnLayout {
|
||||
ColumnLayout
|
||||
{
|
||||
width: parent.width
|
||||
height: 420
|
||||
|
||||
Text {
|
||||
Text
|
||||
{
|
||||
color: palette.text
|
||||
font.pixelSize: Constants.h3Font.pixelSize
|
||||
font.pixelSize: Constants.h2Font.pixelSize
|
||||
font.bold: true
|
||||
text: "Newest Wallpaper Packs"
|
||||
text: qsTr("Newest Wallpaper Packs")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 256
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.leftMargin: Constants.largeMargin
|
||||
|
||||
Repeater {
|
||||
Rectangle
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
color: "transparent"
|
||||
|
||||
clip: true
|
||||
Row
|
||||
{
|
||||
clip: true
|
||||
spacing: Constants.mediumMargin
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: newPacksMoreButton.left
|
||||
anchors.leftMargin: Constants.largeMargin
|
||||
anchors.rightMargin: Constants.largeMargin
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: newestPacksModel
|
||||
|
||||
delegate: Item {
|
||||
width: 256
|
||||
height: 256
|
||||
width: resultWidth
|
||||
height: resultHeight
|
||||
|
||||
required property string name
|
||||
required property string author
|
||||
required property string description
|
||||
@@ -84,10 +113,33 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SquareButton {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 64
|
||||
Rectangle
|
||||
{
|
||||
id: newestGradientMap
|
||||
anchors.top: parent.top
|
||||
anchors.right: newPacksMoreButton.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: newPacksMoreButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
height: resultHeight
|
||||
|
||||
width: 64
|
||||
|
||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
||||
icon.height: 24
|
||||
@@ -95,35 +147,59 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
height: Constants.largeMargin
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
ColumnLayout
|
||||
{
|
||||
width: parent.width
|
||||
height: 420
|
||||
|
||||
Text {
|
||||
Text
|
||||
{
|
||||
color: palette.text
|
||||
font.pixelSize: Constants.h3Font.pixelSize
|
||||
font.pixelSize: Constants.h2Font.pixelSize
|
||||
font.bold: true
|
||||
text: "Featured Images"
|
||||
text: qsTr("Featured Images")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 256
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.leftMargin: Constants.largeMargin
|
||||
|
||||
Repeater {
|
||||
Rectangle
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
color: "transparent"
|
||||
|
||||
clip: true
|
||||
Row
|
||||
{
|
||||
clip: true
|
||||
spacing: Constants.mediumMargin
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: featuredImagesMoreButton.left
|
||||
anchors.leftMargin: Constants.largeMargin
|
||||
anchors.rightMargin: Constants.largeMargin
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: featuredImagesModel
|
||||
|
||||
delegate: Item {
|
||||
width: 256
|
||||
height: 256
|
||||
delegate: Item
|
||||
{
|
||||
width: resultWidth
|
||||
height: resultHeight
|
||||
|
||||
required property string author
|
||||
required property string description
|
||||
required property string uuid
|
||||
@@ -141,10 +217,32 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SquareButton {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 64
|
||||
Rectangle
|
||||
{
|
||||
anchors.top: parent.top
|
||||
anchors.right: featuredImagesMoreButton.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: featuredImagesMoreButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
height: resultHeight
|
||||
|
||||
width: 64
|
||||
|
||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
||||
icon.height: 24
|
||||
@@ -152,35 +250,58 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
height: Constants.largeMargin
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
ColumnLayout
|
||||
{
|
||||
width: parent.width
|
||||
height: 420
|
||||
|
||||
Text {
|
||||
Text
|
||||
{
|
||||
color: palette.text
|
||||
font.pixelSize: Constants.h3Font.pixelSize
|
||||
font.pixelSize: Constants.h2Font.pixelSize
|
||||
font.bold: true
|
||||
text: "Featured Videos"
|
||||
text: qsTr("Featured Videos")
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 256
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.leftMargin: Constants.largeMargin
|
||||
|
||||
Repeater {
|
||||
Rectangle
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
color: "transparent"
|
||||
|
||||
clip: true
|
||||
Row
|
||||
{
|
||||
clip: true
|
||||
spacing: Constants.mediumMargin
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: featuredVideosMoreButton.left
|
||||
anchors.leftMargin: Constants.largeMargin
|
||||
anchors.rightMargin: Constants.largeMargin
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: featuredVideosModel
|
||||
|
||||
delegate: Item {
|
||||
width: 256
|
||||
height: 256
|
||||
width: resultWidth
|
||||
height: resultHeight
|
||||
|
||||
required property string uuid
|
||||
required property string author
|
||||
required property string authorId
|
||||
@@ -198,10 +319,32 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SquareButton {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 64
|
||||
Rectangle
|
||||
{
|
||||
anchors.top: parent.top
|
||||
anchors.right: featuredVideosMoreButton.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: featuredVideosMoreButton
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
height: resultHeight
|
||||
|
||||
width: 64
|
||||
|
||||
icon.source: "qrc:/images/icons/icons8-forward.svg"
|
||||
icon.height: 24
|
||||
@@ -212,6 +355,7 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KeroLoadingAnimation
|
||||
{
|
||||
|
||||
@@ -11,9 +11,12 @@ Item
|
||||
{
|
||||
property string query
|
||||
readonly property bool searchable: true
|
||||
property int resultsPerRow: (resultsView.width - (64 + Constants.largeMargin)) / (256 + Constants.largeMargin)
|
||||
property int rows: (resultsView.height - (Constants.largeMargin * 2) / (256 + Constants.largeMargin))
|
||||
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
|
||||
|
||||
id: imageSearchPageRoot
|
||||
|
||||
@@ -29,29 +32,53 @@ Item
|
||||
anchors.fill: parent
|
||||
color: palette.base
|
||||
|
||||
ScrollView
|
||||
Rectangle
|
||||
{
|
||||
id: resultsView
|
||||
id: resultsContainer
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: buttonBoxLayout.top
|
||||
|
||||
GridLayout {
|
||||
color: "transparent"
|
||||
|
||||
ScrollView
|
||||
{
|
||||
id: resultsView
|
||||
anchors.fill: parent
|
||||
|
||||
RowLayout
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
|
||||
anchors.margins: Constants.largeMargin
|
||||
columns: imageSearchPageRoot.resultsPerRow
|
||||
|
||||
Repeater {
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: emptyWidth / 2
|
||||
Layout.maximumWidth: emptyWidth / 2
|
||||
}
|
||||
|
||||
GridLayout
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
columns: imageSearchPageRoot.resultsPerRow
|
||||
columnSpacing: Constants.mediumMargin
|
||||
rowSpacing: Constants.mediumMargin
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: searchModel
|
||||
|
||||
delegate: Item {
|
||||
delegate: Item
|
||||
{
|
||||
width: 256
|
||||
height: 256
|
||||
height: 245
|
||||
required property string author
|
||||
required property string description
|
||||
required property string uuid
|
||||
@@ -71,16 +98,21 @@ Item
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
RowLayout
|
||||
{
|
||||
id: buttonBoxLayout
|
||||
height: 50
|
||||
height: 35
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: Constants.largeMargin
|
||||
|
||||
SquareButton {
|
||||
SquareButton
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 128
|
||||
|
||||
@@ -89,11 +121,14 @@ Item
|
||||
icon.width: 16
|
||||
text: qsTr("Previous")
|
||||
enabled: searchModel.hasPreviousPage
|
||||
|
||||
onTriggered: () => searchModel.previousPage()
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
SquareButton {
|
||||
SquareButton
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: 128
|
||||
|
||||
@@ -102,25 +137,30 @@ Item
|
||||
icon.width: 16
|
||||
text: qsTr("Next")
|
||||
enabled: searchModel.hasNextPage
|
||||
|
||||
onTriggered: () => searchModel.nextPage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KeroErrorAvatar {
|
||||
KeroErrorAvatar
|
||||
{
|
||||
id: errorOverlay
|
||||
|
||||
anchors.fill: parent
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
KeroNoResultsAvatar {
|
||||
KeroNoResultsAvatar
|
||||
{
|
||||
id: noResultsOverlay
|
||||
|
||||
anchors.fill: parent
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
KeroLoadingAnimation {
|
||||
KeroLoadingAnimation
|
||||
{
|
||||
id: loadingOverlay
|
||||
|
||||
anchors.fill: parent
|
||||
@@ -128,7 +168,8 @@ Item
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
State
|
||||
{
|
||||
name: "loading"
|
||||
when: searchModel.state == ImageSearchModel.Loading
|
||||
|
||||
@@ -143,7 +184,8 @@ Item
|
||||
opacity: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
State
|
||||
{
|
||||
name: "empty"
|
||||
when: searchModel.totalResults === 0
|
||||
|
||||
@@ -157,12 +199,14 @@ Item
|
||||
target: resultsView
|
||||
opacity: 0
|
||||
}
|
||||
PropertyChanges {
|
||||
PropertyChanges
|
||||
{
|
||||
target: buttonBoxLayout
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
State {
|
||||
State
|
||||
{
|
||||
name: "error"
|
||||
when: searchModel.state == ImageSearchModel.Error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user