Moving views to content instad of controls

This commit is contained in:
Digital Artifex
2026-08-18 18:21:45 -04:00
parent 45f293a349
commit ac65bbb3ab
21 changed files with 444 additions and 375 deletions
+14 -4
View File
@@ -18,10 +18,20 @@ qt6_add_qml_module(KomplexHubContent
"pages/UserProfilePage.qml"
"pages/WallpaperSettingsPage.qml"
"pages/VideoSearchPage.qml"
QML_FILES pages/FeaturedVideosPage.qml
QML_FILES pages/FeaturedPacksPage.qml
QML_FILES pages/FeaturedImagesPage.qml
QML_FILES pages/NewestPacksPage.qml
"pages/FeaturedVideosPage.qml"
"pages/FeaturedPacksPage.qml"
"pages/FeaturedImagesPage.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)
+7 -7
View File
@@ -81,7 +81,7 @@ Rectangle {
height: 64
width: 100
text: "Home"
text: qsTr("Home")
icon.height: 32
icon.width: 32
@@ -109,7 +109,7 @@ Rectangle {
height: 64
width: 100
text: "Images"
text: qsTr("Images")
icon.height: 32
icon.width: 32
@@ -132,7 +132,7 @@ Rectangle {
height: 64
width: 100
text: "Videos"
text: qsTr("Videos")
icon.height: 32
icon.width: 32
@@ -155,7 +155,7 @@ Rectangle {
height: 64
width: 100
text: "Live"
text: qsTr("Komplex")
icon.height: 32
icon.width: 32
@@ -178,7 +178,7 @@ Rectangle {
height: 64
width: 100
text: "Installed"
text: qsTr("Installed")
icon.height: 32
icon.width: 32
@@ -207,7 +207,7 @@ Rectangle {
height: 64
width: 100
text: "Settings"
text: qsTr("Settings")
icon.height: 32
icon.width: 32
@@ -369,7 +369,7 @@ Rectangle {
function isSearchPage()
{
return (
return(
pageLoader.item instanceof ImageSearchPage ||
pageLoader.item instanceof LiveSearchPage ||
pageLoader.item instanceof VideoSearchPage
+20
View File
@@ -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.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Rectangle
{
@@ -6,6 +6,8 @@ import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Rectangle
{
@@ -6,6 +6,8 @@ import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Rectangle
{
+26 -16
View File
@@ -7,6 +7,7 @@ import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHubContent
Item
{
@@ -111,7 +112,7 @@ Item
color: palette.text
font.pixelSize: Constants.h2Font.pixelSize
font.bold: true
text: qsTr("Featured Live Wallpapers")
text: qsTr("Featured Komplex Wallpapers")
verticalAlignment: Qt.AlignVCenter
}
@@ -198,7 +199,7 @@ Item
SearchResultItem
{
anchors.fill: parent
title: parent.author
author: parent.author
description: parent.description
thumbnail: parent.thumbnail
uuid: parent.uuid
@@ -220,13 +221,13 @@ Item
}
}
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
VerticalSpacer { height: Constants.largeMargin; width: Constants.largeMargin }
}
}
}
}
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
VerticalSpacer { height: Constants.largeMargin; width: Constants.largeMargin }
Rectangle
{
@@ -257,8 +258,8 @@ Item
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Constants.largeMargin
height: childrenRect.height
height: childrenRect.height
color: palette.window
Column
@@ -363,7 +364,7 @@ Item
SearchResultItem
{
anchors.fill: parent
title: parent.author
author: parent.author
thumbnail: parent.thumbnail
uuid: parent.uuid
pexels: true
@@ -388,7 +389,6 @@ Item
VerticalSpacer{ height: Constants.largeMargin; width: Constants.largeMargin }
}
}
Component.onCompleted: () =>
@@ -422,7 +422,8 @@ Item
opacity: 0
visible: opacity > 0.01
Behavior on opacity {
Behavior on opacity
{
NumberAnimation
{
duration: 250
@@ -437,7 +438,8 @@ Item
opacity: 0
visible: opacity > 0.01
Behavior on opacity {
Behavior on opacity
{
NumberAnimation
{
duration: 250
@@ -452,7 +454,8 @@ Item
opacity: 0
visible: opacity > 0.01
Behavior on opacity {
Behavior on opacity
{
NumberAnimation
{
duration: 250
@@ -460,7 +463,8 @@ Item
}
}
Behavior on opacity {
Behavior on opacity
{
NumberAnimation
{
duration: 250
@@ -478,7 +482,8 @@ Item
anchors.fill: parent
opacity: 0
Behavior on opacity {
Behavior on opacity
{
NumberAnimation
{
duration: 250
@@ -548,8 +553,10 @@ Item
}
}
states: [
State {
states:
[
State
{
name: "loading"
when: homePageRoot.loading
@@ -571,7 +578,8 @@ Item
opacity: 0
}
},
State {
State
{
name: "idle"
when: !popup && !loading
@@ -606,7 +614,8 @@ Item
}
]
transitions: [
transitions:
[
Transition
{
from: "loading"
@@ -692,6 +701,7 @@ Item
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.name = packsModel.data(packsModel.index(index,0), NewestPacksModel.NameRole)
viewMoreWallpaperPopup.opacity = 1
popupContainer.opacity = 1
pageArea.opacity = 0
@@ -6,6 +6,8 @@ import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Item
{
@@ -2,10 +2,13 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Rectangle {
id: root
@@ -1,9 +1,12 @@
import QtQuick
import QtQuick.Controls
import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Item
{
+5
View File
@@ -1,8 +1,13 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Item {
id: loginFormRoot
@@ -6,6 +6,8 @@ import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Rectangle
{
+5
View File
@@ -1,8 +1,13 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Item {
readonly property bool searchable: false
@@ -1,7 +1,13 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Item {
id: root
@@ -6,6 +6,8 @@ import KomplexHub
import KomplexHub.Controls
import KomplexHub.Kero
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
Item
{
@@ -31,9 +31,12 @@ import QtQuick.Layouts
//import org.kde.plasma.core as PlasmaCore
import QtCore
import Qt.labs.folderlistmodel 2.15
import KomplexHub
import KomplexHub.Controls
import KomplexHub.Plugin
import KomplexHub.Views
import KomplexHub.Pages
//import com.github.digitalartifex.komplex 1.0 as Komplex
+13
View File
@@ -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"
)
+6 -13
View File
@@ -14,18 +14,11 @@ qt6_add_qml_module(KomplexHubModule_Controls
"Throbber.qml"
"SearchResultItem.qml"
"SearchResultList.qml"
QML_FILES PaginationBox.qml
QML_FILES PaginatorGrid.qml
QML_FILES HorizontalPaginator.qml
QML_FILES ImageView.qml
QML_FILES
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
"PaginationBox.qml"
"PaginatorGrid.qml"
"HorizontalPaginator.qml"
"VerticalSpacer.qml"
"ImageFrame.qml"
"BackgroundImage.qml"
)
+14 -56
View File
@@ -74,7 +74,7 @@ Item {
width: 24
height: 24
transform: Image.PreserveAspectFit
fillMode: Image.PreserveAspectFit
opacity: 0.5
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
{
color: palette.text
@@ -140,18 +97,6 @@ Item {
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
{
id: descriptionText
@@ -171,6 +116,19 @@ Item {
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
{
id: viewMoreButton
+307 -278
View File
@@ -79,305 +79,334 @@ DownloadManager::DownloadManager(QObject *parent)
*/
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);
QString requestUrl = request.url().toString();
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
QNetworkRequest request(url);
QString requestUrl = request.url().toString();
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
setState(Downloading);
setState(Downloading);
//QFuture<QUrl> downloadUri = download(request, id, Get);
if(m_downloadFuture.isRunning())
//QFuture<QUrl> downloadUri = download(request, id, Get);
if(m_downloadFuture.isRunning())
{
m_downloadFuture.cancelChain();
}
m_downloadFuture = download(request, id, Get);
m_downloadFuture
.then
(
[this, author, description, id](QUrl result) -> QUrl
{
m_downloadFuture.cancelChain();
}
setState(Installing);
m_downloadFuture = download(request, id, Get);
ShaderPack metadata;
metadata.setAuthor(author);
metadata.setDescription(description);
metadata.setName(QStringLiteral("Pexels Image (%1)").arg(id));
metadata.setSource(QStringLiteral("./images/%1").arg(result.fileName()));
m_downloadFuture
.then
QUrl packUri
(
[this, author, description, id](QUrl result) -> QUrl
{
setState(Installing);
ShaderPack metadata;
metadata.setAuthor(author);
metadata.setDescription(description);
metadata.setName(QStringLiteral("Pexels Image (%1)").arg(id));
metadata.setSource(QStringLiteral("./images/%1").arg(result.fileName()));
QUrl packUri
(
QStringLiteral("file://%1/%2").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id
)
);
QUrl packImageUri
(
QStringLiteral("file://%1/%2/images/%3").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id,
result.fileName()
)
);
QDir packDirectory(packUri.toLocalFile());
if(!packDirectory.mkpath(packUri.toLocalFile()))
{
throw FileException(QStringLiteral("Could not create directory"));
}
packDirectory.mkdir(QStringLiteral("images"));
QFile::rename(result.toLocalFile(), packImageUri.toLocalFile());
QFile packFile
(
packDirectory.absoluteFilePath
(
QStringLiteral("pack.json")
)
);
if(!packFile.open(QFile::ReadWrite))
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
QByteArray data = metadata.json().toJson(QJsonDocument::Indented);
if(packFile.write(data) != data.length())
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
packFile.close();
return packUri;
}
)
.then
(
[this](QUrl result) -> QUrl
{
return install(result);
}
)
.then
(
[this](QUrl result)
{
setLastInstalledFile(result.toLocalFile());
setState(Complete);
}
)
.onCanceled
(
[this]()
{
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());
}
QStringLiteral("file://%1/%2").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id
)
);
// downloadUri.waitForFinished();
// }
// );
QUrl packImageUri
(
QStringLiteral("file://%1/%2/images/%3").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id,
result.fileName()
)
);
QDir packDirectory(packUri.toLocalFile());
if(!packDirectory.mkpath(packUri.toLocalFile()))
{
throw FileException(QStringLiteral("Could not create directory"));
}
packDirectory.mkdir(QStringLiteral("images"));
QFile::rename(result.toLocalFile(), packImageUri.toLocalFile());
QFile packFile
(
packDirectory.absoluteFilePath
(
QStringLiteral("pack.json")
)
);
if(!packFile.open(QFile::ReadWrite))
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
QByteArray data = metadata.json().toJson(QJsonDocument::Indented);
if(packFile.write(data) != data.length())
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
packFile.close();
return packUri;
}
)
.then
(
[this](QUrl result) -> QUrl
{
return install(result);
}
)
.then
(
[this](QUrl result)
{
setLastInstalledFile(result.toLocalFile());
setState(Complete);
}
)
.onCanceled
(
[this]()
{
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());
}
);
}
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);
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
QNetworkRequest request(url);
QString id = QUuid::createUuidV7().toString(QUuid::WithoutBraces);
QFuture<QUrl> downloadUri = download(request, id);
setState(Downloading);
downloadUri
.then
if(m_downloadFuture.isRunning())
{
m_downloadFuture.cancelChain();
}
m_downloadFuture = download(request, id, Get);
m_downloadFuture
.then
(
[this, author, id](QUrl result) -> QUrl
{
ShaderPack metadata;
metadata.setAuthor(author);
metadata.setType(ShaderPack::Video);
metadata.setName(QStringLiteral("Pexels Video (%1)").arg(id));
metadata.setSource(QStringLiteral("./videos/%1").arg(result.fileName()));
QUrl packUri
(
[this, author, description, id](QUrl result) -> QUrl
{
ShaderPack metadata;
metadata.setAuthor(author);
metadata.setDescription(description);
metadata.setName(QStringLiteral("Pexels Video (%1)").arg(id));
metadata.setType(ShaderPack::Video);
QUrl packUri
(
QStringLiteral("%1/%2").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id
)
);
QUrl packImageUri
(
QStringLiteral("%1/%2/images/%3").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id,
result.fileName()
)
);
QDir packDirectory(packUri.toLocalFile());
packDirectory.mkpath(packUri.toLocalFile());
packDirectory.mkdir(QStringLiteral("images"));
QFile::rename(result.toLocalFile(), packImageUri.toLocalFile());
QFile packFile
(
packDirectory.absoluteFilePath
(
QStringLiteral("pack.json")
)
);
if(!packFile.open(QFile::ReadWrite))
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
QByteArray data = metadata.json().toJson(QJsonDocument::Compact);
if(packFile.write(data) != data.length())
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
packFile.close();
return packUri;
}
)
.then
(
[this](QUrl result)
{
install(result);
}
)
.onCanceled
(
[this]()
{
reset();
}
)
.onFailed
(
[this] ()
{
reset();
}
QStringLiteral("%1/%2").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id
)
);
}
);
QUrl packVideoUri
(
QStringLiteral("%1/%2/videos/%3").arg
(
QStandardPaths::writableLocation(QStandardPaths::TempLocation),
id,
result.fileName()
)
);
QDir packDirectory(packUri.toLocalFile());
packDirectory.mkpath(packUri.toLocalFile());
packDirectory.mkdir(QStringLiteral("images"));
QFile::rename(result.toLocalFile(), packVideoUri.toLocalFile());
QFile packFile
(
packDirectory.absoluteFilePath
(
QStringLiteral("pack.json")
)
);
if(!packFile.open(QFile::ReadWrite))
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
QByteArray data = metadata.json().toJson(QJsonDocument::Compact);
if(packFile.write(data) != data.length())
{
setError(QStringLiteral("File Error"), packFile.errorString());
throw FileException(packFile.errorString());
}
packFile.close();
return packUri;
}
)
.then
(
[this](QUrl result) -> QUrl
{
return install(result);
}
)
.then
(
[this](QUrl result)
{
setLastInstalledFile(result.toLocalFile());
setState(Complete);
}
)
.onCanceled
(
[this]()
{
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());
}
);
}
auto DownloadManager::downloadPack(const QString &id) -> void
{
QFuture aether = QtConcurrent::run
QUrl downloadUrl = QUrl
(
[this, id]()
{
QUrl downloadUrl = QUrl
(
QStringLiteral("%1/%2/%3").arg
(
KOMPLEX_API_HOST,
KOMPLEX_API_VERSION,
KOMPLEX_ENDPOINT_PACKS_ITEM
)
);
QNetworkRequest request(downloadUrl);
request.setRawHeader(QByteArray("uuid"), id.toUtf8());
QFuture<QUrl> downloadUri = download(request, id, Post);
downloadUri
.then
(
[this](QUrl result) -> QUrl
{
return m_compiler->process(result).result();
}
)
.then
(
[this](QUrl result) -> QUrl
{
return install(result);
}
)
.then
(
[this] (QUrl result)
{
setState(Complete);
}
)
.onFailed
(
[this]()
{
reset();
setError(m_compiler->errorTitle(), m_compiler->errorMessage());
}
)
.onCanceled
(
[this]()
{
reset();
}
);
}
QStringLiteral("%1/%2/%3").arg
(
KOMPLEX_API_HOST,
KOMPLEX_API_VERSION,
KOMPLEX_ENDPOINT_PACKS_ITEM
)
);
QNetworkRequest request(downloadUrl);
request.setRawHeader(QByteArray("uuid"), id.toUtf8());
QFuture<QUrl> downloadUri = download(request, id, Post);
downloadUri
.then
(
[this](QUrl result) -> QUrl
{
return m_compiler->process(result).result();
}
)
.then
(
[this](QUrl result) -> QUrl
{
return install(result);
}
)
.then
(
[this](QUrl result)
{
setLastInstalledFile(result.toLocalFile());
setState(Complete);
}
)
.onCanceled
(
[this]()
{
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());
}
);
}
auto DownloadManager::reset() -> void
-1
View File
@@ -89,7 +89,6 @@ public:
(
const QString &author,
const QString &authorId,
const QString &description,
const QUrl &url
) -> void;