Fixing bugs with alerts, better popup for inserting characters.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2021-07-23 19:37:03 +02:00
parent 8155efa166
commit 1e73465f08
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
3 changed files with 25 additions and 22 deletions

View file

@ -49,7 +49,7 @@ Rectangle {
Timer { Timer {
id: fadeTimer id: fadeTimer
interval: text.length * 40 interval: 1000 + text.length * 45
onTriggered: { onTriggered: {
hideTimer.start() hideTimer.start()
fadingAnimation.start() fadingAnimation.start()
@ -66,7 +66,7 @@ Rectangle {
function show(alertText) { function show(alertText) {
visible = true visible = true
fadeTimer.start() fadeTimer.restart()
text = alertText text = alertText
opacity = 0.75 opacity = 0.75
fadingX = parent.width - width - 10 fadingX = parent.width - width - 10

View file

@ -29,7 +29,7 @@ ApplicationWindow {
width: 1000 width: 1000
height: 500 height: 500
color: sysPalette.window 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: sysPalette; colorGroup: SystemPalette.Active }
SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled } SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled }
@ -172,13 +172,14 @@ ApplicationWindow {
"objects": objs, "objects": objs,
"type": "logplotv1" "type": "logplotv1"
})) }))
alert.show("Saved plot to " + filename) alert.show("Saved plot to '" + filename.split("/").pop() + "'.")
} }
function loadDiagram(filename) { function loadDiagram(filename) {
alert.show("Loading file '" + filename + "'.") let basename = filename.split("/").pop()
var data = JSON.parse(Helper.load(filename)) alert.show("Loading file '" + basename + "'.")
var error = ""; let data = JSON.parse(Helper.load(filename))
let error = "";
if(Object.keys(data).includes("type") && data["type"] == "logplotv1") { if(Object.keys(data).includes("type") && data["type"] == "logplotv1") {
history.clear() history.clear()
// Importing settings // Importing settings
@ -237,7 +238,7 @@ ApplicationWindow {
// TODO: Error handling // TODO: Error handling
} }
drawCanvas.requestPaint() drawCanvas.requestPaint()
alert.show("Loaded file '" + filename + "'.") alert.show("Loaded file '" + basename + "'.")
} }
Timer { Timer {
@ -258,6 +259,6 @@ ApplicationWindow {
var file = Helper.gettmpfile() var file = Helper.gettmpfile()
drawCanvas.save(file) drawCanvas.save(file)
Helper.copyImageToClipboard() Helper.copyImageToClipboard()
alert.show("Copied plot to clipboard!") alert.show("Copied plot screenshot to clipboard!")
} }
} }

View file

@ -91,10 +91,10 @@ Item {
Popup { Popup {
id: insertPopup id: insertPopup
x: input.x x: Math.round((parent.width - width) / 2)
y: input.y + input.height y: Math.round((parent.height - height) / 2)
width: 200 width: 280
height: insertGrid.insertChars/insertGrid.columns height: insertGrid.insertChars.length/insertGrid.columns*(width/insertGrid.columns)
modal: true modal: true
focus: true focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
@ -102,17 +102,18 @@ Item {
Grid { Grid {
id: insertGrid id: insertGrid
width: parent.width width: parent.width
columns: 10 columns: 7
property var insertChars: [ property var insertChars: [
"α","β","γ","δ","ε","ζ","η","θ","κ","λ", "α","β","γ","δ","ε","ζ","η",
"μ","ξ","ρ","ς","σ","τ","φ","χ","ψ","ω", "θ","κ","λ","μ","ξ","ρ","ς",
"Γ","Δ","Θ","Λ","Ξ","Π","Σ","Φ","Ψ","Ω", "σ","τ","φ","χ","ψ","ω","Γ",
"∞","∂"," "," "," "," "," "," "," "," ", "Δ","Θ","Λ","Ξ","Π","Σ","Φ",
"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","⁰", "Ψ","Ω","ₐ","ₑ","ₒ","ₓ","ₕ",
"₁","₂","₃","₄","₅","₆","₇","₈","₉","₀", "ₖ","ₗ","ₘ","ₙ","ₚ","ₛ","ₜ",
"ₐ","ₑ","ₒ","ₓ","ₔ","ₕ","ₖ","ₗ","ₘ","ₙ", "¹","²","³","⁴","⁵","⁶","⁷",
"ₚ","ₛ","ₜ"," "," "," "," "," "," "," " "⁸","⁹","⁰","₁","₂","₃","₄",
"₅","₆","₇","₈","₉","₀"," "
] ]
Repeater { Repeater {
@ -124,6 +125,7 @@ Item {
height: width height: width
text: insertGrid.insertChars[modelData] text: insertGrid.insertChars[modelData]
flat: text == " " flat: text == " "
font.pixelSize: 18
onClicked: { onClicked: {
input.insert(input.cursorPosition, insertGrid.insertChars[modelData]) input.insert(input.cursorPosition, insertGrid.insertChars[modelData])