[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeplasma-addons/plasma/luisgabriellima/weatherstation-qml] applets/weatherstation: Adding resize s
From:       Luís_Gabriel_Lima <lampih () gmail ! com>
Date:       2012-06-04 21:21:20
Message-ID: 20120604212120.68160A60D2 () git ! kde ! org
[Download RAW message or body]

Git commit face78823fe293f4a271c60beb6f3c2b3d2bf433 by Luís Gabriel Lima.
Committed on 04/06/2012 at 02:31.
Pushed by luisgabriellima into branch 'plasma/luisgabriellima/weatherstation-qml'.

Adding resize support

Now the applet is resizing correctly.

Other changes:
    - Removing the labels from the svg (moving to QML)

Signed-off-by: Luís Gabriel Lima <lampih@gmail.com>

M  +0    -87   applets/weatherstation/lcd.svg
M  +93   -24   applets/weatherstation/package/contents/ui/main.qml

http://commits.kde.org/kdeplasma-addons/face78823fe293f4a271c60beb6f3c2b3d2bf433

diff --git a/applets/weatherstation/lcd.svg b/applets/weatherstation/lcd.svg
index c7e790f..4d7edd8 100644
--- a/applets/weatherstation/lcd.svg
+++ b/applets/weatherstation/lcd.svg
@@ -158,93 +158,6 @@
            id="path3275"
            style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#404040;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" \
/>  </g>
-      <g
-         inkscape:label="#g3662"
-         id="texts">
-        <path
-           id="percent-label"
-           d="M 192.81651,169.32031 C 192.58994,169.32032 192.41156,169.41667 \
192.28136,169.60938 C 192.15375,169.80209 192.08995,170.07031 192.08995,170.41406 C \
192.08995,170.75261 192.15375,171.01953 192.28136,171.21484 C 192.41156,171.40755 \
192.58994,171.50391 192.81651,171.50391 C 193.03786,171.50391 193.21234,171.40755 \
193.33995,171.21484 C 193.47015,171.01953 193.53526,170.75261 193.53526,170.41406 C \
193.53526,170.07292 193.47015,169.80599 193.33995,169.61328 C 193.21234,169.41797 \
193.03786,169.32032 192.81651,169.32031 M 192.81651,168.82422 C 193.22797,168.82422 \
193.55479,168.96745 193.79698,169.25391 C 194.03916,169.54037 194.16026,169.92709 \
194.16026,170.41406 C 194.16026,170.90104 194.03786,171.28776 193.79308,171.57422 C \
193.55088,171.85807 193.22536,172 192.81651,172 C 192.39984,172 192.07041,171.85807 \
191.82823,171.57422 C 191.58604,171.28776 191.46495,170.90104 191.46495,170.41406 C \
191.46495,169.92448 191.58604,169.53776 191.82823,169.25391 C 192.07302,168.96745 \
192.40245,168.82422 192.81651,168.82422 M 188.78526,166.44531 C 188.5613,166.44532 \
188.38422,166.54297 188.25401,166.73828 C 188.12641,166.93099 188.06261,167.19662 \
188.06261,167.53516 C 188.06261,167.87891 188.12641,168.14714 188.25401,168.33984 C \
188.38162,168.53256 188.5587,168.62891 188.78526,168.62891 C 189.01182,168.62891 \
189.18891,168.53256 189.31651,168.33984 C 189.44672,168.14714 189.51182,167.87891 \
189.51183,167.53516 C 189.51182,167.19922 189.44672,166.9336 189.31651,166.73828 C \
189.1863,166.54297 189.00922,166.44532 188.78526,166.44531 M 192.31261,165.94922 L \
192.93761,165.94922 L 189.28917,172 L 188.66417,172 L 192.31261,165.94922 M \
188.78526,165.94922 C 189.19672,165.94922 189.52484,166.09245 189.76964,166.37891 C \
190.01443,166.66277 190.13682,167.04818 190.13683,167.53516 C 190.13682,168.02735 \
190.01443,168.41537 189.76964,168.69922 C 189.52745,168.98308 189.19932,169.125 \
188.78526,169.125 C 188.3712,169.125 188.04307,168.98308 187.80089,168.69922 C \
187.5613,168.41276 187.44151,168.02474 187.44151,167.53516 C 187.44151,167.05079 \
187.56261,166.66537 187.80479,166.37891 C 188.04698,166.09245 188.3738,165.94922 \
                188.78526,165.94922"
-           style="font-size:8px;font-style:normal;font-variant:normal;font-weight:nor \
mal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anch \
or:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu \
                Sans;-inkscape-font-specification:DejaVu Sans" />
