2020-12-22 00:01:36 +00:00
|
|
|
|
/**
|
2022-03-05 16:49:35 +00:00
|
|
|
|
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
|
2022-01-12 13:39:23 +00:00
|
|
|
|
* Copyright (C) 2022 Ad5001
|
2020-12-22 00:01:36 +00:00
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import QtQml 2.12
|
|
|
|
|
import QtQuick.Controls 2.12
|
2021-08-14 19:40:42 +00:00
|
|
|
|
import eu.ad5001.MixedMenu 1.1
|
2021-07-30 23:40:51 +00:00
|
|
|
|
import QtQuick.Layouts 1.12
|
2020-12-22 00:01:36 +00:00
|
|
|
|
import QtQuick 2.12
|
2021-08-14 16:57:29 +00:00
|
|
|
|
// Auto loading all objects.
|
|
|
|
|
import "js/objs/autoload.js" as ALObjects
|
|
|
|
|
|
2020-12-22 00:01:36 +00:00
|
|
|
|
import "js/objects.js" as Objects
|
2022-01-30 00:22:33 +00:00
|
|
|
|
import eu.ad5001.LogarithmPlotter.History 1.0
|
2021-08-14 16:57:29 +00:00
|
|
|
|
import eu.ad5001.LogarithmPlotter.ObjectLists 1.0
|
2022-01-27 20:36:34 +00:00
|
|
|
|
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
2022-01-29 17:17:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
\qmltype LogarithmPlotter
|
|
|
|
|
\inqmlmodule eu.ad5001.LogarithmPlotter
|
|
|
|
|
\brief Main window of LogarithmPlotter
|
|
|
|
|
|
|
|
|
|
\sa AppMenuBar, History, GreetScreen, Changelog, Alert, ObjectLists, Settings, HistoryBrowser, LogGraphCanvas, PickLocationOverlay.
|
|
|
|
|
*/
|
2020-12-22 00:01:36 +00:00
|
|
|
|
ApplicationWindow {
|
|
|
|
|
id: root
|
|
|
|
|
visible: true
|
|
|
|
|
width: 1000
|
|
|
|
|
height: 500
|
|
|
|
|
color: sysPalette.window
|
2022-01-23 16:31:34 +00:00
|
|
|
|
title: "LogarithmPlotter " + (settings.saveFilename != "" ? " - " + settings.saveFilename.split('/').pop() : "") + (history.saved ? "" : "*")
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
|
|
|
|
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
|
|
|
|
SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled }
|
|
|
|
|
|
2022-02-07 13:19:02 +00:00
|
|
|
|
menuBar: appMenu.trueItem
|
2021-07-11 17:35:12 +00:00
|
|
|
|
|
|
|
|
|
AppMenuBar {id: appMenu}
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
2021-08-14 19:40:42 +00:00
|
|
|
|
History { id: history }
|
|
|
|
|
|
2022-01-27 20:36:34 +00:00
|
|
|
|
Popup.GreetScreen {}
|
|
|
|
|
|
2022-01-27 21:59:02 +00:00
|
|
|
|
Popup.Changelog {id: changelog}
|
|
|
|
|
|
2022-01-27 20:36:34 +00:00
|
|
|
|
Popup.About {id: about}
|
2021-05-03 15:31:37 +00:00
|
|
|
|
|
2022-04-02 16:17:09 +00:00
|
|
|
|
Popup.ThanksTo {id: thanksTo}
|
|
|
|
|
|
2022-01-27 20:36:34 +00:00
|
|
|
|
Popup.Alert {
|
2021-07-22 21:50:21 +00:00
|
|
|
|
id: alert
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: 5
|
|
|
|
|
z: 3
|
|
|
|
|
}
|
2021-07-22 20:52:23 +00:00
|
|
|
|
|
2022-02-07 13:19:02 +00:00
|
|
|
|
Item {
|
2020-12-22 00:01:36 +00:00
|
|
|
|
id: sidebar
|
2020-12-22 22:19:00 +00:00
|
|
|
|
width: 300
|
2020-12-22 00:01:36 +00:00
|
|
|
|
height: parent.height
|
2022-02-07 13:19:02 +00:00
|
|
|
|
//y: root.menuBar.height
|
2020-12-22 00:01:36 +00:00
|
|
|
|
readonly property bool inPortrait: root.width < root.height
|
2022-02-07 13:19:02 +00:00
|
|
|
|
/*modal: true// inPortrait
|
2020-12-22 00:01:36 +00:00
|
|
|
|
interactive: inPortrait
|
|
|
|
|
position: inPortrait ? 0 : 1
|
2022-02-07 13:19:02 +00:00
|
|
|
|
*/
|
2020-12-22 00:01:36 +00:00
|
|
|
|
visible: !inPortrait
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TabBar {
|
|
|
|
|
id: sidebarSelector
|
|
|
|
|
width: parent.width
|
2021-03-14 18:03:58 +00:00
|
|
|
|
anchors.top: parent.top
|
2020-12-22 00:01:36 +00:00
|
|
|
|
TabButton {
|
2020-12-22 22:19:00 +00:00
|
|
|
|
text: qsTr("Objects")
|
2021-05-16 15:18:08 +00:00
|
|
|
|
icon.name: 'polygon-add-nodes'
|
|
|
|
|
icon.color: sysPalette.windowText
|
|
|
|
|
//height: 24
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
|
|
|
|
TabButton {
|
2020-12-22 22:19:00 +00:00
|
|
|
|
text: qsTr("Settings")
|
2021-07-31 22:49:44 +00:00
|
|
|
|
icon.name: 'preferences-system-symbolic'
|
2021-05-16 15:18:08 +00:00
|
|
|
|
icon.color: sysPalette.windowText
|
|
|
|
|
//height: 24
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
2021-04-07 12:51:48 +00:00
|
|
|
|
TabButton {
|
|
|
|
|
text: qsTr("History")
|
2021-07-31 22:49:44 +00:00
|
|
|
|
icon.name: 'view-history'
|
2021-05-16 15:18:08 +00:00
|
|
|
|
icon.color: sysPalette.windowText
|
|
|
|
|
//height: 24
|
2021-04-07 12:51:48 +00:00
|
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StackLayout {
|
2021-03-09 19:37:12 +00:00
|
|
|
|
id: sidebarContents
|
2020-12-22 00:01:36 +00:00
|
|
|
|
anchors.top: sidebarSelector.bottom
|
2020-12-22 22:19:00 +00:00
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.topMargin: 5
|
|
|
|
|
anchors.leftMargin: 5
|
2021-03-31 22:29:05 +00:00
|
|
|
|
anchors.bottom: parent.bottom
|
2022-02-08 13:51:41 +00:00
|
|
|
|
//anchors.bottomMargin: sidebarSelector.height
|
2021-08-14 13:32:33 +00:00
|
|
|
|
width: parent.width - 5
|
2020-12-22 22:19:00 +00:00
|
|
|
|
currentIndex: sidebarSelector.currentIndex
|
2020-12-22 17:22:38 +00:00
|
|
|
|
z: -1
|
|
|
|
|
clip: true
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
|
|
|
|
ObjectLists {
|
|
|
|
|
id: objectLists
|
|
|
|
|
onChanged: drawCanvas.requestPaint()
|
|
|
|
|
}
|
2020-12-22 22:19:00 +00:00
|
|
|
|
|
|
|
|
|
Settings {
|
|
|
|
|
id: settings
|
2021-08-21 17:46:20 +00:00
|
|
|
|
canvas: drawCanvas
|
2020-12-22 22:19:00 +00:00
|
|
|
|
onChanged: drawCanvas.requestPaint()
|
|
|
|
|
}
|
2021-04-07 12:51:48 +00:00
|
|
|
|
|
|
|
|
|
HistoryBrowser {
|
|
|
|
|
id: historyBrowser
|
|
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogGraphCanvas {
|
|
|
|
|
id: drawCanvas
|
|
|
|
|
anchors.top: parent.top
|
2021-03-14 17:28:53 +00:00
|
|
|
|
anchors.left: sidebar.inPortrait ? parent.left : sidebar.right
|
2020-12-22 00:01:36 +00:00
|
|
|
|
height: parent.height
|
2022-02-07 13:19:02 +00:00
|
|
|
|
width: sidebar.inPortrait ? parent.width : parent.width - sidebar.width//*sidebar.position
|
|
|
|
|
x: sidebar.width//*sidebar.position
|
2020-12-22 00:01:36 +00:00
|
|
|
|
|
|
|
|
|
xmin: settings.xmin
|
|
|
|
|
ymax: settings.ymax
|
|
|
|
|
xzoom: settings.xzoom
|
|
|
|
|
yzoom: settings.yzoom
|
2022-01-29 17:17:19 +00:00
|
|
|
|
xlabel: settings.xlabel
|
|
|
|
|
ylabel: settings.ylabel
|
2020-12-22 00:01:36 +00:00
|
|
|
|
yaxisstep: settings.yaxisstep
|
2020-12-25 18:55:47 +00:00
|
|
|
|
xaxisstep: settings.xaxisstep
|
2020-12-25 15:44:53 +00:00
|
|
|
|
logscalex: settings.logscalex
|
2021-03-31 22:29:05 +00:00
|
|
|
|
linewidth: settings.linewidth
|
|
|
|
|
textsize: settings.textsize
|
2021-01-26 17:36:21 +00:00
|
|
|
|
showxgrad: settings.showxgrad
|
|
|
|
|
showygrad: settings.showygrad
|
2021-07-11 14:18:01 +00:00
|
|
|
|
|
2021-08-14 16:57:29 +00:00
|
|
|
|
property bool firstDrawDone: false
|
|
|
|
|
|
|
|
|
|
onPainted: if(!firstDrawDone) {
|
|
|
|
|
firstDrawDone = true;
|
|
|
|
|
console.info("First paint done in " + (new Date().getTime()-(StartTime*1000)) + "ms")
|
|
|
|
|
if(TestBuild == true) {
|
|
|
|
|
console.log("Plot drawn in canvas, terminating test of build in 100ms.")
|
|
|
|
|
testBuildTimer.start()
|
|
|
|
|
}
|
2021-07-11 14:18:01 +00:00
|
|
|
|
}
|
2021-08-14 20:17:17 +00:00
|
|
|
|
|
|
|
|
|
PickLocationOverlay {
|
2021-08-14 23:18:13 +00:00
|
|
|
|
id: positionPicker
|
2021-08-14 20:17:17 +00:00
|
|
|
|
anchors.fill: parent
|
|
|
|
|
canvas: parent
|
|
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-29 17:17:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
\qmlmethod void LogarithmPlotter::saveDiagram(string filename)
|
|
|
|
|
Saves the diagram to a certain \c filename.
|
|
|
|
|
*/
|
2020-12-22 00:01:36 +00:00
|
|
|
|
function saveDiagram(filename) {
|
2021-08-16 21:17:38 +00:00
|
|
|
|
if(['lpf'].indexOf(filename.split('.')[filename.split('.').length-1]) == -1)
|
2021-03-14 17:28:53 +00:00
|
|
|
|
filename += '.lpf'
|
2021-03-09 10:14:12 +00:00
|
|
|
|
settings.saveFilename = filename
|
2020-12-22 00:01:36 +00:00
|
|
|
|
var objs = {}
|
2020-12-25 22:42:31 +00:00
|
|
|
|
for(var objType in Objects.currentObjects){
|
2020-12-22 00:01:36 +00:00
|
|
|
|
objs[objType] = []
|
2020-12-25 22:42:31 +00:00
|
|
|
|
for(var obj of Objects.currentObjects[objType]) {
|
2020-12-22 00:01:36 +00:00
|
|
|
|
objs[objType].push(obj.export())
|
2020-12-25 22:42:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
|
Helper.write(filename, JSON.stringify({
|
|
|
|
|
"xzoom": settings.xzoom,
|
|
|
|
|
"yzoom": settings.yzoom,
|
|
|
|
|
"xmin": settings.xmin,
|
|
|
|
|
"ymax": settings.ymax,
|
2020-12-25 18:55:47 +00:00
|
|
|
|
"xaxisstep": settings.xaxisstep,
|
2020-12-22 00:01:36 +00:00
|
|
|
|
"yaxisstep": settings.yaxisstep,
|
2022-01-29 17:17:19 +00:00
|
|
|
|
"xaxislabel": settings.xlabel,
|
|
|
|
|
"yaxislabel": settings.ylabel,
|
2020-12-25 18:55:47 +00:00
|
|
|
|
"logscalex": settings.logscalex,
|
2021-03-31 22:29:05 +00:00
|
|
|
|
"linewidth": settings.linewidth,
|
2021-04-09 14:05:47 +00:00
|
|
|
|
"showxgrad": settings.showxgrad,
|
|
|
|
|
"showygrad": settings.showygrad,
|
2021-03-31 22:29:05 +00:00
|
|
|
|
"textsize": settings.textsize,
|
2021-05-07 22:34:11 +00:00
|
|
|
|
"history": history.serialize(),
|
2020-12-22 00:01:36 +00:00
|
|
|
|
"width": root.width,
|
|
|
|
|
"height": root.height,
|
|
|
|
|
"objects": objs,
|
2020-12-22 15:47:48 +00:00
|
|
|
|
"type": "logplotv1"
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}))
|
2022-01-20 17:19:36 +00:00
|
|
|
|
alert.show(qsTr("Saved plot to '%1'.").arg(filename.split("/").pop()))
|
2022-01-23 16:31:34 +00:00
|
|
|
|
history.saved = true
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-29 17:17:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
\qmlmethod void LogarithmPlotter::saveDiagram(string filename)
|
|
|
|
|
Loads the diagram from a certain \c filename.
|
|
|
|
|
*/
|
2020-12-22 00:01:36 +00:00
|
|
|
|
function loadDiagram(filename) {
|
2021-07-23 17:37:03 +00:00
|
|
|
|
let basename = filename.split("/").pop()
|
2022-01-20 17:19:36 +00:00
|
|
|
|
alert.show(qsTr("Loading file '%1'.").arg(basename))
|
2021-07-23 17:37:03 +00:00
|
|
|
|
let data = JSON.parse(Helper.load(filename))
|
|
|
|
|
let error = "";
|
2020-12-25 22:42:31 +00:00
|
|
|
|
if(Object.keys(data).includes("type") && data["type"] == "logplotv1") {
|
2021-04-07 12:51:48 +00:00
|
|
|
|
history.clear()
|
2021-05-07 22:34:11 +00:00
|
|
|
|
// Importing settings
|
2021-03-09 10:14:12 +00:00
|
|
|
|
settings.saveFilename = filename
|
2020-12-22 00:01:36 +00:00
|
|
|
|
settings.xzoom = data["xzoom"]
|
|
|
|
|
settings.yzoom = data["yzoom"]
|
|
|
|
|
settings.xmin = data["xmin"]
|
|
|
|
|
settings.ymax = data["ymax"]
|
2020-12-25 18:55:47 +00:00
|
|
|
|
settings.xaxisstep = data["xaxisstep"]
|
2020-12-22 00:01:36 +00:00
|
|
|
|
settings.yaxisstep = data["yaxisstep"]
|
2022-01-29 17:17:19 +00:00
|
|
|
|
settings.xlabel = data["xaxislabel"]
|
|
|
|
|
settings.ylabel = data["yaxislabel"]
|
2020-12-25 18:55:47 +00:00
|
|
|
|
settings.logscalex = data["logscalex"]
|
2021-04-09 14:05:47 +00:00
|
|
|
|
if("showxgrad" in data)
|
|
|
|
|
settings.showxgrad = data["showxgrad"]
|
|
|
|
|
if("showygrad" in data)
|
|
|
|
|
settings.textsize = data["showygrad"]
|
2021-03-31 22:29:05 +00:00
|
|
|
|
if("linewidth" in data)
|
|
|
|
|
settings.linewidth = data["linewidth"]
|
|
|
|
|
if("textsize" in data)
|
|
|
|
|
settings.textsize = data["textsize"]
|
2020-12-22 00:01:36 +00:00
|
|
|
|
root.height = data["height"]
|
|
|
|
|
root.width = data["width"]
|
|
|
|
|
|
2021-08-14 16:57:29 +00:00
|
|
|
|
// Importing objects
|
2020-12-24 15:07:27 +00:00
|
|
|
|
Objects.currentObjects = {}
|
2022-10-17 22:45:53 +00:00
|
|
|
|
Objects.currentObjectsByName = {}
|
|
|
|
|
for(let objType in data['objects']) {
|
2021-03-09 14:01:03 +00:00
|
|
|
|
if(Object.keys(Objects.types).indexOf(objType) > -1) {
|
|
|
|
|
Objects.currentObjects[objType] = []
|
2022-10-17 22:45:53 +00:00
|
|
|
|
for(let objData of data['objects'][objType]) {
|
|
|
|
|
let obj = new Objects.types[objType](...objData)
|
2021-03-09 14:01:03 +00:00
|
|
|
|
Objects.currentObjects[objType].push(obj)
|
2022-10-17 18:25:29 +00:00
|
|
|
|
Objects.currentObjectsByName[obj.name] = obj
|
2021-03-09 14:01:03 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-01-20 17:19:36 +00:00
|
|
|
|
error += qsTr("Unknown object type: %1.").arg(objType) + "\n";
|
2020-12-25 22:42:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-26 11:02:10 +00:00
|
|
|
|
|
2022-10-17 22:45:53 +00:00
|
|
|
|
// Updating object dependencies.
|
|
|
|
|
for(let objName in Objects.currentObjectsByName)
|
|
|
|
|
Objects.currentObjectsByName[objName].update()
|
|
|
|
|
|
2022-01-26 11:02:10 +00:00
|
|
|
|
// Importing history
|
|
|
|
|
if("history" in data)
|
|
|
|
|
history.unserialize(...data["history"])
|
|
|
|
|
|
2020-12-22 00:01:36 +00:00
|
|
|
|
// Refreshing sidebar
|
2022-10-18 16:31:42 +00:00
|
|
|
|
//if(sidebarSelector.currentIndex == 0) {
|
|
|
|
|
// // For some reason, if we load a file while the tab is on object,
|
|
|
|
|
// // we get stuck in a Qt-side loop? Qt bug or side-effect here, I don't know.
|
|
|
|
|
// sidebarSelector.currentIndex = 1
|
|
|
|
|
// objectLists.update()
|
|
|
|
|
// delayRefreshTimer.start()
|
|
|
|
|
//} else {
|
2020-12-22 22:19:00 +00:00
|
|
|
|
objectLists.update()
|
2022-10-18 16:31:42 +00:00
|
|
|
|
//}
|
2021-03-31 22:29:05 +00:00
|
|
|
|
} else {
|
2022-01-20 17:19:36 +00:00
|
|
|
|
error = qsTr("Invalid file provided.")
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
2021-03-09 14:01:03 +00:00
|
|
|
|
if(error != "") {
|
2021-07-11 14:18:01 +00:00
|
|
|
|
console.log(error)
|
2022-01-20 17:19:36 +00:00
|
|
|
|
alert.show(qsTr("Could not save file: ") + error)
|
2021-07-11 14:18:01 +00:00
|
|
|
|
// TODO: Error handling
|
2022-01-23 16:31:34 +00:00
|
|
|
|
return
|
2021-03-09 14:01:03 +00:00
|
|
|
|
}
|
2021-07-11 14:18:01 +00:00
|
|
|
|
drawCanvas.requestPaint()
|
2022-01-20 17:19:36 +00:00
|
|
|
|
alert.show(qsTr("Loaded file '%1'.").arg(basename))
|
2022-01-23 16:31:34 +00:00
|
|
|
|
history.saved = true
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 22:19:00 +00:00
|
|
|
|
Timer {
|
|
|
|
|
id: delayRefreshTimer
|
|
|
|
|
repeat: false
|
|
|
|
|
interval: 1
|
|
|
|
|
onTriggered: sidebarSelector.currentIndex = 0
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-11 14:18:01 +00:00
|
|
|
|
Timer {
|
|
|
|
|
id: testBuildTimer
|
|
|
|
|
repeat: false
|
|
|
|
|
interval: 100
|
|
|
|
|
onTriggered: Qt.quit() // Quit after paint on test build
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-23 16:31:34 +00:00
|
|
|
|
onClosing: {
|
|
|
|
|
if(!history.saved) {
|
|
|
|
|
close.accepted = false
|
|
|
|
|
appMenu.showSaveUnsavedChangesDialog()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-29 17:17:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
\qmlmethod void LogarithmPlotter::copyDiagramToClipboard()
|
|
|
|
|
Copies the current diagram image to the clipboard.
|
|
|
|
|
*/
|
2020-12-22 00:01:36 +00:00
|
|
|
|
function copyDiagramToClipboard() {
|
|
|
|
|
var file = Helper.gettmpfile()
|
|
|
|
|
drawCanvas.save(file)
|
|
|
|
|
Helper.copyImageToClipboard()
|
2022-01-20 17:19:36 +00:00
|
|
|
|
alert.show(qsTr("Copied plot screenshot to clipboard!"))
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|
2021-08-14 19:40:42 +00:00
|
|
|
|
|
2022-01-29 17:17:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
\qmlmethod void LogarithmPlotter::showAlert(string alertText)
|
|
|
|
|
Shows an alert on the diagram.
|
|
|
|
|
*/
|
2021-08-14 19:40:42 +00:00
|
|
|
|
function showAlert(alertText) {
|
|
|
|
|
// This function is called from the backend and is used to show alerts from there.
|
|
|
|
|
alert.show(alertText)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Menu {
|
|
|
|
|
id: updateMenu
|
|
|
|
|
title: qsTr("&Update")
|
|
|
|
|
Action {
|
|
|
|
|
text: qsTr("&Update LogarithmPlotter")
|
|
|
|
|
icon.name: 'update'
|
2022-01-31 20:39:51 +00:00
|
|
|
|
onTriggered: Qt.openUrlExternally("https://dev.apps.ad5001.eu/logarithmplotter")
|
2021-08-14 19:40:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-29 17:17:19 +00:00
|
|
|
|
/*!
|
|
|
|
|
\qmlmethod void LogarithmPlotter::showUpdateMenu()
|
|
|
|
|
Shows the update menu in the AppMenuBar.
|
|
|
|
|
*/
|
2021-08-14 19:40:42 +00:00
|
|
|
|
function showUpdateMenu() {
|
|
|
|
|
appMenu.addMenu(updateMenu)
|
|
|
|
|
}
|
2020-12-22 00:01:36 +00:00
|
|
|
|
}
|