Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
ac65bbb3ab
|
|||
|
45f293a349
|
@@ -18,10 +18,20 @@ qt6_add_qml_module(KomplexHubContent
|
|||||||
"pages/UserProfilePage.qml"
|
"pages/UserProfilePage.qml"
|
||||||
"pages/WallpaperSettingsPage.qml"
|
"pages/WallpaperSettingsPage.qml"
|
||||||
"pages/VideoSearchPage.qml"
|
"pages/VideoSearchPage.qml"
|
||||||
QML_FILES pages/FeaturedVideosPage.qml
|
"pages/FeaturedVideosPage.qml"
|
||||||
QML_FILES pages/FeaturedPacksPage.qml
|
"pages/FeaturedPacksPage.qml"
|
||||||
QML_FILES pages/FeaturedImagesPage.qml
|
"pages/FeaturedImagesPage.qml"
|
||||||
QML_FILES pages/NewestPacksPage.qml
|
"pages/NewestPacksPage.qml"
|
||||||
|
"views/CompletedView.qml"
|
||||||
|
"views/DownloadView.qml"
|
||||||
|
"views/ErrorView.qml"
|
||||||
|
"views/ImageView.qml"
|
||||||
|
"views/PackView.qml"
|
||||||
|
"views/VideoView.qml"
|
||||||
|
RESOURCES views/CMakeLists.txt
|
||||||
|
RESOURCES pages/CMakeLists.txt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory(pages)
|
||||||
|
add_subdirectory(views)
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ Rectangle {
|
|||||||
|
|
||||||
height: 64
|
height: 64
|
||||||
width: 100
|
width: 100
|
||||||
text: "Home"
|
text: qsTr("Home")
|
||||||
|
|
||||||
icon.height: 32
|
icon.height: 32
|
||||||
icon.width: 32
|
icon.width: 32
|
||||||
@@ -109,7 +109,7 @@ Rectangle {
|
|||||||
|
|
||||||
height: 64
|
height: 64
|
||||||
width: 100
|
width: 100
|
||||||
text: "Images"
|
text: qsTr("Images")
|
||||||
|
|
||||||
icon.height: 32
|
icon.height: 32
|
||||||
icon.width: 32
|
icon.width: 32
|
||||||
@@ -132,7 +132,7 @@ Rectangle {
|
|||||||
|
|
||||||
height: 64
|
height: 64
|
||||||
width: 100
|
width: 100
|
||||||
text: "Videos"
|
text: qsTr("Videos")
|
||||||
|
|
||||||
icon.height: 32
|
icon.height: 32
|
||||||
icon.width: 32
|
icon.width: 32
|
||||||
@@ -155,7 +155,7 @@ Rectangle {
|
|||||||
|
|
||||||
height: 64
|
height: 64
|
||||||
width: 100
|
width: 100
|
||||||
text: "Live"
|
text: qsTr("Komplex")
|
||||||
|
|
||||||
icon.height: 32
|
icon.height: 32
|
||||||
icon.width: 32
|
icon.width: 32
|
||||||
@@ -178,7 +178,7 @@ Rectangle {
|
|||||||
|
|
||||||
height: 64
|
height: 64
|
||||||
width: 100
|
width: 100
|
||||||
text: "Installed"
|
text: qsTr("Installed")
|
||||||
|
|
||||||
icon.height: 32
|
icon.height: 32
|
||||||
icon.width: 32
|
icon.width: 32
|
||||||
@@ -207,7 +207,7 @@ Rectangle {
|
|||||||
|
|
||||||
height: 64
|
height: 64
|
||||||
width: 100
|
width: 100
|
||||||
text: "Settings"
|
text: qsTr("Settings")
|
||||||
|
|
||||||
icon.height: 32
|
icon.height: 32
|
||||||
icon.width: 32
|
icon.width: 32
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
qt_add_library(KomplexHubPages STATIC)
|
||||||
|
qt6_add_qml_module(KomplexHubPages
|
||||||
|
URI "KomplexHub.Pages"
|
||||||
|
VERSION 1.0
|
||||||
|
RESOURCE_PREFIX "/qt/qml"
|
||||||
|
QML_FILES
|
||||||
|
"HomePage.qml"
|
||||||
|
"ImageSearchPage.qml"
|
||||||
|
"InstalledWallpaperPage.qml"
|
||||||
|
"LiveSearchPage.qml"
|
||||||
|
"LoginPage.qml"
|
||||||
|
"SettingsPage.qml"
|
||||||
|
"UserProfilePage.qml"
|
||||||
|
"WallpaperSettingsPage.qml"
|
||||||
|
"VideoSearchPage.qml"
|
||||||
|
"FeaturedVideosPage.qml"
|
||||||
|
"FeaturedPacksPage.qml"
|
||||||
|
"FeaturedImagesPage.qml"
|
||||||
|
"NewestPacksPage.qml"
|
||||||
|
)
|
||||||
@@ -6,6 +6,8 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHubContent
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
@@ -111,7 +112,7 @@ Item
|
|||||||
color: palette.text
|
color: palette.text
|
||||||
font.pixelSize: Constants.h2Font.pixelSize
|
font.pixelSize: Constants.h2Font.pixelSize
|
||||||
font.bold: true
|
font.bold: true
|
||||||
text: qsTr("Featured Live Wallpapers")
|
text: qsTr("Featured Komplex Wallpapers")
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ Item
|
|||||||
SearchResultItem
|
SearchResultItem
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
title: parent.author
|
author: parent.author
|
||||||
description: parent.description
|
description: parent.description
|
||||||
thumbnail: parent.thumbnail
|
thumbnail: parent.thumbnail
|
||||||
uuid: parent.uuid
|
uuid: parent.uuid
|
||||||
@@ -257,8 +258,8 @@ Item
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.margins: Constants.largeMargin
|
anchors.margins: Constants.largeMargin
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
|
height: childrenRect.height
|
||||||
color: palette.window
|
color: palette.window
|
||||||
|
|
||||||
Column
|
Column
|
||||||
@@ -363,7 +364,7 @@ Item
|
|||||||
SearchResultItem
|
SearchResultItem
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
title: parent.author
|
author: parent.author
|
||||||
thumbnail: parent.thumbnail
|
thumbnail: parent.thumbnail
|
||||||
uuid: parent.uuid
|
uuid: parent.uuid
|
||||||
pexels: true
|
pexels: true
|
||||||
@@ -388,7 +389,6 @@ Item
|
|||||||
|
|
||||||
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: () =>
|
Component.onCompleted: () =>
|
||||||
@@ -422,7 +422,8 @@ Item
|
|||||||
opacity: 0
|
opacity: 0
|
||||||
visible: opacity > 0.01
|
visible: opacity > 0.01
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity
|
||||||
|
{
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -437,7 +438,8 @@ Item
|
|||||||
opacity: 0
|
opacity: 0
|
||||||
visible: opacity > 0.01
|
visible: opacity > 0.01
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity
|
||||||
|
{
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -452,7 +454,8 @@ Item
|
|||||||
opacity: 0
|
opacity: 0
|
||||||
visible: opacity > 0.01
|
visible: opacity > 0.01
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity
|
||||||
|
{
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -460,7 +463,8 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity
|
||||||
|
{
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -478,7 +482,8 @@ Item
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity
|
||||||
|
{
|
||||||
NumberAnimation
|
NumberAnimation
|
||||||
{
|
{
|
||||||
duration: 250
|
duration: 250
|
||||||
@@ -548,8 +553,10 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
states: [
|
states:
|
||||||
State {
|
[
|
||||||
|
State
|
||||||
|
{
|
||||||
name: "loading"
|
name: "loading"
|
||||||
when: homePageRoot.loading
|
when: homePageRoot.loading
|
||||||
|
|
||||||
@@ -571,7 +578,8 @@ Item
|
|||||||
opacity: 0
|
opacity: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
State {
|
State
|
||||||
|
{
|
||||||
name: "idle"
|
name: "idle"
|
||||||
when: !popup && !loading
|
when: !popup && !loading
|
||||||
|
|
||||||
@@ -606,7 +614,8 @@ Item
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
transitions: [
|
transitions:
|
||||||
|
[
|
||||||
Transition
|
Transition
|
||||||
{
|
{
|
||||||
from: "loading"
|
from: "loading"
|
||||||
@@ -692,6 +701,7 @@ Item
|
|||||||
viewMoreWallpaperPopup.authorId = packsModel.data(packsModel.index(index,0), NewestPacksModel.AuthorIdRole)
|
viewMoreWallpaperPopup.authorId = packsModel.data(packsModel.index(index,0), NewestPacksModel.AuthorIdRole)
|
||||||
viewMoreWallpaperPopup.description = packsModel.data(packsModel.index(index,0), NewestPacksModel.DescriptionRole)
|
viewMoreWallpaperPopup.description = packsModel.data(packsModel.index(index,0), NewestPacksModel.DescriptionRole)
|
||||||
viewMoreWallpaperPopup.thumbnail = packsModel.data(packsModel.index(index,0), NewestPacksModel.ThumbnailRole)
|
viewMoreWallpaperPopup.thumbnail = packsModel.data(packsModel.index(index,0), NewestPacksModel.ThumbnailRole)
|
||||||
|
viewMoreWallpaperPopup.name = packsModel.data(packsModel.index(index,0), NewestPacksModel.NameRole)
|
||||||
viewMoreWallpaperPopup.opacity = 1
|
viewMoreWallpaperPopup.opacity = 1
|
||||||
popupContainer.opacity = 1
|
popupContainer.opacity = 1
|
||||||
pageArea.opacity = 0
|
pageArea.opacity = 0
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Dialogs
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: loginFormRoot
|
id: loginFormRoot
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
readonly property bool searchable: false
|
readonly property bool searchable: false
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import KomplexHub
|
|||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Kero
|
import KomplexHub.Kero
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,9 +31,12 @@ import QtQuick.Layouts
|
|||||||
//import org.kde.plasma.core as PlasmaCore
|
//import org.kde.plasma.core as PlasmaCore
|
||||||
import QtCore
|
import QtCore
|
||||||
import Qt.labs.folderlistmodel 2.15
|
import Qt.labs.folderlistmodel 2.15
|
||||||
|
|
||||||
import KomplexHub
|
import KomplexHub
|
||||||
import KomplexHub.Controls
|
import KomplexHub.Controls
|
||||||
import KomplexHub.Plugin
|
import KomplexHub.Plugin
|
||||||
|
import KomplexHub.Views
|
||||||
|
import KomplexHub.Pages
|
||||||
|
|
||||||
//import com.github.digitalartifex.komplex 1.0 as Komplex
|
//import com.github.digitalartifex.komplex 1.0 as Komplex
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
qt_add_library(KomplexHubViews STATIC)
|
||||||
|
qt6_add_qml_module(KomplexHubViews
|
||||||
|
URI "KomplexHub.Views"
|
||||||
|
VERSION 1.0
|
||||||
|
RESOURCE_PREFIX "/qt/qml"
|
||||||
|
QML_FILES
|
||||||
|
"CompletedView.qml"
|
||||||
|
"DownloadView.qml"
|
||||||
|
"ErrorView.qml"
|
||||||
|
"ImageView.qml"
|
||||||
|
"PackView.qml"
|
||||||
|
"VideoView.qml"
|
||||||
|
)
|
||||||
@@ -0,0 +1,307 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
import KomplexHub
|
||||||
|
import KomplexHub.Controls
|
||||||
|
import KomplexHub.Kero
|
||||||
|
import KomplexHub.Plugin
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
property string uuid
|
||||||
|
property string author
|
||||||
|
property string authorId
|
||||||
|
property string description
|
||||||
|
property string thumbnail
|
||||||
|
property string name
|
||||||
|
|
||||||
|
property int imageHeight
|
||||||
|
property int imageWidth
|
||||||
|
|
||||||
|
id: rootItem
|
||||||
|
|
||||||
|
DownloadManager
|
||||||
|
{
|
||||||
|
id: downloadManager
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: pageView
|
||||||
|
anchors.fill: parent
|
||||||
|
color: palette.base
|
||||||
|
|
||||||
|
BackgroundImage
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
source: rootItem.thumbnail
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Constants.largeMargin
|
||||||
|
spacing: Constants.largeMargin
|
||||||
|
|
||||||
|
ImageFrame
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop| Qt.AlignHCenter
|
||||||
|
Layout.topMargin: Constants.largeMargin
|
||||||
|
Layout.preferredHeight: width / 1.77777777778
|
||||||
|
Layout.maximumWidth: 800
|
||||||
|
|
||||||
|
source: rootItem.thumbnail
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: titleText
|
||||||
|
text: rootItem.name
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
id: authorText
|
||||||
|
text: qsTr("By: ") + rootItem.author
|
||||||
|
color: palette.text
|
||||||
|
font.pointSize: Constants.h5Font.pixelSize
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
|
horizontalAlignment: Qt.AlignRight
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignTop | Qt.AlignRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Spacer **/
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 32
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
Item { Layout.fillWidth: true }
|
||||||
|
|
||||||
|
SquareButton
|
||||||
|
{
|
||||||
|
Layout.preferredHeight: 36
|
||||||
|
Layout.preferredWidth: 128
|
||||||
|
text: qsTr("Download")
|
||||||
|
icon.source: "qrc:/images/icons/icons8-download.svg"
|
||||||
|
|
||||||
|
onTriggered: () => rootItem.download()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Spacer **/
|
||||||
|
Item { Layout.fillWidth: true; Layout.fillHeight: true }
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignBottom
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: qsTr("Shaders Provided Courtesy of ShaderToy, Komplex and Their Respective Authors")
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
states:
|
||||||
|
[
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "downloading"
|
||||||
|
when: downloadManager.state === DownloadManager.Downloading
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "complete"
|
||||||
|
when: downloadManager.state === DownloadManager.Complete
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "error"
|
||||||
|
when: downloadManager.state === DownloadManager.Error
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "idle"
|
||||||
|
when: downloadManager.state === DownloadManager.Idle
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
DownloadView
|
||||||
|
{
|
||||||
|
id: downloadView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
manager: downloadManager
|
||||||
|
thumbnail: rootItem.thumbnail
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
}
|
||||||
|
|
||||||
|
CompletedView
|
||||||
|
{
|
||||||
|
id: completedView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
manager: downloadManager
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorView
|
||||||
|
{
|
||||||
|
id: errorView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
manager: downloadManager
|
||||||
|
}
|
||||||
|
|
||||||
|
function download()
|
||||||
|
{
|
||||||
|
downloadManager.downloadPack(uuid)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,17 +21,10 @@ Item
|
|||||||
property int imageWidth
|
property int imageWidth
|
||||||
|
|
||||||
visible: opacity > 0.01
|
visible: opacity > 0.01
|
||||||
onVisibleChanged: () =>
|
|
||||||
{
|
|
||||||
if(!visible)
|
|
||||||
{
|
|
||||||
model = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: model
|
target: model ? model : null
|
||||||
|
|
||||||
function onRowCountChanged()
|
function onRowCountChanged()
|
||||||
{
|
{
|
||||||
@@ -39,10 +32,16 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DownloadManager
|
||||||
|
{
|
||||||
|
id: downloadManager
|
||||||
|
}
|
||||||
|
|
||||||
id: rootItem
|
id: rootItem
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
|
id: pageView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: palette.base
|
color: palette.base
|
||||||
|
|
||||||
@@ -119,6 +118,8 @@ Item
|
|||||||
Layout.preferredWidth: 128
|
Layout.preferredWidth: 128
|
||||||
text: qsTr("Download")
|
text: qsTr("Download")
|
||||||
icon.source: "qrc:/images/icons/icons8-download.svg"
|
icon.source: "qrc:/images/icons/icons8-download.svg"
|
||||||
|
|
||||||
|
onTriggered: () => rootItem.download()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,5 +153,161 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
states:
|
||||||
|
[
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "downloading"
|
||||||
|
when: downloadManager.state === DownloadManager.Downloading
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "complete"
|
||||||
|
when: downloadManager.state === DownloadManager.Complete
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "error"
|
||||||
|
when: downloadManager.state === DownloadManager.Error
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State
|
||||||
|
{
|
||||||
|
name: "idle"
|
||||||
|
when: downloadManager.state === DownloadManager.Idle
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: pageView
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: downloadView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: completedView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyChanges
|
||||||
|
{
|
||||||
|
target: errorView
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
DownloadView
|
||||||
|
{
|
||||||
|
id: downloadView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
manager: downloadManager
|
||||||
|
thumbnail: rootItem.thumbnail
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
}
|
||||||
|
|
||||||
|
CompletedView
|
||||||
|
{
|
||||||
|
id: completedView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
manager: downloadManager
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorView
|
||||||
|
{
|
||||||
|
id: errorView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
visible: opacity > 0.01
|
||||||
|
manager: downloadManager
|
||||||
|
}
|
||||||
|
|
||||||
|
function download()
|
||||||
|
{
|
||||||
|
downloadManager.downloadImage(author, authorUrl, downloadSelector.currentValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,18 +14,11 @@ qt6_add_qml_module(KomplexHubModule_Controls
|
|||||||
"Throbber.qml"
|
"Throbber.qml"
|
||||||
"SearchResultItem.qml"
|
"SearchResultItem.qml"
|
||||||
"SearchResultList.qml"
|
"SearchResultList.qml"
|
||||||
QML_FILES PaginationBox.qml
|
"PaginationBox.qml"
|
||||||
QML_FILES PaginatorGrid.qml
|
"PaginatorGrid.qml"
|
||||||
QML_FILES HorizontalPaginator.qml
|
"HorizontalPaginator.qml"
|
||||||
QML_FILES ImageView.qml
|
"VerticalSpacer.qml"
|
||||||
QML_FILES
|
"ImageFrame.qml"
|
||||||
QML_FILES VideoView.qml
|
"BackgroundImage.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
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,130 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Effects
|
|
||||||
|
|
||||||
import KomplexHub
|
|
||||||
import KomplexHub.Controls
|
|
||||||
import KomplexHub.Kero
|
|
||||||
import KomplexHub.Plugin
|
|
||||||
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
property string uuid
|
|
||||||
property string author
|
|
||||||
property string authorId
|
|
||||||
property string description
|
|
||||||
property string thumbnail
|
|
||||||
|
|
||||||
property int imageHeight
|
|
||||||
property int imageWidth
|
|
||||||
|
|
||||||
id: rootItem
|
|
||||||
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
color: palette.base
|
|
||||||
|
|
||||||
BackgroundImage
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
source: rootItem.thumbnail
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Constants.largeMargin
|
|
||||||
spacing: Constants.largeMargin
|
|
||||||
|
|
||||||
ImageFrame
|
|
||||||
{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignTop| Qt.AlignHCenter
|
|
||||||
Layout.topMargin: Constants.largeMargin
|
|
||||||
Layout.preferredHeight: width / 1.77777777778
|
|
||||||
Layout.maximumWidth: 800
|
|
||||||
|
|
||||||
source: rootItem.thumbnail
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout
|
|
||||||
{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
|
|
||||||
SquareButton
|
|
||||||
{
|
|
||||||
Layout.preferredHeight: 36
|
|
||||||
Layout.preferredWidth: 128
|
|
||||||
text: qsTr("Download")
|
|
||||||
icon.source: "qrc:/images/icons/icons8-download.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Spacer **/
|
|
||||||
Item { Layout.fillWidth: true; Layout.fillHeight: true }
|
|
||||||
|
|
||||||
RowLayout
|
|
||||||
{
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignBottom
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: qsTr("Shaders Provided Courtesy of ShaderToy and Their Respective Authors")
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -74,7 +74,7 @@ Item {
|
|||||||
|
|
||||||
width: 24
|
width: 24
|
||||||
height: 24
|
height: 24
|
||||||
transform: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
source: "qrc:/images/icons/pexels-icon-filled-256.svg"
|
source: "qrc:/images/icons/pexels-icon-filled-256.svg"
|
||||||
|
|
||||||
@@ -82,49 +82,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
Text
|
||||||
{
|
{
|
||||||
color: palette.text
|
color: palette.text
|
||||||
@@ -140,18 +97,6 @@ Item {
|
|||||||
|
|
||||||
Item { Layout.fillHeight: true }
|
Item { Layout.fillHeight: true }
|
||||||
|
|
||||||
Text
|
|
||||||
{
|
|
||||||
color: palette.text
|
|
||||||
font.pixelSize: 12
|
|
||||||
text: "By: " + rootItem.author
|
|
||||||
leftPadding: 12
|
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
|
||||||
Layout.preferredWidth: 250
|
|
||||||
visible: !rootItem.pexels
|
|
||||||
}
|
|
||||||
|
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
id: descriptionText
|
id: descriptionText
|
||||||
@@ -171,6 +116,19 @@ Item {
|
|||||||
Layout.bottomMargin: 3
|
Layout.bottomMargin: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text
|
||||||
|
{
|
||||||
|
color: palette.text
|
||||||
|
font.pixelSize: 12
|
||||||
|
text: "By: " + rootItem.author
|
||||||
|
leftPadding: Constants.mediumMargin
|
||||||
|
rightPadding: Constants.mediumMargin
|
||||||
|
horizontalAlignment: Qt.AlignRight
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
SquareButton
|
SquareButton
|
||||||
{
|
{
|
||||||
id: viewMoreButton
|
id: viewMoreButton
|
||||||
|
|||||||
@@ -79,10 +79,6 @@ DownloadManager::DownloadManager(QObject *parent)
|
|||||||
*/
|
*/
|
||||||
auto DownloadManager::downloadImage(const QString &author, const QString &authorId, const QString &description, const QUrl &url) -> void
|
auto DownloadManager::downloadImage(const QString &author, const QString &authorId, const QString &description, const QUrl &url) -> void
|
||||||
{
|
{
|
||||||
// QFuture future = QtConcurrent::run
|
|
||||||
// (
|
|
||||||
// [this, url, author, authorId, description]()
|
|
||||||
// {
|
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
QString requestUrl = request.url().toString();
|
QString requestUrl = request.url().toString();
|
||||||
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
|
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
|
||||||
@@ -213,33 +209,32 @@ auto DownloadManager::downloadImage(const QString &author, const QString &author
|
|||||||
setError(QStringLiteral("Unknown Exception"), QString());
|
setError(QStringLiteral("Unknown Exception"), QString());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// downloadUri.waitForFinished();
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto DownloadManager::downloadVideo(const QString &author, const QString &authorId, const QString &description, const QUrl &url) -> void
|
auto DownloadManager::downloadVideo(const QString &author, const QString &authorId, const QUrl &url) -> void
|
||||||
{
|
|
||||||
QFuture future = QtConcurrent::run
|
|
||||||
(
|
|
||||||
[this, url, author, authorId, description]()
|
|
||||||
{
|
{
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
|
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
|
||||||
|
|
||||||
QFuture<QUrl> downloadUri = download(request, id);
|
setState(Downloading);
|
||||||
|
|
||||||
downloadUri
|
if(m_downloadFuture.isRunning())
|
||||||
|
{
|
||||||
|
m_downloadFuture.cancelChain();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_downloadFuture = download(request, id, Get);
|
||||||
|
|
||||||
|
m_downloadFuture
|
||||||
.then
|
.then
|
||||||
(
|
(
|
||||||
[this, author, description, id](QUrl result) -> QUrl
|
[this, author, id](QUrl result) -> QUrl
|
||||||
{
|
{
|
||||||
ShaderPack metadata;
|
ShaderPack metadata;
|
||||||
metadata.setAuthor(author);
|
metadata.setAuthor(author);
|
||||||
metadata.setDescription(description);
|
|
||||||
metadata.setName(QStringLiteral("Pexels Video (%1)").arg(id));
|
|
||||||
metadata.setType(ShaderPack::Video);
|
metadata.setType(ShaderPack::Video);
|
||||||
|
metadata.setName(QStringLiteral("Pexels Video (%1)").arg(id));
|
||||||
|
metadata.setSource(QStringLiteral("./videos/%1").arg(result.fileName()));
|
||||||
|
|
||||||
QUrl packUri
|
QUrl packUri
|
||||||
(
|
(
|
||||||
@@ -250,9 +245,9 @@ auto DownloadManager::downloadVideo(const QString &author, const QString &author
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
QUrl packImageUri
|
QUrl packVideoUri
|
||||||
(
|
(
|
||||||
QStringLiteral("%1/%2/images/%3").arg
|
QStringLiteral("%1/%2/videos/%3").arg
|
||||||
(
|
(
|
||||||
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
|
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
|
||||||
id,
|
id,
|
||||||
@@ -264,7 +259,7 @@ auto DownloadManager::downloadVideo(const QString &author, const QString &author
|
|||||||
packDirectory.mkpath(packUri.toLocalFile());
|
packDirectory.mkpath(packUri.toLocalFile());
|
||||||
packDirectory.mkdir(QStringLiteral("images"));
|
packDirectory.mkdir(QStringLiteral("images"));
|
||||||
|
|
||||||
QFile::rename(result.toLocalFile(), packImageUri.toLocalFile());
|
QFile::rename(result.toLocalFile(), packVideoUri.toLocalFile());
|
||||||
|
|
||||||
QFile packFile
|
QFile packFile
|
||||||
(
|
(
|
||||||
@@ -294,10 +289,18 @@ auto DownloadManager::downloadVideo(const QString &author, const QString &author
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then
|
.then
|
||||||
|
(
|
||||||
|
[this](QUrl result) -> QUrl
|
||||||
|
{
|
||||||
|
return install(result);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then
|
||||||
(
|
(
|
||||||
[this](QUrl result)
|
[this](QUrl result)
|
||||||
{
|
{
|
||||||
install(result);
|
setLastInstalledFile(result.toLocalFile());
|
||||||
|
setState(Complete);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.onCanceled
|
.onCanceled
|
||||||
@@ -308,21 +311,32 @@ auto DownloadManager::downloadVideo(const QString &author, const QString &author
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.onFailed
|
.onFailed
|
||||||
|
(
|
||||||
|
[this] (const NetworkException &e)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
setError(QStringLiteral("Network Exception %1").arg(QString::number(e.errorCode)), e.message);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.onFailed
|
||||||
|
(
|
||||||
|
[this] (const FileException &e)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
setError(QStringLiteral("File Exception %1").arg(QString::number(e.errorCode)), e.message);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.onFailed
|
||||||
(
|
(
|
||||||
[this] ()
|
[this] ()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
setError(QStringLiteral("Unknown Exception"), QString());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto DownloadManager::downloadPack(const QString &id) -> void
|
auto DownloadManager::downloadPack(const QString &id) -> void
|
||||||
{
|
|
||||||
QFuture aether = QtConcurrent::run
|
|
||||||
(
|
|
||||||
[this, id]()
|
|
||||||
{
|
{
|
||||||
QUrl downloadUrl = QUrl
|
QUrl downloadUrl = QUrl
|
||||||
(
|
(
|
||||||
@@ -358,24 +372,39 @@ auto DownloadManager::downloadPack(const QString &id) -> void
|
|||||||
(
|
(
|
||||||
[this](QUrl result)
|
[this](QUrl result)
|
||||||
{
|
{
|
||||||
|
setLastInstalledFile(result.toLocalFile());
|
||||||
setState(Complete);
|
setState(Complete);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.onFailed
|
|
||||||
(
|
|
||||||
[this]()
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
setError(m_compiler->errorTitle(), m_compiler->errorMessage());
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.onCanceled
|
.onCanceled
|
||||||
(
|
(
|
||||||
[this]()
|
[this]()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
.onFailed
|
||||||
|
(
|
||||||
|
[this] (const NetworkException &e)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
setError(QStringLiteral("Network Exception %1").arg(QString::number(e.errorCode)), e.message);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.onFailed
|
||||||
|
(
|
||||||
|
[this] (const FileException &e)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
setError(QStringLiteral("File Exception %1").arg(QString::number(e.errorCode)), e.message);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.onFailed
|
||||||
|
(
|
||||||
|
[this] ()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
setError(QStringLiteral("Unknown Exception"), QString());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ public:
|
|||||||
(
|
(
|
||||||
const QString &author,
|
const QString &author,
|
||||||
const QString &authorId,
|
const QString &authorId,
|
||||||
const QString &description,
|
|
||||||
const QUrl &url
|
const QUrl &url
|
||||||
) -> void;
|
) -> void;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user