PageChargeSelect.qml 1.79 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import QtQuick 2.8
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import App 1.0

Page {

    Component.onCompleted: initializeValues()

    property alias dialValue: dial.value

    function initializeValues()
    {
        dial.value = Variables.initialCharge
        spinBoxes.updateValues( dial.value )
    }

18 19 20
    background: RowLayout  {
        spacing: 40
        anchors.centerIn: parent
21 22 23 24

        DialBase
        {
            id: dial
25 26 27
            Layout.alignment: Qt.AlignCenter
            Layout.preferredHeight: 240
            Layout.preferredWidth: 240
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
            from: 0
            to: 100
            onMoved:
            {
                if ( value < Variables.initialCharge )
                    value = Variables.initialCharge
                spinBoxes.updateValues( value )
            }

            onValueChanged:
            {
                Variables.wantedCharge = value;
            }
        }

        InfoSpinBoxes
        {
            id: spinBoxes
46 47 48
            Layout.preferredWidth: Variables.pixelSpinBoxWidth
            Layout.preferredHeight: 180
            Layout.alignment: Qt.AlignCenter
49 50 51 52 53 54 55 56 57

            onValueChanged:
            {
                dial.value = value;
            }
            onPriceChanged:
            {
                Variables.currentPrice = value;
            }
58 59 60 61 62 63 64 65 66

            Text
            {
                anchors.bottom: spinBoxes.top
                anchors.bottomMargin: 8
                color: "#fefefe"
                text: qsTr("Select charging level")
                font.pixelSize: Variables.fontSelectCharging
            }
67 68 69 70
        }

        Battery
        {
71 72 73
            Layout.preferredWidth: 100
            Layout.preferredHeight: 280
            Layout.alignment: Qt.AlignCenter
74 75 76 77
            topUpCharge: dial.value
        }
    }
}