89 lines
2.4 KiB
QML
89 lines
2.4 KiB
QML
import QtQuick
|
|
import QtQuick.Controls.Material
|
|
import QtQuick.Layouts
|
|
import QtQml.Models
|
|
|
|
Window {
|
|
id: window
|
|
property bool discardChangesOnExit: false
|
|
property bool isDataModified: !appUndoStack.isClean
|
|
|
|
property string titleClean: `${Application.name}`
|
|
property string titleDirty: `${Application.name}` + " *"
|
|
width: 480
|
|
height: 800
|
|
visible: true
|
|
title: appUndoStack.clean ? titleClean : titleDirty
|
|
|
|
property int fontSize: 16
|
|
property color textColor: "black"
|
|
|
|
property color wccDarkDark: "#010101"
|
|
property color wccDarkDefault: "#3C3B3B"
|
|
property color wccDarkLight: "#828282"
|
|
|
|
property color wccPurpleDark: "#631A61"
|
|
property color wccPurpleDefault: "#A834A5"
|
|
property color wccPurpleLight: "#E88FE5"
|
|
|
|
property color wccLavenderDark: "#8C52FF"
|
|
property color wccLavenderDefault: "#9D74EE"
|
|
property color wccLavenderLight: "#BC9AFF"
|
|
|
|
ListPage {
|
|
id: listPage
|
|
anchors.fill: parent
|
|
}
|
|
|
|
// Component.onCompleted: {
|
|
// // core.displayStatusMessage.connect(displayStatusMessage)
|
|
// appUndoStack.cleanChanged.connect(cleanChanged)
|
|
// // core.userConfigChanged.connect(onUserConfigChanged)
|
|
// }
|
|
|
|
// function cleanChanged() {
|
|
// let clean = appUndoStack.clean
|
|
// console.debug("Clean state changed to: " + clean)
|
|
// // if (!clean) {
|
|
// // footerText.text = ""
|
|
// // }
|
|
// }
|
|
onClosing: event => {
|
|
if (appUndoStack.clean) {
|
|
console.debug("Closing on a clean undo stack.");
|
|
} else {
|
|
console.debug("Closing on an unclean undo stack!");
|
|
if (!window.discardChangesOnExit) {
|
|
event.accepted = false;
|
|
exitOnUnsavedChangesDialog.open();
|
|
}
|
|
}
|
|
}
|
|
|
|
Dialog {
|
|
id: exitOnUnsavedChangesDialog
|
|
title: "Unsaved Changes"
|
|
modal: false
|
|
anchors.centerIn: parent
|
|
width: 300
|
|
standardButtons: Dialog.Yes | Dialog.Cancel | Dialog.Discard
|
|
|
|
contentItem: Label {
|
|
text: "Do you want save your changes?\n" + "Or discard them?"
|
|
}
|
|
|
|
onAccepted: {
|
|
core.saveItems();
|
|
window.close();
|
|
}
|
|
|
|
onDiscarded: {
|
|
window.discardChangesOnExit = true;
|
|
window.close();
|
|
}
|
|
onRejected: {
|
|
console.debug("Canceling exit...");
|
|
}
|
|
}
|
|
}
|