[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/poetaster/harbour-dwd.git</param>
<param name="branch">main</param>
- <param name="revision">0.9.4</param>
+ <param name="revision">0.9.5</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/.github/FUNDING.yml
^
|
@@ -0,0 +1,2 @@
+
+liberapay: poetaster
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/README.md
^
|
@@ -1,12 +1,14 @@
# harbour-dwd
+
A german weather service app for SailfishOS.
+
The service at brightsky.dev creates an easy to use json api to get at the data. I wrap that with QML.
-https://brightsky.dev/demo for a web demo and https://github.com/jdemaeyer/brightsky/ for the source.
+We also include a rainviewer html Radar view (WebView) from https://rainviewer.com
-Translations are being trialled with the Weblate service at https://hosted.weblate.org
+https://brightsky.dev/demo for a web demo and https://github.com/jdemaeyer/brightsky/ for the source.
-Just getting it up-to-date for SFOS 3.4. This is a simple project to test QML programming and network api usage/access.
+This is still a simple project to test QML programming and network api usage/access.
Weather icons from:
https://github.com/erikflowers/weather-icons
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/harbour-dwd.desktop
^
|
@@ -12,5 +12,4 @@
Permissions=Internet;Location
[X-HarbourBackup]
-BackupPathList=.local/share/de.poetaster/harbour-dwd/
-
+BackupPathList=.cache/de.poetaster/harbour-scaler
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/harbour-dwd.pro
^
|
@@ -19,6 +19,7 @@
DISTFILES += \
qml/cover/CoverPage.qml \
qml/pages/About.qml \
+ qml/pages/RadarViewQml.qml \
qml/pages/StartPage.qml \
qml/pages/OverviewPage.qml \
qml/pages/LocationSearchPage.qml \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/cover/CoverPage.qml
^
|
@@ -22,7 +22,7 @@
property var hourly;
function reload(){
- debug = false;
+ debug = true;
var tz = TZ.jstz.determine(); // Determines the time zone of the browser client
var tzname = tz.name(); // Returns the name of the time zone eg "Europe/Berlin"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/delegates/ForecastItem.qml
^
|
@@ -92,11 +92,11 @@
//color: Theme.highlightColor
}
Label {
- text: model.totalRain + " mm \uf084 "
+ text: model.likelyRain + " % \uf084 " + model.totalRain + " mm"
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
- //color: Theme.highlightColor
+ color: Theme.highlightColor
}
Label {
bottomPadding: 4
@@ -105,7 +105,8 @@
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
//color: Theme.highlightColor
- }/*
+ }
+ /*
Label {
text: model.pressure_msl + " hPa"
width: parent.width
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/delegates/WeatherItem.qml
^
|
@@ -49,11 +49,13 @@
x: Theme.horizontalPageMargin
width: parent.width - 2*x
spacing: Theme.paddingSmall
+
Column {
id: column
- width: parent.width * .30
+ width: parent.width * .3
spacing: Theme.paddingMedium
- Text {
+ Text
+ {
visible: index < listView.count
text: model.timestamp.split('T')[1].split('+')[0].split(':')[0] + ":00";
//text: model.timestamp;
@@ -63,7 +65,8 @@
//color: ((index % 2 === 0 ) ) ? Theme.highlightColor : Theme.primaryColor
color: Theme.primaryColor
}
- Label {
+ Label
+ {
text: model.temperature + " °C"
width: parent.width
wrapMode: Text.WordWrap
@@ -74,7 +77,7 @@
}
Column {
id: column2
- width: parent.width * .30
+ width: parent.width * .25
spacing: Theme.paddingMedium
Label {
topPadding: 24
@@ -115,32 +118,34 @@
}
Column {
id: column3
- width: parent.width * .40
+ width: parent.width * .45
spacing: Theme.paddingMedium
Label {
topPadding: 8
- //text: model.cloud_cover + "% \uf013 " +parseFloat(model.precipitation) + " mm \uf084 "
- text: parseFloat(model.precipitation) + " mm \uf084 " + model.cloud_cover + "% \uf013 "
+ text:model.cloud_cover + "% \uf013 " + model.pressure_msl + " hPa"
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
- color: Theme.primaryColor
+ //color: Theme.highlightColor
}
- Text {
- text: model.wind_speed + " km/h \uf050 " + model.wind_direction + " °"
+ Label {
+ //text: model.cloud_cover + "% \uf013 " +parseFloat(model.precipitation) + " mm \uf084 "
+ text: model.precipitation_probability + "% \uf084 " + parseFloat(model.precipitation) + " mm"
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
- color: Theme.primaryColor
+ color: Theme.highlightColor
+ //color: Theme.primaryColor
}
- Label {
- text: model.pressure_msl + " hPa"
+ Text {
+ text: model.wind_speed + " km/h \uf050 " + model.wind_direction + " °"
width: parent.width
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
- //color: Theme.highlightColor
+ color: Theme.primaryColor
}
+
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/harbour-dwd.qml
^
|
@@ -34,6 +34,23 @@
ApplicationWindow
{
+ id:root
+
+ ListModel{
+ id: model0
+ }
+ ListModel{
+ id: model1
+ }
+ ListModel{
+ id: model2
+ }
+ ListModel{
+ id: model3
+ }
+ ListModel{
+ id: model4
+ }
initialPage: Component { StartPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/js/locations.js
^
|
@@ -156,9 +156,11 @@
//console.debug(parseFloat(total).toPrecision(2))
return parseFloat(total).toPrecision(2);
}
+
function dailyAvg(weather, key) {
return dailyTotal(weather, key) / weather.length;
}
+
function dailyMax(weather, key) {
var current = 0.0 ;
for (var i = 0; i < weather.length; i++) {
@@ -168,6 +170,7 @@
}
return current;
}
+
function dailyMin(weather, key) {
var current = dailyMax(weather,key);
for (var i = 0; i < weather.length; i++) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/pages/DailyDetails.qml
^
|
@@ -17,7 +17,7 @@
Page {
id: detailsPage
- property bool debug: false
+ property bool debug: true
property string name
property string lat
property string lon
@@ -29,13 +29,50 @@
property var index
property var locale: Qt.locale()
property var tindex
+ property var oindex
+ function updateModel(index){
+
+ console.log("func index: " + index)
+
+ for (var i = 0; i < 26; i++) {
+ switch( index ) {
+ case 0 : {
+ listModel.insert(i, model0.get(i))
+ break
+ }
+ case 1 : {
+ listModel.insert(i, model1.get(i))
+ break
+ }
+ case 2 : {
+ listModel.insert(i, model2.get(i))
+ break
+ }
+ case 3 : {
+ listModel.insert(i,model3.get(i))
+ break
+ }
+ case 4 : {
+ listModel.insert(i, model4.get(i))
+ break
+ }
+ default : console.log("none")
+
+ }
+ };
+
+ }
function reloadDetails(){
if (name === "") { name="Berlin" }
if (lat === "") { lat="52.52" }
if (lon ==="") { lon="13.41" }
if (debug) console.debug("daily: "+dailyDate)
+ if (debug) console.debug("oindex: "+oindex)
+
+ // update the listModel from previously obtained values.
+ updateModel(oindex)
if (dailyDate === "") {
now = new Date();
@@ -65,15 +102,20 @@
headerDate = now.toLocaleString(locale, "ddd MMM dd");
// not being used yet
- if (weatherDetails !== ""){
+ if (listModel.count > 20){
+ if (debug) console.log("cached")
+
+ /*
for (var i = 0; i < weather.length && i < 30; i++) {
//console.debug(JSON.stringify(response.weather[i]));
if (debug) console.debug(weather[i]);
listModel.append(weather[i]);
};
+ */
+
} else {
- var uri = "https://api.brightsky.dev/weather?tz="+tzname + "&lat=" + lat + "&lon=" + lon + "&date=" + passDate;
+ var uri = "https://api.brightsky.dev/weather?tz="+tzname + "&lat=" + lat + "&lon=" + lon + "&date=" + passDate //+ "&max_dist=5000";
if (debug) console.debug(uri);
Locs.httpRequest(uri, function(doc) {
@@ -137,7 +179,8 @@
MenuItem {
text: qsTr("Refresh")
onClicked: {
- reloadDetails();
+ listModel.clear()
+ reloadDetails()
}
}
MenuItem {
@@ -154,6 +197,8 @@
now = Locs.addDays(now, 1);
if (debug) console.debug(now);
dailyDate = now;
+ listModel.clear()
+ oindex+=1
reloadDetails();
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/pages/ManageLocations.qml
^
|
@@ -28,7 +28,7 @@
property var cities
property variant coordinate
- property var debug: false
+ property bool debug: false
property var now
property var coord
property var lat
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/pages/OverviewPage.qml
^
|
@@ -26,16 +26,52 @@
//onWeatherChanged: updateWeatherModel();
//onQueryChanged: updateJSONModel();
+ function updateModel(index,response){
+
+ console.log("func index: " + index)
+ for (var i = 0; i < response.weather.length && i < 30; i++) {
+ switch( index ) {
+ case 0 : {
+ model0.append(response.weather[i]);
+ break
+ }
+ case 1 : {
+ model1.append(response.weather[i]);
+ break
+ }
+ case 2 : {
+ model2.append(response.weather[i]);
+ break
+ }
+ case 3 : {
+ model3.append(response.weather[i]);
+ break
+ }
+ case 4 : {
+ model4.append(response.weather[i]);
+ break
+ }
+ default : console.log("none")
+
+ }
+ };
+
+ }
function reload(){
+ model0.clear()
+ model1.clear()
+ model2.clear()
+ model3.clear()
+ model4.clear()
debug = false;
- if (name === "") { name="Berlin" ; }
- if (lat === "") { lat="52.52"; }
- if (lon ==="") { lon="13.41" ; }
+ if (name === "") name="Berlin"
+ if (lat === "" ) lat="52.52"
+ if (lon ==="" ) lon="13.41"
- if (now == undefined) {
+ if (now === undefined) {
now = new Date();
}
var tz = TZ.jstz.determine(); // Determines the time zone of the browser client
@@ -47,25 +83,19 @@
var headerDay = Locs.addDays(now, 4).toLocaleString(locale, "dd");
headerDate = now.toLocaleString(locale, "MMM dd - ") + headerDay;
- // clear the listmodel
- //listModel.clear();
weather = new Array;
- //listModel.clear();
for (var j = 0; j < 5; j++) {
var dDate = Locs.addDays(now,j).toISOString().replace(/T.*/,'') ;
- var uri = "https://api.brightsky.dev/weather?tz="+tzname+"&lat=" + lat + "&lon=" + lon + "&date=" + dDate;
+ //var uri = "https://api.brightsky.dev/weather?tz="+tzname+"&lat=" + lat + "&lon=" + lon + "&date=" + dDate + "&max_dist=5000";
+ var uri = "https://api.brightsky.dev/weather?tz="+tzname+"&lat=" + lat + "&lon=" + lon + "&date=" + dDate ;
if (debug) console.debug(uri)
-
- // initialize listModel slot
- // sadly, this doesn't work
- //listModel.set(j,{})
-
Locs.httpRequestIndex(uri,j, function(index,doc) {
var response = JSON.parse(doc.responseText);
var dailyDate = new Date(response.weather[0].timestamp);
var dailyRain = Locs.dailyTotal(response.weather ,"precipitation");
+ var pRain = Locs.dailyMax(response.weather,"precipitation_probability");
var dailyCloud = Locs.dailyAvg(response.weather ,"cloud_cover");
var dailyIcon = Locs.mapIcon(response.weather[15].icon,dailyRain,response.weather[15].condition) ;
//var dailyIcon = response.weather[15].icon) ;
@@ -73,18 +103,15 @@
var dailyHigh = Locs.dailyMax(response.weather,"temperature");
var dailyWind= Locs.dailyAvg(response.weather ,"wind_speed");
var daily = {dailyDate: dailyDate, icon: dailyIcon , temperatureHigh: dailyHigh, temperatureLow: dailyLow,
- totalRain: dailyRain, cloud_cover:dailyCloud, wind_speed:dailyWind};
+ totalRain: dailyRain, likelyRain: pRain, cloud_cover:dailyCloud, wind_speed:dailyWind};
- weather[index]=daily;
+ weather[index]=daily
+ updateModel(index,response)
- // the listmodel set method does not work. well sometimes.
- //listModel.set(index,daily)
- //listModel.insert(index,daily);
// restart the timer. gives us enough time to
// get all the results since ORDER is not garanteed
- if(index < 4) getTimer.restart();
-
+ if( index < 4) getTimer.restart();
if (debug) console.debug(JSON.stringify(weather[index]));
});
}
@@ -92,12 +119,13 @@
function updateWeatherModel(){
- debug = false
+ debug = true
listModel.clear();
var modelComplete = true;
for (var i = 0; i < 5; i++) {
+
if (weather[i] === ""){
if (debug) console.debug(JSON.stringify('weather: ' + i));
modelComplete = false;
@@ -105,12 +133,18 @@
}
for (var j = 0; j < 5; j++) {
if (modelComplete === true){
- if (debug) console.debug(JSON.stringify('index: ' + j));
- // this migt come to haunt us, but append generates errors
listModel.append(weather[j]);
- //listModel.insert(j,weather[j]);
}
}
+ if (debug) console.debug("length0 : " + model0.count);
+ if (debug) console.debug("length1 : " + model1.count);
+ if (debug) console.debug("length2 : " + model2.count);
+ if (debug) console.debug("length3 : " + model3.count);
+ if (debug) console.debug("length4 : " + model4.count);
+
+ /*for (var i = 0; i < model4.count; i++) {
+ console.log("element " + i + ":" + model4.get(i).timestamp)
+ }*/
}
allowedOrientations: Orientation.Portrait
@@ -120,25 +154,25 @@
id:getTimer
interval: 400
repeat: false
- running:true
+ running:false
triggeredOnStart:true
onTriggered: updateWeatherModel()
}
//Component.onCompleted: page.reload();
- /*onStatusChanged: {
+ /* onStatusChanged: {
switch (status) {
case PageStatus.Activating:
- indicator.visible = true;
- errorMsg.visible = false;
- page.reloadDetails();
+ //indicator.visible = true;
+ //errorMsg.visible = false;
+ page.reload();
break;
case PageStatus.Deactivating:
- errorMsg.visible = false;
+ //errorMsg.visible = false;
break;
}
- } */
+ }*/
SilicaFlickable {
@@ -196,8 +230,8 @@
delegate: ForecastItem {
id:delegate
onClicked: {
- //console.debug(JSON.stringify(weather[index]))
- pageStack.push(Qt.resolvedUrl("DailyDetails.qml"), { "name": name, "lat": lat, "lon": lon, "dailyDate": dailyDate });
+ console.debug(JSON.stringify(weather[index]))
+ pageStack.push(Qt.resolvedUrl("DailyDetails.qml"), { "name": name, "lat": lat, "lon": lon, "dailyDate": dailyDate, "oindex": index });
}
}
spacing: 2
@@ -211,10 +245,20 @@
onClicked: {
now = Locs.addDays(now, 5);
//now = dailyDate;
- console.debug(now);
+ //console.debug(now);
dailyDate = now.toLocaleString();
page.reload();
+ /*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/qml/pages/RadarView.qml
^
|
@@ -1,4 +1,4 @@
-/*
+/*
* This file is part of harbour-dwd.
* Copyright (C) 2021 <blueprint@poetaster.de> Mark Washeim
*
@@ -29,7 +29,7 @@
Page {
- property bool debug: false
+ property bool debug: true
property string lat
property string lon
property string dailyDate
@@ -113,6 +113,7 @@
webview.runJavaScript("return latlon('" + lat + "','" + lon + "')");
if (debug) console.debug(data.topic)
if (debug) console.debug(data.also)
+ if (debug) console.debug(data.src)
}
break
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-dwd-0.9.5.tar.bz2/translations/harbour-dwd.ts
^
|
@@ -129,27 +129,27 @@
<context>
<name>OverviewPage</name>
<message>
- <location filename="../qml/pages/OverviewPage.qml" line="151"/>
+ <location filename="../qml/pages/OverviewPage.qml" line="169"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../qml/pages/OverviewPage.qml" line="157"/>
+ <location filename="../qml/pages/OverviewPage.qml" line="175"/>
<source>GPS Locations</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../qml/pages/OverviewPage.qml" line="163"/>
+ <location filename="../qml/pages/OverviewPage.qml" line="181"/>
<source>Add Locations</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../qml/pages/OverviewPage.qml" line="169"/>
+ <location filename="../qml/pages/OverviewPage.qml" line="187"/>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../qml/pages/OverviewPage.qml" line="210"/>
+ <location filename="../qml/pages/OverviewPage.qml" line="228"/>
<source>Next</source>
<translation type="unfinished"></translation>
</message>
|