mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
update
This commit is contained in:
parent
e81a2cc849
commit
c52439ac39
@ -1568,7 +1568,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
|
|||||||
<context>
|
<context>
|
||||||
<name>T_Network</name>
|
<name>T_Network</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Network.qml" line="12"/>
|
<location filename="qml/page/T_Network.qml" line="13"/>
|
||||||
<source>Network</source>
|
<source>Network</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -1608,7 +1608,7 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
|
|||||||
<context>
|
<context>
|
||||||
<name>T_Network</name>
|
<name>T_Network</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Network.qml" line="12"/>
|
<location filename="qml/page/T_Network.qml" line="13"/>
|
||||||
<source>Network</source>
|
<source>Network</source>
|
||||||
<translation type="unfinished">网络</translation>
|
<translation type="unfinished">网络</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -25,8 +25,8 @@ FluLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
FluNetwork.openLog = false
|
Network.openLog = false
|
||||||
FluNetwork.setInterceptor(function(param){
|
Network.setInterceptor(function(param){
|
||||||
param.addHeader("Token","000000000000000000000")
|
param.addHeader("Token","000000000000000000000")
|
||||||
})
|
})
|
||||||
FluApp.init(app,Qt.locale(TranslateHelper.current))
|
FluApp.init(app,Qt.locale(TranslateHelper.current))
|
||||||
|
@ -4,6 +4,7 @@ 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 Qt.labs.platform 1.0
|
||||||
|
import example 1.0
|
||||||
import "../component"
|
import "../component"
|
||||||
|
|
||||||
FluContentPage{
|
FluContentPage{
|
||||||
@ -11,7 +12,7 @@ FluContentPage{
|
|||||||
id:root
|
id:root
|
||||||
title: qsTr("Network")
|
title: qsTr("Network")
|
||||||
|
|
||||||
FluNetworkCallable{
|
NetworkCallable{
|
||||||
id:callable
|
id:callable
|
||||||
onStart: {
|
onStart: {
|
||||||
showLoading()
|
showLoading()
|
||||||
@ -56,7 +57,7 @@ FluContentPage{
|
|||||||
text: "Get"
|
text: "Get"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.get("https://httpbingo.org/get")
|
Network.get("https://httpbingo.org/get")
|
||||||
.addQuery("name","孙悟空")
|
.addQuery("name","孙悟空")
|
||||||
.addQuery("age",500)
|
.addQuery("age",500)
|
||||||
.addQuery("address","花果山水帘洞")
|
.addQuery("address","花果山水帘洞")
|
||||||
@ -70,7 +71,7 @@ FluContentPage{
|
|||||||
text: "Head"
|
text: "Head"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.head("https://httpbingo.org/head")
|
Network.head("https://httpbingo.org/head")
|
||||||
.addQuery("name","孙悟空")
|
.addQuery("name","孙悟空")
|
||||||
.addQuery("age",500)
|
.addQuery("age",500)
|
||||||
.addQuery("address","花果山水帘洞")
|
.addQuery("address","花果山水帘洞")
|
||||||
@ -84,7 +85,7 @@ FluContentPage{
|
|||||||
text: "Post Body"
|
text: "Post Body"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postBody("https://httpbingo.org/post")
|
Network.postBody("https://httpbingo.org/post")
|
||||||
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
||||||
.bind(root)
|
.bind(root)
|
||||||
.go(callable)
|
.go(callable)
|
||||||
@ -96,7 +97,7 @@ FluContentPage{
|
|||||||
text: "Post Form"
|
text: "Post Form"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postForm("https://httpbingo.org/post")
|
Network.postForm("https://httpbingo.org/post")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -110,7 +111,7 @@ FluContentPage{
|
|||||||
text: "Post JSON"
|
text: "Post JSON"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -124,7 +125,7 @@ FluContentPage{
|
|||||||
text: "Post JSON Array"
|
text: "Post JSON Array"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJsonArray("https://httpbingo.org/post")
|
Network.postJsonArray("https://httpbingo.org/post")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -138,7 +139,7 @@ FluContentPage{
|
|||||||
text: "Put Body"
|
text: "Put Body"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.putBody("https://httpbingo.org/put")
|
Network.putBody("https://httpbingo.org/put")
|
||||||
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
||||||
.bind(root)
|
.bind(root)
|
||||||
.go(callable)
|
.go(callable)
|
||||||
@ -150,7 +151,7 @@ FluContentPage{
|
|||||||
text: "Put Form"
|
text: "Put Form"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.putForm("https://httpbingo.org/put")
|
Network.putForm("https://httpbingo.org/put")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -164,7 +165,7 @@ FluContentPage{
|
|||||||
text: "Put JSON"
|
text: "Put JSON"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.putJson("https://httpbingo.org/put")
|
Network.putJson("https://httpbingo.org/put")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -178,7 +179,7 @@ FluContentPage{
|
|||||||
text: "Put JSON Array"
|
text: "Put JSON Array"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.putJsonArray("https://httpbingo.org/put")
|
Network.putJsonArray("https://httpbingo.org/put")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -192,7 +193,7 @@ FluContentPage{
|
|||||||
text: "Patch Body"
|
text: "Patch Body"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.patchBody("https://httpbingo.org/patch")
|
Network.patchBody("https://httpbingo.org/patch")
|
||||||
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
||||||
.bind(root)
|
.bind(root)
|
||||||
.go(callable)
|
.go(callable)
|
||||||
@ -204,7 +205,7 @@ FluContentPage{
|
|||||||
text: "Patch Form"
|
text: "Patch Form"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.patchForm("https://httpbingo.org/patch")
|
Network.patchForm("https://httpbingo.org/patch")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -218,7 +219,7 @@ FluContentPage{
|
|||||||
text: "Patch JSON"
|
text: "Patch JSON"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.patchJson("https://httpbingo.org/patch")
|
Network.patchJson("https://httpbingo.org/patch")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -232,7 +233,7 @@ FluContentPage{
|
|||||||
text: "Patch JSON Array"
|
text: "Patch JSON Array"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.patchJsonArray("https://httpbingo.org/patch")
|
Network.patchJsonArray("https://httpbingo.org/patch")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -246,7 +247,7 @@ FluContentPage{
|
|||||||
text: "Delete Body"
|
text: "Delete Body"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.deleteBody("https://httpbingo.org/delete")
|
Network.deleteBody("https://httpbingo.org/delete")
|
||||||
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
.setBody("花果山水帘洞美猴王齐天大圣孙悟空")
|
||||||
.bind(root)
|
.bind(root)
|
||||||
.go(callable)
|
.go(callable)
|
||||||
@ -258,7 +259,7 @@ FluContentPage{
|
|||||||
text: "Delete Form"
|
text: "Delete Form"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.deleteForm("https://httpbingo.org/delete")
|
Network.deleteForm("https://httpbingo.org/delete")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -272,7 +273,7 @@ FluContentPage{
|
|||||||
text: "Delete JSON"
|
text: "Delete JSON"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.deleteJson("https://httpbingo.org/delete")
|
Network.deleteJson("https://httpbingo.org/delete")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -286,7 +287,7 @@ FluContentPage{
|
|||||||
text: "Delete JSON Array"
|
text: "Delete JSON Array"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.deleteJsonArray("https://httpbingo.org/delete")
|
Network.deleteJsonArray("https://httpbingo.org/delete")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -300,7 +301,7 @@ FluContentPage{
|
|||||||
text: "Open Log"
|
text: "Open Log"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -315,7 +316,7 @@ FluContentPage{
|
|||||||
text: "Custom Header"
|
text: "Custom Header"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.addHeader("os","PC")
|
.addHeader("os","PC")
|
||||||
.addHeader("version","1.0.0")
|
.addHeader("version","1.0.0")
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
@ -331,8 +332,8 @@ FluContentPage{
|
|||||||
text: "RequestFailedReadCache"
|
text: "RequestFailedReadCache"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.setCacheMode(FluNetworkType.RequestFailedReadCache)
|
.setCacheMode(NetworkType.RequestFailedReadCache)
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -347,8 +348,8 @@ FluContentPage{
|
|||||||
text: "IfNoneCacheRequest"
|
text: "IfNoneCacheRequest"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.setCacheMode(FluNetworkType.IfNoneCacheRequest)
|
.setCacheMode(NetworkType.IfNoneCacheRequest)
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -363,8 +364,8 @@ FluContentPage{
|
|||||||
text: "FirstCacheThenRequest"
|
text: "FirstCacheThenRequest"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.setCacheMode(FluNetworkType.FirstCacheThenRequest)
|
.setCacheMode(NetworkType.FirstCacheThenRequest)
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
.add("age",500)
|
.add("age",500)
|
||||||
.add("address","花果山水帘洞")
|
.add("address","花果山水帘洞")
|
||||||
@ -379,7 +380,7 @@ FluContentPage{
|
|||||||
text: "Timeout And Retry"
|
text: "Timeout And Retry"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
text_info.text = ""
|
text_info.text = ""
|
||||||
FluNetwork.postJson("https://httpbingo.org/post")
|
Network.postJson("https://httpbingo.org/post")
|
||||||
.setTimeout(5000)
|
.setTimeout(5000)
|
||||||
.setRetry(3)
|
.setRetry(3)
|
||||||
.add("name","孙悟空")
|
.add("name","孙悟空")
|
||||||
@ -407,7 +408,7 @@ FluContentPage{
|
|||||||
text: "Download File"
|
text: "Download File"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
folder_dialog.showDialog(function(path){
|
folder_dialog.showDialog(function(path){
|
||||||
FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4")
|
Network.get("http://vjs.zencdn.net/v/oceans.mp4")
|
||||||
.toDownload(path)
|
.toDownload(path)
|
||||||
.bind(root)
|
.bind(root)
|
||||||
.go(callable_download_file)
|
.go(callable_download_file)
|
||||||
@ -421,7 +422,7 @@ FluContentPage{
|
|||||||
text: "Breakpoint Download File"
|
text: "Breakpoint Download File"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
folder_dialog.showDialog(function(path){
|
folder_dialog.showDialog(function(path){
|
||||||
FluNetwork.get("http://vjs.zencdn.net/v/oceans.mp4")
|
Network.get("http://vjs.zencdn.net/v/oceans.mp4")
|
||||||
.toDownload(path,true)
|
.toDownload(path,true)
|
||||||
.bind(root)
|
.bind(root)
|
||||||
.go(callable_breakpoint_download_file)
|
.go(callable_breakpoint_download_file)
|
||||||
@ -431,7 +432,7 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkCallable{
|
NetworkCallable{
|
||||||
id:callable_upload_file
|
id:callable_upload_file
|
||||||
onStart: {
|
onStart: {
|
||||||
btn_upload.disabled = true
|
btn_upload.disabled = true
|
||||||
@ -455,7 +456,7 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkCallable{
|
NetworkCallable{
|
||||||
id:callable_download_file
|
id:callable_download_file
|
||||||
onStart: {
|
onStart: {
|
||||||
btn_download.progress = 0
|
btn_download.progress = 0
|
||||||
@ -480,7 +481,7 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkCallable{
|
NetworkCallable{
|
||||||
id:callable_breakpoint_download_file
|
id:callable_breakpoint_download_file
|
||||||
onStart: {
|
onStart: {
|
||||||
btn_download_breakpoint.progress = 0
|
btn_download_breakpoint.progress = 0
|
||||||
@ -508,7 +509,7 @@ FluContentPage{
|
|||||||
FileDialog {
|
FileDialog {
|
||||||
id: file_dialog
|
id: file_dialog
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
FluNetwork.postForm("https://httpbingo.org/post")
|
Network.postForm("https://httpbingo.org/post")
|
||||||
.setRetry(1)//只请求一次
|
.setRetry(1)//只请求一次
|
||||||
.add("accessToken","12345678")
|
.add("accessToken","12345678")
|
||||||
.addFile("file",FluTools.toLocalPath(file_dialog.currentFile))
|
.addFile("file",FluTools.toLocalPath(file_dialog.currentFile))
|
||||||
|
@ -351,7 +351,7 @@ FluWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkCallable{
|
NetworkCallable{
|
||||||
id:callable
|
id:callable
|
||||||
property bool silent: true
|
property bool silent: true
|
||||||
onStart: {
|
onStart: {
|
||||||
@ -387,7 +387,7 @@ FluWindow {
|
|||||||
|
|
||||||
function checkUpdate(silent){
|
function checkUpdate(silent){
|
||||||
callable.silent = silent
|
callable.silent = silent
|
||||||
FluNetwork.get("https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest")
|
Network.get("https://api.github.com/repos/zhuzichu520/FluentUI/releases/latest")
|
||||||
.go(callable)
|
.go(callable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "FluNetwork.h"
|
#include "Network.h"
|
||||||
|
|
||||||
#include <QUrlQuery>
|
#include <QUrlQuery>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
@ -18,11 +18,11 @@
|
|||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
FluNetworkCallable::FluNetworkCallable(QObject *parent):QObject{parent}{
|
NetworkCallable::NetworkCallable(QObject *parent):QObject{parent}{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FluNetworkParams::method2String(){
|
QString NetworkParams::method2String(){
|
||||||
switch (_method) {
|
switch (_method) {
|
||||||
case METHOD_GET:
|
case METHOD_GET:
|
||||||
return "GET";
|
return "GET";
|
||||||
@ -41,25 +41,25 @@ QString FluNetworkParams::method2String(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int FluNetworkParams::getTimeout(){
|
int NetworkParams::getTimeout(){
|
||||||
if(_timeout != -1){
|
if(_timeout != -1){
|
||||||
return _timeout;
|
return _timeout;
|
||||||
}
|
}
|
||||||
return FluNetwork::getInstance()->timeout();
|
return Network::getInstance()->timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
int FluNetworkParams::getRetry(){
|
int NetworkParams::getRetry(){
|
||||||
if(_retry != -1){
|
if(_retry != -1){
|
||||||
return _retry;
|
return _retry;
|
||||||
}
|
}
|
||||||
return FluNetwork::getInstance()->retry();
|
return Network::getInstance()->retry();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FluNetworkParams::getOpenLog(){
|
bool NetworkParams::getOpenLog(){
|
||||||
if(!_openLog.isNull()){
|
if(!_openLog.isNull()){
|
||||||
return _openLog.toBool();
|
return _openLog.toBool();
|
||||||
}
|
}
|
||||||
return FluNetwork::getInstance()->openLog();
|
return Network::getInstance()->openLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
FluDownloadParam::FluDownloadParam(QObject *parent)
|
FluDownloadParam::FluDownloadParam(QObject *parent)
|
||||||
@ -74,12 +74,12 @@ FluDownloadParam::FluDownloadParam(QString destPath,bool append,QObject *parent)
|
|||||||
this->_append = append;
|
this->_append = append;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams::FluNetworkParams(QObject *parent)
|
NetworkParams::NetworkParams(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams::FluNetworkParams(QString url,Type type,Method method,QObject *parent)
|
NetworkParams::NetworkParams(QString url,Type type,Method method,QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
this->_method = method;
|
this->_method = method;
|
||||||
@ -87,62 +87,62 @@ FluNetworkParams::FluNetworkParams(QString url,Type type,Method method,QObject *
|
|||||||
this->_type = type;
|
this->_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::add(QString key,QVariant val){
|
NetworkParams* NetworkParams::add(QString key,QVariant val){
|
||||||
_paramMap.insert(key,val);
|
_paramMap.insert(key,val);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::addFile(QString key,QVariant val){
|
NetworkParams* NetworkParams::addFile(QString key,QVariant val){
|
||||||
_fileMap.insert(key,val);
|
_fileMap.insert(key,val);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::addHeader(QString key,QVariant val){
|
NetworkParams* NetworkParams::addHeader(QString key,QVariant val){
|
||||||
_headerMap.insert(key,val);
|
_headerMap.insert(key,val);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::addQuery(QString key,QVariant val){
|
NetworkParams* NetworkParams::addQuery(QString key,QVariant val){
|
||||||
_queryMap.insert(key,val);
|
_queryMap.insert(key,val);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::setBody(QString val){
|
NetworkParams* NetworkParams::setBody(QString val){
|
||||||
_body = val;
|
_body = val;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::setTimeout(int val){
|
NetworkParams* NetworkParams::setTimeout(int val){
|
||||||
_timeout = val;
|
_timeout = val;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::setRetry(int val){
|
NetworkParams* NetworkParams::setRetry(int val){
|
||||||
_retry = val;
|
_retry = val;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::setCacheMode(int val){
|
NetworkParams* NetworkParams::setCacheMode(int val){
|
||||||
_cacheMode = val;
|
_cacheMode = val;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::toDownload(QString destPath,bool append){
|
NetworkParams* NetworkParams::toDownload(QString destPath,bool append){
|
||||||
_downloadParam = new FluDownloadParam(destPath,append,this);
|
_downloadParam = new FluDownloadParam(destPath,append,this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::bind(QObject* target){
|
NetworkParams* NetworkParams::bind(QObject* target){
|
||||||
_target = target;
|
_target = target;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetworkParams::openLog(QVariant val){
|
NetworkParams* NetworkParams::openLog(QVariant val){
|
||||||
_openLog = val;
|
_openLog = val;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FluNetworkParams::buildCacheKey(){
|
QString NetworkParams::buildCacheKey(){
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
obj.insert("url",_url);
|
obj.insert("url",_url);
|
||||||
obj.insert("method",method2String());
|
obj.insert("method",method2String());
|
||||||
@ -161,30 +161,30 @@ QString FluNetworkParams::buildCacheKey(){
|
|||||||
return QCryptographicHash::hash(data, QCryptographicHash::Sha256).toHex();
|
return QCryptographicHash::hash(data, QCryptographicHash::Sha256).toHex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetworkParams::go(FluNetworkCallable* callable){
|
void NetworkParams::go(NetworkCallable* callable){
|
||||||
QJSValueList data;
|
QJSValueList data;
|
||||||
data<<qjsEngine(callable)->newQObject(this);
|
data<<qjsEngine(callable)->newQObject(this);
|
||||||
FluNetwork::getInstance()->_interceptor.call(data);
|
Network::getInstance()->_interceptor.call(data);
|
||||||
if(_downloadParam){
|
if(_downloadParam){
|
||||||
FluNetwork::getInstance()->handleDownload(this,callable);
|
Network::getInstance()->handleDownload(this,callable);
|
||||||
}else{
|
}else{
|
||||||
FluNetwork::getInstance()->handle(this,callable);
|
Network::getInstance()->handle(this,callable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
|
void Network::handle(NetworkParams* params,NetworkCallable* c){
|
||||||
QPointer<FluNetworkCallable> callable(c);
|
QPointer<NetworkCallable> callable(c);
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
callable->start();
|
callable->start();
|
||||||
}
|
}
|
||||||
QString cacheKey = params->buildCacheKey();
|
QString cacheKey = params->buildCacheKey();
|
||||||
if(params->_cacheMode == FluNetworkType::CacheMode::FirstCacheThenRequest && cacheExists(cacheKey)){
|
if(params->_cacheMode == NetworkType::CacheMode::FirstCacheThenRequest && cacheExists(cacheKey)){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
callable->cache(readCache(cacheKey));
|
callable->cache(readCache(cacheKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(params->_cacheMode == FluNetworkType::CacheMode::IfNoneCacheRequest && cacheExists(cacheKey)){
|
if(params->_cacheMode == NetworkType::CacheMode::IfNoneCacheRequest && cacheExists(cacheKey)){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
callable->cache(readCache(cacheKey));
|
callable->cache(readCache(cacheKey));
|
||||||
callable->finish();
|
callable->finish();
|
||||||
@ -228,7 +228,7 @@ void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
disconnect(conn_quit);
|
disconnect(conn_quit);
|
||||||
}
|
}
|
||||||
QString response;
|
QString response;
|
||||||
if(params->_method == FluNetworkParams::METHOD_HEAD){
|
if(params->_method == NetworkParams::METHOD_HEAD){
|
||||||
response = headerList2String(reply->rawHeaderPairs());
|
response = headerList2String(reply->rawHeaderPairs());
|
||||||
}else{
|
}else{
|
||||||
if(reply->isOpen()){
|
if(reply->isOpen()){
|
||||||
@ -238,7 +238,7 @@ void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
if(httpStatus == 200){
|
if(httpStatus == 200){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
if(params->_cacheMode != FluNetworkType::CacheMode::NoCache){
|
if(params->_cacheMode != NetworkType::CacheMode::NoCache){
|
||||||
saveResponse(cacheKey,response);
|
saveResponse(cacheKey,response);
|
||||||
}
|
}
|
||||||
callable->success(response);
|
callable->success(response);
|
||||||
@ -248,7 +248,7 @@ void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
}else{
|
}else{
|
||||||
if(i == params->getRetry()-1){
|
if(i == params->getRetry()-1){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
if(params->_cacheMode == FluNetworkType::CacheMode::RequestFailedReadCache && cacheExists(cacheKey)){
|
if(params->_cacheMode == NetworkType::CacheMode::RequestFailedReadCache && cacheExists(cacheKey)){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
callable->cache(readCache(cacheKey));
|
callable->cache(readCache(cacheKey));
|
||||||
}
|
}
|
||||||
@ -267,8 +267,8 @@ void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::handleDownload(FluNetworkParams* params,FluNetworkCallable* c){
|
void Network::handleDownload(NetworkParams* params,NetworkCallable* c){
|
||||||
QPointer<FluNetworkCallable> callable(c);
|
QPointer<NetworkCallable> callable(c);
|
||||||
QThreadPool::globalInstance()->start([=](){
|
QThreadPool::globalInstance()->start([=](){
|
||||||
if(!callable.isNull()){
|
if(!callable.isNull()){
|
||||||
callable->start();
|
callable->start();
|
||||||
@ -391,7 +391,7 @@ void FluNetwork::handleDownload(FluNetworkParams* params,FluNetworkCallable* c){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FluNetwork::readCache(const QString& key){
|
QString Network::readCache(const QString& key){
|
||||||
auto filePath = getCacheFilePath(key);
|
auto filePath = getCacheFilePath(key);
|
||||||
QString result;
|
QString result;
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
@ -405,11 +405,11 @@ QString FluNetwork::readCache(const QString& key){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FluNetwork::cacheExists(const QString& key){
|
bool Network::cacheExists(const QString& key){
|
||||||
return QFile(getCacheFilePath(key)).exists();
|
return QFile(getCacheFilePath(key)).exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FluNetwork::getCacheFilePath(const QString& key){
|
QString Network::getCacheFilePath(const QString& key){
|
||||||
QDir cacheDir(_cacheDir);
|
QDir cacheDir(_cacheDir);
|
||||||
if(!cacheDir.exists()){
|
if(!cacheDir.exists()){
|
||||||
cacheDir.mkpath(_cacheDir);
|
cacheDir.mkpath(_cacheDir);
|
||||||
@ -417,7 +417,7 @@ QString FluNetwork::getCacheFilePath(const QString& key){
|
|||||||
return cacheDir.absoluteFilePath(key);
|
return cacheDir.absoluteFilePath(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FluNetwork::headerList2String(const QList<QNetworkReply::RawHeaderPair>& data){
|
QString Network::headerList2String(const QList<QNetworkReply::RawHeaderPair>& data){
|
||||||
QJsonObject object;
|
QJsonObject object;
|
||||||
for (auto it = data.constBegin(); it != data.constEnd(); ++it) {
|
for (auto it = data.constBegin(); it != data.constEnd(); ++it) {
|
||||||
object.insert(QString(it->first),QString(it->second));
|
object.insert(QString(it->first),QString(it->second));
|
||||||
@ -425,7 +425,7 @@ QString FluNetwork::headerList2String(const QList<QNetworkReply::RawHeaderPair>&
|
|||||||
return QJsonDocument(object).toJson(QJsonDocument::Compact);
|
return QJsonDocument(object).toJson(QJsonDocument::Compact);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FluNetwork::map2String(const QMap<QString, QVariant>& map){
|
QString Network::map2String(const QMap<QString, QVariant>& map){
|
||||||
QStringList parameters;
|
QStringList parameters;
|
||||||
for (auto it = map.constBegin(); it != map.constEnd(); ++it) {
|
for (auto it = map.constBegin(); it != map.constEnd(); ++it) {
|
||||||
parameters << QString("%1=%2").arg(it.key(), it.value().toString());
|
parameters << QString("%1=%2").arg(it.key(), it.value().toString());
|
||||||
@ -433,10 +433,10 @@ QString FluNetwork::map2String(const QMap<QString, QVariant>& map){
|
|||||||
return parameters.join(" ");
|
return parameters.join(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::sendRequest(QNetworkAccessManager* manager,QNetworkRequest request,FluNetworkParams* params,QNetworkReply*& reply,bool isFirst,QPointer<FluNetworkCallable> callable){
|
void Network::sendRequest(QNetworkAccessManager* manager,QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,bool isFirst,QPointer<NetworkCallable> callable){
|
||||||
QByteArray verb = params->method2String().toUtf8();
|
QByteArray verb = params->method2String().toUtf8();
|
||||||
switch (params->_type) {
|
switch (params->_type) {
|
||||||
case FluNetworkParams::TYPE_FORM:{
|
case NetworkParams::TYPE_FORM:{
|
||||||
bool isFormData = !params->_fileMap.isEmpty();
|
bool isFormData = !params->_fileMap.isEmpty();
|
||||||
if(isFormData){
|
if(isFormData){
|
||||||
QHttpMultiPart *multiPart = new QHttpMultiPart();
|
QHttpMultiPart *multiPart = new QHttpMultiPart();
|
||||||
@ -484,7 +484,7 @@ void FluNetwork::sendRequest(QNetworkAccessManager* manager,QNetworkRequest requ
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FluNetworkParams::TYPE_JSON:{
|
case NetworkParams::TYPE_JSON:{
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8"));
|
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8"));
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
for (const auto& each : params->_paramMap.toStdMap())
|
for (const auto& each : params->_paramMap.toStdMap())
|
||||||
@ -495,7 +495,7 @@ void FluNetwork::sendRequest(QNetworkAccessManager* manager,QNetworkRequest requ
|
|||||||
reply = manager->sendCustomRequest(request,verb,data);
|
reply = manager->sendCustomRequest(request,verb,data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FluNetworkParams::TYPE_JSONARRAY:{
|
case NetworkParams::TYPE_JSONARRAY:{
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8"));
|
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("application/json;charset=utf-8"));
|
||||||
QJsonArray jsonArray;
|
QJsonArray jsonArray;
|
||||||
for (const auto& each : params->_paramMap.toStdMap())
|
for (const auto& each : params->_paramMap.toStdMap())
|
||||||
@ -508,7 +508,7 @@ void FluNetwork::sendRequest(QNetworkAccessManager* manager,QNetworkRequest requ
|
|||||||
reply = manager->sendCustomRequest(request,params->method2String().toUtf8(),data);
|
reply = manager->sendCustomRequest(request,params->method2String().toUtf8(),data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FluNetworkParams::TYPE_BODY:{
|
case NetworkParams::TYPE_BODY:{
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("text/plain;charset=utf-8"));
|
request.setHeader(QNetworkRequest::ContentTypeHeader, QString("text/plain;charset=utf-8"));
|
||||||
QByteArray data = params->_body.toUtf8();
|
QByteArray data = params->_body.toUtf8();
|
||||||
reply = manager->sendCustomRequest(request,verb,data);
|
reply = manager->sendCustomRequest(request,verb,data);
|
||||||
@ -523,7 +523,7 @@ void FluNetwork::sendRequest(QNetworkAccessManager* manager,QNetworkRequest requ
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::printRequestStartLog(QNetworkRequest request,FluNetworkParams* params){
|
void Network::printRequestStartLog(QNetworkRequest request,NetworkParams* params){
|
||||||
if(!params->getOpenLog()){
|
if(!params->getOpenLog()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ void FluNetwork::printRequestStartLog(QNetworkRequest request,FluNetworkParams*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::printRequestEndLog(QNetworkRequest request,FluNetworkParams* params,QNetworkReply*& reply,const QString& response){
|
void Network::printRequestEndLog(QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,const QString& response){
|
||||||
if(!params->getOpenLog()){
|
if(!params->getOpenLog()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -560,7 +560,7 @@ void FluNetwork::printRequestEndLog(QNetworkRequest request,FluNetworkParams* pa
|
|||||||
qDebug()<<"<Result>"<<qUtf8Printable(response);
|
qDebug()<<"<Result>"<<qUtf8Printable(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::saveResponse(QString key,QString response){
|
void Network::saveResponse(QString key,QString response){
|
||||||
QSharedPointer<QFile> file(new QFile(getCacheFilePath(key)));
|
QSharedPointer<QFile> file(new QFile(getCacheFilePath(key)));
|
||||||
QIODevice::OpenMode mode = QIODevice::WriteOnly|QIODevice::Truncate;
|
QIODevice::OpenMode mode = QIODevice::WriteOnly|QIODevice::Truncate;
|
||||||
if (!file->open(mode))
|
if (!file->open(mode))
|
||||||
@ -570,7 +570,7 @@ void FluNetwork::saveResponse(QString key,QString response){
|
|||||||
file->write(response.toUtf8().toBase64());
|
file->write(response.toUtf8().toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::addHeaders(QNetworkRequest* request,const QMap<QString, QVariant>& headers){
|
void Network::addHeaders(QNetworkRequest* request,const QMap<QString, QVariant>& headers){
|
||||||
request->setHeader(QNetworkRequest::UserAgentHeader,QString::fromStdString("Mozilla/5.0 %1/%2").arg(QGuiApplication::applicationName(),QGuiApplication::applicationVersion()));
|
request->setHeader(QNetworkRequest::UserAgentHeader,QString::fromStdString("Mozilla/5.0 %1/%2").arg(QGuiApplication::applicationName(),QGuiApplication::applicationVersion()));
|
||||||
QMapIterator<QString, QVariant> iter(headers);
|
QMapIterator<QString, QVariant> iter(headers);
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
@ -580,7 +580,7 @@ void FluNetwork::addHeaders(QNetworkRequest* request,const QMap<QString, QVarian
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::addQueryParam(QUrl* url,const QMap<QString, QVariant>& params){
|
void Network::addQueryParam(QUrl* url,const QMap<QString, QVariant>& params){
|
||||||
QMapIterator<QString, QVariant> iter(params);
|
QMapIterator<QString, QVariant> iter(params);
|
||||||
QUrlQuery urlQuery(*url);
|
QUrlQuery urlQuery(*url);
|
||||||
while (iter.hasNext())
|
while (iter.hasNext())
|
||||||
@ -591,7 +591,7 @@ void FluNetwork::addQueryParam(QUrl* url,const QMap<QString, QVariant>& params){
|
|||||||
url->setQuery(urlQuery);
|
url->setQuery(urlQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetwork::FluNetwork(QObject *parent): QObject{parent}
|
Network::Network(QObject *parent): QObject{parent}
|
||||||
{
|
{
|
||||||
timeout(5000);
|
timeout(5000);
|
||||||
retry(3);
|
retry(3);
|
||||||
@ -599,78 +599,78 @@ FluNetwork::FluNetwork(QObject *parent): QObject{parent}
|
|||||||
cacheDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation).append(QDir::separator()).append("network"));
|
cacheDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation).append(QDir::separator()).append("network"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::get(const QString& url){
|
NetworkParams* Network::get(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_NONE,FluNetworkParams::METHOD_GET,this);
|
return new NetworkParams(url,NetworkParams::TYPE_NONE,NetworkParams::METHOD_GET,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::head(const QString& url){
|
NetworkParams* Network::head(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_NONE,FluNetworkParams::METHOD_HEAD,this);
|
return new NetworkParams(url,NetworkParams::TYPE_NONE,NetworkParams::METHOD_HEAD,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::postBody(const QString& url){
|
NetworkParams* Network::postBody(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_BODY,FluNetworkParams::METHOD_POST,this);
|
return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_POST,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::putBody(const QString& url){
|
NetworkParams* Network::putBody(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_BODY,FluNetworkParams::METHOD_PUT,this);
|
return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_PUT,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::patchBody(const QString& url){
|
NetworkParams* Network::patchBody(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_BODY,FluNetworkParams::METHOD_PATCH,this);
|
return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_PATCH,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::deleteBody(const QString& url){
|
NetworkParams* Network::deleteBody(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_BODY,FluNetworkParams::METHOD_DELETE,this);
|
return new NetworkParams(url,NetworkParams::TYPE_BODY,NetworkParams::METHOD_DELETE,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::postForm(const QString& url){
|
NetworkParams* Network::postForm(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_FORM,FluNetworkParams::METHOD_POST,this);
|
return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_POST,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::putForm(const QString& url){
|
NetworkParams* Network::putForm(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_FORM,FluNetworkParams::METHOD_PUT,this);
|
return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_PUT,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::patchForm(const QString& url){
|
NetworkParams* Network::patchForm(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_FORM,FluNetworkParams::METHOD_PATCH,this);
|
return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_PATCH,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::deleteForm(const QString& url){
|
NetworkParams* Network::deleteForm(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_FORM,FluNetworkParams::METHOD_DELETE,this);
|
return new NetworkParams(url,NetworkParams::TYPE_FORM,NetworkParams::METHOD_DELETE,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::postJson(const QString& url){
|
NetworkParams* Network::postJson(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSON,FluNetworkParams::METHOD_POST,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_POST,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::putJson(const QString& url){
|
NetworkParams* Network::putJson(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSON,FluNetworkParams::METHOD_PUT,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_PUT,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::patchJson(const QString& url){
|
NetworkParams* Network::patchJson(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSON,FluNetworkParams::METHOD_PATCH,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_PATCH,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::deleteJson(const QString& url){
|
NetworkParams* Network::deleteJson(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSON,FluNetworkParams::METHOD_DELETE,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSON,NetworkParams::METHOD_DELETE,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::postJsonArray(const QString& url){
|
NetworkParams* Network::postJsonArray(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSONARRAY,FluNetworkParams::METHOD_POST,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_POST,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::putJsonArray(const QString& url){
|
NetworkParams* Network::putJsonArray(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSONARRAY,FluNetworkParams::METHOD_PUT,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_PUT,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::patchJsonArray(const QString& url){
|
NetworkParams* Network::patchJsonArray(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSONARRAY,FluNetworkParams::METHOD_PATCH,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_PATCH,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNetworkParams* FluNetwork::deleteJsonArray(const QString& url){
|
NetworkParams* Network::deleteJsonArray(const QString& url){
|
||||||
return new FluNetworkParams(url,FluNetworkParams::TYPE_JSONARRAY,FluNetworkParams::METHOD_DELETE,this);
|
return new NetworkParams(url,NetworkParams::TYPE_JSONARRAY,NetworkParams::METHOD_DELETE,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluNetwork::setInterceptor(QJSValue interceptor){
|
void Network::setInterceptor(QJSValue interceptor){
|
||||||
this->_interceptor = interceptor;
|
this->_interceptor = interceptor;
|
||||||
}
|
}
|
169
example/src/helper/Network.h
Normal file
169
example/src/helper/Network.h
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
#ifndef NETWORK_H
|
||||||
|
#define NETWORK_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonValue>
|
||||||
|
#include <QJSValue>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include "src/stdafx.h"
|
||||||
|
#include "src/singleton.h"
|
||||||
|
|
||||||
|
namespace NetworkType {
|
||||||
|
Q_NAMESPACE
|
||||||
|
enum CacheMode {
|
||||||
|
NoCache = 0x0000,
|
||||||
|
RequestFailedReadCache = 0x0001,
|
||||||
|
IfNoneCacheRequest = 0x0002,
|
||||||
|
FirstCacheThenRequest = 0x0004,
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(CacheMode)
|
||||||
|
QML_NAMED_ELEMENT(NetworkType)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The NetworkCallable class
|
||||||
|
*/
|
||||||
|
class NetworkCallable : public QObject{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_NAMED_ELEMENT(NetworkCallable)
|
||||||
|
public:
|
||||||
|
explicit NetworkCallable(QObject *parent = nullptr);
|
||||||
|
Q_SIGNAL void start();
|
||||||
|
Q_SIGNAL void finish();
|
||||||
|
Q_SIGNAL void error(int status,QString errorString,QString result);
|
||||||
|
Q_SIGNAL void success(QString result);
|
||||||
|
Q_SIGNAL void cache(QString result);
|
||||||
|
Q_SIGNAL void uploadProgress(qint64 sent, qint64 total);
|
||||||
|
Q_SIGNAL void downloadProgress(qint64 recv, qint64 total);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The FluDownloadParam class
|
||||||
|
*/
|
||||||
|
class FluDownloadParam : public QObject{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit FluDownloadParam(QObject *parent = nullptr);
|
||||||
|
FluDownloadParam(QString destPath,bool append,QObject *parent = nullptr);
|
||||||
|
public:
|
||||||
|
QString _destPath;
|
||||||
|
bool _append;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The NetworkParams class
|
||||||
|
*/
|
||||||
|
class NetworkParams : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
QML_NAMED_ELEMENT(NetworkParams)
|
||||||
|
public:
|
||||||
|
enum Method{
|
||||||
|
METHOD_GET,
|
||||||
|
METHOD_HEAD,
|
||||||
|
METHOD_POST,
|
||||||
|
METHOD_PUT,
|
||||||
|
METHOD_PATCH,
|
||||||
|
METHOD_DELETE
|
||||||
|
};
|
||||||
|
enum Type{
|
||||||
|
TYPE_NONE,
|
||||||
|
TYPE_FORM,
|
||||||
|
TYPE_JSON,
|
||||||
|
TYPE_JSONARRAY,
|
||||||
|
TYPE_BODY
|
||||||
|
};
|
||||||
|
explicit NetworkParams(QObject *parent = nullptr);
|
||||||
|
NetworkParams(QString url,Type type,Method method,QObject *parent = nullptr);
|
||||||
|
Q_INVOKABLE NetworkParams* addQuery(QString key,QVariant val);
|
||||||
|
Q_INVOKABLE NetworkParams* addHeader(QString key,QVariant val);
|
||||||
|
Q_INVOKABLE NetworkParams* add(QString key,QVariant val);
|
||||||
|
Q_INVOKABLE NetworkParams* addFile(QString key,QVariant val);
|
||||||
|
Q_INVOKABLE NetworkParams* setBody(QString val);
|
||||||
|
Q_INVOKABLE NetworkParams* setTimeout(int val);
|
||||||
|
Q_INVOKABLE NetworkParams* setRetry(int val);
|
||||||
|
Q_INVOKABLE NetworkParams* setCacheMode(int val);
|
||||||
|
Q_INVOKABLE NetworkParams* toDownload(QString destPath,bool append = false);
|
||||||
|
Q_INVOKABLE NetworkParams* bind(QObject* target);
|
||||||
|
Q_INVOKABLE NetworkParams* openLog(QVariant val);
|
||||||
|
Q_INVOKABLE void go(NetworkCallable* result);
|
||||||
|
QString buildCacheKey();
|
||||||
|
QString method2String();
|
||||||
|
int getTimeout();
|
||||||
|
int getRetry();
|
||||||
|
bool getOpenLog();
|
||||||
|
public:
|
||||||
|
FluDownloadParam* _downloadParam = nullptr;
|
||||||
|
QObject* _target = nullptr;
|
||||||
|
Method _method;
|
||||||
|
Type _type;
|
||||||
|
QString _url;
|
||||||
|
QString _body;
|
||||||
|
QMap<QString, QVariant> _queryMap;
|
||||||
|
QMap<QString, QVariant> _headerMap;
|
||||||
|
QMap<QString, QVariant> _paramMap;
|
||||||
|
QMap<QString, QVariant> _fileMap;
|
||||||
|
int _timeout = -1;
|
||||||
|
int _retry = -1;
|
||||||
|
QVariant _openLog;
|
||||||
|
int _cacheMode = NetworkType::CacheMode::NoCache;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The Network class
|
||||||
|
*/
|
||||||
|
class Network : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(int,timeout)
|
||||||
|
Q_PROPERTY_AUTO(int,retry)
|
||||||
|
Q_PROPERTY_AUTO(QString,cacheDir)
|
||||||
|
Q_PROPERTY_AUTO(bool,openLog)
|
||||||
|
QML_NAMED_ELEMENT(Network)
|
||||||
|
QML_SINGLETON
|
||||||
|
private:
|
||||||
|
explicit Network(QObject *parent = nullptr);
|
||||||
|
public:
|
||||||
|
SINGLETON(Network)
|
||||||
|
static Network *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
|
||||||
|
Q_INVOKABLE NetworkParams* get(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* head(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* postBody(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* putBody(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* patchBody(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* deleteBody(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* postForm(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* putForm(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* patchForm(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* deleteForm(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* postJson(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* putJson(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* patchJson(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* deleteJson(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* postJsonArray(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* putJsonArray(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* patchJsonArray(const QString& url);
|
||||||
|
Q_INVOKABLE NetworkParams* deleteJsonArray(const QString& url);
|
||||||
|
Q_INVOKABLE void setInterceptor(QJSValue interceptor);
|
||||||
|
void handle(NetworkParams* params,NetworkCallable* result);
|
||||||
|
void handleDownload(NetworkParams* params,NetworkCallable* result);
|
||||||
|
private:
|
||||||
|
void sendRequest(QNetworkAccessManager* manager,QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,bool isFirst,QPointer<NetworkCallable> callable);
|
||||||
|
void addQueryParam(QUrl* url,const QMap<QString, QVariant>& params);
|
||||||
|
void addHeaders(QNetworkRequest* request,const QMap<QString, QVariant>& headers);
|
||||||
|
void saveResponse(QString key,QString response);
|
||||||
|
QString readCache(const QString& key);
|
||||||
|
bool cacheExists(const QString& key);
|
||||||
|
QString getCacheFilePath(const QString& key);
|
||||||
|
QString map2String(const QMap<QString, QVariant>& map);
|
||||||
|
QString headerList2String(const QList<QNetworkReply::RawHeaderPair>& data);
|
||||||
|
void printRequestStartLog(QNetworkRequest request,NetworkParams* params);
|
||||||
|
void printRequestEndLog(QNetworkRequest request,NetworkParams* params,QNetworkReply*& reply,const QString& response);
|
||||||
|
public:
|
||||||
|
QJSValue _interceptor;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // Network_H
|
@ -17,6 +17,7 @@
|
|||||||
#include "src/helper/SettingsHelper.h"
|
#include "src/helper/SettingsHelper.h"
|
||||||
#include "src/helper/InitalizrHelper.h"
|
#include "src/helper/InitalizrHelper.h"
|
||||||
#include "src/helper/TranslateHelper.h"
|
#include "src/helper/TranslateHelper.h"
|
||||||
|
#include "src/helper/Network.h"
|
||||||
|
|
||||||
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 2, 0))
|
#if (QT_VERSION > QT_VERSION_CHECK(6, 2, 0))
|
||||||
@ -65,18 +66,25 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
const char *uri = "example";
|
||||||
|
int major = 1;
|
||||||
|
int minor = 0;
|
||||||
|
//@uri example
|
||||||
|
qmlRegisterType<CircularReveal>(uri, major, minor, "CircularReveal");
|
||||||
|
qmlRegisterType<FileWatcher>(uri, major, minor, "FileWatcher");
|
||||||
|
qmlRegisterType<FpsItem>(uri, major, minor, "FpsItem");
|
||||||
|
qmlRegisterType<NetworkCallable>(uri,major,minor,"NetworkCallable");
|
||||||
|
qmlRegisterType<NetworkParams>(uri,major,minor,"NetworkParams");
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
TranslateHelper::getInstance()->init(&engine);
|
TranslateHelper::getInstance()->init(&engine);
|
||||||
engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance());
|
engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance());
|
||||||
engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::getInstance());
|
engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::getInstance());
|
||||||
engine.rootContext()->setContextProperty("InitalizrHelper",InitalizrHelper::getInstance());
|
engine.rootContext()->setContextProperty("InitalizrHelper",InitalizrHelper::getInstance());
|
||||||
engine.rootContext()->setContextProperty("TranslateHelper",TranslateHelper::getInstance());
|
engine.rootContext()->setContextProperty("TranslateHelper",TranslateHelper::getInstance());
|
||||||
|
engine.rootContext()->setContextProperty("Network",Network::getInstance());
|
||||||
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||||
FluentUI::getInstance()->registerTypes(&engine);
|
FluentUI::getInstance()->registerTypes(&engine);
|
||||||
#endif
|
#endif
|
||||||
qmlRegisterType<CircularReveal>("example", 1, 0, "CircularReveal");
|
|
||||||
qmlRegisterType<FileWatcher>("example", 1, 0, "FileWatcher");
|
|
||||||
qmlRegisterType<FpsItem>("example", 1, 0, "FpsItem");
|
|
||||||
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
|
@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
#设置版本号
|
#设置版本号
|
||||||
add_definitions(-DFLUENTUI_VERSION=1,7,3,0)
|
add_definitions(-DFLUENTUI_VERSION=1,7,4,0)
|
||||||
|
|
||||||
if (FLUENTUI_BUILD_STATIC_LIB)
|
if (FLUENTUI_BUILD_STATIC_LIB)
|
||||||
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
||||||
|
11
src/Def.h
11
src/Def.h
@ -4,17 +4,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtQml/qqml.h>
|
#include <QtQml/qqml.h>
|
||||||
|
|
||||||
namespace FluNetworkType {
|
|
||||||
Q_NAMESPACE
|
|
||||||
enum CacheMode {
|
|
||||||
NoCache = 0x0000,
|
|
||||||
RequestFailedReadCache = 0x0001,
|
|
||||||
IfNoneCacheRequest = 0x0002,
|
|
||||||
FirstCacheThenRequest = 0x0004,
|
|
||||||
};
|
|
||||||
Q_ENUM_NS(CacheMode)
|
|
||||||
QML_NAMED_ELEMENT(FluNetworkType)
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace FluThemeType {
|
namespace FluThemeType {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
|
158
src/FluNetwork.h
158
src/FluNetwork.h
@ -1,158 +0,0 @@
|
|||||||
#ifndef FLUNETWORK_H
|
|
||||||
#define FLUNETWORK_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QtQml/qqml.h>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QJsonValue>
|
|
||||||
#include <QJSValue>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include "Def.h"
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "singleton.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The NetworkCallable class
|
|
||||||
*/
|
|
||||||
class FluNetworkCallable : public QObject{
|
|
||||||
Q_OBJECT
|
|
||||||
QML_NAMED_ELEMENT(FluNetworkCallable)
|
|
||||||
public:
|
|
||||||
explicit FluNetworkCallable(QObject *parent = nullptr);
|
|
||||||
Q_SIGNAL void start();
|
|
||||||
Q_SIGNAL void finish();
|
|
||||||
Q_SIGNAL void error(int status,QString errorString,QString result);
|
|
||||||
Q_SIGNAL void success(QString result);
|
|
||||||
Q_SIGNAL void cache(QString result);
|
|
||||||
Q_SIGNAL void uploadProgress(qint64 sent, qint64 total);
|
|
||||||
Q_SIGNAL void downloadProgress(qint64 recv, qint64 total);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The FluDownloadParam class
|
|
||||||
*/
|
|
||||||
class FluDownloadParam : public QObject{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit FluDownloadParam(QObject *parent = nullptr);
|
|
||||||
FluDownloadParam(QString destPath,bool append,QObject *parent = nullptr);
|
|
||||||
public:
|
|
||||||
QString _destPath;
|
|
||||||
bool _append;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The FluNetworkParams class
|
|
||||||
*/
|
|
||||||
class FluNetworkParams : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
QML_NAMED_ELEMENT(FluNetworkParams)
|
|
||||||
public:
|
|
||||||
enum Method{
|
|
||||||
METHOD_GET,
|
|
||||||
METHOD_HEAD,
|
|
||||||
METHOD_POST,
|
|
||||||
METHOD_PUT,
|
|
||||||
METHOD_PATCH,
|
|
||||||
METHOD_DELETE
|
|
||||||
};
|
|
||||||
enum Type{
|
|
||||||
TYPE_NONE,
|
|
||||||
TYPE_FORM,
|
|
||||||
TYPE_JSON,
|
|
||||||
TYPE_JSONARRAY,
|
|
||||||
TYPE_BODY
|
|
||||||
};
|
|
||||||
explicit FluNetworkParams(QObject *parent = nullptr);
|
|
||||||
FluNetworkParams(QString url,Type type,Method method,QObject *parent = nullptr);
|
|
||||||
Q_INVOKABLE FluNetworkParams* addQuery(QString key,QVariant val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* addHeader(QString key,QVariant val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* add(QString key,QVariant val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* addFile(QString key,QVariant val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* setBody(QString val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* setTimeout(int val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* setRetry(int val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* setCacheMode(int val);
|
|
||||||
Q_INVOKABLE FluNetworkParams* toDownload(QString destPath,bool append = false);
|
|
||||||
Q_INVOKABLE FluNetworkParams* bind(QObject* target);
|
|
||||||
Q_INVOKABLE FluNetworkParams* openLog(QVariant val);
|
|
||||||
Q_INVOKABLE void go(FluNetworkCallable* result);
|
|
||||||
QString buildCacheKey();
|
|
||||||
QString method2String();
|
|
||||||
int getTimeout();
|
|
||||||
int getRetry();
|
|
||||||
bool getOpenLog();
|
|
||||||
public:
|
|
||||||
FluDownloadParam* _downloadParam = nullptr;
|
|
||||||
QObject* _target = nullptr;
|
|
||||||
Method _method;
|
|
||||||
Type _type;
|
|
||||||
QString _url;
|
|
||||||
QString _body;
|
|
||||||
QMap<QString, QVariant> _queryMap;
|
|
||||||
QMap<QString, QVariant> _headerMap;
|
|
||||||
QMap<QString, QVariant> _paramMap;
|
|
||||||
QMap<QString, QVariant> _fileMap;
|
|
||||||
int _timeout = -1;
|
|
||||||
int _retry = -1;
|
|
||||||
QVariant _openLog;
|
|
||||||
int _cacheMode = FluNetworkType::CacheMode::NoCache;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The FluNetwork class
|
|
||||||
*/
|
|
||||||
class FluNetwork : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY_AUTO(int,timeout)
|
|
||||||
Q_PROPERTY_AUTO(int,retry)
|
|
||||||
Q_PROPERTY_AUTO(QString,cacheDir)
|
|
||||||
Q_PROPERTY_AUTO(bool,openLog)
|
|
||||||
QML_NAMED_ELEMENT(FluNetwork)
|
|
||||||
QML_SINGLETON
|
|
||||||
private:
|
|
||||||
explicit FluNetwork(QObject *parent = nullptr);
|
|
||||||
public:
|
|
||||||
SINGLETON(FluNetwork)
|
|
||||||
static FluNetwork *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
|
|
||||||
Q_INVOKABLE FluNetworkParams* get(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* head(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* postBody(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* putBody(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* patchBody(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* deleteBody(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* postForm(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* putForm(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* patchForm(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* deleteForm(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* postJson(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* putJson(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* patchJson(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* deleteJson(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* postJsonArray(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* putJsonArray(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* patchJsonArray(const QString& url);
|
|
||||||
Q_INVOKABLE FluNetworkParams* deleteJsonArray(const QString& url);
|
|
||||||
Q_INVOKABLE void setInterceptor(QJSValue interceptor);
|
|
||||||
void handle(FluNetworkParams* params,FluNetworkCallable* result);
|
|
||||||
void handleDownload(FluNetworkParams* params,FluNetworkCallable* result);
|
|
||||||
private:
|
|
||||||
void sendRequest(QNetworkAccessManager* manager,QNetworkRequest request,FluNetworkParams* params,QNetworkReply*& reply,bool isFirst,QPointer<FluNetworkCallable> callable);
|
|
||||||
void addQueryParam(QUrl* url,const QMap<QString, QVariant>& params);
|
|
||||||
void addHeaders(QNetworkRequest* request,const QMap<QString, QVariant>& headers);
|
|
||||||
void saveResponse(QString key,QString response);
|
|
||||||
QString readCache(const QString& key);
|
|
||||||
bool cacheExists(const QString& key);
|
|
||||||
QString getCacheFilePath(const QString& key);
|
|
||||||
QString map2String(const QMap<QString, QVariant>& map);
|
|
||||||
QString headerList2String(const QList<QNetworkReply::RawHeaderPair>& data);
|
|
||||||
void printRequestStartLog(QNetworkRequest request,FluNetworkParams* params);
|
|
||||||
void printRequestEndLog(QNetworkRequest request,FluNetworkParams* params,QNetworkReply*& reply,const QString& response);
|
|
||||||
public:
|
|
||||||
QJSValue _interceptor;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FLUNETWORK_H
|
|
@ -12,7 +12,6 @@
|
|||||||
#include "FluEventBus.h"
|
#include "FluEventBus.h"
|
||||||
#include "FluTreeModel.h"
|
#include "FluTreeModel.h"
|
||||||
#include "FluRectangle.h"
|
#include "FluRectangle.h"
|
||||||
#include "FluNetwork.h"
|
|
||||||
#include "FluFramelessHelper.h"
|
#include "FluFramelessHelper.h"
|
||||||
#include "FluQrCodeItem.h"
|
#include "FluQrCodeItem.h"
|
||||||
#include "FluTableSortProxyModel.h"
|
#include "FluTableSortProxyModel.h"
|
||||||
@ -32,8 +31,6 @@ void FluentUI::registerTypes(const char *uri){
|
|||||||
qmlRegisterType<FluEvent>(uri,major,minor,"FluEvent");
|
qmlRegisterType<FluEvent>(uri,major,minor,"FluEvent");
|
||||||
qmlRegisterType<FluTreeModel>(uri,major,minor,"FluTreeModel");
|
qmlRegisterType<FluTreeModel>(uri,major,minor,"FluTreeModel");
|
||||||
qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle");
|
qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle");
|
||||||
qmlRegisterType<FluNetworkCallable>(uri,major,minor,"FluNetworkCallable");
|
|
||||||
qmlRegisterType<FluNetworkParams>(uri,major,minor,"FluNetworkParams");
|
|
||||||
qmlRegisterType<FluFramelessHelper>(uri,major,minor,"FluFramelessHelper");
|
qmlRegisterType<FluFramelessHelper>(uri,major,minor,"FluFramelessHelper");
|
||||||
qmlRegisterType<FluTableSortProxyModel>(uri,major,minor,"FluTableSortProxyModel");
|
qmlRegisterType<FluTableSortProxyModel>(uri,major,minor,"FluTableSortProxyModel");
|
||||||
|
|
||||||
@ -140,7 +137,6 @@ void FluentUI::registerTypes(const char *uri){
|
|||||||
qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri,major,minor,"FluTabViewType", "Access to enums & flags only");
|
qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri,major,minor,"FluTabViewType", "Access to enums & flags only");
|
||||||
qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri,major,minor,"FluNavigationViewType", "Access to enums & flags only");
|
qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri,major,minor,"FluNavigationViewType", "Access to enums & flags only");
|
||||||
qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri,major,minor,"FluTimelineType", "Access to enums & flags only");
|
qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri,major,minor,"FluTimelineType", "Access to enums & flags only");
|
||||||
qmlRegisterUncreatableMetaObject(FluNetworkType::staticMetaObject, uri,major,minor,"FluNetworkType", "Access to enums & flags only");
|
|
||||||
|
|
||||||
qmlRegisterModule(uri,major,minor);
|
qmlRegisterModule(uri,major,minor);
|
||||||
#endif
|
#endif
|
||||||
@ -158,5 +154,4 @@ void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
|
|||||||
engine->rootContext()->setContextProperty("FluTools",FluTools::getInstance());
|
engine->rootContext()->setContextProperty("FluTools",FluTools::getInstance());
|
||||||
engine->rootContext()->setContextProperty("FluTextStyle",FluTextStyle::getInstance());
|
engine->rootContext()->setContextProperty("FluTextStyle",FluTextStyle::getInstance());
|
||||||
engine->rootContext()->setContextProperty("FluEventBus",FluEventBus::getInstance());
|
engine->rootContext()->setContextProperty("FluEventBus",FluEventBus::getInstance());
|
||||||
engine->rootContext()->setContextProperty("FluNetwork",FluNetwork::getInstance());
|
|
||||||
}
|
}
|
||||||
|
@ -109,128 +109,6 @@ Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
|
||||||
name: "FluNetworkCallable"
|
|
||||||
prototype: "QObject"
|
|
||||||
exports: ["FluentUI/FluNetworkCallable 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: "uploadProgress"
|
|
||||||
Parameter { name: "sent"; type: "qlonglong" }
|
|
||||||
Parameter { name: "total"; type: "qlonglong" }
|
|
||||||
}
|
|
||||||
Signal {
|
|
||||||
name: "downloadProgress"
|
|
||||||
Parameter { name: "recv"; type: "qlonglong" }
|
|
||||||
Parameter { name: "total"; type: "qlonglong" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
|
||||||
name: "FluNetworkParams"
|
|
||||||
prototype: "QObject"
|
|
||||||
exports: ["FluentUI/FluNetworkParams 1.0"]
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Method {
|
|
||||||
name: "addQuery"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "key"; type: "string" }
|
|
||||||
Parameter { name: "val"; type: "QVariant" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "addHeader"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "key"; type: "string" }
|
|
||||||
Parameter { name: "val"; type: "QVariant" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "add"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "key"; type: "string" }
|
|
||||||
Parameter { name: "val"; type: "QVariant" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "addFile"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "key"; type: "string" }
|
|
||||||
Parameter { name: "val"; type: "QVariant" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "setBody"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "val"; type: "string" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "setTimeout"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "val"; type: "int" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "setRetry"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "val"; type: "int" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "setCacheMode"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "val"; type: "int" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "toDownload"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "destPath"; type: "string" }
|
|
||||||
Parameter { name: "append"; type: "bool" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "toDownload"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "destPath"; type: "string" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "bind"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "target"; type: "QObject"; isPointer: true }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "openLog"
|
|
||||||
type: "FluNetworkParams*"
|
|
||||||
Parameter { name: "val"; type: "QVariant" }
|
|
||||||
}
|
|
||||||
Method {
|
|
||||||
name: "go"
|
|
||||||
Parameter { name: "result"; type: "FluNetworkCallable"; isPointer: true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
|
||||||
name: "FluNetworkType"
|
|
||||||
exports: ["FluentUI/FluNetworkType 1.0"]
|
|
||||||
isCreatable: false
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Enum {
|
|
||||||
name: "CacheMode"
|
|
||||||
values: {
|
|
||||||
"NoCache": 0,
|
|
||||||
"RequestFailedReadCache": 1,
|
|
||||||
"IfNoneCacheRequest": 2,
|
|
||||||
"FirstCacheThenRequest": 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
Component {
|
||||||
name: "FluPageType"
|
name: "FluPageType"
|
||||||
exports: ["FluentUI/FluPageType 1.0"]
|
exports: ["FluentUI/FluPageType 1.0"]
|
||||||
@ -454,27 +332,6 @@ Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
|
||||||
name: "FluViewModel"
|
|
||||||
prototype: "QObject"
|
|
||||||
exports: ["FluentUI/FluViewModel 1.0"]
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Property { name: "scope"; type: "int" }
|
|
||||||
Signal { name: "initData" }
|
|
||||||
}
|
|
||||||
Component {
|
|
||||||
name: "FluViewModelType"
|
|
||||||
exports: ["FluentUI/FluViewModelType 1.0"]
|
|
||||||
isCreatable: false
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Enum {
|
|
||||||
name: "Scope"
|
|
||||||
values: {
|
|
||||||
"Window": 0,
|
|
||||||
"Application": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
Component {
|
||||||
name: "FluWatermark"
|
name: "FluWatermark"
|
||||||
defaultProperty: "data"
|
defaultProperty: "data"
|
||||||
@ -488,22 +345,6 @@ Module {
|
|||||||
Property { name: "rotate"; type: "int" }
|
Property { name: "rotate"; type: "int" }
|
||||||
Property { name: "textSize"; type: "int" }
|
Property { name: "textSize"; type: "int" }
|
||||||
}
|
}
|
||||||
Component {
|
|
||||||
name: "FluWindowLifecycle"
|
|
||||||
prototype: "QObject"
|
|
||||||
exports: ["FluentUI/FluWindowLifecycle 1.0"]
|
|
||||||
exportMetaObjectRevisions: [0]
|
|
||||||
Method {
|
|
||||||
name: "onCompleted"
|
|
||||||
Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
|
|
||||||
}
|
|
||||||
Method { name: "onDestruction" }
|
|
||||||
Method {
|
|
||||||
name: "onVisible"
|
|
||||||
Parameter { name: "visible"; type: "bool" }
|
|
||||||
}
|
|
||||||
Method { name: "onDestoryOnClose" }
|
|
||||||
}
|
|
||||||
Component {
|
Component {
|
||||||
name: "FluWindowType"
|
name: "FluWindowType"
|
||||||
exports: ["FluentUI/FluWindowType 1.0"]
|
exports: ["FluentUI/FluWindowType 1.0"]
|
||||||
@ -2401,12 +2242,12 @@ Module {
|
|||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
isComposite: true
|
isComposite: true
|
||||||
defaultProperty: "contentData"
|
defaultProperty: "contentData"
|
||||||
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
|
|
||||||
Property { name: "paddings"; type: "int" }
|
Property { name: "paddings"; type: "int" }
|
||||||
Property { name: "leftPadding"; type: "int" }
|
Property { name: "leftPadding"; type: "int" }
|
||||||
Property { name: "rightPadding"; type: "int" }
|
Property { name: "rightPadding"; type: "int" }
|
||||||
Property { name: "topPadding"; type: "int" }
|
Property { name: "topPadding"; type: "int" }
|
||||||
Property { name: "bottomPadding"; type: "int" }
|
Property { name: "bottomPadding"; type: "int" }
|
||||||
|
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
prototype: "QQuickTextField"
|
prototype: "QQuickTextField"
|
||||||
@ -2423,6 +2264,11 @@ Module {
|
|||||||
name: "itemClicked"
|
name: "itemClicked"
|
||||||
Parameter { name: "data"; type: "QVariant" }
|
Parameter { name: "data"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
|
Method {
|
||||||
|
name: "updateText"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "text"; type: "QVariant" }
|
||||||
|
}
|
||||||
Property { name: "disabled"; type: "bool" }
|
Property { name: "disabled"; type: "bool" }
|
||||||
Property { name: "iconSource"; type: "int" }
|
Property { name: "iconSource"; type: "int" }
|
||||||
Property { name: "normalColor"; type: "QColor" }
|
Property { name: "normalColor"; type: "QColor" }
|
||||||
@ -2903,6 +2749,15 @@ Module {
|
|||||||
isComposite: true
|
isComposite: true
|
||||||
defaultProperty: "data"
|
defaultProperty: "data"
|
||||||
}
|
}
|
||||||
|
Component {
|
||||||
|
prototype: "QObject"
|
||||||
|
name: "FluentUI/FluLauncher 1.0"
|
||||||
|
exports: ["FluentUI/FluLauncher 1.0"]
|
||||||
|
exportMetaObjectRevisions: [0]
|
||||||
|
isComposite: true
|
||||||
|
defaultProperty: "children"
|
||||||
|
Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
|
||||||
|
}
|
||||||
Component {
|
Component {
|
||||||
prototype: "QQuickLoader"
|
prototype: "QQuickLoader"
|
||||||
name: "FluentUI/FluLoader 1.0"
|
name: "FluentUI/FluLoader 1.0"
|
||||||
@ -3002,15 +2857,15 @@ Module {
|
|||||||
defaultProperty: "data"
|
defaultProperty: "data"
|
||||||
Property { name: "logo"; type: "QUrl" }
|
Property { name: "logo"; type: "QUrl" }
|
||||||
Property { name: "title"; type: "string" }
|
Property { name: "title"; type: "string" }
|
||||||
Property { name: "items"; type: "FluObject_QMLTYPE_166"; isPointer: true }
|
Property { name: "items"; type: "FluObject_QMLTYPE_126"; isPointer: true }
|
||||||
Property { name: "footerItems"; type: "FluObject_QMLTYPE_166"; isPointer: true }
|
Property { name: "footerItems"; type: "FluObject_QMLTYPE_126"; isPointer: true }
|
||||||
Property { name: "displayMode"; type: "int" }
|
Property { name: "displayMode"; type: "int" }
|
||||||
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
|
||||||
Property { name: "topPadding"; type: "int" }
|
Property { name: "topPadding"; type: "int" }
|
||||||
Property { name: "pageMode"; type: "int" }
|
Property { name: "pageMode"; type: "int" }
|
||||||
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_40"; isPointer: true }
|
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_39"; isPointer: true }
|
||||||
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_40"; isPointer: true }
|
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_39"; isPointer: true }
|
||||||
Property { name: "navCompactWidth"; type: "int" }
|
Property { name: "navCompactWidth"; type: "int" }
|
||||||
Property { name: "navTopMargin"; type: "int" }
|
Property { name: "navTopMargin"; type: "int" }
|
||||||
Property { name: "cellHeight"; type: "int" }
|
Property { name: "cellHeight"; type: "int" }
|
||||||
@ -3367,6 +3222,39 @@ Module {
|
|||||||
Method { name: "showEmptyView"; type: "QVariant" }
|
Method { name: "showEmptyView"; type: "QVariant" }
|
||||||
Method { name: "showErrorView"; type: "QVariant" }
|
Method { name: "showErrorView"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
|
Component {
|
||||||
|
prototype: "QObject"
|
||||||
|
name: "FluentUI/FluRouter 1.0"
|
||||||
|
exports: ["FluentUI/FluRouter 1.0"]
|
||||||
|
exportMetaObjectRevisions: [0]
|
||||||
|
isComposite: true
|
||||||
|
isCreatable: false
|
||||||
|
isSingleton: true
|
||||||
|
Property { name: "routes"; type: "QVariant" }
|
||||||
|
Property { name: "windows"; type: "QVariant" }
|
||||||
|
Method {
|
||||||
|
name: "addWindow"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "window"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "removeWindow"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "window"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "exit"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "retCode"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "navigate"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "route"; type: "QVariant" }
|
||||||
|
Parameter { name: "argument"; type: "QVariant" }
|
||||||
|
Parameter { name: "windowRegister"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
}
|
||||||
Component {
|
Component {
|
||||||
prototype: "QQuickScrollBar"
|
prototype: "QQuickScrollBar"
|
||||||
name: "FluentUI/FluScrollBar 1.0"
|
name: "FluentUI/FluScrollBar 1.0"
|
||||||
@ -3825,7 +3713,6 @@ Module {
|
|||||||
exportMetaObjectRevisions: [0]
|
exportMetaObjectRevisions: [0]
|
||||||
isComposite: true
|
isComposite: true
|
||||||
defaultProperty: "contentData"
|
defaultProperty: "contentData"
|
||||||
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
|
|
||||||
Property { name: "windowIcon"; type: "string" }
|
Property { name: "windowIcon"; type: "string" }
|
||||||
Property { name: "launchMode"; type: "int" }
|
Property { name: "launchMode"; type: "int" }
|
||||||
Property { name: "argument"; type: "QVariant" }
|
Property { name: "argument"; type: "QVariant" }
|
||||||
@ -3844,7 +3731,7 @@ Module {
|
|||||||
Property { name: "autoMaximize"; type: "bool" }
|
Property { name: "autoMaximize"; type: "bool" }
|
||||||
Property { name: "autoVisible"; type: "bool" }
|
Property { name: "autoVisible"; type: "bool" }
|
||||||
Property { name: "autoCenter"; type: "bool" }
|
Property { name: "autoCenter"; type: "bool" }
|
||||||
Property { name: "autoDestory"; type: "bool" }
|
Property { name: "autoDestroy"; type: "bool" }
|
||||||
Property { name: "useSystemAppBar"; type: "bool" }
|
Property { name: "useSystemAppBar"; type: "bool" }
|
||||||
Property { name: "resizeBorderColor"; type: "QColor" }
|
Property { name: "resizeBorderColor"; type: "QColor" }
|
||||||
Property { name: "resizeBorderWidth"; type: "int" }
|
Property { name: "resizeBorderWidth"; type: "int" }
|
||||||
@ -3854,13 +3741,13 @@ Module {
|
|||||||
Property { name: "_appBarHeight"; type: "int" }
|
Property { name: "_appBarHeight"; type: "int" }
|
||||||
Property { name: "_windowRegister"; type: "QVariant" }
|
Property { name: "_windowRegister"; type: "QVariant" }
|
||||||
Property { name: "_route"; type: "string" }
|
Property { name: "_route"; type: "string" }
|
||||||
|
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
|
||||||
Signal { name: "showSystemMenu" }
|
Signal { name: "showSystemMenu" }
|
||||||
Signal {
|
Signal {
|
||||||
name: "initArgument"
|
name: "initArgument"
|
||||||
Parameter { name: "argument"; type: "QVariant" }
|
Parameter { name: "argument"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Signal { name: "firstVisible" }
|
Signal { name: "firstVisible" }
|
||||||
Method { name: "destoryOnClose"; type: "QVariant" }
|
|
||||||
Method {
|
Method {
|
||||||
name: "showLoading"
|
name: "showLoading"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
@ -3904,7 +3791,7 @@ Module {
|
|||||||
Parameter { name: "path"; type: "QVariant" }
|
Parameter { name: "path"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "onResult"
|
name: "setResult"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
Parameter { name: "data"; type: "QVariant" }
|
Parameter { name: "data"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
@ -3919,7 +3806,6 @@ Module {
|
|||||||
defaultProperty: "contentData"
|
defaultProperty: "contentData"
|
||||||
Property { name: "contentDelegate"; type: "QQmlComponent"; isPointer: true }
|
Property { name: "contentDelegate"; type: "QQmlComponent"; isPointer: true }
|
||||||
Method { name: "showDialog"; type: "QVariant" }
|
Method { name: "showDialog"; type: "QVariant" }
|
||||||
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
|
|
||||||
Property { name: "windowIcon"; type: "string" }
|
Property { name: "windowIcon"; type: "string" }
|
||||||
Property { name: "launchMode"; type: "int" }
|
Property { name: "launchMode"; type: "int" }
|
||||||
Property { name: "argument"; type: "QVariant" }
|
Property { name: "argument"; type: "QVariant" }
|
||||||
@ -3938,7 +3824,7 @@ Module {
|
|||||||
Property { name: "autoMaximize"; type: "bool" }
|
Property { name: "autoMaximize"; type: "bool" }
|
||||||
Property { name: "autoVisible"; type: "bool" }
|
Property { name: "autoVisible"; type: "bool" }
|
||||||
Property { name: "autoCenter"; type: "bool" }
|
Property { name: "autoCenter"; type: "bool" }
|
||||||
Property { name: "autoDestory"; type: "bool" }
|
Property { name: "autoDestroy"; type: "bool" }
|
||||||
Property { name: "useSystemAppBar"; type: "bool" }
|
Property { name: "useSystemAppBar"; type: "bool" }
|
||||||
Property { name: "resizeBorderColor"; type: "QColor" }
|
Property { name: "resizeBorderColor"; type: "QColor" }
|
||||||
Property { name: "resizeBorderWidth"; type: "int" }
|
Property { name: "resizeBorderWidth"; type: "int" }
|
||||||
@ -3948,13 +3834,13 @@ Module {
|
|||||||
Property { name: "_appBarHeight"; type: "int" }
|
Property { name: "_appBarHeight"; type: "int" }
|
||||||
Property { name: "_windowRegister"; type: "QVariant" }
|
Property { name: "_windowRegister"; type: "QVariant" }
|
||||||
Property { name: "_route"; type: "string" }
|
Property { name: "_route"; type: "string" }
|
||||||
|
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
|
||||||
Signal { name: "showSystemMenu" }
|
Signal { name: "showSystemMenu" }
|
||||||
Signal {
|
Signal {
|
||||||
name: "initArgument"
|
name: "initArgument"
|
||||||
Parameter { name: "argument"; type: "QVariant" }
|
Parameter { name: "argument"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Signal { name: "firstVisible" }
|
Signal { name: "firstVisible" }
|
||||||
Method { name: "destoryOnClose"; type: "QVariant" }
|
|
||||||
Method {
|
Method {
|
||||||
name: "showLoading"
|
name: "showLoading"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
@ -3998,10 +3884,35 @@ Module {
|
|||||||
Parameter { name: "path"; type: "QVariant" }
|
Parameter { name: "path"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Method {
|
Method {
|
||||||
name: "onResult"
|
name: "setResult"
|
||||||
type: "QVariant"
|
type: "QVariant"
|
||||||
Parameter { name: "data"; type: "QVariant" }
|
Parameter { name: "data"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
Method { name: "showMaximized"; type: "QVariant" }
|
Method { name: "showMaximized"; type: "QVariant" }
|
||||||
}
|
}
|
||||||
|
Component {
|
||||||
|
prototype: "QQuickItem"
|
||||||
|
name: "FluentUI/FluWindowResultLauncher 1.0"
|
||||||
|
exports: ["FluentUI/FluWindowResultLauncher 1.0"]
|
||||||
|
exportMetaObjectRevisions: [0]
|
||||||
|
isComposite: true
|
||||||
|
defaultProperty: "data"
|
||||||
|
Property { name: "_from"; type: "QVariant" }
|
||||||
|
Property { name: "_to"; type: "QVariant" }
|
||||||
|
Property { name: "path"; type: "QVariant" }
|
||||||
|
Signal {
|
||||||
|
name: "result"
|
||||||
|
Parameter { name: "data"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "launch"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "argument"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
Method {
|
||||||
|
name: "setResult"
|
||||||
|
type: "QVariant"
|
||||||
|
Parameter { name: "data"; type: "QVariant" }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ FluImage 1.0 Controls/FluImage.qml
|
|||||||
FluImageButton 1.0 Controls/FluImageButton.qml
|
FluImageButton 1.0 Controls/FluImageButton.qml
|
||||||
FluInfoBar 1.0 Controls/FluInfoBar.qml
|
FluInfoBar 1.0 Controls/FluInfoBar.qml
|
||||||
FluItemDelegate 1.0 Controls/FluItemDelegate.qml
|
FluItemDelegate 1.0 Controls/FluItemDelegate.qml
|
||||||
|
FluLauncher 1.0 Controls/FluLauncher.qml
|
||||||
FluLoader 1.0 Controls/FluLoader.qml
|
FluLoader 1.0 Controls/FluLoader.qml
|
||||||
FluLoadingButton 1.0 Controls/FluLoadingButton.qml
|
FluLoadingButton 1.0 Controls/FluLoadingButton.qml
|
||||||
FluMenu 1.0 Controls/FluMenu.qml
|
FluMenu 1.0 Controls/FluMenu.qml
|
||||||
@ -64,6 +65,7 @@ FluRadioButtons 1.0 Controls/FluRadioButtons.qml
|
|||||||
FluRangeSlider 1.0 Controls/FluRangeSlider.qml
|
FluRangeSlider 1.0 Controls/FluRangeSlider.qml
|
||||||
FluRatingControl 1.0 Controls/FluRatingControl.qml
|
FluRatingControl 1.0 Controls/FluRatingControl.qml
|
||||||
FluRemoteLoader 1.0 Controls/FluRemoteLoader.qml
|
FluRemoteLoader 1.0 Controls/FluRemoteLoader.qml
|
||||||
|
FluRouter 1.0 Controls/FluRouter.qml
|
||||||
FluScrollBar 1.0 Controls/FluScrollBar.qml
|
FluScrollBar 1.0 Controls/FluScrollBar.qml
|
||||||
FluScrollIndicator 1.0 Controls/FluScrollIndicator.qml
|
FluScrollIndicator 1.0 Controls/FluScrollIndicator.qml
|
||||||
FluScrollablePage 1.0 Controls/FluScrollablePage.qml
|
FluScrollablePage 1.0 Controls/FluScrollablePage.qml
|
||||||
@ -91,6 +93,5 @@ FluTreeView 1.0 Controls/FluTreeView.qml
|
|||||||
FluWindow 1.0 Controls/FluWindow.qml
|
FluWindow 1.0 Controls/FluWindow.qml
|
||||||
FluWindowDialog 1.0 Controls/FluWindowDialog.qml
|
FluWindowDialog 1.0 Controls/FluWindowDialog.qml
|
||||||
FluWindowResultLauncher 1.0 Controls/FluWindowResultLauncher.qml
|
FluWindowResultLauncher 1.0 Controls/FluWindowResultLauncher.qml
|
||||||
FluLauncher 1.0 Controls/FluLauncher.qml
|
|
||||||
|
|
||||||
plugin fluentuiplugin
|
plugin fluentuiplugin
|
||||||
|
@ -104,7 +104,6 @@
|
|||||||
<file>FluentUI/Controls/FluLauncher.qml</file>
|
<file>FluentUI/Controls/FluLauncher.qml</file>
|
||||||
<file>FluentUI/Controls/FluRouter.qml</file>
|
<file>FluentUI/Controls/FluRouter.qml</file>
|
||||||
<file>FluentUI/Controls/FluWindowResultLauncher.qml</file>
|
<file>FluentUI/Controls/FluWindowResultLauncher.qml</file>
|
||||||
<file>FluentUI/JS/Global.js</file>
|
|
||||||
<file>FluentUI/Controls/qmldir</file>
|
<file>FluentUI/Controls/qmldir</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
Reference in New Issue
Block a user