This commit is contained in:
朱子楚\zhuzi 2023-09-29 19:30:22 +08:00
parent c048336de1
commit cbe26ce4cd
10 changed files with 18 additions and 14 deletions

View File

@ -25,8 +25,8 @@ DisableProgramGroupPage=yes
;PrivilegesRequired=lowest ;PrivilegesRequired=lowest
OutputDir=.\ OutputDir=.\
OutputBaseFilename=installer OutputBaseFilename=installer
Compression=lzma Compression=zip
SolidCompression=yes SolidCompression=no
WizardStyle=modern WizardStyle=modern
[Languages] [Languages]

View File

@ -10,7 +10,7 @@ import "qrc:///example/qml/component"
FluContentPage{ FluContentPage{
title:"Http" title:"Http"
property string cacheDirPath: FluTools.getApplicationDirPath() + "/cache/http" property string cacheDirPath: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation) + "/cache/http"
property bool isDownCompleted: false property bool isDownCompleted: false
FluHttp{ FluHttp{

View File

@ -3,6 +3,7 @@ import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
import QtQuick.Controls import QtQuick.Controls
import FluentUI import FluentUI
import Qt.labs.platform
import "qrc:///example/qml/component" import "qrc:///example/qml/component"
FluScrollablePage{ FluScrollablePage{
@ -47,7 +48,7 @@ FluScrollablePage{
FluScreenshot{ FluScreenshot{
id:screenshot id:screenshot
captrueMode: FluScreenshotType.File captrueMode: FluScreenshotType.File
saveFolder: FluTools.getApplicationDirPath()+"/screenshot" saveFolder: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation)+"/screenshot"
onCaptrueCompleted: onCaptrueCompleted:
(captrue)=>{ (captrue)=>{
image.source = captrue image.source = captrue

View File

@ -11,7 +11,7 @@ import "../component"
FluContentPage{ FluContentPage{
title:"Http" title:"Http"
property string cacheDirPath: FluTools.getApplicationDirPath() + "/cache/http" property string cacheDirPath: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation) + "/cache/http"
property bool isDownCompleted: false property bool isDownCompleted: false
FluHttp{ FluHttp{

View File

@ -3,6 +3,7 @@ import QtQuick.Layouts 1.15
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import FluentUI 1.0 import FluentUI 1.0
import Qt.labs.platform 1.0
import "qrc:///example/qml/component" import "qrc:///example/qml/component"
import "../component" import "../component"
@ -48,7 +49,7 @@ FluScrollablePage{
FluScreenshot{ FluScreenshot{
id:screenshot id:screenshot
captrueMode: FluScreenshotType.File captrueMode: FluScreenshotType.File
saveFolder: FluTools.getApplicationDirPath()+"/screenshot" saveFolder: StandardPaths.writableLocation(StandardPaths.AppLocalDataLocation)+"/screenshot"
onCaptrueCompleted: onCaptrueCompleted:
(captrue)=>{ (captrue)=>{
image.source = captrue image.source = captrue

View File

@ -1,6 +1,7 @@
#include "SettingsHelper.h" #include "SettingsHelper.h"
#include <QDataStream> #include <QDataStream>
#include <QStandardPaths>
SettingsHelper::SettingsHelper(QObject *parent) : QObject(parent) SettingsHelper::SettingsHelper(QObject *parent) : QObject(parent)
{ {
@ -34,7 +35,7 @@ void SettingsHelper::init(char *argv[]){
auto applicationPath = QString::fromStdString(argv[0]); auto applicationPath = QString::fromStdString(argv[0]);
const QFileInfo fileInfo(applicationPath); const QFileInfo fileInfo(applicationPath);
const QString iniFileName = fileInfo.completeBaseName() + ".ini"; 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->"<<iniFilePath; qDebug()<<"Application configuration file path->"<<iniFilePath;
m_settings.reset(new QSettings(iniFilePath, QSettings::IniFormat)); m_settings.reset(new QSettings(iniFilePath, QSettings::IniFormat));
} }

View File

@ -27,7 +27,6 @@ FRAMELESSHELPER_USE_NAMESPACE
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
SettingsHelper::getInstance()->init(argv);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
@ -40,6 +39,7 @@ int main(int argc, char *argv[])
QGuiApplication::setOrganizationName("ZhuZiChu"); QGuiApplication::setOrganizationName("ZhuZiChu");
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io"); QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
QGuiApplication::setApplicationName("FluentUI"); QGuiApplication::setApplicationName("FluentUI");
SettingsHelper::getInstance()->init(argv);
if(SettingsHelper::getInstance()->getReander()=="software"){ if(SettingsHelper::getInstance()->getReander()=="software"){
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QQuickWindow::setGraphicsApi(QSGRendererInterface::Software); QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);

View File

@ -527,11 +527,12 @@ bool FluHttp::cacheExists(const QString& httpId){
} }
QString FluHttp::getCacheFilePath(const QString& httpId){ QString FluHttp::getCacheFilePath(const QString& httpId){
QDir dir = _cacheDir; QString path = FluTools::getInstance()->toLocalPath(QUrl(_cacheDir));
if (!dir.exists(_cacheDir)){ QDir dir = path;
dir.mkpath(_cacheDir); if (!dir.exists(path)){
dir.mkpath(path);
} }
auto filePath = _cacheDir+"/"+httpId; auto filePath = path+"/"+httpId;
return filePath; return filePath;
} }

View File

@ -48,7 +48,7 @@ Item{
captureMode:control.captrueMode captureMode:control.captrueMode
saveFolder: { saveFolder: {
if(typeof control.saveFolder === 'string'){ if(typeof control.saveFolder === 'string'){
return control.saveFolder return FluTools.toLocalPath(Qt.resolvedUrl(control.saveFolder))
}else{ }else{
return FluTools.toLocalPath(control.saveFolder) return FluTools.toLocalPath(control.saveFolder)
} }

View File

@ -48,7 +48,7 @@ Item{
captureMode:control.captrueMode captureMode:control.captrueMode
saveFolder: { saveFolder: {
if(typeof control.saveFolder === 'string'){ if(typeof control.saveFolder === 'string'){
return control.saveFolder return FluTools.toLocalPath(Qt.resolvedUrl(control.saveFolder))
}else{ }else{
return FluTools.toLocalPath(control.saveFolder) return FluTools.toLocalPath(control.saveFolder)
} }