Debian Codegraph @

src/qml/AMDPMFreqVoltForm.qml

raw
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
9 AMD_PM_FREQ_VOLT {
10 id: pmFreqVolt
11 objectName: "AMD_PM_FREQ_VOLT"
12
13 width: contents.width
14 height: contents.height
15
16 onControlLabelChanged: label => fv.title = label
17
18 onVoltRangeChanged: (min, max) => {
19 p.voltMin = min
20 p.voltMax = max
21
22 fv.setVoltRange(min, max)
23 }
24
25 onFreqRangeChanged: (min, max) => {
26 p.freqMin = min
27 p.freqMax = max
28
29 fv.setFreqRange(min, max)
30 }
31
32 onVoltModeChanged: mode => fv.voltManual = mode === "manual"
33
34 onStatesChanged: states => fv.setFVStates(states, p.activeStates,
35 p.freqMin, p.freqMax,
36 p.voltMin, p.voltMax)
37
38 onSomeStateChanged: (index, freq, volt) => fv.updateFVState(index, freq, volt)
39
40 onActiveStatesChanged: states => {
41 p.activeStates.length = 0
42 p.activeStates = states
43 fv.activeStates(states)
44 }
45
46 QtObject {
47 id: p
48
49 property int freqMin: 0
50 property int freqMax: 0
51 property int voltMin: 0
52 property int voltMax: 0
53
54 property var activeStates: []
55 }
56
57 CPane {
58 id: contents
59 padding: 0
60
61 RowLayout {
62 FVControl {
63 id: fv
64 Layout.fillHeight: true
65
66 onVoltManualChanged: pmFreqVolt.changeVoltMode(voltManual ? "manual" : "auto")
67 onSomeStateChanged: (index, freq, volt) => pmFreqVolt.changeState(index, freq, volt)
68 onActiveStateChanged: (index, active) => pmFreqVolt.changeActiveState(index, active)
69 }
70 }
71 }
72 }