mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Add scale dialgs
This commit is contained in:
parent
aaaf23f3d7
commit
a0701bde69
@ -86,5 +86,6 @@
|
||||
<file>icons/scroll-down.svg</file>
|
||||
<file>icons/scroll-top.svg</file>
|
||||
<file>icons/scroll-up.svg</file>
|
||||
<file>qml/Widgets/SimpleDial.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -203,7 +203,6 @@ Window {
|
||||
anchors.fill: parent
|
||||
copyrightsVisible: false
|
||||
anchors.margins: parent.border.width
|
||||
onActiveMapTypeChanged: console.log(map.activeMapType)
|
||||
|
||||
tilt: 27
|
||||
zoomLevel: 16
|
||||
|
75
assets/qml/Widgets/SimpleDial.qml
Normal file
75
assets/qml/Widgets/SimpleDial.qml
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Alex Spataru <https://github.com/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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -137,7 +137,7 @@
|
||||
<name>Console</name>
|
||||
<message>
|
||||
<source>No data received so far...</source>
|
||||
<translation type="vanished">Noch keine Daten verfügbar...</translation>
|
||||
<translation>Noch keine Daten verfügbar...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Send data to device</source>
|
||||
@ -241,6 +241,14 @@
|
||||
<source>Data</source>
|
||||
<translation>Daten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Points</source>
|
||||
<translation>Punkte</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scale</source>
|
||||
<translation>Multiplikator</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DeviceManager</name>
|
||||
|
Binary file not shown.
@ -163,6 +163,10 @@
|
||||
<source>Save as</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No data received so far...</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CsvPlayer</name>
|
||||
@ -197,6 +201,14 @@
|
||||
<source>Data</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Points</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scale</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DeviceManager</name>
|
||||
|
Binary file not shown.
@ -141,7 +141,7 @@
|
||||
<name>Console</name>
|
||||
<message>
|
||||
<source>No data received so far...</source>
|
||||
<translation type="vanished">No se han recibido datos hasta ahora ...</translation>
|
||||
<translation>No se han recibido datos hasta ahora ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Autoscroll</source>
|
||||
@ -249,6 +249,14 @@
|
||||
<source>Data</source>
|
||||
<translation>Datos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Points</source>
|
||||
<translation>Puntos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scale</source>
|
||||
<translation>Escala</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DeviceManager</name>
|
||||
|
Binary file not shown.
@ -137,7 +137,7 @@
|
||||
<name>Console</name>
|
||||
<message>
|
||||
<source>No data received so far...</source>
|
||||
<translation type="vanished">目前未收到任何数据...</translation>
|
||||
<translation>目前未收到任何数据...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Send data to device</source>
|
||||
@ -245,6 +245,14 @@
|
||||
<source>Data</source>
|
||||
<translation>数据</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Points</source>
|
||||
<translation>点数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scale</source>
|
||||
<translation>乘数</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DeviceManager</name>
|
||||
|
Loading…
x
Reference in New Issue
Block a user