Summary: | weather info not shown for stations needing maintenance | ||
---|---|---|---|
Product: | [Unmaintained] kweather-kde3 | Reporter: | Sok Ann Yap <sokann> |
Component: | general | Assignee: | geiseri |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | kde |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch to disregard the maintenance flag
Complete patch |
Description
Sok Ann Yap
2005-01-15 23:49:58 UTC
Created attachment 9110 [details]
Patch to disregard the maintenance flag
After applying the patch, kweather finally shows me the weather infos. Compared
to the results from websites such as weather.com and weather.yahoo.com, I can
say that they are accurate.
Created attachment 9112 [details]
Complete patch
Ahh... I forgot to update the frontend in the previous patch. Please see this
one.
*** Bug 95870 has been marked as a duplicate of this bug. *** SVN commit 616506 by mkoller: BUG: 97107 BUG: 134426 BUG: 108427 Display weather data even if station needs maintenance Patch included from Sok Ann Yap sokann@gmail.com Make the tooltip more informative by showing station name and more data M +56 -31 dockwidget.cpp M +3 -6 metar_parser.cpp M +6 -10 reportview.cpp M +1 -4 weatherlib.cpp --- branches/KDE/3.5/kdetoys/kweather/dockwidget.cpp #616505:616506 @@ -41,7 +41,8 @@ setBackgroundOrigin( AncestorOrigin ); } -dockwidget::~dockwidget(){ +dockwidget::~dockwidget() +{ delete m_weatherService; } @@ -77,51 +78,74 @@ void dockwidget::showWeather() { - QString tip; + QString tip = "<qt>"; QString temp = "?"; QString wind = "?"; QString pressure = "?"; - if ( !m_locationCode.isEmpty() && m_weatherService->stationNeedsMaintenance( m_locationCode ) ) + if ( !m_locationCode.isEmpty() ) { - tip = i18n("Station reports that it needs maintenance\n" - "Please try again later"); - } - else - { - if ( !m_locationCode.isEmpty() ) - { - temp = m_weatherService->temperature( m_locationCode ); - wind = m_weatherService->wind( m_locationCode ); - pressure = m_weatherService->pressure( m_locationCode ); - } + temp = m_weatherService->temperature( m_locationCode ); + wind = m_weatherService->wind( m_locationCode ); + pressure = m_weatherService->pressure( m_locationCode ); - if (m_mode != ShowAll) - { - tip = i18n("Temperature: ") + temp; - tip += i18n("\nWind: ") + wind; - tip += i18n("\nAir pressure: ") + pressure; - } + QString dewPoint = m_weatherService->dewPoint( m_locationCode); + QString relHumidity = m_weatherService->relativeHumidity( m_locationCode ); + QString heatIndex = m_weatherService->heatIndex( m_locationCode ); + QString windChill = m_weatherService->windChill( m_locationCode ); + QString sunRiseTime = m_weatherService->sunRiseTime( m_locationCode ); + QString sunSetTime = m_weatherService->sunSetTime( m_locationCode ); + + tip += "<h3><center><nobr>" + + m_weatherService->stationName( m_locationCode ) + " (" + + m_weatherService->stationCountry( m_locationCode ) + ")</nobr></center></h3><br>"; + + tip += QString("<table>" + "<tr><th><nobr>" + i18n( "Temperature:" ) + "</nobr></th><td><nobr>%1</nobr></td>" + "<th><nobr>" + i18n( "Dew Point:" ) + "</nobr></th><td><nobr>%2</nobr></td></nobr></tr>" + + "<tr><th><nobr>" + i18n( "Air Pressure:" ) + "</nobr></th><td><nobr>%3</nobr></td>" + "<th><nobr>" + i18n( "Rel. Humidity:" ) + "</nobr></th><td><nobr>%4</nobr></td></nobr></tr>" + + "<tr><th><nobr>" + i18n( "Wind Speed:" ) + "</nobr></th><td><nobr>%5</nobr></td>") + .arg(temp).arg(dewPoint).arg(pressure).arg(relHumidity).arg(wind); + + if ( !heatIndex.isEmpty() ) + tip += QString("<th><nobr>" + i18n( "Heat Index:" ) + "</nobr></th><td><nobr>%1</nobr></td>").arg(heatIndex); + else if ( !windChill.isEmpty() ) + tip += QString("<th><nobr>" + i18n( "Wind Chill:" ) + "</nobr></th><td><nobr>%1</nobr></td>").arg(windChill); else + tip += "<td> </td><td> </td>"; + tip += "</tr>"; + + tip += QString("<tr><th><nobr>" + i18n( "Sunrise:" ) + "</nobr></th><td><nobr>%1</nobr></td>" + + "<th><nobr>" + i18n( "Sunset:" ) + "</nobr></th><td><nobr>%2</nobr></td>") + .arg(sunRiseTime).arg(sunSetTime); + + tip += "</tr></table>"; + + if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) ) { - tip = i18n("Click here to see\nthe detailed weather report..."); + tip += "<br>" + i18n("Station reports that it needs maintenance\n" + "Please try again later"); } } + else + { + tip += i18n("Temperature: ") + temp + "<br>"; + tip += i18n("\nWind: ") + wind + "<br>"; + tip += i18n("\nAir pressure: ") + pressure + "<br>"; + } + tip += "</qt>"; + // On null or empty location code, or if the station needs maintenance, this will return the dunno icon. QPixmap icon = m_weatherService->icon( m_locationCode ); - if ( ! m_locationCode.isEmpty() ) - { - tip = m_weatherService->stationName( m_locationCode ) + "\n" + - m_weatherService->stationCountry( m_locationCode ) + "\n" + - tip; - } + QToolTip::remove(this); + QToolTip::add(this, tip); - QToolTip::remove(m_button); - QToolTip::add(m_button, tip); - kdDebug(12004) << "show weather: " << endl; kdDebug(12004) << "location: " << m_locationCode << endl; kdDebug(12004) << "temp,wind,pressure: " << temp << " " << wind << " " << pressure << endl; @@ -134,7 +158,8 @@ m_button->setPixmap( icon ); } -void dockwidget::initDock(){ +void dockwidget::initDock() +{ kdDebug(12004) << "Init dockwidget " << endl; m_button= new WeatherButton(this,"m_button"); --- branches/KDE/3.5/kdetoys/kweather/metar_parser.cpp #616505:616506 @@ -135,12 +135,9 @@ } } - if (!weatherInfo.stationNeedsMaintenance) - { - calcTemperatureVariables(); - calcWindChill(); - calcCurrentIcon(); - } + calcTemperatureVariables(); + calcWindChill(); + calcCurrentIcon(); return weatherInfo; } --- branches/KDE/3.5/kdetoys/kweather/reportview.cpp #616505:616506 @@ -100,18 +100,14 @@ if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) ) { weatherText += "<li>" + i18n( "Station reports that it needs maintenance" ) + " \n"; - weatherText += "<li>" + i18n( "Please try a different one" ) + " \n"; } - else - { - for (QStringList::const_iterator it = cover.begin(); - it != cover.end(); ++it) - weatherText += "<li>" + *it + "\n"; + for (QStringList::const_iterator it = cover.begin(); + it != cover.end(); ++it) + weatherText += "<li>" + *it + "\n"; - for (QStringList::const_iterator it = weather.begin(); - it != weather.end(); ++it) - weatherText += "<li>" + *it + "\n"; - } + for (QStringList::const_iterator it = weather.begin(); + it != weather.end(); ++it) + weatherText += "<li>" + *it + "\n"; weatherText += "</ul>\n"; --- branches/KDE/3.5/kdetoys/kweather/weatherlib.cpp #616505:616506 @@ -276,10 +276,7 @@ if ( !stationID.isEmpty() ) { Data *d = findData(stationID); - if (!d->wi.stationNeedsMaintenance) - { - result = d->wi.theWeather; - } + result = d->wi.theWeather; } return result; |