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:
Ad5001 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 {
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

View file

@ -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!")
}
}

View file

@ -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])