添加退出确认 (#174)
This commit is contained in:
parent
bbaa8a0235
commit
81440000b3
23
Fk/main.qml
23
Fk/main.qml
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Dialogs
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import "Logic.js" as Logic
|
import "Logic.js" as Logic
|
||||||
|
@ -17,7 +18,7 @@ Window {
|
||||||
property var callbacks: Logic.callbacks
|
property var callbacks: Logic.callbacks
|
||||||
property var tipList: []
|
property var tipList: []
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: mainWindow
|
id: mainWindow
|
||||||
width: (parent.width / parent.height < 960 / 540)
|
width: (parent.width / parent.height < 960 / 540)
|
||||||
? 960 : 540 * parent.width / parent.height
|
? 960 : 540 * parent.width / parent.height
|
||||||
|
@ -66,6 +67,7 @@ Item {
|
||||||
property bool busy: false
|
property bool busy: false
|
||||||
property string busyText: ""
|
property string busyText: ""
|
||||||
onBusyChanged: busyText = "";
|
onBusyChanged: busyText = "";
|
||||||
|
property bool closing: false
|
||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
id: busyIndicator
|
id: busyIndicator
|
||||||
|
@ -181,7 +183,7 @@ Item {
|
||||||
callbacks["ErrorMsg"]("Unknown command " + command + "!");
|
callbacks["ErrorMsg"]("Unknown command " + command + "!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequences: [ StandardKey.FullScreen ]
|
sequences: [ StandardKey.FullScreen ]
|
||||||
|
@ -217,10 +219,25 @@ Item {
|
||||||
tipList = tips.trim().split("\n");
|
tipList = tips.trim().split("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosing: {
|
MessageDialog {
|
||||||
|
id: exitMessageDialog
|
||||||
|
title: realMainWin.title
|
||||||
|
informativeText: qsTr("Are you sure to exit?")
|
||||||
|
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
||||||
|
onAccepted: {
|
||||||
|
mainWindow.closing = true;
|
||||||
config.winWidth = width;
|
config.winWidth = width;
|
||||||
config.winHeight = height;
|
config.winHeight = height;
|
||||||
config.saveConf();
|
config.saveConf();
|
||||||
Backend.quitLobby(false);
|
Backend.quitLobby(false);
|
||||||
|
realMainWin.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClosing: (closeEvent) => {
|
||||||
|
if (!mainWindow.closing) {
|
||||||
|
closeEvent.accepted = false;
|
||||||
|
exitMessageDialog.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,10 @@
|
||||||
<source>updated packages for md5</source>
|
<source>updated packages for md5</source>
|
||||||
<translation>已为您与服务器同步拓展包,请尝试再次连入</translation>
|
<translation>已为您与服务器同步拓展包,请尝试再次连入</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Are you sure to exit?</source>
|
||||||
|
<translation>是否确认退出?</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
|
||||||
<context>
|
<context>
|
||||||
|
|
Loading…
Reference in New Issue