Fixing bugs

This commit is contained in:
Ad5001 2021-03-09 20:37:12 +01:00
parent b90fa5a99b
commit f63e86b78a
5 changed files with 227 additions and 215 deletions

View file

@ -1,8 +1,11 @@
#!/bin/bash #!/bin/bash
APPROOT="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" APPROOT="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "Adding desktop file..."
mkdir -p ~/.local/share/applications mkdir -p ~/.local/share/applications
sed "s+/home/ad5001/Apps/LogarithmPlotter/+$APPROOT+g" "$APPROOT/linux/logplotter.desktop" > ~/.local/share/applications/logplotter.desktop sed "s+/home/ad5001/Apps/LogarithmPlotter/+$APPROOT/+g" "$APPROOT/linux/logplotter.desktop" > ~/.local/share/applications/logplotter.desktop
sed "s+/home/ad5001/Apps/LogarithmPlotter/+$APPROOT+g" "$APPROOT/linux/x-logarithm-plotter.xml" > ~/.local/share/mime/x-logarithm-plotter.xml echo "Installing mime-type..."
mkdir -p ~/.local/share/applications
sed "s+/home/ad5001/Apps/LogarithmPlotter/+$APPROOT/+g" "$APPROOT/linux/x-logarithm-plotter.xml" > ~/.local/share/mime/packages/x-logarithm-plotter.xml
mkdir -p ~/.local/share/icons/hicolor/scalable/mimetypes mkdir -p ~/.local/share/icons/hicolor/scalable/mimetypes
cp "$APPROOT/linux/logplotterfile.svg" ~/.local/share/icons/hicolor/scalable/mimetypes/application-x-logarithm-plotter.svg cp "$APPROOT/linux/logplotterfile.svg" ~/.local/share/icons/hicolor/scalable/mimetypes/application-x-logarithm-plotter.svg
update-mime-database ~/.local/share/mime/ update-mime-database ~/.local/share/mime/

View file

@ -14,18 +14,18 @@
version="1.1" version="1.1"
id="SVGRoot" id="SVGRoot"
sodipodi:docname="logplotterfile.svg" sodipodi:docname="logplotterfile.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"> inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs <defs
id="defs10"> id="defs10">
<linearGradient <linearGradient
inkscape:collect="always" inkscape:collect="always"
id="linearGradient51"> id="linearGradient51">
<stop <stop
style="stop-color:#ededef;stop-opacity:1" style="stop-color:#e0e0e0;stop-opacity:1"
offset="0" offset="0"
id="stop47" /> id="stop47" />
<stop <stop
style="stop-color:#ffffff;stop-opacity:0;" style="stop-color:#ffffff;stop-opacity:1"
offset="1" offset="1"
id="stop49" /> id="stop49" />
</linearGradient> </linearGradient>
@ -73,7 +73,12 @@
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
inkscape:document-rotation="0" inkscape:document-rotation="0"
showgrid="true"> showgrid="true"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1">
<inkscape:grid <inkscape:grid
type="xygrid" type="xygrid"
id="grid19" /> id="grid19" />

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/x-logarithm-plotter"> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<!--Created automatically by update-mime-database. DO NOT EDIT!--> <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/x-logarithm-plotter">
<comment>Logarithm Plot/Graph</comment> <comment>Logarithm Plot/Graph</comment>
<icon name="/home/ad5001/Apps/LogarithmPlotter/logplotterfile.svg"/> <icon name="/home/ad5001/Apps/LogarithmPlotter/linux/logplotterfile.svg"/>
<glob-deleteall/> <glob-deleteall/>
<glob pattern="*.json"/> <glob pattern="*.json"/>
<glob pattern="*.lgg"/> <glob pattern="*.lgg"/>
<glob pattern="*.lgp"/> <glob pattern="*.lgp"/>
</mime-type> </mime-type>
</mime-info>

View file

