Added modules to reduce redunant code
This commit is contained in:
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Rectangle
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Rectangle
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Rectangle
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ import QtQuick.Effects
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
@@ -64,7 +64,7 @@ Item
|
||||
id: content
|
||||
width: pageArea.width
|
||||
|
||||
VerticalSpacer{ height: Constants.largeMargin }
|
||||
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
||||
|
||||
Rectangle
|
||||
{
|
||||
@@ -153,11 +153,6 @@ Item
|
||||
{
|
||||
showWallpaperPopup(parent.index)
|
||||
}
|
||||
|
||||
onThumbnailChanged: () =>
|
||||
{
|
||||
console.log(index + " " + thumbnail + " " + parent.thumbnail)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,13 +220,13 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
VerticalSpacer{ height: Constants.largeMargin }
|
||||
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerticalSpacer{ height: Constants.largeMargin }
|
||||
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
||||
|
||||
Rectangle
|
||||
{
|
||||
@@ -322,11 +317,6 @@ Item
|
||||
{
|
||||
showWallpaperPopup(parent.index)
|
||||
}
|
||||
|
||||
onThumbnailChanged: () =>
|
||||
{
|
||||
console.log(index + " " + thumbnail + " " + parent.thumbnail)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,13 +380,13 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
VerticalSpacer{ height: Constants.largeMargin }
|
||||
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerticalSpacer{ height: Constants.largeMargin }
|
||||
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -607,6 +597,12 @@ Item
|
||||
target: pageArea
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
PropertyChanges
|
||||
{
|
||||
target: loadingAnimation
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -661,7 +657,6 @@ Item
|
||||
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.LargeThumbnailRole)
|
||||
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.backgroundPortrait = imagesModel.data(imagesModel.index(index,0), FeaturedImagesModel.BackgroundPortraitRole)
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Dialogs
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
@@ -3,7 +3,7 @@ import QtQuick.Controls
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Rectangle
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ import QtCore
|
||||
import Qt.labs.folderlistmodel 2.15
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
//import com.github.digitalartifex.komplex 1.0 as Komplex
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
|
||||
Item
|
||||
{
|
||||
property alias source: image.source
|
||||
property alias imageOpacity: effect.opacity
|
||||
property alias blur: effect.blur
|
||||
property alias saturation: effect.saturation
|
||||
|
||||
Image
|
||||
{
|
||||
anchors.fill: parent
|
||||
id: image
|
||||
source: thumbnail
|
||||
fillMode: Image.PreserveAspectFit
|
||||
visible: false
|
||||
}
|
||||
|
||||
MultiEffect
|
||||
{
|
||||
id: effect
|
||||
anchors.fill: image
|
||||
source: image
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 1.0
|
||||
opacity: 0.25
|
||||
saturation: -0.8
|
||||
}
|
||||
}
|
||||
@@ -22,5 +22,10 @@ qt6_add_qml_module(KomplexHubModule_Controls
|
||||
QML_FILES VideoView.qml
|
||||
QML_FILES PackView.qml
|
||||
QML_FILES VerticalSpacer.qml
|
||||
QML_FILES DownloadView.qml
|
||||
QML_FILES ImageFrame.qml
|
||||
QML_FILES BackgroundImage.qml
|
||||
QML_FILES CompletedView.qml
|
||||
QML_FILES ErrorView.qml
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Item
|
||||
{
|
||||
property alias source: viewImage.source
|
||||
id: rootItem
|
||||
|
||||
Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
color: palette.base.darker()
|
||||
border.color: palette.midlight
|
||||
|
||||
Throbber
|
||||
{
|
||||
anchors.fill: parent
|
||||
id: loadingThrobber
|
||||
visible: viewImage.status === Image.Loading
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: viewImage
|
||||
anchors.fill: parent
|
||||
transform: Image.PreserveAspectCrop
|
||||
source: rootItem.source
|
||||
visible: !(status === Image.Loading)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import QtQuick.Effects
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
@@ -26,24 +26,10 @@ Item
|
||||
anchors.fill: parent
|
||||
color: palette.base
|
||||
|
||||
Image
|
||||
BackgroundImage
|
||||
{
|
||||
id: backgroundImage
|
||||
source: thumbnail
|
||||
transform: Image.PreserveAspectCrop
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
}
|
||||
|
||||
MultiEffect
|
||||
{
|
||||
anchors.fill: backgroundImage
|
||||
source: backgroundImage
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 1.0
|
||||
opacity: 0.25
|
||||
saturation: -0.8
|
||||
source: rootItem.thumbnail
|
||||
}
|
||||
|
||||
ColumnLayout
|
||||
@@ -52,36 +38,15 @@ Item
|
||||
anchors.margins: Constants.largeMargin
|
||||
spacing: Constants.largeMargin
|
||||
|
||||
RowLayout
|
||||
ImageFrame
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop| Qt.AlignHCenter
|
||||
Layout.topMargin: 32
|
||||
Layout.topMargin: Constants.largeMargin
|
||||
Layout.preferredHeight: width / 1.77777777778
|
||||
Layout.maximumWidth: 800
|
||||
|
||||
Rectangle
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width / 1.77777777778
|
||||
Layout.maximumWidth: 800
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: palette.base.darker()
|
||||
|
||||
Throbber
|
||||
{
|
||||
anchors.fill: parent
|
||||
id: loadingThrobber
|
||||
visible: viewImage.status === Image.Loading
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: viewImage
|
||||
anchors.fill: parent
|
||||
transform: Image.PreserveAspectCrop
|
||||
source: rootItem.thumbnail
|
||||
visible: !(status === Image.Loading)
|
||||
}
|
||||
}
|
||||
source: rootItem.thumbnail
|
||||
}
|
||||
|
||||
Text
|
||||
@@ -116,18 +81,6 @@ Item
|
||||
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
|
||||
|
||||
@@ -5,7 +5,7 @@ import QtQuick.Layouts
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ Item {
|
||||
signal triggered
|
||||
signal viewMoreTriggered
|
||||
|
||||
id: mainItem
|
||||
id: rootItem
|
||||
width: 256
|
||||
height: 256
|
||||
clip: true
|
||||
@@ -48,7 +48,7 @@ Item {
|
||||
onReleased: () => {
|
||||
if(!states.selected)
|
||||
{
|
||||
mainItem.triggered()
|
||||
rootItem.triggered()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,47 +57,13 @@ Item {
|
||||
{
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle
|
||||
ImageFrame
|
||||
{
|
||||
Layout.preferredWidth: 250
|
||||
Layout.preferredHeight: 141
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
Layout.topMargin: 3
|
||||
|
||||
border.color: palette.alternateBase.lighter(1.75)
|
||||
|
||||
color: palette.base.lighter(1.25)
|
||||
|
||||
Throbber
|
||||
{
|
||||
anchors.fill: parent
|
||||
id: loadingThrobber
|
||||
visible: viewImage.status === Image.Loading
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
property int retries: 0
|
||||
id: viewImage
|
||||
anchors.fill: parent
|
||||
source: mainItem.thumbnail
|
||||
visible: !(status === Image.Loading)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
||||
onStatusChanged: () =>
|
||||
{
|
||||
// if(status === Image.Error)
|
||||
// {
|
||||
// if(retries <= 3)
|
||||
// {
|
||||
// ++retries
|
||||
// let src = source
|
||||
// source = ""
|
||||
// source = src
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
source: rootItem.thumbnail
|
||||
|
||||
Image
|
||||
{
|
||||
@@ -112,14 +78,57 @@ Item {
|
||||
opacity: 0.5
|
||||
source: "qrc:/images/icons/pexels-icon-filled-256.svg"
|
||||
|
||||
visible: mainItem.pexels
|
||||
visible: rootItem.pexels
|
||||
}
|
||||
}
|
||||
|
||||
// Rectangle
|
||||
// {
|
||||
// Layout.preferredWidth: 250
|
||||
// Layout.preferredHeight: 141
|
||||
// Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
||||
// Layout.topMargin: 3
|
||||
|
||||
// border.color: palette.alternateBase.lighter(1.75)
|
||||
|
||||
// color: palette.base.lighter(1.25)
|
||||
|
||||
// // Throbber
|
||||
// // {
|
||||
// // anchors.fill: parent
|
||||
// // id: loadingThrobber
|
||||
// // visible: viewImage.status === Image.Loading
|
||||
// // }
|
||||
|
||||
// // Image
|
||||
// // {
|
||||
// // property int retries: 0
|
||||
// // id: viewImage
|
||||
// // anchors.fill: parent
|
||||
// // source: rootItem.thumbnail
|
||||
// // visible: !(status === Image.Loading)
|
||||
// // fillMode: Image.PreserveAspectCrop
|
||||
|
||||
// // onStatusChanged: () =>
|
||||
// // {
|
||||
// // // if(status === Image.Error)
|
||||
// // // {
|
||||
// // // if(retries <= 3)
|
||||
// // // {
|
||||
// // // ++retries
|
||||
// // // let src = source
|
||||
// // // source = ""
|
||||
// // // source = src
|
||||
// // // }
|
||||
// // // }
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
|
||||
Text
|
||||
{
|
||||
color: palette.text
|
||||
text: mainItem.title
|
||||
text: rootItem.title
|
||||
|
||||
font.pixelSize: 16
|
||||
font.bold: true
|
||||
@@ -135,12 +144,12 @@ Item {
|
||||
{
|
||||
color: palette.text
|
||||
font.pixelSize: 12
|
||||
text: "By: " + mainItem.author
|
||||
text: "By: " + rootItem.author
|
||||
leftPadding: 12
|
||||
|
||||
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
||||
Layout.preferredWidth: 250
|
||||
visible: !mainItem.pexels
|
||||
visible: !rootItem.pexels
|
||||
}
|
||||
|
||||
Text
|
||||
@@ -149,7 +158,7 @@ Item {
|
||||
clip: true
|
||||
color: palette.text
|
||||
font.pixelSize: 12
|
||||
text: mainItem.description
|
||||
text: rootItem.description
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
textFormat: Text.PlainText
|
||||
elide: Text.ElideRight
|
||||
@@ -176,7 +185,7 @@ Item {
|
||||
opacity: 0
|
||||
|
||||
onTriggered: () => {
|
||||
mainItem.viewMoreTriggered()
|
||||
rootItem.viewMoreTriggered()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +198,7 @@ Item {
|
||||
id: states
|
||||
property bool clicked: false
|
||||
property bool hovered: false
|
||||
property alias selected: mainItem.selected
|
||||
property alias selected: rootItem.selected
|
||||
property bool idle: true
|
||||
|
||||
onIdleChanged: () =>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle
|
||||
{
|
||||
height: 36
|
||||
Layout.fillHeight: true
|
||||
|
||||
color: "transparent"
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import QtQuick.Effects
|
||||
import KomplexHub
|
||||
import KomplexHub.Controls
|
||||
import KomplexHub.Kero
|
||||
import KomplexHubPlugin
|
||||
import KomplexHub.Plugin
|
||||
|
||||
Item
|
||||
{
|
||||
@@ -46,24 +46,10 @@ Item
|
||||
anchors.fill: parent
|
||||
color: palette.base
|
||||
|
||||
Image
|
||||
BackgroundImage
|
||||
{
|
||||
id: backgroundImage
|
||||
source: thumbnail
|
||||
anchors.fill: parent
|
||||
visible: false
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
MultiEffect
|
||||
{
|
||||
anchors.fill: backgroundImage
|
||||
source: backgroundImage
|
||||
blurEnabled: true
|
||||
blurMax: 64
|
||||
blur: 1.0
|
||||
opacity: 0.25
|
||||
saturation: -0.8
|
||||
source: rootItem.thumbnail
|
||||
}
|
||||
|
||||
ColumnLayout
|
||||
@@ -72,36 +58,15 @@ Item
|
||||
anchors.margins: Constants.largeMargin
|
||||
spacing: Constants.largeMargin
|
||||
|
||||
RowLayout
|
||||
ImageFrame
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop| Qt.AlignHCenter
|
||||
Layout.topMargin: 32
|
||||
Layout.topMargin: Constants.largeMargin
|
||||
Layout.preferredHeight: width / 1.77777777778
|
||||
Layout.maximumWidth: 800
|
||||
|
||||
Rectangle
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width / 1.77777777778
|
||||
Layout.maximumWidth: 800
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: palette.base.darker()
|
||||
|
||||
Throbber
|
||||
{
|
||||
anchors.fill: parent
|
||||
id: loadingThrobber
|
||||
visible: viewImage.status === Image.Loading
|
||||
}
|
||||
|
||||
Image
|
||||
{
|
||||
id: viewImage
|
||||
anchors.fill: parent
|
||||
source: rootItem.thumbnail
|
||||
visible: !(status === Image.Loading)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
}
|
||||
}
|
||||
source: rootItem.thumbnail
|
||||
}
|
||||
|
||||
Text
|
||||
|
||||
Reference in New Issue
Block a user