-       <text
-           transform="scale(0.9999851,1.0000149)"
-           xml:space="preserve"
-           style="font-size:7.99988127px;font-style:normal;font-variant:normal;font-w \
eight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb; \
text-anchor:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-line \
cap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           x="176.74809"
-           y="121.69691"
-           id="pressure-unit-label"
-           sodipodi:linespacing="125%"><tspan
-             sodipodi:role="line"
-             id="tspan2664"
-             x="176.74809"
-             y="121.69691">kPa</tspan></text>
-        <text
-           sodipodi:linespacing="125%"
-           id="humidity-label"
-           y="159.99973"
-           x="194.20035"
-           style="font-size:8px;font-style:normal;font-variant:normal;font-weight:nor \
mal;font-stretch:normal;text-align:end;line-height:125%;writing-mode:lr-tb;text-anchor \
:end;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stro \
ke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           xml:space="preserve"><tspan
-             y="159.99973"
-             x="194.20035"
-             id="tspan2629"
-             sodipodi:role="line">HUMIDITY</tspan></text>
-        <text
-           xml:space="preserve"
-           style="font-size:8px;font-style:normal;font-variant:normal;font-weight:nor \
mal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anch \
or:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt; \
stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           x="4.4808435"
-           y="219.88672"
-           id="wind-label"
-           sodipodi:linespacing="125%"><tspan
-             sodipodi:role="line"
-             id="tspan2633"
-             x="4.4808435"
-             y="219.88672">WIND</tspan></text>
-        <text
-           sodipodi:linespacing="125%"
-           id="temperature-label"
-           y="159.99973"
-           x="4.9997811"
-           style="font-size:8px;font-style:normal;font-variant:normal;font-weight:nor \
mal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anch \
or:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt; \
stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           xml:space="preserve"><tspan
-             y="159.99973"
-             x="4.9997811"
-             id="tspan2637"
-             sodipodi:role="line">OUTDOOR TEMP</tspan></text>
-        <text
-           xml:space="preserve"
-           style="font-size:8px;font-style:normal;font-variant:normal;font-weight:nor \
mal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anch \
or:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt; \
stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           x="4.9997811"
-           y="19.99972"
-           id="weather-label"
-           sodipodi:linespacing="125%"><tspan
-             sodipodi:role="line"
-             id="tspan2641"
-             x="4.9997811"
-             y="19.99972">CURRENT WEATHER</tspan></text>
-        <text
-           sodipodi:linespacing="125%"
-           id="temperature-unit-label"
-           y="171.98416"
-           x="103.60184"
-           style="font-size:7.99988127px;font-style:normal;font-variant:normal;font-w \
eight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb; \
text-anchor:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-line \
cap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           xml:space="preserve"
-           transform="scale(0.9999851,1.0000149)"><tspan
-             y="171.98416"
-             x="103.60184"
-             id="tspan2647"
-             sodipodi:role="line"> °C</tspan></text>
-        <text
-           xml:space="preserve"
-           style="font-size:8px;font-style:normal;font-variant:normal;font-weight:nor \
mal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anch \
or:start;fill:#202020;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt; \
stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
                
-           x="4.9848437"
-           y="134.90172"
-           id="pressure-label"
-           sodipodi:linespacing="125%"><tspan
-             sodipodi:role="line"
-             id="tspan2625"
-             x="4.9848437"
-             y="134.90172">PRESSURE</tspan></text>
-      </g>
     </g>
     <g
        id="pressure_direction"
