From 1e73465f084d42ddf6dc1fdb256ac3b86b1a9616 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Fri, 23 Jul 2021 19:37:03 +0200 Subject: [PATCH] Fixing bugs with alerts, better popup for inserting characters. --- .../qml/eu/ad5001/LogarithmPlotter/Alert.qml | 4 +-- .../LogarithmPlotter/LogarithmPlotter.qml | 15 +++++----- .../ad5001/LogarithmPlotter/TextSetting.qml | 28 ++++++++++--------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml index 03dd491..b820f51 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Alert.qml @@ -49,7 +49,7 @@ Rectangle { Timer { id: fadeTimer - interval: text.length * 40 + interval: 1000 + text.length * 45 onTriggered: { hideTimer.start() fadingAnimation.start() @@ -66,7 +66,7 @@ Rectangle { function show(alertText) { visible = true - fadeTimer.start() + fadeTimer.restart() text = alertText opacity = 0.75 fadingX = parent.width - width - 10 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index b689ea1..6bffe8e 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -29,7 +29,7 @@ ApplicationWindow { width: 1000 height: 500 color: sysPalette.window - title: "LogarithmPlotter " + (settings.saveFilename != "" ? " - " + settings.saveFilename.split('/')[settings.saveFilename.split('/').length -1] : "") + title: "LogarithmPlotter " + (settings.saveFilename != "" ? " - " + settings.saveFilename.split('/').pop() : "") SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active } SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled } @@ -172,13 +172,14 @@ ApplicationWindow { "objects": objs, "type": "logplotv1" })) - alert.show("Saved plot to " + filename) + alert.show("Saved plot to '" + filename.split("/").pop() + "'.") } function loadDiagram(filename) { - alert.show("Loading file '" + filename + "'.") - var data = JSON.parse(Helper.load(filename)) - var error = ""; + let basename = filename.split("/").pop() + alert.show("Loading file '" + basename + "'.") + let data = JSON.parse(Helper.load(filename)) + let error = ""; if(Object.keys(data).includes("type") && data["type"] == "logplotv1") { history.clear() // Importing settings @@ -237,7 +238,7 @@ ApplicationWindow { // TODO: Error handling } drawCanvas.requestPaint() - alert.show("Loaded file '" + filename + "'.") + alert.show("Loaded file '" + basename + "'.") } Timer { @@ -258,6 +259,6 @@ ApplicationWindow { var file = Helper.gettmpfile() drawCanvas.save(file) Helper.copyImageToClipboard() - alert.show("Copied plot to clipboard!") + alert.show("Copied plot screenshot to clipboard!") } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml index 96c932e..8c73fe5 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml @@ -91,10 +91,10 @@ Item { Popup { id: insertPopup - x: input.x - y: input.y + input.height - width: 200 - height: insertGrid.insertChars/insertGrid.columns + x: Math.round((parent.width - width) / 2) + y: Math.round((parent.height - height) / 2) + width: 280 + height: insertGrid.insertChars.length/insertGrid.columns*(width/insertGrid.columns) modal: true focus: true closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent @@ -102,17 +102,18 @@ Item { Grid { id: insertGrid width: parent.width - columns: 10 + columns: 7 property var insertChars: [ - "α","β","γ","δ","ε","ζ","η","θ","κ","λ", - "μ","ξ","ρ","ς","σ","τ","φ","χ","ψ","ω", - "Γ","Δ","Θ","Λ","Ξ","Π","Σ","Φ","Ψ","Ω", - "∞","∂"," "," "," "," "," "," "," "," ", - "¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","⁰", - "₁","₂","₃","₄","₅","₆","₇","₈","₉","₀", - "ₐ","ₑ","ₒ","ₓ","ₔ","ₕ","ₖ","ₗ","ₘ","ₙ", - "ₚ","ₛ","ₜ"," "," "," "," "," "," "," " + "α","β","γ","δ","ε","ζ","η", + "θ","κ","λ","μ","ξ","ρ","ς", + "σ","τ","φ","χ","ψ","ω","Γ", + "Δ","Θ","Λ","Ξ","Π","Σ","Φ", + "Ψ","Ω","ₐ","ₑ","ₒ","ₓ","ₕ", + "ₖ","ₗ","ₘ","ₙ","ₚ","ₛ","ₜ", + "¹","²","³","⁴","⁵","⁶","⁷", + "⁸","⁹","⁰","₁","₂","₃","₄", + "₅","₆","₇","₈","₉","₀"," " ] Repeater { @@ -124,6 +125,7 @@ Item { height: width text: insertGrid.insertChars[modelData] flat: text == " " + font.pixelSize: 18 onClicked: { input.insert(input.cursorPosition, insertGrid.insertChars[modelData])