Browse Source

more locale tweaks

Malte Veerman 10 years ago
parent
commit
ee257c6d10

+ 0 - 1
lib/src/loader.cpp

@@ -77,7 +77,6 @@ void Loader::parseHwmons()
 
 bool Loader::load(const QUrl &url)
 {
-    qDebug() << "loading";
     QString fileName;
     if (url.isEmpty())
     {

+ 9 - 8
package/contents/ui/KCM.qml

@@ -26,21 +26,23 @@ import "../scripts/arrayfunctions.js" as ArrayFunctions
 
 ColumnLayout {
     id: root
-    implicitWidth: 1024
-    implicitHeight: 768
     
     CheckBox {
         id: enabledBox
+        Layout.alignment: Qt.AlignLeft | Qt.AlignTop
         text: i18n("Control fans manually")
         checked: kcm.manualControl
-        onCheckedChanged: kcm.manualControl = checked
+        onCheckedChanged: {
+            kcm.manualControl = checked;
+            fanRow.visible = checked;
+            fan.visible = checked;
+        }
     }
     
-    RowLayout {
-        enabled: enabledBox.checked
+    RowLayout {  
+        id: fanRow
         
         Label {
-            id: fanLabel
             text: i18n("Fan:")
             Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
             renderType: Text.NativeRendering
@@ -49,13 +51,12 @@ ColumnLayout {
             id: fanCombobox
             model: ArrayFunctions.namesWithPaths(kcm.base.loader.allPwmFans)
             Layout.fillWidth: true
-            Layout.maximumWidth: root.width - fanLabel.width - parent.spacing
+            Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
         }
     }
     
     PwmFan {
         id: fan
-        enabled: enabledBox.checked
         minimizable: false
         unit: kcm.base.unit
         fan: kcm.base.loader.allPwmFans[fanCombobox.currentIndex]

+ 9 - 5
package/contents/ui/PwmFan.qml

@@ -163,7 +163,7 @@ Rectangle {
     }
 
     Canvas {
-        property int fontSize: Math.max(9, Math.min(height / 25, 20))
+        property int fontSize: MoreMath.bound(9, height / 20 + 1, 18)
         property int leftPadding: fontSize * 4
         property int rightPadding: fontSize * 2
         property int topPadding: fontSize
@@ -202,7 +202,6 @@ Rectangle {
             
             Behavior on unscaledTemp {
                 SpringAnimation { 
-//                     duration: 2000
                     epsilon: 0.1
                     spring: 1.0
                     damping: 0.5
@@ -210,7 +209,6 @@ Rectangle {
             }
             Behavior on unscaledPwm {
                 SpringAnimation { 
-//                     duration: 2000
                     epsilon: 0.1
                     spring: 1.0
                     damping: 0.5
@@ -221,6 +219,7 @@ Rectangle {
             id: stopPoint
             color: "blue"
             size: canvas.fontSize
+            unit: root.unit
             drag.maximumX: Math.min(canvas.scaleX(canvas.scaleTemp(maxPoint.x)-1), maxPoint.x-1)
             drag.minimumY: Math.max(canvas.scaleY(canvas.scalePwm(maxPoint.y)-1), maxPoint.y+1)
             x: canvas.scaleX(MoreMath.bound(minTemp, fan.minTemp, maxTemp)) - width/2
@@ -238,6 +237,7 @@ Rectangle {
             id: maxPoint
             color: "red"
             size: canvas.fontSize
+            unit: root.unit
             drag.minimumX: stopPoint.x
             drag.maximumY: stopPoint.y
             x: canvas.scaleX(MoreMath.bound(minTemp, fan.maxTemp, maxTemp)) - width/2
@@ -328,9 +328,12 @@ Rectangle {
             c.textBaseline = "top";
             var convertedMinTemp = Units.fromCelsius(minTemp, unit);
             var convertedMaxTemp = Units.fromCelsius(maxTemp, unit);
+            var suffix = (unit == 0) ? "°C" : (unit == 1) ? "K" : "°F"
+            var lastTemp;
             for (i=convertedMinTemp; i<convertedMaxTemp; i+= 10) {
+                lastTemp = i;
                 var x = scaleX(Units.toCelsius(i, unit));
-                c.fillText(i + '°', x, topPadding+plotHeight+fontSize/2);
+                c.fillText(i + suffix, x, topPadding+plotHeight+fontSize/2);
                 if (i != convertedMinTemp) {
                     for (var j=scaleY(255); j<=scaleY(0); j+=20) {
                         c.moveTo(x, j);
@@ -339,7 +342,8 @@ Rectangle {
                     c.stroke();
                 }
             }
-            c.fillText(convertedMaxTemp + '°', scaleX(maxTemp), topPadding+plotHeight+fontSize/2);
+            if ((convertedMaxTemp - lastTemp) > 5)
+                c.fillText(convertedMaxTemp + suffix, scaleX(maxTemp), topPadding+plotHeight+fontSize/2);
         }
     }
 

+ 9 - 4
package/contents/ui/PwmPoint.qml

@@ -20,6 +20,8 @@
 import QtQuick 2.4
 import QtQuick.Layouts 1.2
 import QtQuick.Controls 1.4
+import QtQml 2.2
+import "../scripts/units.js" as Units
 
 Rectangle {
     property Item canvas: parent
@@ -28,6 +30,7 @@ Rectangle {
     readonly property real centerY: y + height / 2
     property alias drag: pwmMouse.drag
     property alias size: root.width
+    property int unit: 0
 
     id: root
     width: 10
@@ -66,13 +69,15 @@ Rectangle {
         Column {
             Label {
                 id: pwm
-                font.pixelSize: root.size
-                text: Math.round(canvas.scalePwm(root.centerY) / 2.55) + '%'
+                font.pixelSize: root.size * 1.5
+                text: Number(Units.fromCelsius(canvas.scalePwm(root.centerY) / 2.55)).toLocaleString() + '%'
             }
             Label {
+                property string suffix: (unit == 0) ? "°C" : (unit == 1) ? "K" : "°F"
+                
                 id: temp
-                font.pixelSize: root.size
-                text: Math.round(canvas.scaleTemp(root.centerX)) + '°'
+                font.pixelSize: root.size * 1.5
+                text: Number(Units.fromCelsius(canvas.scaleTemp(root.centerX), unit)).toLocaleString() + suffix                      
             }
         }
     }