Compare commits
3 Commits
3e3aae63ae
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 28f9de31d5 | |||
| 61ae4fc02c | |||
| f5efa975c6 |
@ -184,7 +184,7 @@ Item {
|
||||
ComboBox {
|
||||
// TODO use model from metadata.h (in some way)
|
||||
model: ["A", "B", "C", ""]
|
||||
// BUG type will probably not been updated due to undo/redo step
|
||||
// BUG type is not been updated due to undo/redo step
|
||||
currentIndex: find(item.type)
|
||||
Component.onCompleted: currentIndex = find(item.type)
|
||||
onCurrentTextChanged: {
|
||||
|
||||
62
Main.qml
62
Main.qml
@ -4,19 +4,18 @@ 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}` + " *"
|
||||
|
||||
id: window
|
||||
width: 480
|
||||
height: 800
|
||||
visible: true
|
||||
title: appUndoStack.clean ? titleClean : titleDirty
|
||||
|
||||
property int fontSize: 16
|
||||
|
||||
property color textColor: "black"
|
||||
|
||||
property color wccDarkDark: "#010101"
|
||||
@ -36,17 +35,54 @@ Window {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// core.displayStatusMessage.connect(displayStatusMessage)
|
||||
appUndoStack.cleanChanged.connect(cleanChanged)
|
||||
// core.userConfigChanged.connect(onUserConfigChanged)
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cleanChanged() {
|
||||
let clean = appUndoStack.clean
|
||||
console.debug("Clean state changed to: " + clean)
|
||||
// if (!clean) {
|
||||
// footerText.text = ""
|
||||
// }
|
||||
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...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user