Clean up and formatting.
This commit is contained in:
35
Main.qml
35
Main.qml
@ -4,13 +4,12 @@ import QtQuick.Layouts
|
|||||||
import QtQml.Models
|
import QtQml.Models
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
|
id: window
|
||||||
property bool discardChangesOnExit: false
|
property bool discardChangesOnExit: false
|
||||||
property bool isDataModified: !appUndoStack.isClean
|
property bool isDataModified: !appUndoStack.isClean
|
||||||
|
|
||||||
property string titleClean: `${Application.name}`
|
property string titleClean: `${Application.name}`
|
||||||
property string titleDirty: `${Application.name}` + " *"
|
property string titleDirty: `${Application.name}` + " *"
|
||||||
|
|
||||||
id: window
|
|
||||||
width: 480
|
width: 480
|
||||||
height: 800
|
height: 800
|
||||||
visible: true
|
visible: true
|
||||||
@ -50,16 +49,16 @@ Window {
|
|||||||
// // }
|
// // }
|
||||||
// }
|
// }
|
||||||
onClosing: event => {
|
onClosing: event => {
|
||||||
if (appUndoStack.clean) {
|
if (appUndoStack.clean) {
|
||||||
console.debug("Closing on a clean undo stack.")
|
console.debug("Closing on a clean undo stack.");
|
||||||
} else {
|
} else {
|
||||||
console.debug("Closing on an unclean undo stack!")
|
console.debug("Closing on an unclean undo stack!");
|
||||||
if (!window.discardChangesOnExit) {
|
if (!window.discardChangesOnExit) {
|
||||||
event.accepted = false
|
event.accepted = false;
|
||||||
exitOnUnsavedChangesDialog.open()
|
exitOnUnsavedChangesDialog.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: exitOnUnsavedChangesDialog
|
id: exitOnUnsavedChangesDialog
|
||||||
@ -70,20 +69,20 @@ Window {
|
|||||||
standardButtons: Dialog.Yes | Dialog.Cancel | Dialog.Discard
|
standardButtons: Dialog.Yes | Dialog.Cancel | Dialog.Discard
|
||||||
|
|
||||||
contentItem: Label {
|
contentItem: Label {
|
||||||
text: "Do you want save your changes?"
|
text: "Do you want save your changes?\n" + "Or discard them?"
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
core.saveItems()
|
core.saveItems();
|
||||||
window.close()
|
window.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDiscarded: {
|
onDiscarded: {
|
||||||
window.discardChangesOnExit = true
|
window.discardChangesOnExit = true;
|
||||||
window.close()
|
window.close();
|
||||||
}
|
}
|
||||||
onRejected: {
|
onRejected: {
|
||||||
console.debug("Canceling exit...")
|
console.debug("Canceling exit...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user