diff --git a/assets/assets.qrc b/assets/assets.qrc index 62912e3f..41ef811b 100644 --- a/assets/assets.qrc +++ b/assets/assets.qrc @@ -86,5 +86,6 @@ icons/scroll-down.svg icons/scroll-top.svg icons/scroll-up.svg + qml/Widgets/SimpleDial.qml diff --git a/assets/qml/Widgets/MapDelegate.qml b/assets/qml/Widgets/MapDelegate.qml index c4b1a675..f03f0fa5 100644 --- a/assets/qml/Widgets/MapDelegate.qml +++ b/assets/qml/Widgets/MapDelegate.qml @@ -203,7 +203,6 @@ Window { anchors.fill: parent copyrightsVisible: false anchors.margins: parent.border.width - onActiveMapTypeChanged: console.log(map.activeMapType) tilt: 27 zoomLevel: 16 diff --git a/assets/qml/Widgets/SimpleDial.qml b/assets/qml/Widgets/SimpleDial.qml new file mode 100644 index 00000000..35bd44ea --- /dev/null +++ b/assets/qml/Widgets/SimpleDial.qml @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2020-2021 Alex Spataru + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +import QtQuick 2.12 +import QtQuick.Controls 2.0 + +Dial { + id: control + + property string text: control.value.toFixed(1) + property color dialColor: pressed ? palette.highlight : "#eee" + + background: Rectangle { + border.width: 2 + radius: width / 2 + color: "transparent" + border.color: control.dialColor + x: control.width / 2 - width / 2 + y: control.height / 2 - height / 2 + width: Math.min(control.width, control.height) + height: Math.min(control.width, control.height) + + Label { + font.pixelSize: 12 + text: control.text + color: control.dialColor + anchors.centerIn: parent + font.family: app.monoFont + } + } + + handle: ToolButton { + id: handleItem + + width: 42 + height: 42 + enabled: false + icon.width: width + icon.height: height + icon.color: control.dialColor + icon.source: "qrc:/icons/scroll-up.svg" + x: control.background.x + control.background.width / 2 - width / 2 + y: control.background.y + control.background.height / 2 - height / 2 + + transform: [ + Translate { + y: -Math.min(control.background.width, control.background.height) * 0.55 + handleItem.height / 2 + }, + Rotation { + angle: control.angle + origin.x: handleItem.width / 2 + origin.y: handleItem.height / 2 + } + ] + } +} diff --git a/assets/qml/Windows/DataGrid.qml b/assets/qml/Windows/DataGrid.qml index 1d077f48..f7b64938 100644 --- a/assets/qml/Windows/DataGrid.qml +++ b/assets/qml/Windows/DataGrid.qml @@ -41,8 +41,8 @@ Control { // Settings // Settings { - property alias numPoints: slider.value - property alias multiplier: mult.value + property alias numPoints: points.value + property alias multiplier: scale.value } // @@ -164,45 +164,72 @@ Control { // Horizontal range slider // RowLayout { - spacing: 0 + id: ranges + spacing: app.spacing * 2 visible: graphGenerator.count > 0 - Slider { - id: slider - to: 25 - from: 1 - value: 10 - live: false + function updateGraphValue() { + Cpp_UI_GraphProvider.displayedPoints = points.value * Math.pow(10, scale.value) + } + + ColumnLayout { + spacing: app.spacing Layout.fillWidth: true - Layout.alignment: Qt.AlignVCenter - onValueChanged: Cpp_UI_GraphProvider.displayedPoints = value * Math.pow(10, mult.value) + Layout.fillHeight: true + Layout.alignment: Qt.AlignHCenter + + Widgets.SimpleDial { + id: points + + to: 25 + from: 1 + value: 10 + Layout.fillWidth: true + Layout.fillHeight: true + Layout.alignment: Qt.AlignHCenter + onPressedChanged: ranges.updateGraphValue() + Component.onCompleted: ranges.updateGraphValue() + } + + Label { + font.pixelSize: 12 + text: qsTr("Points") + Layout.fillWidth: true + font.family: app.monoFont + Layout.alignment: Qt.AlignHCenter + horizontalAlignment: Label.AlignHCenter + } } - Item { - width: app.spacing - } + ColumnLayout { + spacing: app.spacing + Layout.fillWidth: true + Layout.fillHeight: true + Layout.alignment: Qt.AlignHCenter - Label { - font.pixelSize: 12 - font.family: app.monoFont - Layout.alignment: Qt.AlignVCenter - text: Math.ceil(slider.position * (slider.to)) + "×10^" - } + Widgets.SimpleDial { + id: scale - Item { - width: app.spacing - } + to: 6 + from: 0 + value: 1 + Layout.fillWidth: true + Layout.fillHeight: true + snapMode: Dial.SnapOnRelease + text: "10^" + Math.ceil(scale.value) + Layout.alignment: Qt.AlignHCenter + onPressedChanged: ranges.updateGraphValue() + Component.onCompleted: ranges.updateGraphValue() + } - SpinBox { - id: mult - to: 6 - from: 0 - value: 1 - editable: true - Layout.maximumWidth: 42 - font.family: app.monoFont - Layout.alignment: Qt.AlignVCenter - onValueChanged: Cpp_UI_GraphProvider.displayedPoints = slider.value * Math.pow(10, mult.value) + Label { + font.pixelSize: 12 + Layout.fillWidth: true + font.family: app.monoFont + Layout.alignment: Qt.AlignHCenter + horizontalAlignment: Label.AlignHCenter + text: qsTr("Scale") + } } } diff --git a/assets/translations/de.qm b/assets/translations/de.qm index 54bd6dfe..2cbc8a94 100644 Binary files a/assets/translations/de.qm and b/assets/translations/de.qm differ diff --git a/assets/translations/de.ts b/assets/translations/de.ts index 10c2c8a1..0bf97085 100644 --- a/assets/translations/de.ts +++ b/assets/translations/de.ts @@ -137,7 +137,7 @@ Console No data received so far... - Noch keine Daten verfügbar... + Noch keine Daten verfügbar... Send data to device @@ -241,6 +241,14 @@ Data Daten + + Points + Punkte + + + Scale + Multiplikator + DeviceManager diff --git a/assets/translations/en.qm b/assets/translations/en.qm index 555f764d..f936eac3 100644 Binary files a/assets/translations/en.qm and b/assets/translations/en.qm differ diff --git a/assets/translations/en.ts b/assets/translations/en.ts index 40a8fa40..d83eb421 100644 --- a/assets/translations/en.ts +++ b/assets/translations/en.ts @@ -163,6 +163,10 @@ Save as + + No data received so far... + + CsvPlayer @@ -197,6 +201,14 @@ Data + + Points + + + + Scale + + DeviceManager diff --git a/assets/translations/es.qm b/assets/translations/es.qm index 8049ddd1..daa59f49 100644 Binary files a/assets/translations/es.qm and b/assets/translations/es.qm differ diff --git a/assets/translations/es.ts b/assets/translations/es.ts index fec08ed3..6d6a2241 100644 --- a/assets/translations/es.ts +++ b/assets/translations/es.ts @@ -141,7 +141,7 @@ Console No data received so far... - No se han recibido datos hasta ahora ... + No se han recibido datos hasta ahora ... Autoscroll @@ -249,6 +249,14 @@ Data Datos + + Points + Puntos + + + Scale + Escala + DeviceManager diff --git a/assets/translations/zh.qm b/assets/translations/zh.qm index 819d1378..7ef96e23 100644 Binary files a/assets/translations/zh.qm and b/assets/translations/zh.qm differ diff --git a/assets/translations/zh.ts b/assets/translations/zh.ts index 0e5bbbb4..34f56d32 100644 --- a/assets/translations/zh.ts +++ b/assets/translations/zh.ts @@ -137,7 +137,7 @@ Console No data received so far... - 目前未收到任何数据... + 目前未收到任何数据... Send data to device @@ -245,6 +245,14 @@ Data 数据 + + Points + 点数 + + + Scale + 乘数 + DeviceManager