@ -68,12 +68,13 @@ ApplicationWindow {
} }
StackLayout { StackLayout {
id: sidebarContents
anchors.top: sidebarSelector.bottom anchors.top: sidebarSelector.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.topMargin: 5 anchors.topMargin: 5
anchors.leftMargin: 5 anchors.leftMargin: 5
width: parent.width - 10 width: parent.width - 10
height: parent.height - sidebarSelector.height height: parent.height - sidebarContents.x;
currentIndex: sidebarSelector.currentIndex currentIndex: sidebarSelector.currentIndex
z: -1 z: -1
clip: true clip: true

View file

@ -20,11 +20,8 @@ import QtQuick.Controls 2.12
import QtQuick 2.12 import QtQuick 2.12
import "js/utils.js" as Utils import "js/utils.js" as Utils
Column { ScrollView {
id: settings id: settings
height: 30*9 //30*Math.max(1, Math.ceil(7 / columns))
//columns: Math.floor(width / settingWidth)
spacing: 10
signal changed() signal changed()
@ -43,220 +40,225 @@ Column {
property bool showxgrad: true property bool showxgrad: true
property bool showygrad: true property bool showygrad: true
FileDialog { Column {
id: fdiag height: 30*9 //30*Math.max(1, Math.ceil(7 / columns))
onAccepted: { //columns: Math.floor(width / settingWidth)
var filePath = fileUrl.toString().substr(7) spacing: 10
settings.saveFilename = filePath FileDialog {
if(exportMode) { id: fdiag
root.saveDiagram(filePath) onAccepted: {
} else { var filePath = fileUrl.toString().substr(7)
root.loadDiagram(filePath) settings.saveFilename = filePath
if(xAxisLabel.find(settings.xaxislabel) == -1) xAxisLabel.model.append({text: settings.xaxislabel}) if(exportMode) {
xAxisLabel.editText = settings.xaxislabel root.saveDiagram(filePath)
if(yAxisLabel.find(settings.yaxislabel) == -1) yAxisLabel.model.append({text: settings.yaxislabel}) } else {
yAxisLabel.editText = settings.yaxislabel root.loadDiagram(filePath)
if(xAxisLabel.find(settings.xaxislabel) == -1) xAxisLabel.model.append({text: settings.xaxislabel})
xAxisLabel.editText = settings.xaxislabel
if(yAxisLabel.find(settings.yaxislabel) == -1) yAxisLabel.model.append({text: settings.yaxislabel})
yAxisLabel.editText = settings.yaxislabel
}
} }
} }
}
// Line 1
// Line 1 // Zoom
// Zoom TextSetting {
TextSetting { id: zoomX
id: zoomX height: 30
height: 30 isInt: true
isInt: true label: "X Zoom"
label: "X Zoom" min: 1
min: 1 width: settings.settingWidth
width: settings.settingWidth defValue: settings.xzoom
defValue: settings.xzoom onChanged: function(newValue) {
onChanged: function(newValue) { settings.xzoom = newValue
settings.xzoom = newValue settings.changed()
settings.changed() }
} }
} TextSetting {
TextSetting { id: zoomY
id: zoomY height: 30
height: 30 isInt: true
isInt: true label: "Y Zoom"
label: "Y Zoom" width: settings.settingWidth
width: settings.settingWidth defValue: settings.yzoom
defValue: settings.yzoom onChanged: function(newValue) {
onChanged: function(newValue) { settings.yzoom = newValue
settings.yzoom = newValue settings.changed()
settings.changed() }
} }
} // Positioning the graph
// Positioning the graph TextSetting {
TextSetting { id: minX
id: minX height: 30
height: 30 isDouble: true
isDouble: true min: -Infinity
min: -Infinity label: "Min X"
label: "Min X" width: settings.settingWidth
width: settings.settingWidth defValue: settings.xmin
defValue: settings.xmin onChanged: function(newValue) {
onChanged: function(newValue) { settings.xmin = newValue
settings.xmin = newValue settings.changed()
settings.changed() }
} }
} TextSetting {
TextSetting { id: maxY
id: maxY height: 30
height: 30 isDouble: true
isDouble: true label: "Max Y"
label: "Max Y" width: settings.settingWidth
width: settings.settingWidth defValue: settings.ymax
defValue: settings.ymax onChanged: function(newValue) {
onChanged: function(newValue) { settings.ymax = newValue
settings.ymax = newValue settings.changed()
settings.changed() }
} }
} TextSetting {
TextSetting { id: yAxisStep
id: yAxisStep height: 30
height: 30 label: "Y Axis Step"
label: "Y Axis Step" width: settings.settingWidth
width: settings.settingWidth defValue: settings.yaxisstep
defValue: settings.yaxisstep onChanged: function(newValue) {
onChanged: function(newValue) { settings.yaxisstep = newValue
settings.yaxisstep = newValue settings.changed()
settings.changed() }
} }
}
TextSetting {
TextSetting { id: xAxisStep
id: xAxisStep height: 30
height: 30 label: "X Axis Step"
label: "X Axis Step" width: settings.settingWidth
width: settings.settingWidth defValue: settings.xaxisstep
defValue: settings.xaxisstep visible: !settings.logscalex
visible: !settings.logscalex onChanged: function(newValue) {
onChanged: function(newValue) { settings.xaxisstep = newValue
settings.xaxisstep = newValue settings.changed()
settings.changed() }
} }
}
ComboBoxSetting {
ComboBoxSetting { id: xAxisLabel
id: xAxisLabel height: 30
height: 30 width: settings.settingWidth
width: settings.settingWidth label: 'X Label'
label: 'X Label' model: ListModel {
model: ListModel { ListElement { text: "" }
ListElement { text: "" } ListElement { text: "x" }
ListElement { text: "x" } ListElement { text: "ω (rad/s)" }
ListElement { text: "ω (rad/s)" } }
currentIndex: find(settings.xaxislabel)
editable: true
onAccepted: function(){
editText = Utils.parseName(editText, false)
if (find(editText) === -1) model.append({text: editText})
settings.xaxislabel = editText
settings.changed()
}
onActivated: function(selectedId) {
settings.xaxislabel = model.get(selectedId).text
settings.changed()
}
Component.onCompleted: editText = settings.xaxislabel
} }
currentIndex: find(settings.xaxislabel)
editable: true ComboBoxSetting {
onAccepted: function(){ id: yAxisLabel
editText = Utils.parseName(editText, false) height: 30
if (find(editText) === -1) model.append({text: editText}) width: settings.settingWidth
settings.xaxislabel = editText label: 'Y Label'
settings.changed() model: ListModel {
ListElement { text: "" }
ListElement { text: "y" }
ListElement { text: "G (dB)" }
ListElement { text: "φ (°)" }
ListElement { text: "φ (deg)" }
ListElement { text: "φ (rad)" }
}
currentIndex: find(settings.yaxislabel)
editable: true
onAccepted: function(){
editText = Utils.parseName(editText, false)
if (find(editText) === -1) model.append({text: editText, yaxisstep: root.yaxisstep})
settings.yaxislabel = editText
settings.changed()
}
onActivated: function(selectedId) {
settings.yaxislabel = model.get(selectedId).text
settings.changed()
}
Component.onCompleted: editText = settings.yaxislabel
} }
onActivated: function(selectedId) {
settings.xaxislabel = model.get(selectedId).text CheckBox {
settings.changed() id: logScaleX
checked: settings.logscalex
text: 'X Log scale'
onClicked: {
settings.logscalex = checked
settings.changed()
}
} }
Component.onCompleted: editText = settings.xaxislabel
} CheckBox {
id: showXGrad
ComboBoxSetting { checked: settings.showxgrad
id: yAxisLabel text: 'Show X graduation'
height: 30 onClicked: {
width: settings.settingWidth settings.showxgrad = checked
label: 'Y Label' settings.changed()
model: ListModel { }
ListElement { text: "" }
ListElement { text: "y" }
ListElement { text: "G (dB)" }
ListElement { text: "φ (°)" }
ListElement { text: "φ (deg)" }
ListElement { text: "φ (rad)" }
} }
currentIndex: find(settings.yaxislabel)
editable: true CheckBox {
onAccepted: function(){ id: showYGrad
editText = Utils.parseName(editText, false) checked: settings.showygrad
if (find(editText) === -1) model.append({text: editText, yaxisstep: root.yaxisstep}) text: 'Show Y graduation'
settings.yaxislabel = editText onClicked: {
settings.changed() settings.showygrad = checked
settings.changed()
}
} }
onActivated: function(selectedId) {
settings.yaxislabel = model.get(selectedId).text Button {
settings.changed() id: copyToClipboard
height: 30
width: settings.settingWidth
text: "Copy to clipboard"
icon.name: 'editcopy'
onClicked: root.copyDiagramToClipboard()
} }
Component.onCompleted: editText = settings.yaxislabel
} Button {
id: saveDiagram
CheckBox { height: 30
id: logScaleX width: settings.settingWidth
checked: settings.logscalex text: "Save diagram"
text: 'X Log scale' icon.name: 'filesave'
onClicked: { onClicked: save()
settings.logscalex = checked
settings.changed()
} }
}
Button {
CheckBox { id: saveDiagramAs
id: showXGrad height: 30
checked: settings.showxgrad width: settings.settingWidth
text: 'Show X graduation' text: "Save diagram as"
onClicked: { icon.name: 'filesaveas'
settings.showxgrad = checked onClicked: saveAs()
settings.changed()
} }
}
Button {
CheckBox { id: loadDiagram
id: showYGrad height: 30
checked: settings.showygrad width: settings.settingWidth
text: 'Show Y graduation' text: "Load diagram"
onClicked: { icon.name: 'fileopen'
settings.showygrad = checked onClicked: load()
settings.changed()
} }
} }
Button {
id: copyToClipboard
height: 30
width: settings.settingWidth
text: "Copy to clipboard"
icon.name: 'editcopy'
onClicked: root.copyDiagramToClipboard()
}
Button {
id: saveDiagram
height: 30
width: settings.settingWidth
text: "Save diagram"
icon.name: 'filesave'
onClicked: save()
}
Button {
id: saveDiagramAs
height: 30
width: settings.settingWidth
text: "Save diagram as"
icon.name: 'filesaveas'
onClicked: saveAs()
}
Button {
id: loadDiagram
height: 30
width: settings.settingWidth
text: "Load diagram"
icon.name: 'fileopen'
onClicked: load()
}
function save() { function save() {
if(settings.saveFilename == "") { if(settings.saveFilename == "") {
fdiag.exportMode = true fdiag.exportMode = true