Browse Source

Ported to QtQuickControls 2

Malte Veerman 6 years ago
parent
commit
ef1fcbb3ad

+ 2 - 1
CMakeLists.txt

@@ -44,8 +44,9 @@ include(FindPkgConfig)
 
 
 #Find Qt5
 #Find Qt5
 find_package(Qt5Core REQUIRED)
 find_package(Qt5Core REQUIRED)
-find_package(Qt5 5.8 COMPONENTS Quick)
+find_package(Qt5 5.10 COMPONENTS Quick QuickControls2)
 set_package_properties(Qt5Quick PROPERTIES TYPE RUNTIME PURPOSE "Needed by the QML parts")
 set_package_properties(Qt5Quick PROPERTIES TYPE RUNTIME PURPOSE "Needed by the QML parts")
+set_package_properties(Qt5QuickControls2 PROPERTIES TYPE RUNTIME PURPOSE "Needed by the QML parts")
 
 
 #Find KF5
 #Find KF5
 find_package(KF5 COMPONENTS I18n REQUIRED)
 find_package(KF5 COMPONENTS I18n REQUIRED)

+ 56 - 38
fancontrol-gui/package/contents/ui/Application.qml

@@ -19,14 +19,14 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.3
-import QtQuick.Dialogs 1.2
-import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.10
+import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Gui 1.0 as Gui
 import Fancontrol.Gui 1.0 as Gui
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 
 
 
 
