| 1 |
// SPDX-License-Identifier: GPL-3.0-or-later |
| 2 |
// Copyright 2019 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_FIXED_FREQ { |
| 11 |
id: pmFrequency |
| 12 |
objectName: "AMD_PM_FIXED_FREQ" |
| 13 |
|
| 14 |
width: contents.width |
| 15 |
height: contents.height |
| 16 |
|
| 17 |
onSclkIndexChanged: index => sclkIndex.value = index |
| 18 |
onMclkIndexChanged: index => mclkIndex.value = index |
| 19 |
|
| 20 |
onSclkStatesChanged: states => { |
| 21 |
if (states.length > 0) { |
| 22 |
|
| 23 |
p.sclkStateLbls.length = 0 |
| 24 |
p.sclkStateIndices.length = 0 |
| 25 |
|
| 26 |
for (var i = 0; i < states.length; i += 2) { |
| 27 |
p.sclkStateIndices.push(states[i]) |
| 28 |
p.sclkStateLbls.push(states[i + 1]) |
| 29 |
} |
| 30 |
sclkIndex.to = p.sclkStateLbls.length - 1 |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
onMclkStatesChanged: states => { |
| 35 |
if (states.length > 0) { |
| 36 |
|
| 37 |
p.mclkStateLbls.length = 0 |
| 38 |
p.mclkStateIndices.length = 0 |
| 39 |
|
| 40 |
for (var i = 0; i < states.length; i += 2) { |
| 41 |
p.mclkStateIndices.push(states[i]) |
| 42 |
p.mclkStateLbls.push(states[i + 1]) |
| 43 |
} |
| 44 |
mclkIndex.to = p.mclkStateLbls.length - 1 |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
QtObject { |
| 49 |
id: p |
| 50 |
|
| 51 |
property var sclkStateLbls: [] |
| 52 |
property var mclkStateLbls: [] |
| 53 |
property var sclkStateIndices: [] |
| 54 |
property var mclkStateIndices: [] |
| 55 |
} |
| 56 |
|
| 57 |
TextMetrics { |
| 58 |
id: tFMetrics |
| 59 |
text: "0000 MHz" |
| 60 |
} |
| 61 |
|
| 62 |
CPane { |
| 63 |
id: contents |
| 64 |
|
| 65 |
ColumnLayout { |
| 66 |
spacing: 0 |
| 67 |
|
| 68 |
RowLayout { |
| 69 |
spacing: 8 |
| 70 |
visible: sclkIndex.from < sclkIndex.to |
| 71 |
|
| 72 |
Item { Layout.fillWidth: true } |
| 73 |
|
| 74 |
Label { text: qsTr("GPU") } |
| 75 |
|
| 76 |
Slider { |
| 77 |
id: sclkIndex |
| 78 |
|
| 79 |
value: 0 |
| 80 |
from: 0 |
| 81 |
to: 0 |
| 82 |
stepSize: 1 |
| 83 |
snapMode: Slider.SnapAlways |
| 84 |
|
| 85 |
onPressedChanged: pressed => { |
| 86 |
if (!pressed) |
| 87 |
pmFrequency.changeSclkIndex(p.sclkStateIndices[sclkIndex.value]) |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
Label { |
| 92 |
text: sclkIndex.to > 0 ? p.sclkStateLbls[sclkIndex.value] |
| 93 |
: "" |
| 94 |
horizontalAlignment: Text.AlignRight |
| 95 |
Layout.preferredWidth: tFMetrics.width |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
RowLayout { |
| 100 |
spacing: 8 |
| 101 |
visible: mclkIndex.from < mclkIndex.to |
| 102 |
|
| 103 |
Item { Layout.fillWidth: true } |
| 104 |
|
| 105 |
Label { text: qsTr("Memory") } |
| 106 |
|
| 107 |
Slider { |
| 108 |
id: mclkIndex |
| 109 |
|
| 110 |
value: 0 |
| 111 |
from: 0 |
| 112 |
to: 0 |
| 113 |
stepSize: 1 |
| 114 |
snapMode: Slider.SnapAlways |
| 115 |
|
| 116 |
onPressedChanged: pressed => { |
| 117 |
if (!pressed) |
| 118 |
pmFrequency.changeMclkIndex(p.mclkStateIndices[mclkIndex.value]) |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
Label { |
| 123 |
text: mclkIndex.to > 0 ? p.mclkStateLbls[mclkIndex.value] |
| 124 |
: "" |
| 125 |
horizontalAlignment: Text.AlignRight |
| 126 |
Layout.preferredWidth: tFMetrics.width |
| 127 |
} |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
} |