~martin-borho/ubuntu-weather-app/keyboard-shortcuts

« back to all changes in this revision

Viewing changes to components/LocationTab.qml

  • Committer: Martin Borho
  • Date: 2014-02-15 14:31:10 UTC
  • mfrom: (187.1.10 trunk)
  • Revision ID: martin@borho.net-20140215143110-gij32mdfm2mah342
merged from trunk, resolved conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
                    dateRel: "",//Tomorrow",
89
89
                    date: formatTimestamp(dailyForecasts[x].date, 'dddd, dd MMMM'),
90
90
                    temp: (dailyForecasts[x]["current"] === undefined) ? dailyForecasts[x][units].tempMax :
91
 
                                                dailyForecasts[x]["current"][units].temp,
92
 
                    tempMin: dailyForecasts[x][units].tempMin,
93
 
                    tempMax: (dailyForecasts[x]["current"] !== undefined) ? dailyForecasts[x][units].tempMax :
94
 
                                                null,
95
 
                    cond: dailyForecasts[x].condition.id,
 
91
                        dailyForecasts[x]["current"][units].temp,
 
92
                    tempMin: dailyForecasts[x][units].tempMin.toString(),
 
93
                    tempMax: (dailyForecasts[x]["current"] !== undefined
 
94
                        && dailyForecasts[x][units].tempMax !== undefined) ? dailyForecasts[x][units].tempMax.toString() : "",
96
95
                    condIcon: dailyForecasts[x].icon,
97
96
                    wind_speed: dailyForecasts[x][wind_units].windSpeed,
98
97
                    wind_dir: dailyForecasts[x].windDir,
99
98
                    humid: dailyForecasts[x].humidity,
100
99
                    precip: +(dailyForecasts[x][precip_units].rain || dailyForecasts[x][precip_units].snow || 0).toFixed(2),
101
 
                    press: dailyForecasts[x].pressure,
 
100
                    prop_precip: ((dailyForecasts[x].propPrecip !== undefined  && ""+dailyForecasts[x].propPrecip) || ""),
 
101
                    precip_type: dailyForecasts[x].precipType || "",
 
102
                    uv: (dailyForecasts[x].uv !== undefined) ? dailyForecasts[x].uv.toString() : "",
 
103
                    press: dailyForecasts[x].pressure || false,
102
104
                    hours: dailyForecasts[x]["hourly"]
103
105
                });
104
106
            }
161
163
                Rectangle {
162
164
                    id: listRectangle
163
165
                    width: parent.width
164
 
                    height: dailyForecastList.height
165
 
                    anchors.verticalCenter: parent.verticalCenter
 
166
                    height: dailyForecastList.height-tabFooter.height
 
167
                    anchors.top: parent.top
166
168
                    color: "transparent"
167
169
 
168
170
                    DateComponent {
177
179
                        minTemp: tempMin
178
180
                        maxTemp: tempMax
179
181
                        icon: condIcon
180
 
                        condition: cond
181
182
                        windSpeed: wind_speed
182
183
                        windDir: wind_dir
183
184
                        humidity: humid
184
185
                        precipitation: precip
 
186
                        propPrecip: prop_precip
 
187
                        precipType: precip_type
185
188
                        pressure: press
 
189
                        uvIndex: uv
186
190
                        hourly: hours
187
191
                        anchors.top: dateComponent.bottom
188
192
                        showMaxTemp: (index === 0)
191
195
            }
192
196
            LastUpdatedComponent{
193
197
                id: lastUpdatedComponent
 
198
                anchors.bottom: (tabFooter.visible) ? tabFooter.top : parent.bottom
194
199
            }
195
 
            Rectangle {
196
 
                id: noDataAvaible
197
 
                visible: false
198
 
                width:parent.width-units.gu(10)
199
 
                anchors.centerIn:parent
200
 
                anchors.verticalCenterOffset: -units.gu(10)
201
 
                color: "transparent"
202
 
                Label {
203
 
                    width:parent.width
204
 
                    text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
205
 
                    fontSize: "large"
206
 
                    wrapMode: Text.WordWrap
207
 
                }
 
200
            TabFooter {
 
201
                id:tabFooter
 
202
                objectName: "TabFooter"
 
203
                visible: !dataProviderLogo.visible
208
204
            }
209
205
            Image {
210
206
                id: dataProviderLogo
 
207
                objectName: "DataProviderLogo"
 
208
                visible: (settings["service"] === "openweathermap")
211
209
                source: Qt.resolvedUrl("../resources/images/openWeatherMapLogo.png")
212
210
                anchors {
213
211
                    bottom: parent.bottom
223
221
                    onClicked: Qt.openUrlExternally("http://m.openweathermap.org/city/" + locationData.location.services.openweathermap)
224
222
                }
225
223
            }
 
224
            Rectangle {
 
225
                id: noDataAvaible
 
226
                visible: false
 
227
                width:parent.width-units.gu(10)
 
228
                anchors.centerIn:parent
 
229
                anchors.verticalCenterOffset: -units.gu(10)
 
230
                color: "transparent"
 
231
                Label {
 
232
                    width:parent.width
 
233
                    text: i18n.tr("No weather data available at the moment, please try to refresh later again!")
 
234
                    fontSize: "large"
 
235
                    wrapMode: Text.WordWrap
 
236
                }
 
237
            }            
226
238
        }
227
239
 
228
240