mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-30 07:03:46 +08:00
update
This commit is contained in:
parent
ddee70cdca
commit
ed5956d824
@ -17,6 +17,12 @@ FluContentPage{
|
|||||||
cacheDir:cacheDirPath
|
cacheDir:cacheDirPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluHttp{
|
||||||
|
id:http_breakpoint_download
|
||||||
|
cacheDir:cacheDirPath
|
||||||
|
breakPointDownload: true
|
||||||
|
}
|
||||||
|
|
||||||
FluHttp{
|
FluHttp{
|
||||||
id:http_cache_ifnonecacherequest
|
id:http_cache_ifnonecacherequest
|
||||||
cacheMode:FluHttpType.IfNoneCacheRequest
|
cacheMode:FluHttpType.IfNoneCacheRequest
|
||||||
@ -125,6 +131,45 @@ FluContentPage{
|
|||||||
folder_dialog.open()
|
folder_dialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluProgressButton{
|
||||||
|
property string saveFilePath: FluTools.getApplicationDirPath()+ "/download/big_buck_bunny.mp4"
|
||||||
|
property string resourcePath: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||||
|
id:btn_breakpoint_download
|
||||||
|
implicitWidth: parent.width
|
||||||
|
implicitHeight: 36
|
||||||
|
text: progress === 1 ? "打开文件" : "断点下载文件"
|
||||||
|
Component.onCompleted: {
|
||||||
|
progress = http_breakpoint_download.breakPointDownloadProgress(resourcePath,saveFilePath)
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
if(progress === 1){
|
||||||
|
FluTools.showFileInFolder(saveFilePath)
|
||||||
|
}else{
|
||||||
|
http_breakpoint_download.download(resourcePath,callable_breakpoint_download,saveFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluMenu{
|
||||||
|
id:menu_breakpoint_download
|
||||||
|
width: 120
|
||||||
|
FluMenuItem{
|
||||||
|
text: "删除文件"
|
||||||
|
onClicked: {
|
||||||
|
if(FluTools.removeFile(btn_breakpoint_download.saveFilePath)){
|
||||||
|
btn_breakpoint_download.progress = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onClicked: {
|
||||||
|
if(btn_breakpoint_download.progress === 1){
|
||||||
|
menu_breakpoint_download.popup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
FluProgressButton{
|
FluProgressButton{
|
||||||
id:btn_upload
|
id:btn_upload
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
@ -230,6 +275,30 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpCallable{
|
||||||
|
id:callable_breakpoint_download
|
||||||
|
onStart: {
|
||||||
|
btn_breakpoint_download.disabled = true
|
||||||
|
}
|
||||||
|
onFinish: {
|
||||||
|
btn_breakpoint_download.disabled = false
|
||||||
|
}
|
||||||
|
onError:
|
||||||
|
(status,errorString,result)=>{
|
||||||
|
btn_breakpoint_download.progress = 0
|
||||||
|
showError(errorString)
|
||||||
|
console.debug(status+";"+errorString+";"+result)
|
||||||
|
}
|
||||||
|
onSuccess:
|
||||||
|
(result)=>{
|
||||||
|
showSuccess(result)
|
||||||
|
}
|
||||||
|
onDownloadProgress:
|
||||||
|
(recv,total)=>{
|
||||||
|
btn_breakpoint_download.progress = recv/total
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HttpCallable{
|
HttpCallable{
|
||||||
id:callable_download
|
id:callable_download
|
||||||
onStart: {
|
onStart: {
|
||||||
@ -289,5 +358,4 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import FluentUI 1.0
|
|||||||
import "qrc:///example/qml/component"
|
import "qrc:///example/qml/component"
|
||||||
import "../component"
|
import "../component"
|
||||||
|
|
||||||
|
|
||||||
FluContentPage{
|
FluContentPage{
|
||||||
|
|
||||||
title:"Http"
|
title:"Http"
|
||||||
@ -19,6 +18,12 @@ FluContentPage{
|
|||||||
cacheDir:cacheDirPath
|
cacheDir:cacheDirPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluHttp{
|
||||||
|
id:http_breakpoint_download
|
||||||
|
cacheDir:cacheDirPath
|
||||||
|
breakPointDownload: true
|
||||||
|
}
|
||||||
|
|
||||||
FluHttp{
|
FluHttp{
|
||||||
id:http_cache_ifnonecacherequest
|
id:http_cache_ifnonecacherequest
|
||||||
cacheMode:FluHttpType.IfNoneCacheRequest
|
cacheMode:FluHttpType.IfNoneCacheRequest
|
||||||
@ -127,6 +132,45 @@ FluContentPage{
|
|||||||
folder_dialog.open()
|
folder_dialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluProgressButton{
|
||||||
|
property string saveFilePath: FluTools.getApplicationDirPath()+ "/download/big_buck_bunny.mp4"
|
||||||
|
property string resourcePath: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||||
|
id:btn_breakpoint_download
|
||||||
|
implicitWidth: parent.width
|
||||||
|
implicitHeight: 36
|
||||||
|
text: progress === 1 ? "打开文件" : "断点下载文件"
|
||||||
|
Component.onCompleted: {
|
||||||
|
progress = http_breakpoint_download.breakPointDownloadProgress(resourcePath,saveFilePath)
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
if(progress === 1){
|
||||||
|
FluTools.showFileInFolder(saveFilePath)
|
||||||
|
}else{
|
||||||
|
http_breakpoint_download.download(resourcePath,callable_breakpoint_download,saveFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FluMenu{
|
||||||
|
id:menu_breakpoint_download
|
||||||
|
width: 120
|
||||||
|
FluMenuItem{
|
||||||
|
text: "删除文件"
|
||||||
|
onClicked: {
|
||||||
|
if(FluTools.removeFile(btn_breakpoint_download.saveFilePath)){
|
||||||
|
btn_breakpoint_download.progress = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onClicked: {
|
||||||
|
if(btn_breakpoint_download.progress === 1){
|
||||||
|
menu_breakpoint_download.popup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
FluProgressButton{
|
FluProgressButton{
|
||||||
id:btn_upload
|
id:btn_upload
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
@ -232,6 +276,30 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpCallable{
|
||||||
|
id:callable_breakpoint_download
|
||||||
|
onStart: {
|
||||||
|
btn_breakpoint_download.disabled = true
|
||||||
|
}
|
||||||
|
onFinish: {
|
||||||
|
btn_breakpoint_download.disabled = false
|
||||||
|
}
|
||||||
|
onError:
|
||||||
|
(status,errorString,result)=>{
|
||||||
|
btn_breakpoint_download.progress = 0
|
||||||
|
showError(errorString)
|
||||||
|
console.debug(status+";"+errorString+";"+result)
|
||||||
|
}
|
||||||
|
onSuccess:
|
||||||
|
(result)=>{
|
||||||
|
showSuccess(result)
|
||||||
|
}
|
||||||
|
onDownloadProgress:
|
||||||
|
(recv,total)=>{
|
||||||
|
btn_breakpoint_download.progress = recv/total
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HttpCallable{
|
HttpCallable{
|
||||||
id:callable_download
|
id:callable_download
|
||||||
onStart: {
|
onStart: {
|
||||||
@ -291,5 +359,4 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
|||||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||||
#ifdef Q_OS_WIN // 此设置仅在Windows下生效
|
#ifdef Q_OS_WIN // 此设置仅在Windows下生效
|
||||||
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
||||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow,true);
|
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow,false);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
|
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
|
||||||
|
123
src/FluHttp.cpp
123
src/FluHttp.cpp
@ -25,7 +25,7 @@ FluHttp::FluHttp(QObject *parent)
|
|||||||
timeout(15000);
|
timeout(15000);
|
||||||
cacheMode(FluHttpType::CacheMode::NoCache);
|
cacheMode(FluHttpType::CacheMode::NoCache);
|
||||||
cacheDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)+"/httpcache");
|
cacheDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)+"/httpcache");
|
||||||
breakPointDownload(true);
|
breakPointDownload(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluHttp::~FluHttp(){
|
FluHttp::~FluHttp(){
|
||||||
@ -40,21 +40,18 @@ void FluHttp::cancel(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluHttp::handleReply(QNetworkReply* reply){
|
|
||||||
_cacheReply.append(reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
QMap<QString, QVariant> data = invokeIntercept(toRequest(url,params,headers,"post")).toMap();
|
auto requestMap = toRequest(url,params,headers,"post");
|
||||||
|
QMap<QString, QVariant> data = invokeIntercept(requestMap).toMap();
|
||||||
Q_EMIT callable->start();
|
Q_EMIT callable->start();
|
||||||
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
Q_EMIT callable->finish();
|
Q_EMIT callable->finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
@ -84,17 +81,16 @@ void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> pa
|
|||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
QString errorString = reply->errorString();
|
QString errorString = reply->errorString();
|
||||||
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
||||||
_cacheReply.removeOne(reply);
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
handleCache(data,result);
|
handleCache(requestMap,result);
|
||||||
Q_EMIT callable->success(result);
|
Q_EMIT callable->success(result);
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
if(i == retry()-1){
|
if(i == retry()-1){
|
||||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
Q_EMIT callable->error(status,errorString,result);
|
Q_EMIT callable->error(status,errorString,result);
|
||||||
}
|
}
|
||||||
@ -106,15 +102,16 @@ void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> pa
|
|||||||
|
|
||||||
void FluHttp::postString(QString url,HttpCallable* callable,QString params,QMap<QString, QVariant> headers){
|
void FluHttp::postString(QString url,HttpCallable* callable,QString params,QMap<QString, QVariant> headers){
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
QMap<QString, QVariant> data = invokeIntercept(toRequest(url,params,headers,"postString")).toMap();
|
auto requestMap = toRequest(url,params,headers,"postString");
|
||||||
|
QMap<QString, QVariant> data = invokeIntercept(requestMap).toMap();
|
||||||
Q_EMIT callable->start();
|
Q_EMIT callable->start();
|
||||||
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
Q_EMIT callable->finish();
|
Q_EMIT callable->finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
@ -135,17 +132,16 @@ void FluHttp::postString(QString url,HttpCallable* callable,QString params,QMap<
|
|||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
QString errorString = reply->errorString();
|
QString errorString = reply->errorString();
|
||||||
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
||||||
_cacheReply.removeOne(reply);
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
handleCache(data,result);
|
handleCache(requestMap,result);
|
||||||
Q_EMIT callable->success(result);
|
Q_EMIT callable->success(result);
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
if(i == retry()-1){
|
if(i == retry()-1){
|
||||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
Q_EMIT callable->error(status,errorString,result);
|
Q_EMIT callable->error(status,errorString,result);
|
||||||
}
|
}
|
||||||
@ -157,15 +153,16 @@ void FluHttp::postString(QString url,HttpCallable* callable,QString params,QMap<
|
|||||||
|
|
||||||
void FluHttp::postJson(QString url,HttpCallable* callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
void FluHttp::postJson(QString url,HttpCallable* callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
QMap<QString, QVariant> data = invokeIntercept(toRequest(url,params,headers,"postJson")).toMap();
|
auto requestMap = toRequest(url,params,headers,"postJson");
|
||||||
|
QMap<QString, QVariant> data = invokeIntercept(requestMap).toMap();
|
||||||
Q_EMIT callable->start();
|
Q_EMIT callable->start();
|
||||||
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
Q_EMIT callable->finish();
|
Q_EMIT callable->finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < retry(); ++i) {
|
for (int i = 0; i < retry(); ++i) {
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
@ -186,17 +183,16 @@ void FluHttp::postJson(QString url,HttpCallable* callable,QMap<QString, QVariant
|
|||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
QString errorString = reply->errorString();
|
QString errorString = reply->errorString();
|
||||||
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
||||||
_cacheReply.removeOne(reply);
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
handleCache(data,result);
|
handleCache(requestMap,result);
|
||||||
Q_EMIT callable->success(result);
|
Q_EMIT callable->success(result);
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
if(i == retry()-1){
|
if(i == retry()-1){
|
||||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
Q_EMIT callable->error(status,errorString,result);
|
Q_EMIT callable->error(status,errorString,result);
|
||||||
}
|
}
|
||||||
@ -208,13 +204,14 @@ void FluHttp::postJson(QString url,HttpCallable* callable,QMap<QString, QVariant
|
|||||||
|
|
||||||
void FluHttp::get(QString url,HttpCallable* callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
void FluHttp::get(QString url,HttpCallable* callable,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
QMap<QString, QVariant> data = invokeIntercept(toRequest(url,params,headers,"get")).toMap();
|
auto requestMap = toRequest(url,params,headers,"get");
|
||||||
|
QMap<QString, QVariant> data = invokeIntercept(requestMap).toMap();
|
||||||
Q_EMIT callable->start();
|
Q_EMIT callable->start();
|
||||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
Q_EMIT callable->finish();
|
Q_EMIT callable->finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -236,17 +233,16 @@ void FluHttp::get(QString url,HttpCallable* callable,QMap<QString, QVariant> par
|
|||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
QString errorString = reply->errorString();
|
QString errorString = reply->errorString();
|
||||||
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
||||||
_cacheReply.removeOne(reply);
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
handleCache(data,result);
|
handleCache(requestMap,result);
|
||||||
Q_EMIT callable->success(result);
|
Q_EMIT callable->success(result);
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
if(i == retry()-1){
|
if(i == retry()-1){
|
||||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(data)){
|
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||||
Q_EMIT callable->cache(readCache(data));
|
Q_EMIT callable->cache(readCache(requestMap));
|
||||||
}
|
}
|
||||||
Q_EMIT callable->error(status,errorString,result);
|
Q_EMIT callable->error(status,errorString,result);
|
||||||
}
|
}
|
||||||
@ -268,17 +264,21 @@ void FluHttp::download(QString url,HttpCallable* callable,QString savePath,QMap<
|
|||||||
QNetworkRequest request(_url);
|
QNetworkRequest request(_url);
|
||||||
addHeaders(&request,data["headers"].toMap());
|
addHeaders(&request,data["headers"].toMap());
|
||||||
QSharedPointer<QFile> file(new QFile(savePath));
|
QSharedPointer<QFile> file(new QFile(savePath));
|
||||||
|
QDir dir = QFileInfo(savePath).path();
|
||||||
|
if (!dir.exists(dir.path())){
|
||||||
|
dir.mkpath(dir.path());
|
||||||
|
}
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){
|
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){
|
||||||
loop.quit();
|
loop.quit();
|
||||||
});
|
});
|
||||||
auto filePath = getCacheFilePath(data);
|
|
||||||
qint64 seek = 0;
|
qint64 seek = 0;
|
||||||
|
auto filePath = getCacheFilePath(requestMap);
|
||||||
QSharedPointer<QFile> fileCache(new QFile(filePath));
|
QSharedPointer<QFile> fileCache(new QFile(filePath));
|
||||||
if(fileCache->exists() && file->exists() && _breakPointDownload){
|
if(fileCache->exists() && file->exists() && _breakPointDownload){
|
||||||
QJsonObject cacheInfo = QJsonDocument::fromJson(readCache(data).toUtf8()).object();
|
QJsonObject cacheInfo = QJsonDocument::fromJson(readCache(requestMap).toUtf8()).object();
|
||||||
auto fileSize = cacheInfo.value("fileSize").toInteger();
|
qint64 fileSize = cacheInfo.value("fileSize").toDouble();
|
||||||
auto contentLength = cacheInfo.value("contentLength").toInteger();
|
qint64 contentLength = cacheInfo.value("contentLength").toDouble();
|
||||||
if(fileSize == contentLength && file->size() == contentLength){
|
if(fileSize == contentLength && file->size() == contentLength){
|
||||||
Q_EMIT callable->downloadProgress(fileSize,contentLength);
|
Q_EMIT callable->downloadProgress(fileSize,contentLength);
|
||||||
Q_EMIT callable->success(savePath);
|
Q_EMIT callable->success(savePath);
|
||||||
@ -301,12 +301,12 @@ void FluHttp::download(QString url,HttpCallable* callable,QString savePath,QMap<
|
|||||||
{
|
{
|
||||||
qDebug()<<"FileCache Error";
|
qDebug()<<"FileCache Error";
|
||||||
}
|
}
|
||||||
connect(reply,&QNetworkReply::readyRead,reply,[reply,file,fileCache,data,callable,seek]{
|
connect(reply,&QNetworkReply::readyRead,reply,[reply,file,fileCache,requestMap,callable,seek]{
|
||||||
if (!reply || !file || reply->error() != QNetworkReply::NoError)
|
if (!reply || !file || reply->error() != QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMap<QString, QVariant> downMap = data;
|
QMap<QString, QVariant> downMap = requestMap;
|
||||||
qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong()+seek;
|
qint64 contentLength = reply->header(QNetworkRequest::ContentLengthHeader).toLongLong()+seek;
|
||||||
downMap.insert("contentLength",contentLength);
|
downMap.insert("contentLength",contentLength);
|
||||||
QString eTag = reply->header(QNetworkRequest::ETagHeader).toString();
|
QString eTag = reply->header(QNetworkRequest::ETagHeader).toString();
|
||||||
@ -325,7 +325,6 @@ void FluHttp::download(QString url,HttpCallable* callable,QString savePath,QMap<
|
|||||||
}else{
|
}else{
|
||||||
Q_EMIT callable->error(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(),reply->errorString(),"");
|
Q_EMIT callable->error(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(),reply->errorString(),"");
|
||||||
}
|
}
|
||||||
_cacheReply.removeOne(reply);
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
Q_EMIT callable->finish();
|
Q_EMIT callable->finish();
|
||||||
@ -371,7 +370,6 @@ void FluHttp::upload(QString url,HttpCallable* callable,QMap<QString, QVariant>
|
|||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
QString errorString = reply->errorString();
|
QString errorString = reply->errorString();
|
||||||
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
bool isSuccess = reply->error() == QNetworkReply::NoError;
|
||||||
_cacheReply.removeOne(reply);
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
reply = nullptr;
|
reply = nullptr;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
@ -393,12 +391,12 @@ QMap<QString, QVariant> FluHttp::toRequest(const QString& url,const QVariant& pa
|
|||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FluHttp::invokeIntercept(QMap<QString, QVariant> request){
|
QVariant FluHttp::invokeIntercept(QMap<QString, QVariant> request,Qt::ConnectionType type){
|
||||||
if(!FluApp::getInstance()->httpInterceptor()){
|
if(!FluApp::getInstance()->httpInterceptor()){
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
QVariant target;
|
QVariant target;
|
||||||
QMetaObject::invokeMethod(FluApp::getInstance()->httpInterceptor(), "onIntercept",Qt::BlockingQueuedConnection,Q_RETURN_ARG(QVariant,target),Q_ARG(QVariant, request));
|
QMetaObject::invokeMethod(FluApp::getInstance()->httpInterceptor(), "onIntercept",type,Q_RETURN_ARG(QVariant,target),Q_ARG(QVariant, request));
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,3 +461,26 @@ void FluHttp::handleCache(QMap<QString, QVariant> request,const QString& result)
|
|||||||
}
|
}
|
||||||
file->write(FluTools::getInstance()->toBase64(result).toUtf8());
|
file->write(FluTools::getInstance()->toBase64(result).toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qreal FluHttp::breakPointDownloadProgress(QString url,QString savePath,QMap<QString, QVariant> params,QMap<QString, QVariant> headers){
|
||||||
|
auto requestMap = toRequest(url,params,headers,"download");
|
||||||
|
requestMap.insert("savePath",savePath);
|
||||||
|
QSharedPointer<QFile> file(new QFile(savePath));
|
||||||
|
auto filePath = getCacheFilePath(requestMap);
|
||||||
|
QSharedPointer<QFile> fileCache(new QFile(filePath));
|
||||||
|
if(fileCache->exists() && file->exists() && _breakPointDownload){
|
||||||
|
QJsonObject cacheInfo = QJsonDocument::fromJson(readCache(requestMap).toUtf8()).object();
|
||||||
|
double fileSize = cacheInfo.value("fileSize").toDouble();
|
||||||
|
double contentLength = cacheInfo.value("contentLength").toDouble();
|
||||||
|
if(fileSize == contentLength && file->size() == contentLength){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(fileSize==file->size()){
|
||||||
|
return fileSize/contentLength;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,9 +32,8 @@ class FluHttp : public QObject
|
|||||||
Q_PROPERTY_AUTO(bool,breakPointDownload);
|
Q_PROPERTY_AUTO(bool,breakPointDownload);
|
||||||
QML_NAMED_ELEMENT(FluHttp)
|
QML_NAMED_ELEMENT(FluHttp)
|
||||||
private:
|
private:
|
||||||
QVariant invokeIntercept(QMap<QString, QVariant> request);
|
QVariant invokeIntercept(QMap<QString, QVariant> request,Qt::ConnectionType type = Qt::BlockingQueuedConnection);
|
||||||
QMap<QString, QVariant> toRequest(const QString& url,const QVariant& params,const QVariant& headers,const QString& method);
|
QMap<QString, QVariant> toRequest(const QString& url,const QVariant& params,const QVariant& headers,const QString& method);
|
||||||
void handleReply(QNetworkReply* reply);
|
|
||||||
void addQueryParam(QUrl* url,const QMap<QString, QVariant>& params);
|
void addQueryParam(QUrl* url,const QMap<QString, QVariant>& params);
|
||||||
void addHeaders(QNetworkRequest* request,const QMap<QString, QVariant>& params);
|
void addHeaders(QNetworkRequest* request,const QMap<QString, QVariant>& params);
|
||||||
void handleCache(QMap<QString, QVariant> request, const QString& result);
|
void handleCache(QMap<QString, QVariant> request, const QString& result);
|
||||||
@ -51,6 +50,7 @@ public:
|
|||||||
Q_INVOKABLE void postJson(QString url,HttpCallable* callable,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
Q_INVOKABLE void postJson(QString url,HttpCallable* callable,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void download(QString url,HttpCallable* callable,QString savePath,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
Q_INVOKABLE void download(QString url,HttpCallable* callable,QString savePath,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void upload(QString url,HttpCallable* callable,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
Q_INVOKABLE void upload(QString url,HttpCallable* callable,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
||||||
|
Q_INVOKABLE qreal breakPointDownloadProgress(QString url,QString savePath,QMap<QString, QVariant> params = {},QMap<QString, QVariant> headers = {});
|
||||||
Q_INVOKABLE void cancel();
|
Q_INVOKABLE void cancel();
|
||||||
private:
|
private:
|
||||||
QList<QPointer<QNetworkReply>> _cacheReply;
|
QList<QPointer<QNetworkReply>> _cacheReply;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QProcess>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
@ -151,6 +152,27 @@ bool FluTools::removeDir(QString dirPath){
|
|||||||
return qDir.removeRecursively();
|
return qDir.removeRecursively();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FluTools::removeFile(QString filePath){
|
||||||
|
QFile file(filePath);
|
||||||
|
return file.remove();
|
||||||
|
}
|
||||||
|
|
||||||
QString FluTools::sha256(QString text){
|
QString FluTools::sha256(QString text){
|
||||||
return QCryptographicHash::hash(text.toUtf8(), QCryptographicHash::Sha256).toHex();
|
return QCryptographicHash::hash(text.toUtf8(), QCryptographicHash::Sha256).toHex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluTools::showFileInFolder(QString path){
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
QProcess::startDetached("explorer.exe", {"/select,", QDir::toNativeSeparators(path)});
|
||||||
|
#endif
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
QFileInfo fileInfo(path);
|
||||||
|
auto process = "xdg-open";
|
||||||
|
auto arguments = { fileInfo.absoluteDir().absolutePath() };
|
||||||
|
QProcess::startDetached(process, arguments);
|
||||||
|
#endif
|
||||||
|
#if defined(Q_OS_MACOS)
|
||||||
|
QProcess::execute("/usr/bin/osascript", {"-e", "tell application \"Finder\" to reveal POSIX file \"" + path + "\""});
|
||||||
|
QProcess::execute("/usr/bin/osascript", {"-e", "tell application \"Finder\" to activate"});
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -180,6 +180,19 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool removeDir(QString dirPath);
|
Q_INVOKABLE bool removeDir(QString dirPath);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief removeFile
|
||||||
|
* @param filePath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE bool removeFile(QString filePath);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief showFileInFolder
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void showFileInFolder(QString path);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTOOLS_H
|
#endif // FLUTOOLS_H
|
||||||
|
@ -8,21 +8,6 @@ import QtQuick.tooling 1.2
|
|||||||
|
|
||||||
Module {
|
Module {
|
||||||
dependencies: ["QtQuick 2.0"]
|
dependencies: ["QtQuick 2.0"]
|
||||||
Component {
|
|
||||||
name: "FluHttpType"
|
|
||||||
exports: ["FluentUI/FluHttpType 1.0"]
|
|
||||||
isCreatable: false
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Enum {
|
|
||||||
name: "CacheMode"
|
|
||||||
values: {
|
|
||||||
"NoCache": 0,
|
|
||||||
"RequestFailedReadCache": 1,
|
|
||||||
"IfNoneCacheRequest": 2,
|
|
||||||
"FirstCacheThenRequest": 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
Component {
|
||||||
name: "FluCalendarViewType"
|
name: "FluCalendarViewType"
|
||||||
exports: ["FluentUI/FluCalendarViewType 1.0"]
|
exports: ["FluentUI/FluCalendarViewType 1.0"]
|
||||||
@ -85,116 +70,140 @@ Module {
|
|||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
Property { name: "retry"; type: "int" }
|
Property { name: "retry"; type: "int" }
|
||||||
Property { name: "timeout"; type: "int" }
|
Property { name: "timeout"; type: "int" }
|
||||||
|
Property { name: "cacheMode"; type: "int" }
|
||||||
|
Property { name: "cacheDir"; type: "string" }
|
||||||
|
Property { name: "breakPointDownload"; type: "bool" }
|
||||||
Method {
|
Method {
|
||||||
name: "get"
|
name: "get"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
Parameter { name: "headers"; type: "QVariantMap" }
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "get"
|
name: "get"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "get"
|
name: "get"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "post"
|
name: "post"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
Parameter { name: "headers"; type: "QVariantMap" }
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "post"
|
name: "post"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "post"
|
name: "post"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "postString"
|
name: "postString"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "string" }
|
Parameter { name: "params"; type: "string" }
|
||||||
Parameter { name: "headers"; type: "QVariantMap" }
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "postString"
|
name: "postString"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "string" }
|
Parameter { name: "params"; type: "string" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "postString"
|
name: "postString"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "postJson"
|
name: "postJson"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
Parameter { name: "headers"; type: "QVariantMap" }
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "postJson"
|
name: "postJson"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "postJson"
|
name: "postJson"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "download"
|
name: "download"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "filePath"; type: "string" }
|
Parameter { name: "savePath"; type: "string" }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
Parameter { name: "headers"; type: "QVariantMap" }
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "download"
|
name: "download"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "filePath"; type: "string" }
|
Parameter { name: "savePath"; type: "string" }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "download"
|
name: "download"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "filePath"; type: "string" }
|
Parameter { name: "savePath"; type: "string" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "upload"
|
name: "upload"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
Parameter { name: "headers"; type: "QVariantMap" }
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "upload"
|
name: "upload"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
Parameter { name: "params"; type: "QVariantMap" }
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "upload"
|
name: "upload"
|
||||||
Parameter { name: "url"; type: "string" }
|
Parameter { name: "url"; type: "string" }
|
||||||
Parameter { name: "callable"; type: "QJSValue" }
|
Parameter { name: "callable"; type: "HttpCallable"; isPointer: true }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "breakPointDownloadProgress"
|
||||||
|
type: "double"
|
||||||
|
Parameter { name: "url"; type: "string" }
|
||||||
|
Parameter { name: "savePath"; type: "string" }
|
||||||
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
|
Parameter { name: "headers"; type: "QVariantMap" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "breakPointDownloadProgress"
|
||||||
|
type: "double"
|
||||||
|
Parameter { name: "url"; type: "string" }
|
||||||
|
Parameter { name: "savePath"; type: "string" }
|
||||||
|
Parameter { name: "params"; type: "QVariantMap" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "breakPointDownloadProgress"
|
||||||
|
type: "double"
|
||||||
|
Parameter { name: "url"; type: "string" }
|
||||||
|
Parameter { name: "savePath"; type: "string" }
|
||||||
}
|
}
|
||||||
Method { name: "cancel" }
|
Method { name: "cancel" }
|
||||||
}
|
}
|
||||||
@ -204,6 +213,21 @@ Module {
|
|||||||
exports: ["FluentUI/FluHttpInterceptor 1.0"]
|
exports: ["FluentUI/FluHttpInterceptor 1.0"]
|
||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
}
|
}
|
||||||
|
Component {
|
||||||
|
name: "FluHttpType"
|
||||||
|
exports: ["FluentUI/FluHttpType 1.0"]
|
||||||
|
isCreatable: false
|
||||||
|
exportMetaObjectRevisions: [0]
|
||||||
|
Enum {
|
||||||
|
name: "CacheMode"
|
||||||
|
values: {
|
||||||
|
"NoCache": 0,
|
||||||
|
"RequestFailedReadCache": 1,
|
||||||
|
"IfNoneCacheRequest": 2,
|
||||||
|
"FirstCacheThenRequest": 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "FluNavigationViewType"
|
name: "FluNavigationViewType"
|
||||||
exports: ["FluentUI/FluNavigationViewType 1.0"]
|
exports: ["FluentUI/FluNavigationViewType 1.0"]
|
||||||
@ -241,7 +265,7 @@ Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "FluScreenshotType"
|
name: "FluScreenshotType"
|
||||||
exports: ["FluentUI/FluScreenshotType 1.0"]
|
exports: ["FluentUI/FluScreenshotType 1.0"]
|
||||||
isCreatable: false
|
isCreatable: false
|
||||||
@ -253,20 +277,6 @@ Module {
|
|||||||
"File": 1
|
"File": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Component {
|
|
||||||
name: "FluTimelineType"
|
|
||||||
exports: ["FluentUI/FluTimelineType 1.0"]
|
|
||||||
isCreatable: false
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Enum {
|
|
||||||
name: "Mode"
|
|
||||||
values: {
|
|
||||||
"Left": 0,
|
|
||||||
"Right": 1,
|
|
||||||
"Alternate": 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "FluStatusViewType"
|
name: "FluStatusViewType"
|
||||||
@ -332,6 +342,20 @@ Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component {
|
||||||
|
name: "FluTimelineType"
|
||||||
|
exports: ["FluentUI/FluTimelineType 1.0"]
|
||||||
|
isCreatable: false
|
||||||
|
exportMetaObjectRevisions: [0]
|
||||||
|
Enum {
|
||||||
|
name: "Mode"
|
||||||
|
values: {
|
||||||
|
"Left": 0,
|
||||||
|
"Right": 1,
|
||||||
|
"Alternate": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "FluTreeViewType"
|
name: "FluTreeViewType"
|
||||||
exports: ["FluentUI/FluTreeViewType 1.0"]
|
exports: ["FluentUI/FluTreeViewType 1.0"]
|
||||||
@ -1787,6 +1811,38 @@ Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component {
|
||||||
|
name: "HttpCallable"
|
||||||
|
prototype: "QObject"
|
||||||
|
exports: ["FluentUI/HttpCallable 1.0"]
|
||||||
|
exportMetaObjectRevisions: [0]
|
||||||
|
Signal { name: "start" }
|
||||||
|
Signal { name: "finish" }
|
||||||
|
Signal {
|
||||||
|
name: "error"
|
||||||
|
Parameter { name: "status"; type: "int" }
|
||||||
|
Parameter { name: "errorString"; type: "string" }
|
||||||
|
Parameter { name: "result"; type: "string" }
|
||||||
|
}
|
||||||
|
Signal {
|
||||||
|
name: "success"
|
||||||
|
Parameter { name: "result"; type: "string" }
|
||||||
|
}
|
||||||
|
Signal {
|
||||||
|
name: "cache"
|
||||||
|
Parameter { name: "result"; type: "string" }
|
||||||
|
}
|
||||||
|
Signal {
|
||||||
|
name: "downloadProgress"
|
||||||
|
Parameter { name: "recv"; type: "qlonglong" }
|
||||||
|
Parameter { name: "total"; type: "qlonglong" }
|
||||||
|
}
|
||||||
|
Signal {
|
||||||
|
name: "uploadProgress"
|
||||||
|
Parameter { name: "recv"; type: "qlonglong" }
|
||||||
|
Parameter { name: "total"; type: "qlonglong" }
|
||||||
|
}
|
||||||
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "QRCode"
|
name: "QRCode"
|
||||||
defaultProperty: "data"
|
defaultProperty: "data"
|
||||||
@ -1816,6 +1872,7 @@ Module {
|
|||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
Property { name: "saveFolder"; type: "string" }
|
Property { name: "saveFolder"; type: "string" }
|
||||||
Property { name: "captureMode"; type: "int" }
|
Property { name: "captureMode"; type: "int" }
|
||||||
|
Property { name: "hitDrawData"; type: "DrawData"; isPointer: true }
|
||||||
Signal {
|
Signal {
|
||||||
name: "captrueToPixmapCompleted"
|
name: "captrueToPixmapCompleted"
|
||||||
Parameter { name: "captrue"; type: "QPixmap" }
|
Parameter { name: "captrue"; type: "QPixmap" }
|
||||||
@ -1829,6 +1886,25 @@ Module {
|
|||||||
Parameter { name: "start"; type: "QPoint" }
|
Parameter { name: "start"; type: "QPoint" }
|
||||||
Parameter { name: "end"; type: "QPoint" }
|
Parameter { name: "end"; type: "QPoint" }
|
||||||
}
|
}
|
||||||
|
Method {
|
||||||
|
name: "appendDrawData"
|
||||||
|
type: "DrawData*"
|
||||||
|
Parameter { name: "drawType"; type: "int" }
|
||||||
|
Parameter { name: "start"; type: "QPoint" }
|
||||||
|
Parameter { name: "end"; type: "QPoint" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "updateDrawData"
|
||||||
|
Parameter { name: "data"; type: "DrawData"; isPointer: true }
|
||||||
|
Parameter { name: "start"; type: "QPoint" }
|
||||||
|
Parameter { name: "end"; type: "QPoint" }
|
||||||
|
}
|
||||||
|
Method { name: "clear" }
|
||||||
|
Method {
|
||||||
|
name: "hit"
|
||||||
|
type: "DrawData*"
|
||||||
|
Parameter { name: "point"; type: "QPoint" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
name: "WindowHelper"
|
name: "WindowHelper"
|
||||||
|
Loading…
Reference in New Issue
Block a user