diff --git a/LogarithmPlotter/config.py b/LogarithmPlotter/config.py index 0e0a2bf..36ea724 100644 --- a/LogarithmPlotter/config.py +++ b/LogarithmPlotter/config.py @@ -22,6 +22,7 @@ from json import load, dumps DEFAULT_SETTINGS = { "check_for_updates": True, + "reset_redo_stack": True, "last_install_greet": "0", "lang": "en" } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml index db644ed..712f23f 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml @@ -113,6 +113,15 @@ MenuBar { onTriggered: Helper.setSettingBool("check_for_updates", checked) icon.name: 'update' } + + Action { + id: resetRedoStackMenuSetting + text: qsTr("Reset redo stack automaticly") + checkable: true + checked: Helper.getSettingBool("reset_redo_stack") + onTriggered: Helper.setSettingBool("reset_redo_stack", checked) + icon.name: 'history' + } } Menu { diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml index 51d50ef..48a8192 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/GreetScreen.qml @@ -97,6 +97,18 @@ Popup { } } + CheckBox { + id: resetRedoStackSetting + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: checkForUpdatesSetting.bottom + checked: Helper.getSettingBool("reset_redo_stack") + text: 'Reset redo stack when a new action is added to history' + onClicked: { + Helper.setSettingBool("reset_redo_stack", checked) + resetRedoStackMenuSetting.checked = checked + } + } + Button { text: "Done" font.pixelSize: 20 @@ -107,7 +119,7 @@ Popup { } Timer { - running: Helper.getSetting("last_install_greet") != Helper.getVersion() + running: Helper.getSetting("last_install_greet") != Helper.getVersion()+"a" repeat: false interval: 50 onTriggered: greetingPopup.open() diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml index 2ad886f..198af79 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml @@ -67,8 +67,10 @@ Item { console.log("Added new entry to history: " + action.getReadableString()) undoStack.push(action) undoCount++; - redoStack = [] - redoCount = 0 + if(Helper.getSettingBool("reset_redo_stack")) { + redoStack = [] + redoCount = 0 + } } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index bc02881..d0a0356 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -112,6 +112,7 @@ ApplicationWindow { Settings { id: settings + canvas: drawCanvas onChanged: drawCanvas.requestPaint() } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml index 9be1b5c..3a0207f 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml @@ -26,6 +26,7 @@ ScrollView { signal changed() property int settingWidth: settings.width - ScrollBar.vertical.width + property Canvas canvas property double xzoom: 100 property double yzoom: 10 @@ -73,7 +74,7 @@ ScrollView { min: 1 icon: "icons/settings/xzoom.svg" width: settings.settingWidth - defValue: settings.xzoom + value: settings.xzoom.toFixed(2) onChanged: function(newValue) { settings.xzoom = newValue settings.changed() @@ -87,7 +88,7 @@ ScrollView { label: "Y Zoom" icon: "icons/settings/yzoom.svg" width: settings.settingWidth - defValue: settings.yzoom + value: settings.yzoom.toFixed(2) onChanged: function(newValue) { settings.yzoom = newValue settings.changed() @@ -105,8 +106,12 @@ ScrollView { width: settings.settingWidth defValue: settings.xmin onChanged: function(newValue) { - settings.xmin = newValue - settings.changed() + if(parseFloat(maxX.value) > newValue) { + settings.xmin = newValue + settings.changed() + } else { + alert.show("Minimum x value must be inferior to maximum.") + } } } @@ -114,6 +119,7 @@ ScrollView { id: maxY height: 30 isDouble: true + min: -Infinity label: "Max Y" icon: "icons/settings/ymax.svg" width: settings.settingWidth @@ -124,6 +130,44 @@ ScrollView { } } + TextSetting { + id: maxX + height: 30 + isDouble: true + min: -Infinity + label: "Max X" + icon: "icons/settings/xmax.svg" + width: settings.settingWidth + value: canvas.px2x(canvas.canvasSize.width).toFixed(2) + onChanged: function(xvaluemax) { + if(xvaluemax > settings.xmin) { + settings.xzoom = settings.xzoom * canvas.canvasSize.width/(canvas.x2px(xvaluemax)) // Adjusting zoom to fit. = (end)/(px of current point) + settings.changed() + } else { + alert.show("Maximum x value must be superior to minimum.") + } + } + } + + TextSetting { + id: minY + height: 30 + isDouble: true + min: -Infinity + label: "Min Y" + icon: "icons/settings/ymin.svg" + width: settings.settingWidth + defValue: canvas.px2y(canvas.canvasSize.height).toFixed(2) + onChanged: function(yvaluemin) { + if(yvaluemin < settings.ymax) { + settings.yzoom = settings.yzoom * canvas.canvasSize.height/(canvas.y2px(yvaluemin)) // Adjusting zoom to fit. = (end)/(px of current point) + settings.changed() + } else { + alert.show("Minimum y value must be inferior to maximum.") + } + } + } + TextSetting { id: xAxisStep height: 30 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml index 8c73fe5..77c62ba 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/TextSetting.qml @@ -30,6 +30,7 @@ Item { property double min: -1 property string label property string defValue + property alias value: input.text property string icon: "" Icon { diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/history.svg b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/history.svg new file mode 100644 index 0000000..829e93a --- /dev/null +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/history.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/xmax.svg b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/xmax.svg new file mode 100644 index 0000000..d3fdb18 --- /dev/null +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/xmax.svg @@ -0,0 +1,80 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/ymin.svg b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/ymin.svg new file mode 100644 index 0000000..4b2d148 --- /dev/null +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/icons/settings/ymin.svg @@ -0,0 +1,81 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + +