From cbe26ce4cd4e0b72672094c3a8102199c8b5f868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 29 Sep 2023 19:30:22 +0800 Subject: [PATCH] update --- .cmake/InstallerScript.iss.in | 4 ++-- example/qml-Qt6/page/T_Http.qml | 2 +- example/qml-Qt6/page/T_Screenshot.qml | 3 ++- example/qml/page/T_Http.qml | 2 +- example/qml/page/T_Screenshot.qml | 3 ++- example/src/helper/SettingsHelper.cpp | 3 ++- example/src/main.cpp | 2 +- src/FluHttp.cpp | 9 +++++---- src/Qt5/imports/FluentUI/Controls/FluScreenshot.qml | 2 +- src/Qt6/imports/FluentUI/Controls/FluScreenshot.qml | 2 +- 10 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.cmake/InstallerScript.iss.in b/.cmake/InstallerScript.iss.in index 77de24d7..7c372722 100644 --- a/.cmake/InstallerScript.iss.in +++ b/.cmake/InstallerScript.iss.in @@ -25,8 +25,8 @@ DisableProgramGroupPage=yes ;PrivilegesRequired=lowest OutputDir=.\ OutputBaseFilename=installer -Compression=lzma -SolidCompression=yes +Compression=zip +SolidCompression=no WizardStyle=modern [Languages] diff --git a/example/qml-Qt6/page/T_Http.qml b/example/qml-Qt6/page/T_Http.qml index 6e7b2b1c..0bf7fdd6 100644 --- a/example/qml-Qt6/page/T_Http.qml +++ b/example/qml-Qt6/page/T_Http.qml @@ -10,7 +10,7 @@ import "qrc:///example/qml/component" FluContentPage{ title:"Http" - property string cacheDirPath: FluTools.getApplicationDirPath() + "/cache/http" + property string cacheDirPath: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation) + "/cache/http" property bool isDownCompleted: false FluHttp{ diff --git a/example/qml-Qt6/page/T_Screenshot.qml b/example/qml-Qt6/page/T_Screenshot.qml index eb3808c6..2a1571a2 100644 --- a/example/qml-Qt6/page/T_Screenshot.qml +++ b/example/qml-Qt6/page/T_Screenshot.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts import QtQuick.Window import QtQuick.Controls import FluentUI +import Qt.labs.platform import "qrc:///example/qml/component" FluScrollablePage{ @@ -47,7 +48,7 @@ FluScrollablePage{ FluScreenshot{ id:screenshot captrueMode: FluScreenshotType.File - saveFolder: FluTools.getApplicationDirPath()+"/screenshot" + saveFolder: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation)+"/screenshot" onCaptrueCompleted: (captrue)=>{ image.source = captrue diff --git a/example/qml/page/T_Http.qml b/example/qml/page/T_Http.qml index c2b0fc00..8363a000 100644 --- a/example/qml/page/T_Http.qml +++ b/example/qml/page/T_Http.qml @@ -11,7 +11,7 @@ import "../component" FluContentPage{ title:"Http" - property string cacheDirPath: FluTools.getApplicationDirPath() + "/cache/http" + property string cacheDirPath: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation) + "/cache/http" property bool isDownCompleted: false FluHttp{ diff --git a/example/qml/page/T_Screenshot.qml b/example/qml/page/T_Screenshot.qml index 3b4cd1dc..30761236 100644 --- a/example/qml/page/T_Screenshot.qml +++ b/example/qml/page/T_Screenshot.qml @@ -3,6 +3,7 @@ import QtQuick.Layouts 1.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import FluentUI 1.0 +import Qt.labs.platform 1.0 import "qrc:///example/qml/component" import "../component" @@ -48,7 +49,7 @@ FluScrollablePage{ FluScreenshot{ id:screenshot captrueMode: FluScreenshotType.File - saveFolder: FluTools.getApplicationDirPath()+"/screenshot" + saveFolder: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation)+"/screenshot" onCaptrueCompleted: (captrue)=>{ image.source = captrue diff --git a/example/src/helper/SettingsHelper.cpp b/example/src/helper/SettingsHelper.cpp index a245d645..0604d018 100644 --- a/example/src/helper/SettingsHelper.cpp +++ b/example/src/helper/SettingsHelper.cpp @@ -1,6 +1,7 @@ #include "SettingsHelper.h" #include +#include SettingsHelper::SettingsHelper(QObject *parent) : QObject(parent) { @@ -34,7 +35,7 @@ void SettingsHelper::init(char *argv[]){ auto applicationPath = QString::fromStdString(argv[0]); const QFileInfo fileInfo(applicationPath); const QString iniFileName = fileInfo.completeBaseName() + ".ini"; - const QString iniFilePath = fileInfo.dir().path() + "/" + iniFileName; + const QString iniFilePath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/" + iniFileName; qDebug()<<"Application configuration file path->"<init(argv); #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); @@ -40,6 +39,7 @@ int main(int argc, char *argv[]) QGuiApplication::setOrganizationName("ZhuZiChu"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setApplicationName("FluentUI"); + SettingsHelper::getInstance()->init(argv); if(SettingsHelper::getInstance()->getReander()=="software"){ #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QQuickWindow::setGraphicsApi(QSGRendererInterface::Software); diff --git a/src/FluHttp.cpp b/src/FluHttp.cpp index a159388e..c9ea4f28 100644 --- a/src/FluHttp.cpp +++ b/src/FluHttp.cpp @@ -527,11 +527,12 @@ bool FluHttp::cacheExists(const QString& httpId){ } QString FluHttp::getCacheFilePath(const QString& httpId){ - QDir dir = _cacheDir; - if (!dir.exists(_cacheDir)){ - dir.mkpath(_cacheDir); + QString path = FluTools::getInstance()->toLocalPath(QUrl(_cacheDir)); + QDir dir = path; + if (!dir.exists(path)){ + dir.mkpath(path); } - auto filePath = _cacheDir+"/"+httpId; + auto filePath = path+"/"+httpId; return filePath; } diff --git a/src/Qt5/imports/FluentUI/Controls/FluScreenshot.qml b/src/Qt5/imports/FluentUI/Controls/FluScreenshot.qml index c2f987d9..1c036953 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluScreenshot.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluScreenshot.qml @@ -48,7 +48,7 @@ Item{ captureMode:control.captrueMode saveFolder: { if(typeof control.saveFolder === 'string'){ - return control.saveFolder + return FluTools.toLocalPath(Qt.resolvedUrl(control.saveFolder)) }else{ return FluTools.toLocalPath(control.saveFolder) } diff --git a/src/Qt6/imports/FluentUI/Controls/FluScreenshot.qml b/src/Qt6/imports/FluentUI/Controls/FluScreenshot.qml index e080a0db..ca49deeb 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluScreenshot.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluScreenshot.qml @@ -48,7 +48,7 @@ Item{ captureMode:control.captrueMode saveFolder: { if(typeof control.saveFolder === 'string'){ - return control.saveFolder + return FluTools.toLocalPath(Qt.resolvedUrl(control.saveFolder)) }else{ return FluTools.toLocalPath(control.saveFolder) }