From bbaa0b970ab1f68abd8e8a440cc478f854175b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stresing?= Date: Sun, 25 Aug 2024 00:26:04 +0200 Subject: [PATCH] Set min. window size, save window position and size --- src/pTouch/Main.qml | 69 ++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/src/pTouch/Main.qml b/src/pTouch/Main.qml index e8e2d5b..61b5c9c 100644 --- a/src/pTouch/Main.qml +++ b/src/pTouch/Main.qml @@ -13,8 +13,10 @@ Rally.RallyApplicationWindow { visible: true - width: 300 - height: 300 + width: 700 + height: 500 + minimumWidth: 700 + minimumHeight: 500 Component.onCompleted: { @@ -24,44 +26,14 @@ Rally.RallyApplicationWindow { property list recentFiles: [] Settings { - property alias recentFile: control.recentFiles + property alias recentFiles: control.recentFiles + property alias x: control.x + property alias y: control.y + property alias width: control.width + property alias height: control.height } - function newEditor(tapeWidthPx, file) { - const editor = Rally.Helper.createItem(Qt.resolvedUrl("Editor.qml"), null, { - "tapeWidth": tapeWidthPx ? tapeWidthPx : 18, - "file": file ? file : "" - }) - editor.onClose.connect(() => { - control.newContinueDialog(editor.canSave, () => { - control.newLandingPage() - editor.destroy() - }) - }) - - - /* - editor.onSaved.connect(file => { - let found = false - let recentFilesList = [file] - - for (var i = 0; i < control.recentFiles.length; i++) { - const tmpFile = control.recentFiles[i] - if (tmpFile != file) { - recentFilesList.push(tmpFile) - } - if (recentFilesList.length === 10) { - break - } - } - - control.recentFiles.length = 0 - recentFilesList.forEach(ele => { - control.recentFiles.push(ele) - }) - }) - */ - stackView.replace(editor) + function updateRecentFiles(file) { if (file) { let recentFilesList = [file] @@ -83,6 +55,27 @@ Rally.RallyApplicationWindow { } } + function newEditor(tapeWidthPx, file) { + const editor = Rally.Helper.createItem(Qt.resolvedUrl("Editor.qml"), null, { + "tapeWidth": tapeWidthPx ? tapeWidthPx : 18, + "file": file ? file : "" + }) + editor.onClose.connect(() => { + control.newContinueDialog(editor.canSave, () => { + control.newLandingPage() + editor.destroy() + }) + }) + + editor.onSaved.connect(file => { + control.updateRecentFiles(file) + }) + + stackView.replace(editor) + + control.updateRecentFiles(file) + } + function newLandingPage() { const landingPage = Rally.Helper.createItem(Qt.resolvedUrl("Landingpage.qml"), null, {