添加退出确认 (#174)

This commit is contained in:
orz12 2023-06-06 12:16:07 +08:00 committed by GitHub
parent bbaa8a0235
commit 81440000b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 181 additions and 160 deletions

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Dialogs
import QtQuick.Controls
import QtQuick.Window
import "Logic.js" as Logic
@ -66,6 +67,7 @@ Item {
property bool busy: false
property string busyText: ""
onBusyChanged: busyText = "";
property bool closing: false
BusyIndicator {
id: busyIndicator
@ -217,10 +219,25 @@ Item {
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.winHeight = height;
config.saveConf();
Backend.quitLobby(false);
realMainWin.close();
}
}
onClosing: (closeEvent) => {
if (!mainWindow.closing) {
closeEvent.accepted = false;
exitMessageDialog.open();
}
}
}

View File

@ -167,6 +167,10 @@
<source>updated packages for md5</source>
<translation></translation>
</message>
<message>
<source>Are you sure to exit?</source>
<translation>退</translation>
</message>
</context>
<context>