diff --git a/applets/weatherstation/package/contents/ui/main.qml \
b/applets/weatherstation/package/contents/ui/main.qml index 7518d1e..532da44 100644
--- a/applets/weatherstation/package/contents/ui/main.qml
+++ b/applets/weatherstation/package/contents/ui/main.qml
@@ -35,18 +35,18 @@ Item {
 
         onTemperatureChanged: {
             temperatureDisplay.number = (temperature != "-" ? temperature : "");
-            console.log("temperatureUnitChanged: " + unit); // XXX: TODO
+            temperatureDisplay.superscript = unit;
         }
 
         onHumidityChanged: humidityDisplay.number = (humidity != "N/A" ? humidity : \
"");  
         onProviderLabelChanged: providerLabel.text = label;
-        onWeatherLabelChanged: console.log("weatherLabelChanged: " + label); // XXX: \
TODO +        onWeatherLabelChanged: weatherLabel.text = label;
 
         onPressureChanged: {
             condition.elementId = conditionId;
             pressureDisplay.number = pressure;
-            console.log("pressureUnitChanged: " + unit); // XXX: TODO
+            pressureDisplay.superscript = unit;
             console.log("pressureDirectionChanged: " + direction); // XXX: TODO
         }
 
@@ -81,53 +81,121 @@ Item {
         visible: backend.useBackground
     }
 
-    // XXX: enable resizing
-    // XXX: fix "moon", "sun" and "clouds" size
+    Text {
+        id: weatherLabel
+        anchors {
+            top: parent.top
+            left: parent.left
+            topMargin: 12 * resizeOpts.heightRate
+            leftMargin: 5 * resizeOpts.widthRate
+        }
+        font {
+            family: "DejaVu Sans"
+            pixelSize: Math.round(8 * resizeOpts.widthRate)
+        }
+        color: "#202020"
+        smooth: true
+        text: i18n("CURRENT WEATHER")
+    }
+
     PlasmaCore.SvgItem {
         id: condition
         anchors {
             top: parent.top
-            topMargin: 20 // XXX: fix positioning
+            topMargin: 30 * resizeOpts.heightRate
             horizontalCenter: parent.horizontalCenter
         }
-        height: iconsSvg.size.height
-        width: iconsSvg.size.width
+        height: naturalSize.height * resizeOpts.heightRate
+        width: naturalSize.width * resizeOpts.widthRate
         visible: elementId != ""
         svg: iconsSvg
     }
 
-    // XXX: enable resizing
+    Text {
+        id: pressureLabel
+        anchors {
+            top: parent.top
+            left: weatherLabel.left
+            topMargin: 127 * resizeOpts.heightRate
+        }
+        font: weatherLabel.font
+        color: weatherLabel.color
+        smooth: true
+        text: i18n("PRESSURE")
+    }
+
     LCDDisplay {
         id: pressureDisplay
         anchors {
             right: parent.right
-            bottom: humidityDisplay.top
-            rightMargin: 24 // XXX: fix positioning
-            bottomMargin: 30 // XXX: fix positioning
+            bottom: pressureLabel.bottom
+            rightMargin: 24 * resizeOpts.widthRate
+        }
+        height: 23 * resizeOpts.heightRate
+        superscriptFont: weatherLabel.font
+    }
+
+    Text {
+        id: temperatureLabel
+        anchors {
+            top: parent.top
+            left: weatherLabel.left
+            topMargin: 152 * resizeOpts.heightRate
         }
-        height: 24 // XXX: fix initial size
+        font: weatherLabel.font
+        color: weatherLabel.color
+        smooth: true
+        text: i18n("OUTDOOR TEMP")
     }
 
-    // XXX: enable resizing
     LCDDisplay {
-        id: humidityDisplay
+        id: temperatureDisplay
         anchors {
             right: parent.right
             bottom: windWidget.top
-            rightMargin: 12 // XXX: fix positioning
-            bottomMargin: 16 // XXX: fix positioning
+            rightMargin: 97 * resizeOpts.widthRate
+            bottomMargin: 16 * resizeOpts.heightRate
+        }
+        height: implicitHeight * resizeOpts.heightRate
+        superscriptFont: weatherLabel.font
+    }
+
+    Text {
+        id: humidityLabel
+        anchors {
+            top: temperatureLabel.top
+            right: parent.right
+            rightMargin: 5 * resizeOpts.widthRate
         }
+        font: weatherLabel.font
+        color: weatherLabel.color
+        smooth: true
+        text: i18n("HUMIDITY")
     }
 
-    // XXX: enable resizing
     LCDDisplay {
-        id: temperatureDisplay
+        id: humidityDisplay
         anchors {
+            top: temperatureDisplay.top
             right: parent.right
-            bottom: windWidget.top
-            rightMargin: 101 // XXX: fix positioning
-            bottomMargin: 16 // XXX: fix positioning
+            rightMargin: 12 * resizeOpts.widthRate
+        }
+        height: temperatureDisplay.height
+        superscript: "%"
+        superscriptFont: weatherLabel.font
+    }
+
+    Text {
+        id: windLabel
+        anchors {
+            top: temperatureLabel.top
+            left: weatherLabel.left
+            topMargin: 60 * resizeOpts.heightRate
         }
+        font: weatherLabel.font
+        color: weatherLabel.color
+        smooth: true
+        text: i18n("WIND")
     }
 
     Wind {
@@ -149,9 +217,10 @@ Item {
         }
         font {
             family: "DejaVu Sans"
-            pixelSize: 7 // XXX: resize
+            pixelSize: 7 * resizeOpts.heightRate
         }
-        color: "#202020"
+        color: weatherLabel.color
+        smooth: true
 
         MouseArea {
             anchors.fill: parent


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic