| 1 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 2 |
// Copyright 2021 Juan Palacios <[email protected]> |
| 3 |
|
| 4 |
import QtQuick 2.15 |
| 5 |
import QtQuick.Controls 2.15 |
| 6 |
import QtQuick.Layouts 1.15 |
| 7 |
import CoreCtrl.UIComponents 1.0 |
| 8 |
import "Style.js" as Style |
| 9 |
|
| 10 |
AMD_PM_VOLT_CURVE { |
| 11 |
id: pmVoltCurve |
| 12 |
objectName: "AMD_PM_VOLT_CURVE" |
| 13 |
|
| 14 |
width: contents.width |
| 15 |
height: contents.height |
| 16 |
|
| 17 |
onModeChanged: mode => modeSw.checked = mode === "manual" |
| 18 |
onPointsRangeChanged: (freqMin, freqMax, voltMin, voltMax) => { |
| 19 |
voltCurve.configureAxes(qsTr("Frequency"), "MHz", freqMin, freqMax, |
| 20 |
qsTr("Voltage"), "mV", voltMin, voltMax) |
| 21 |
} |
| 22 |
onPointsChanged: points => { |
| 23 |
voltCurve.removeCurve("volt") |
| 24 |
voltCurve.addCurve("volt", Style.Theme.accent, points) |
| 25 |
} |
| 26 |
|
| 27 |
CPane { |
| 28 |
id: contents |
| 29 |
padding: 0 |
| 30 |
anchors.fill: parent |
| 31 |
|
| 32 |
RowLayout { |
| 33 |
anchors.fill: parent |
| 34 |
|
| 35 |
Pane { |
| 36 |
Layout.fillHeight: true |
| 37 |
|
| 38 |
padding: Style.g_padding |
| 39 |
background: Rectangle { |
| 40 |
border.color: Style.FVControl.border_color |
| 41 |
border.width: 2 |
| 42 |
color: "#00000000" |
| 43 |
} |
| 44 |
|
| 45 |
ColumnLayout { |
| 46 |
anchors.fill: parent |
| 47 |
|
| 48 |
RowLayout { |
| 49 |
Item { |
| 50 |
implicitWidth: modeSw.width / (1 + Style.g_tweakScale) |
| 51 |
|
| 52 |
Switch { |
| 53 |
id: modeSw |
| 54 |
|
| 55 |
scale: Style.g_tweakScale |
| 56 |
anchors.centerIn: parent |
| 57 |
|
| 58 |
onToggled: pmVoltCurve.changeMode(checked ? "manual" : "auto") |
| 59 |
} |
| 60 |
} |
| 61 |
Label { |
| 62 |
text: qsTr("Voltage") |
| 63 |
font.pointSize: 11 |
| 64 |
font.bold: true |
| 65 |
} |
| 66 |
|
| 67 |
Item { Layout.fillWidth: true } |
| 68 |
} |
| 69 |
|
| 70 |
CurveControl { |
| 71 |
id: voltCurve |
| 72 |
Layout.fillHeight: true |
| 73 |
|
| 74 |
minXDistance: 5 |
| 75 |
|
| 76 |
xTickCount: 3 |
| 77 |
xMinorTickCount: 1 |
| 78 |
yTickCount: 3 |
| 79 |
yMinorTickCount: 1 |
| 80 |
|
| 81 |
width: 400 |
| 82 |
height: 290 |
| 83 |
|
| 84 |
enabled: modeSw.checked |
| 85 |
|
| 86 |
onCurveChanged: (name, oldPoint, newPoint) => pmVoltCurve.updatePoint(oldPoint, newPoint) |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
} |
| 92 |
} |