This commit is contained in:
朱子楚\zhuzi 2024-03-25 21:01:47 +08:00
parent d6c0492665
commit 07fedb43a8
7 changed files with 24 additions and 24 deletions

View File

@ -214,15 +214,15 @@ void FluNetwork::handle(FluNetworkParams* params,FluNetworkCallable* c){
reply->abort();
}
};
QMetaObject::Connection conn_destoryed = {};
QMetaObject::Connection conn_destroyed = {};
QMetaObject::Connection conn_quit = {};
if(params->_target){
conn_destoryed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
conn_destroyed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
}
conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable);
loop.exec();
if(conn_destoryed){
disconnect(conn_destoryed);
if(conn_destroyed){
disconnect(conn_destroyed);
}
if(conn_quit){
disconnect(conn_quit);
@ -336,10 +336,10 @@ void FluNetwork::handleDownload(FluNetworkParams* params,FluNetworkCallable* c){
};
connect(&manager,&QNetworkAccessManager::finished,&manager,[&loop](QNetworkReply *reply){loop.quit();});
connect(qApp,&QGuiApplication::aboutToQuit,&manager, [&loop,reply](){reply->abort(),loop.quit();});
QMetaObject::Connection conn_destoryed = {};
QMetaObject::Connection conn_destroyed = {};
QMetaObject::Connection conn_quit = {};
if(params->_target){
conn_destoryed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
conn_destroyed = connect(params->_target,&QObject::destroyed,&manager,abortCallable);
}
conn_quit = connect(qApp,&QGuiApplication::aboutToQuit,&manager, abortCallable);
connect(reply,&QNetworkReply::readyRead,reply,[reply,seek,destFile,cacheFile,callable]{
@ -377,8 +377,8 @@ void FluNetwork::handleDownload(FluNetworkParams* params,FluNetworkCallable* c){
}
printRequestEndLog(request,params,reply,destPath);
}
if(conn_destoryed){
disconnect(conn_destoryed);
if(conn_destroyed){
disconnect(conn_destroyed);
}
if(conn_quit){
disconnect(conn_quit);

View File

@ -13,7 +13,7 @@ void FluWindowLifecycle::onCompleted(QQuickWindow* window){
}
}
void FluWindowLifecycle::onDestoryOnClose(){
void FluWindowLifecycle::onDestroyOnClose(){
if(_window && _window->transientParent() == nullptr){
FluApp::getInstance()->removeWindow(_window);
_window = nullptr;

View File

@ -20,7 +20,7 @@ public:
Q_INVOKABLE void onCompleted(QQuickWindow* window);
Q_INVOKABLE void onDestruction();
Q_INVOKABLE void onVisible(bool visible);
Q_INVOKABLE void onDestoryOnClose();
Q_INVOKABLE void onDestroyOnClose();
private:
QQuickWindow* _window = nullptr;
};

View File

@ -39,7 +39,7 @@ Window {
property bool autoMaximize: false
property bool autoVisible: true
property bool autoCenter: true
property bool autoDestory: true
property bool autoDestroy: true
property bool useSystemAppBar
property color resizeBorderColor: {
if(window.active){
@ -49,8 +49,8 @@ Window {
}
property int resizeBorderWidth: 1
property var closeListener: function(event){
if(autoDestory){
destoryOnClose()
if(autoDestroy){
destroyOnClose()
}else{
window.visibility = Window.Hidden
event.accepted = false
@ -263,8 +263,8 @@ Window {
return com_border
}
}
function destoryOnClose(){
lifecycle.onDestoryOnClose()
function destroyOnClose(){
lifecycle.onDestroyOnClose()
}
function showLoading(text = qsTr("Loading..."),cancel = true){
loader_loading.loadingText = text

View File

@ -9,12 +9,12 @@ FluWindow {
property Component contentDelegate
autoVisible: false
autoCenter: false
autoDestory: true
autoDestroy: true
fixSize: true
Loader{
anchors.fill: parent
sourceComponent: {
if(control.autoDestory){
if(control.autoDestroy){
return control.visible ? control.contentDelegate : undefined
}
return control.contentDelegate

View File

@ -38,7 +38,7 @@ Window {
property bool autoMaximize: false
property bool autoVisible: true
property bool autoCenter: true
property bool autoDestory: true
property bool autoDestroy: true
property bool useSystemAppBar
property color resizeBorderColor: {
if(window.active){
@ -48,8 +48,8 @@ Window {
}
property int resizeBorderWidth: 1
property var closeListener: function(event){
if(autoDestory){
destoryOnClose()
if(autoDestroy){
destroyOnClose()
}else{
window.visibility = Window.Hidden
event.accepted = false
@ -262,8 +262,8 @@ Window {
return com_border
}
}
function destoryOnClose(){
lifecycle.onDestoryOnClose()
function destroyOnClose(){
lifecycle.onDestroyOnClose()
}
function showLoading(text = qsTr("Loading..."),cancel = true){
loader_loading.loadingText = text

View File

@ -9,12 +9,12 @@ FluWindow {
property Component contentDelegate
autoVisible: false
autoCenter: false
autoDestory: true
autoDestroy: true
fixSize: true
Loader{
anchors.fill: parent
sourceComponent: {
if(control.autoDestory){
if(control.autoDestroy){
return control.visible ? control.contentDelegate : undefined
}
return control.contentDelegate