mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 21:37:04 +08:00
update
This commit is contained in:
parent
f60eaec07c
commit
54be482833
@ -164,6 +164,14 @@ FluContentPage{
|
||||
http_cache_ifnonecacherequest.post("https://httpbingo.org/post",callable,param)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 36
|
||||
text: "打开缓存路径"
|
||||
onClicked: {
|
||||
Qt.openUrlExternally("file:///"+cacheDirPath)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 36
|
||||
|
@ -138,7 +138,7 @@ CustomWindow {
|
||||
id:loader
|
||||
lazy: true
|
||||
anchors.fill: parent
|
||||
source: "https://zhu-zichu.gitee.io/Qt6_155_LieflatPage.qml"
|
||||
source: "https://zhu-zichu.gitee.io/Qt6_156_LieflatPage.qml"
|
||||
}
|
||||
}
|
||||
front: Item{
|
||||
|
@ -165,6 +165,14 @@ FluContentPage{
|
||||
http_cache_ifnonecacherequest.post("https://httpbingo.org/post",callable,param)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 36
|
||||
text: "打开缓存路径"
|
||||
onClicked: {
|
||||
Qt.openUrlExternally("file:///"+cacheDirPath)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: 36
|
||||
|
@ -139,7 +139,7 @@ CustomWindow {
|
||||
id:loader
|
||||
lazy: true
|
||||
anchors.fill: parent
|
||||
source: "https://zhu-zichu.gitee.io/Qt5_155_LieflatPage.qml"
|
||||
source: "https://zhu-zichu.gitee.io/Qt5_156_LieflatPage.qml"
|
||||
}
|
||||
}
|
||||
front: Item{
|
||||
|
@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
#ifdef Q_OS_WIN // 此设置仅在Windows下生效
|
||||
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow,false);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow,true);
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
|
||||
|
@ -10,7 +10,7 @@ enum CacheMode {
|
||||
/** 不使用缓存 */
|
||||
NoCache = 0x0000,
|
||||
|
||||
/** 请求网络失败后,读取缓存 */
|
||||
/** 请求网络失败后,读取缓存 */
|
||||
RequestFailedReadCache = 0x0001,
|
||||
|
||||
/** 如果缓存不存在才请求网络,否则使用缓存 */
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <QTextStream>
|
||||
#include <QDir>
|
||||
#include "Def.h"
|
||||
#include "MainThread.h"
|
||||
#include "FluApp.h"
|
||||
#include "FluTools.h"
|
||||
|
||||
@ -54,7 +53,7 @@ void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> pa
|
||||
Q_EMIT callable->finish();
|
||||
return;
|
||||
}
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest){
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
for (int i = 0; i < retry(); ++i) {
|
||||
@ -94,7 +93,7 @@ void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> pa
|
||||
break;
|
||||
}else{
|
||||
if(i == retry()-1){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
Q_EMIT callable->error(status,errorString,result);
|
||||
@ -102,7 +101,6 @@ void FluHttp::post(QString url,HttpCallable* callable,QMap<QString, QVariant> pa
|
||||
}
|
||||
}
|
||||
Q_EMIT callable->finish();
|
||||
// Q_EMIT callable->finish();
|
||||
});
|
||||
}
|
||||
|
||||
@ -116,7 +114,7 @@ void FluHttp::postString(QString url,HttpCallable* callable,QString params,QMap<
|
||||
Q_EMIT callable->finish();
|
||||
return;
|
||||
}
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest){
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
for (int i = 0; i < retry(); ++i) {
|
||||
@ -147,7 +145,7 @@ void FluHttp::postString(QString url,HttpCallable* callable,QString params,QMap<
|
||||
break;
|
||||
}else{
|
||||
if(i == retry()-1){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
Q_EMIT callable->error(status,errorString,result);
|
||||
@ -168,7 +166,7 @@ void FluHttp::postJson(QString url,HttpCallable* callable,QMap<QString, QVariant
|
||||
Q_EMIT callable->finish();
|
||||
return;
|
||||
}
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest){
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
for (int i = 0; i < retry(); ++i) {
|
||||
@ -199,7 +197,7 @@ void FluHttp::postJson(QString url,HttpCallable* callable,QMap<QString, QVariant
|
||||
break;
|
||||
}else{
|
||||
if(i == retry()-1){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
Q_EMIT callable->error(status,errorString,result);
|
||||
@ -215,7 +213,7 @@ void FluHttp::get(QString url,HttpCallable* callable,QMap<QString, QVariant> par
|
||||
auto requestMap = toRequest(url,params,headers,"get");
|
||||
QMap<QString, QVariant> data = invokeIntercept(requestMap).toMap();
|
||||
Q_EMIT callable->start();
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest){
|
||||
if(_cacheMode == FluHttpType::CacheMode::FirstCacheThenRequest && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
if(_cacheMode == FluHttpType::CacheMode::IfNoneCacheRequest && cacheExists(requestMap)){
|
||||
@ -250,7 +248,7 @@ void FluHttp::get(QString url,HttpCallable* callable,QMap<QString, QVariant> par
|
||||
break;
|
||||
}else{
|
||||
if(i == retry()-1){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache){
|
||||
if(_cacheMode == FluHttpType::CacheMode::RequestFailedReadCache && cacheExists(requestMap)){
|
||||
Q_EMIT callable->cache(readCache(requestMap));
|
||||
}
|
||||
Q_EMIT callable->error(status,errorString,result);
|
||||
|
@ -8,6 +8,21 @@ import QtQuick.tooling 1.2
|
||||
|
||||
Module {
|
||||
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 {
|
||||
name: "FluCalendarViewType"
|
||||
exports: ["FluentUI/FluCalendarViewType 1.0"]
|
||||
|
@ -40,6 +40,7 @@ void FluentUIPlugin::registerTypes(const char *uri)
|
||||
qmlRegisterType<FluHttp>(uri,major,minor,"FluHttp");
|
||||
qmlRegisterType<HttpCallable>(uri,major,minor,"HttpCallable");
|
||||
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluHttpType::staticMetaObject, uri,major,minor,"FluHttpType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri,major,minor,"FluThemeType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluPageType::staticMetaObject, uri,major,minor,"FluPageType", "Access to enums & flags only");
|
||||
qmlRegisterUncreatableMetaObject(FluWindowType::staticMetaObject, uri,major,minor,"FluWindowType", "Access to enums & flags only");
|
||||
|
Loading…
Reference in New Issue
Block a user