Skip to content

Commit

Permalink
Set min. window size, save window position and size
Browse files Browse the repository at this point in the history
  • Loading branch information
Tereius committed Aug 24, 2024
1 parent 9c5d771 commit bbaa0b9
Showing 1 changed file with 31 additions and 38 deletions.
69 changes: 31 additions & 38 deletions src/pTouch/Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ Rally.RallyApplicationWindow {

visible: true

width: 300
height: 300
width: 700
height: 500
minimumWidth: 700
minimumHeight: 500

Component.onCompleted: {

Expand All @@ -24,44 +26,14 @@ Rally.RallyApplicationWindow {
property list<string> 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]
Expand All @@ -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, {
Expand Down

0 comments on commit bbaa0b9

Please sign in to comment.