-ApplicationWindow {
+Kirigami.ApplicationWindow {
     id: window
     id: window
 
 
     function showWindow() {
     function showWindow() {
@@ -55,21 +55,24 @@ ApplicationWindow {
         window.visible = !Fancontrol.Base.startMinimized;
         window.visible = !Fancontrol.Base.startMinimized;
     }
     }
 
 
-    toolBar: ToolBar {
+    header: ToolBar {
         RowLayout {
         RowLayout {
             anchors.fill: parent
             anchors.fill: parent
 
 
             ToolButton {
             ToolButton {
                 action: applyAction
                 action: applyAction
+                display: AbstractButton.IconOnly
             }
             }
             ToolButton {
             ToolButton {
                 action: resetAction
                 action: resetAction
+                display: AbstractButton.IconOnly
             }
             }
             Loader {
             Loader {
                 active: !!Fancontrol.Base.systemdCom
                 active: !!Fancontrol.Base.systemdCom
 
 
                 sourceComponent: ToolButton {
                 sourceComponent: ToolButton {
                     action: startAction
                     action: startAction
+                    display: AbstractButton.IconOnly
                 }
                 }
             }
             }
             Loader {
             Loader {
@@ -77,6 +80,7 @@ ApplicationWindow {
 
 
                 sourceComponent: ToolButton {
                 sourceComponent: ToolButton {
                     action: stopAction
                     action: stopAction
+                    display: AbstractButton.IconOnly
                 }
                 }
             }
             }
             Item {
             Item {
@@ -85,27 +89,42 @@ ApplicationWindow {
         }
         }
     }
     }
 
 
-    TabView {
-        id: tabView
+    ColumnLayout {
         anchors.fill: parent
         anchors.fill: parent
-        anchors.topMargin: 5
-        frameVisible: true
+        spacing: 5
 
 
-        Tab {
-            title: i18n("Sensors")
-            SensorsTab {}
+        TabBar {
+            id: tabBar
+
+            Layout.fillWidth: true
+
+            TabButton {
+                text: i18n("Sensors")
+                width: implicitWidth
+            }
+            TabButton {
+                text: i18n("PwmFans")
+                width: implicitWidth
+            }
+            TabButton {
+                text: i18n("Configfile")
+                width: implicitWidth
+            }
+            TabButton {
+                text: i18n("Settings")
+                width: implicitWidth
+            }
         }
         }
-        Tab {
-            title: i18n("PwmFans")
+
+        StackLayout {
+            Layout.fillWidth: true
+            Layout.fillHeight: true
+            currentIndex: tabBar.currentIndex
+            anchors.margins: Kirigami.Units.smallSpacing
+
+            SensorsTab {}
             PwmFansTab {}
             PwmFansTab {}
-        }
-        Tab {
-            title: i18n("Configfile")
             ConfigfileTab {}
             ConfigfileTab {}
-        }
-        Tab {
-            id: settingsTab
-            title: i18n("Settings")
             SettingsTab {}
             SettingsTab {}
         }
         }
     }
     }
@@ -134,7 +153,6 @@ ApplicationWindow {
         id: errorDialog
         id: errorDialog
 
 
         visible: false
         visible: false
-        modality: Qt.ApplicationModal
     }
     }
 
 
     Dialog {
     Dialog {
@@ -143,17 +161,17 @@ ApplicationWindow {
         property bool answered: false
         property bool answered: false
 
 
         visible: false
         visible: false
-        modality: Qt.ApplicationModal
+        modal: true
         title: i18n("Unsaved changes")
         title: i18n("Unsaved changes")
-        standardButtons: StandardButton.Cancel | StandardButton.Discard | StandardButton.Apply
+        standardButtons: Dialog.Cancel | Dialog.Discard | Dialog.Apply
 
 
         onRejected: close()
         onRejected: close()
-        onDiscard: {
+        onDiscarded: {
             answered = true;
             answered = true;
             close();
             close();
             window.close();
             window.close();
         }
         }
-        onApply: {
+        onApplied: {
             Fancontrol.Base.apply();
             Fancontrol.Base.apply();
             answered = true;
             answered = true;
             close();
             close();
@@ -169,36 +187,36 @@ ApplicationWindow {
 
 
     Action {
     Action {
         id: applyAction
         id: applyAction
-        text: i18n("Apply")
+//         text: i18n("Apply")
         enabled: Fancontrol.Base.needsApply
         enabled: Fancontrol.Base.needsApply
         onTriggered: Fancontrol.Base.apply()
         onTriggered: Fancontrol.Base.apply()
-        iconName: "dialog-ok-apply"
-        tooltip: i18n("Apply changes")
+        icon.name: "dialog-ok-apply"
+//         tooltip: i18n("Apply changes")
         shortcut: StandardKey.Apply
         shortcut: StandardKey.Apply
     }
     }
     Action {
     Action {
         id: resetAction
         id: resetAction
-        text: i18n("Reset")
+//         text: i18n("Reset")
         enabled: Fancontrol.Base.needsApply
         enabled: Fancontrol.Base.needsApply
         onTriggered: Fancontrol.Base.reset()
         onTriggered: Fancontrol.Base.reset()
-        iconName: "edit-undo"
-        tooltip: i18n("Revert changes")
+        icon.name: "edit-undo"
+//         tooltip: i18n("Revert changes")
     }
     }
     Action {
     Action {
         id: startAction
         id: startAction
-        text: i18n("Start")
+//         text: i18n("Start")
         enabled: !!Fancontrol.Base.systemdCom && !Fancontrol.Base.systemdCom.serviceActive
         enabled: !!Fancontrol.Base.systemdCom && !Fancontrol.Base.systemdCom.serviceActive
-        iconName: "media-playback-start"
-        tooltip: i18n("Enable manual control")
+        icon.name: "media-playback-start"
+//         tooltip: i18n("Enable manual control")
 
 
         onTriggered: Fancontrol.Base.systemdCom.serviceActive = true
         onTriggered: Fancontrol.Base.systemdCom.serviceActive = true
     }
     }
     Action {
     Action {
         id: stopAction
         id: stopAction
-        text: i18n("Stop")
+//         text: i18n("Stop")
         enabled: !!Fancontrol.Base.systemdCom && Fancontrol.Base.systemdCom.serviceActive
         enabled: !!Fancontrol.Base.systemdCom && Fancontrol.Base.systemdCom.serviceActive
-        iconName: "media-playback-stop"
-        tooltip: i18n("Disable manual control")
+        icon.name: "media-playback-stop"
+//         tooltip: i18n("Disable manual control")
 
 
         onTriggered: Fancontrol.Base.systemdCom.serviceActive = false
         onTriggered: Fancontrol.Base.systemdCom.serviceActive = false
     }
     }

+ 3 - 5
fancontrol-gui/package/contents/ui/ConfigfileTab.qml

@@ -19,8 +19,8 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.2
-import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.10
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 
 
@@ -28,9 +28,6 @@ import Fancontrol.Qml 1.0 as Fancontrol
 ColumnLayout {
 ColumnLayout {
     property QtObject loader: Fancontrol.Base.loader
     property QtObject loader: Fancontrol.Base.loader
 
 
-    anchors.fill: parent
-    anchors.margins: Kirigami.Units.smallSpacing
-
     Label {
     Label {
         Layout.alignment: Qt.AlignTop
         Layout.alignment: Qt.AlignTop
         text: !!loader && loader.configEqualToLoadedFile ? loader.configPath : i18n("New config")
         text: !!loader && loader.configEqualToLoadedFile ? loader.configPath : i18n("New config")
@@ -45,6 +42,7 @@ ColumnLayout {
 
 
         ScrollView {
         ScrollView {
             id: scrollView
             id: scrollView
+
             anchors.fill: parent
             anchors.fill: parent
             anchors.margins: Kirigami.Units.smallSpacing
             anchors.margins: Kirigami.Units.smallSpacing
 
 

+ 5 - 7
fancontrol-gui/package/contents/ui/PwmFansTab.qml

@@ -19,8 +19,8 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.4
-import QtQuick.Layouts 1.2
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.10
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 
 
@@ -34,8 +34,6 @@ Item {
     property var pwmFans: pwmFanModel.fans
     property var pwmFans: pwmFanModel.fans
 
 
     id: root
     id: root
-    anchors.fill: parent
-    anchors.margins: Kirigami.Units.smallSpacing
 
 
     RowLayout {
     RowLayout {
         id: profileRow
         id: profileRow
@@ -142,21 +140,21 @@ Item {
         id: saveProfileAction
         id: saveProfileAction
 
 
         text: i18n("Save profile")
         text: i18n("Save profile")
-        iconName: "document-save"
+        icon.name: "document-save"
         onTriggered: Fancontrol.Base.saveProfile(profileComboBox.saveText)
         onTriggered: Fancontrol.Base.saveProfile(profileComboBox.saveText)
     }
     }
     Action {
     Action {
         id: deleteProfileAction
         id: deleteProfileAction
 
 
         text: i18n("Delete profile")
         text: i18n("Delete profile")
-        iconName: "edit-delete"
+        icon.name: "edit-delete"
         onTriggered: Fancontrol.Base.deleteProfile(profileComboBox.currentIndex)
         onTriggered: Fancontrol.Base.deleteProfile(profileComboBox.currentIndex)
     }
     }
     Action {
     Action {
         id: detectFansAction
         id: detectFansAction
 
 
         text: loader.sensorsDetected ? i18n("Detect fans again") : i18n("Detect fans")
         text: loader.sensorsDetected ? i18n("Detect fans again") : i18n("Detect fans")
-        iconName: "dialog-password"
+        icon.name: "dialog-password"
         onTriggered: loader.detectSensors()
         onTriggered: loader.detectSensors()
     }
     }
 }
 }

+ 3 - 4
fancontrol-gui/package/contents/ui/SensorsTab.qml

@@ -19,8 +19,8 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.2
-import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.2
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 
 
@@ -32,7 +32,6 @@ RowLayout {
     property QtObject loader: Fancontrol.Base.loader
     property QtObject loader: Fancontrol.Base.loader
 
 
     anchors.fill: parent
     anchors.fill: parent
-    anchors.margins: Kirigami.Units.smallSpacing
 
 
     Repeater {
     Repeater {
         model: loader.hwmons.length
         model: loader.hwmons.length
@@ -41,7 +40,7 @@ RowLayout {
             property QtObject hwmon: loader.hwmons[index]
             property QtObject hwmon: loader.hwmons[index]
 
 
             Layout.preferredWidth: root.width / loader.hwmons.length - root.spacing
             Layout.preferredWidth: root.width / loader.hwmons.length - root.spacing
-            Layout.maximumWidth: 500
+            Layout.minimumWidth: Kirigami.Units.gridUnit * 10
             Layout.fillHeight: true
             Layout.fillHeight: true
             color: palette.light
             color: palette.light
             border.width: 1
             border.width: 1

+ 20 - 19
fancontrol-gui/package/contents/ui/SettingsTab.qml

@@ -19,8 +19,8 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Layouts 1.1
-import QtQuick.Controls 1.2
+import QtQuick.Layouts 1.10
+import QtQuick.Controls 2.3
 import QtQuick.Dialogs 1.2
 import QtQuick.Dialogs 1.2
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
@@ -34,8 +34,6 @@ Item {
     property var locale: Qt.locale()
     property var locale: Qt.locale()
 
 
     id: root
     id: root
-    anchors.fill: parent
-    anchors.margins: Kirigami.Units.smallSpacing
 
 
     Column {
     Column {
         id: column
         id: column
@@ -59,9 +57,10 @@ Item {
                 Layout.minimumWidth: implicitWidth
                 Layout.minimumWidth: implicitWidth
                 Layout.fillWidth: true
                 Layout.fillWidth: true
                 value: loader.interval
                 value: loader.interval
-                suffix: " " + i18np("second", "seconds", loader.interval)
-                minimumValue: 1.0
-                onValueChanged: loader.interval = value
+                from: 1.0
+                editable: true
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0) + ' ' + i18np("second", "seconds", value) }
+                onValueModified: loader.interval = value
 
 
                 Connections {
                 Connections {
                     target: loader
                     target: loader
@@ -84,12 +83,13 @@ Item {
 
 
                 Layout.minimumWidth: implicitWidth
                 Layout.minimumWidth: implicitWidth
                 Layout.fillWidth: true
                 Layout.fillWidth: true
-                decimals: 2
-                maximumValue: Number.POSITIVE_INFINITY
-                minimumValue: Fancontrol.Units.fromKelvin(0, Fancontrol.Base.unit)
+//                 decimals: 2
+                from: Fancontrol.Units.fromKelvin(0, Fancontrol.Base.unit)
+                inputMethodHints: Qt.ImhFormattedNumbersOnly
+                editable: true
                 value: Fancontrol.Units.fromCelsius(Fancontrol.Base.minTemp, Fancontrol.Base.unit)
                 value: Fancontrol.Units.fromCelsius(Fancontrol.Base.minTemp, Fancontrol.Base.unit)
-                suffix: Fancontrol.Base.unit
-                onValueChanged: {
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 2) + Fancontrol.Base.unit }
+                onValueModified: {
                     Fancontrol.Base.minTemp = Fancontrol.Units.toCelsius(value, Fancontrol.Base.unit);
                     Fancontrol.Base.minTemp = Fancontrol.Units.toCelsius(value, Fancontrol.Base.unit);
                     if (value >= maxTempBox.value) maxTempBox.value = value + 1;
                     if (value >= maxTempBox.value) maxTempBox.value = value + 1;
                 }
                 }
@@ -119,12 +119,13 @@ Item {
 
 
                 Layout.minimumWidth: implicitWidth
                 Layout.minimumWidth: implicitWidth
                 Layout.fillWidth: true
                 Layout.fillWidth: true
-                decimals: 2
-                maximumValue: Number.POSITIVE_INFINITY
-                minimumValue: Fancontrol.Units.fromKelvin(0, Fancontrol.Base.unit)
+//                 decimals: 2
+                from: Fancontrol.Units.fromKelvin(0, Fancontrol.Base.unit)
+                inputMethodHints: Qt.ImhFormattedNumbersOnly
+                editable: true
                 value: Fancontrol.Units.fromCelsius(Fancontrol.Base.maxTemp, Fancontrol.Base.unit)
                 value: Fancontrol.Units.fromCelsius(Fancontrol.Base.maxTemp, Fancontrol.Base.unit)
-                suffix: Fancontrol.Base.unit
-                onValueChanged: {
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 2) + Fancontrol.Base.unit }
+                onValueModified: {
                     Fancontrol.Base.maxTemp = Fancontrol.Units.toCelsius(value, Fancontrol.Base.unit);
                     Fancontrol.Base.maxTemp = Fancontrol.Units.toCelsius(value, Fancontrol.Base.unit);
                     if (value <= minTempBox.value) minTempBox.value = value - 1;
                     if (value <= minTempBox.value) minTempBox.value = value - 1;
                 }
                 }
@@ -157,8 +158,8 @@ Item {
                 onTextChanged: Fancontrol.Base.configUrl = text;
                 onTextChanged: Fancontrol.Base.configUrl = text;
             }
             }
             Button {
             Button {
-                iconName: "document-open"
-                tooltip: i18n("Open config file")
+                icon.name: "document-open"
+//                 tooltip: i18n("Open config file")
                 onClicked: openFileDialog.open();
                 onClicked: openFileDialog.open();
             }
             }
         }
         }

+ 2 - 3
import/qml/ErrorDialog.qml

@@ -19,8 +19,7 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Dialogs 1.2
-import QtQuick.Controls 1.2
+import QtQuick.Controls 2.3
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 
 
@@ -30,7 +29,7 @@ Dialog {
 
 
     title: i18n("Error")
     title: i18n("Error")
     width: text.implicitWidth + Kirigami.Units.smallSpacing * 2
     width: text.implicitWidth + Kirigami.Units.smallSpacing * 2
-    standardButtons: StandardButton.Close
+    standardButtons: Dialog.Close
     onRejected: close()
     onRejected: close()
 
 
     Label {
     Label {

+ 42 - 40
import/qml/FanItem.qml

@@ -19,8 +19,8 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.4
-import QtQuick.Layouts 1.1
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.10
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 import "math.js" as MoreMath
 import "math.js" as MoreMath
@@ -113,14 +113,14 @@ Rectangle {
             top: nameField.bottom
             top: nameField.bottom
             bottom: settingsArea.top
             bottom: settingsArea.top
         }
         }
-        visible: background.height > 0 && background.width > 0
+        visible: graphBackground.height > 0 && graphBackground.width > 0
 
 
         Item {
         Item {
             id: verticalScala
             id: verticalScala
 
 
             anchors {
             anchors {
-                top: background.top
-                bottom: background.bottom
+                top: graphBackground.top
+                bottom: graphBackground.bottom
                 left: parent.left
                 left: parent.left
             }
             }
             width: MoreMath.maxWidth(children) + graph.fontSize
             width: MoreMath.maxWidth(children) + graph.fontSize
@@ -132,7 +132,7 @@ Rectangle {
 
 
                 Label {
                 Label {
                     x: verticalScala.width - implicitWidth - graph.fontSize / 3
                     x: verticalScala.width - implicitWidth - graph.fontSize / 3
-                    y: background.height - background.height / (graph.verticalScalaCount - 1) * index - graph.fontSize * 2 / 3
+                    y: graphBackground.height - graphBackground.height / (graph.verticalScalaCount - 1) * index - graph.fontSize * 2 / 3
                     horizontalAlignment: Text.AlignRight
                     horizontalAlignment: Text.AlignRight
                     color: graph.pal.text
                     color: graph.pal.text
                     text: i18n("%1\%", index * (100 / (graph.verticalScalaCount - 1)))
                     text: i18n("%1\%", index * (100 / (graph.verticalScalaCount - 1)))
@@ -140,13 +140,14 @@ Rectangle {
                 }
                 }
             }
             }
         }
         }
+
         Item {
         Item {
             id: horizontalScala
             id: horizontalScala
 
 
             anchors {
             anchors {
-                right: background.right
+                right: graphBackground.right
                 bottom: parent.bottom
                 bottom: parent.bottom
-                left: background.left
+                left: graphBackground.left
             }
             }
             height: graph.fontSize * 2
             height: graph.fontSize * 2
 
 
@@ -154,7 +155,7 @@ Rectangle {
                 model: graph.horIntervals.length;
                 model: graph.horIntervals.length;
 
 
                 Label {
                 Label {
-                    x: background.scaleX(Units.toCelsius(graph.horIntervals[index], unit)) - width/2
+                    x: graphBackground.scaleX(Units.toCelsius(graph.horIntervals[index], unit)) - width/2
                     y: horizontalScala.height / 2 - implicitHeight / 2
                     y: horizontalScala.height / 2 - implicitHeight / 2
                     color: graph.pal.text
                     color: graph.pal.text
                     text: i18n("%1" + unit, graph.horIntervals[index])
                     text: i18n("%1" + unit, graph.horIntervals[index])
@@ -164,7 +165,7 @@ Rectangle {
         }
         }
 
 
         Rectangle {
         Rectangle {
-            id: background
+            id: graphBackground
 
 
             property alias pal: graph.pal
             property alias pal: graph.pal
 
 
@@ -204,7 +205,7 @@ Rectangle {
                 anchors.margins: parent.border.width
                 anchors.margins: parent.border.width
                 renderStrategy: Canvas.Cooperative
                 renderStrategy: Canvas.Cooperative
 
 
-                property alias pal: background.pal
+                property alias pal: graphBackground.pal
 
 
                 onPaint: {
                 onPaint: {
                     var c = curveCanvas.getContext("2d");
                     var c = curveCanvas.getContext("2d");
@@ -240,10 +241,10 @@ Rectangle {
                     }
                     }
                     c.fill();
                     c.fill();
 
 
-                    //blend background
+                    //blend graphBackground
                     gradient = c.createLinearGradient(0, 0, 0, height);
                     gradient = c.createLinearGradient(0, 0, 0, height);
-                    gradient.addColorStop(0, Colors.setAlpha(background.color, 0.5));
-                    gradient.addColorStop(1, Colors.setAlpha(background.color, 0.9));
+                    gradient.addColorStop(0, Colors.setAlpha(graphBackground.color, 0.5));
+                    gradient.addColorStop(1, Colors.setAlpha(graphBackground.color, 0.9));
                     c.fillStyle = gradient;
                     c.fillStyle = gradient;
                     c.fill();
                     c.fill();
                 }
                 }
@@ -255,7 +256,7 @@ Rectangle {
                 anchors.margins: parent.border.width
                 anchors.margins: parent.border.width
                 renderStrategy: Canvas.Cooperative
                 renderStrategy: Canvas.Cooperative
 
 
-                property alias pal: background.pal
+                property alias pal: graphBackground.pal
 
 
                 onPaint: {
                 onPaint: {
                     var c = meshCanvas.getContext("2d");
                     var c = meshCanvas.getContext("2d");
@@ -267,7 +268,7 @@ Rectangle {
 
 
                     //horizontal lines
                     //horizontal lines
                     for (var i=0; i<=100; i+=20) {
                     for (var i=0; i<=100; i+=20) {
-                        var y = background.scaleY(i*2.55);
+                        var y = graphBackground.scaleY(i*2.55);
                         if (i != 0 && i != 100) {
                         if (i != 0 && i != 100) {
                             for (var j=0; j<=width; j+=15) {
                             for (var j=0; j<=width; j+=15) {
                                 c.moveTo(j, y);
                                 c.moveTo(j, y);
@@ -279,7 +280,7 @@ Rectangle {
                     //vertical lines
                     //vertical lines
                     if (graph.horIntervals.length > 1) {
                     if (graph.horIntervals.length > 1) {
                         for (var i=1; i<graph.horIntervals.length; i++) {
                         for (var i=1; i<graph.horIntervals.length; i++) {
-                            var x = background.scaleX(Units.toCelsius(graph.horIntervals[i], unit));
+                            var x = graphBackground.scaleX(Units.toCelsius(graph.horIntervals[i], unit));
                             for (var j=0; j<=height; j+=20) {
                             for (var j=0; j<=height; j+=20) {
                                 c.moveTo(x, j);
                                 c.moveTo(x, j);
                                 c.lineTo(x, Math.min(j+5, height));
                                 c.lineTo(x, Math.min(j+5, height));
@@ -292,7 +293,7 @@ Rectangle {
             StatusPoint {
             StatusPoint {
                 id: currentPwm
                 id: currentPwm
                 size: graph.fontSize
                 size: graph.fontSize
-                visible: background.contains(center) && !!fan && fan.hasTemp
+                visible: graphBackground.contains(center) && !!fan && fan.hasTemp
                 fan: root.fan
                 fan: root.fan
             }
             }
             PwmPoint {
             PwmPoint {
@@ -300,16 +301,16 @@ Rectangle {
                 color: !!fan ? fan.hasTemp ? "blue" : Qt.tint(graph.pal.light, Qt.rgba(0, 0, 1, 0.5)) : "transparent"
                 color: !!fan ? fan.hasTemp ? "blue" : Qt.tint(graph.pal.light, Qt.rgba(0, 0, 1, 0.5)) : "transparent"
                 size: graph.fontSize
                 size: graph.fontSize
                 visible: !!fan ? fan.hasTemp : false
                 visible: !!fan ? fan.hasTemp : false
-                drag.maximumX: Math.min(background.scaleX(background.scaleTemp(maxPoint.x)-1), maxPoint.x-1)
-                drag.minimumY: Math.max(background.scaleY(background.scalePwm(maxPoint.y)-1), maxPoint.y+1)
-                x: !!fan && fan.hasTemp ? background.scaleX(MoreMath.bound(root.minTemp, fan.minTemp, root.maxTemp)) - width/2 : -width/2
-                y: !!fan && fan.hasTemp ? background.scaleY(fan.minStop) - height/2 : -height/2
-                temp: !!fan && fan.hasTemp ? drag.active ? background.scaleTemp(centerX) : fan.minTemp : root.minTemp
-                pwm: !!fan && fan.hasTemp ? drag.active ? background.scalePwm(centerY) : fan.minStop : 255
+                drag.maximumX: Math.min(graphBackground.scaleX(graphBackground.scaleTemp(maxPoint.x)-1), maxPoint.x-1)
+                drag.minimumY: Math.max(graphBackground.scaleY(graphBackground.scalePwm(maxPoint.y)-1), maxPoint.y+1)
+                x: !!fan && fan.hasTemp ? graphBackground.scaleX(MoreMath.bound(root.minTemp, fan.minTemp, root.maxTemp)) - width/2 : -width/2
+                y: !!fan && fan.hasTemp ? graphBackground.scaleY(fan.minStop) - height/2 : -height/2
+                temp: !!fan && fan.hasTemp ? drag.active ? graphBackground.scaleTemp(centerX) : fan.minTemp : root.minTemp
+                pwm: !!fan && fan.hasTemp ? drag.active ? graphBackground.scalePwm(centerY) : fan.minStop : 255
                 drag.onActiveChanged: {
                 drag.onActiveChanged: {
                     if (!drag.active) {
                     if (!drag.active) {
-                        fan.minStop = Math.round(background.scalePwm(centerY));
-                        fan.minTemp = Math.round(background.scaleTemp(centerX));
+                        fan.minStop = Math.round(graphBackground.scalePwm(centerY));
+                        fan.minTemp = Math.round(graphBackground.scaleTemp(centerX));
                         if (!fanOffCheckBox.checked) fan.minPwm = fan.minStop;
                         if (!fanOffCheckBox.checked) fan.minPwm = fan.minStop;
                     }
                     }
                 }
                 }
@@ -325,16 +326,16 @@ Rectangle {
                 color: !!fan ? fan.hasTemp ? "red" : Qt.tint(graph.pal.light, Qt.rgba(1, 0, 0, 0.5)) : "transparent"
                 color: !!fan ? fan.hasTemp ? "red" : Qt.tint(graph.pal.light, Qt.rgba(1, 0, 0, 0.5)) : "transparent"
                 size: graph.fontSize
                 size: graph.fontSize
                 visible: !!fan ? fan.hasTemp : false
                 visible: !!fan ? fan.hasTemp : false
-                drag.minimumX: Math.max(background.scaleX(background.scaleTemp(stopPoint.x)+1), stopPoint.x+1)
-                drag.maximumY: Math.min(background.scaleY(background.scalePwm(stopPoint.y)+1), stopPoint.y-1)
-                x: !!fan && fan.hasTemp ? background.scaleX(MoreMath.bound(root.minTemp, fan.maxTemp, root.maxTemp)) - width/2 : background.width - width/2
-                y: !!fan && fan.hasTemp ? background.scaleY(fan.maxPwm) - height/2 : -height/2
-                temp: !!fan && fan.hasTemp ? drag.active ? background.scaleTemp(centerX) : fan.maxTemp : root.maxTemp
-                pwm: !!fan && fan.hasTemp ? drag.active ? background.scalePwm(centerY) : fan.maxPwm : 255
+                drag.minimumX: Math.max(graphBackground.scaleX(graphBackground.scaleTemp(stopPoint.x)+1), stopPoint.x+1)
+                drag.maximumY: Math.min(graphBackground.scaleY(graphBackground.scalePwm(stopPoint.y)+1), stopPoint.y-1)
+                x: !!fan && fan.hasTemp ? graphBackground.scaleX(MoreMath.bound(root.minTemp, fan.maxTemp, root.maxTemp)) - width/2 : graphBackground.width - width/2
+                y: !!fan && fan.hasTemp ? graphBackground.scaleY(fan.maxPwm) - height/2 : -height/2
+                temp: !!fan && fan.hasTemp ? drag.active ? graphBackground.scaleTemp(centerX) : fan.maxTemp : root.maxTemp
+                pwm: !!fan && fan.hasTemp ? drag.active ? graphBackground.scalePwm(centerY) : fan.maxPwm : 255
                 drag.onActiveChanged: {
                 drag.onActiveChanged: {
                     if (!drag.active) {
                     if (!drag.active) {
-                        fan.maxPwm = Math.round(background.scalePwm(centerY));
-                        fan.maxTemp = Math.round(background.scaleTemp(centerX));
+                        fan.maxPwm = Math.round(graphBackground.scalePwm(centerY));
+                        fan.maxTemp = Math.round(graphBackground.scaleTemp(centerX));
                     }
                     }
                 }
                 }
                 onPositionChanged: {
                 onPositionChanged: {
@@ -443,13 +444,14 @@ Rectangle {
             }
             }
             SpinBox {
             SpinBox {
                 id: minStartInput
                 id: minStartInput
+
                 Layout.fillWidth: true
                 Layout.fillWidth: true
-                minimumValue: 0
-                maximumValue: 100
-                decimals: 1
+                from: 0
+                to: 100
+                editable: true
                 value: !!fan ? Math.round(fan.minStart / 2.55) : 0
                 value: !!fan ? Math.round(fan.minStart / 2.55) : 0
-                suffix: i18n("%")
-                onValueChanged: {
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 1) + i18n("%") }
+                onValueModified: {
                     if (!!fan) {
                     if (!!fan) {
                         fan.minStart = Math.round(value * 2.55)
                         fan.minStart = Math.round(value * 2.55)
                     }
                     }
@@ -476,7 +478,7 @@ Rectangle {
                 id: testButton
                 id: testButton
 
 
                 text: !!fan ? fan.testing ? i18n("Abort test") : i18n("Test start and stop values") : ""
                 text: !!fan ? fan.testing ? i18n("Abort test") : i18n("Test start and stop values") : ""
-                iconName: "dialog-password"
+                icon.name: "dialog-password"
                 Layout.alignment: Qt.AlignRight
                 Layout.alignment: Qt.AlignRight
                 onClicked: {
                 onClicked: {
                     if (fan.testing) {
                     if (fan.testing) {

+ 1 - 1
import/qml/PwmPoint.qml

@@ -19,7 +19,7 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.4
+import QtQuick.Controls 2.3
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 import "units.js" as Units
 import "units.js" as Units

+ 6 - 1
import/qml/StatusPoint.qml

@@ -19,7 +19,7 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.2
+import QtQuick.Controls 2.3
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import Fancontrol.Qml 1.0 as Fancontrol
 import Fancontrol.Qml 1.0 as Fancontrol
 import "units.js" as Units
 import "units.js" as Units
@@ -64,12 +64,14 @@ Rectangle {
 
 
     MouseArea {
     MouseArea {
         id: pwmMouse
         id: pwmMouse
+
         anchors.fill: parent
         anchors.fill: parent
         hoverEnabled: root.enabled ? true : false
         hoverEnabled: root.enabled ? true : false
     }
     }
 
 
     Rectangle {
     Rectangle {
         id: tooltip
         id: tooltip
+
         x: parent.width
         x: parent.width
         y: - height
         y: - height
         width: Math.max(pwm.width, rpm.width)
         width: Math.max(pwm.width, rpm.width)
@@ -81,17 +83,20 @@ Rectangle {
         Column {
         Column {
             Label {
             Label {
                 id: temp
                 id: temp
+
                 font.pixelSize: root.height * 1.5
                 font.pixelSize: root.height * 1.5
                 text: (!!fan && fan.hasTemp ? Math.round(Units.fromCelsius(root.unscaledTemp, unit)) : "0") + i18n(unit)
                 text: (!!fan && fan.hasTemp ? Math.round(Units.fromCelsius(root.unscaledTemp, unit)) : "0") + i18n(unit)
 
 
             }
             }
             Label {
             Label {
                 id: pwm
                 id: pwm
+
                 font.pixelSize: root.height * 1.5
                 font.pixelSize: root.height * 1.5
                 text: Number(Math.round(unscaledPwm / 2.55)).toLocaleString(locale, 'f', 1) + i18n('%')
                 text: Number(Math.round(unscaledPwm / 2.55)).toLocaleString(locale, 'f', 1) + i18n('%')
             }
             }
             Label {
             Label {
                 id: rpm
                 id: rpm
+
                 font.pixelSize: root.height * 1.5
                 font.pixelSize: root.height * 1.5
                 text: (!!fan ? fan.rpm : "0") + i18n("rpm")
                 text: (!!fan ? fan.rpm : "0") + i18n("rpm")
             }
             }

+ 22 - 20
kcm/package/contents/ui/KCM.qml

@@ -19,8 +19,8 @@
 
 
 
 
 import QtQuick 2.4
 import QtQuick 2.4
-import QtQuick.Controls 1.3
-import QtQuick.Layouts 1.2
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.10
 import QtQuick.Dialogs 1.2
 import QtQuick.Dialogs 1.2
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kirigami 2.0 as Kirigami
 import org.kde.kcm 1.0
 import org.kde.kcm 1.0
@@ -76,7 +76,7 @@ Item {
         Button {
         Button {
             Layout.alignment: Qt.AlignCenter
             Layout.alignment: Qt.AlignCenter
             text: loader.sensorsDetected ? i18n("Detect fans again") : i18n("Detect fans")
             text: loader.sensorsDetected ? i18n("Detect fans again") : i18n("Detect fans")
-            iconName: kcm.needsAuthorization ? "dialog-password" : ""
+            icon.name: kcm.needsAuthorization ? "dialog-password" : ""
             onClicked: loader.detectSensors()
             onClicked: loader.detectSensors()
         }
         }
     }
     }
@@ -172,7 +172,7 @@ Item {
             Button {
             Button {
                 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
                 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
                 text: i18n("Detect fans")
                 text: i18n("Detect fans")
-                iconName: kcm.needsAuthorization ? "dialog-password" : ""
+                icon.name: kcm.needsAuthorization ? "dialog-password" : ""
                 onClicked: loader.detectSensors()
                 onClicked: loader.detectSensors()
             }
             }
         }
         }
@@ -271,9 +271,10 @@ Item {
                 Layout.minimumWidth: implicitWidth
                 Layout.minimumWidth: implicitWidth
                 Layout.fillWidth: true
                 Layout.fillWidth: true
                 value: loader.interval
                 value: loader.interval
-                suffix: " " + i18np("second", "seconds", loader.interval)
-                minimumValue: 1.0
-                onValueChanged: loader.interval = value
+                editable: true
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0) + ' ' + i18np("second", "seconds", value) }
+                from: 1.0
+                onValueModified: loader.interval = value
             }
             }
         }
         }
         RowLayout {
         RowLayout {
@@ -290,11 +291,10 @@ Item {
                 id: minTempBox
                 id: minTempBox
                 Layout.minimumWidth: implicitWidth
                 Layout.minimumWidth: implicitWidth
                 Layout.fillWidth: true
                 Layout.fillWidth: true
-                decimals: 2
-                maximumValue: maxTempBox.value
-                minimumValue: Units.fromKelvin(0, Fancontrol.Base.unit)
+                to: maxTempBox.value
+                from: Units.fromKelvin(0, Fancontrol.Base.unit)
                 value: Units.fromCelsius(Fancontrol.Base.minTemp, Fancontrol.Base.unit)
                 value: Units.fromCelsius(Fancontrol.Base.minTemp, Fancontrol.Base.unit)
-                suffix: Fancontrol.Base.unit
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 2) + Fancontrol.Base.unit }
                 onValueChanged: Fancontrol.Base.minTemp = Units.toCelsius(value, Fancontrol.Base.unit)
                 onValueChanged: Fancontrol.Base.minTemp = Units.toCelsius(value, Fancontrol.Base.unit)
             }
             }
         }
         }
@@ -312,11 +312,10 @@ Item {
                 id: maxTempBox
                 id: maxTempBox
                 Layout.minimumWidth: implicitWidth
                 Layout.minimumWidth: implicitWidth
                 Layout.fillWidth: true
                 Layout.fillWidth: true
-                decimals: 2
-                maximumValue: Number.POSITIVE_INFINITY
-                minimumValue: minTempBox.value
+                from: minTempBox.value
                 value: Units.fromCelsius(Fancontrol.Base.maxTemp, Fancontrol.Base.unit)
                 value: Units.fromCelsius(Fancontrol.Base.maxTemp, Fancontrol.Base.unit)
-                suffix: Fancontrol.Base.unit
+                editable: true
+                textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 2) + Fancontrol.Base.unit }
                 onValueChanged: Fancontrol.Base.maxTemp = Units.toCelsius(value, Fancontrol.Base.unit)
                 onValueChanged: Fancontrol.Base.maxTemp = Units.toCelsius(value, Fancontrol.Base.unit)
             }
             }
         }
         }
@@ -365,26 +364,28 @@ Item {
         id: saveProfileAction
         id: saveProfileAction
 
 
         text: i18n("Save profile")
         text: i18n("Save profile")
-        iconName: "document-save"
+        icon.name: "document-save"
         onTriggered: Fancontrol.Base.saveProfile(profileComboBox.saveText)
         onTriggered: Fancontrol.Base.saveProfile(profileComboBox.saveText)
     }
     }
     Action {
     Action {
         id: deleteProfileAction
         id: deleteProfileAction
 
 
         text: i18n("Delete profile")
         text: i18n("Delete profile")
-        iconName: "edit-delete"
+        icon.name: "edit-delete"
         onTriggered: Fancontrol.Base.deleteProfile(profileComboBox.currentIndex)
         onTriggered: Fancontrol.Base.deleteProfile(profileComboBox.currentIndex)
     }
     }
     Action {
     Action {
         id: loadAction
         id: loadAction
-        iconName: "document-open"
+
+        icon.name: "document-open"
         onTriggered: openFileDialog.open()
         onTriggered: openFileDialog.open()
-        tooltip: i18n("Load configuration file")
+//         tooltip: i18n("Load configuration file")
         shortcut: StandardKey.Open
         shortcut: StandardKey.Open
     }
     }
 
 
     FileDialog {
     FileDialog {
         id: openFileDialog
         id: openFileDialog
+
         title: i18n("Please choose a configuration file")
         title: i18n("Please choose a configuration file")
         folder: "file:///etc"
         folder: "file:///etc"
         selectExisting: true
         selectExisting: true
@@ -395,6 +396,7 @@ Item {
 
 
     Fancontrol.ErrorDialog {
     Fancontrol.ErrorDialog {
         id: errorDialog
         id: errorDialog
-        modality: Qt.ApplicationModal
+
+        modal: true
     }
     }
 }
 }