Bug 134426 - show weather information as balloon
Summary: show weather information as balloon
Status: RESOLVED FIXED
Alias: None
Product: kweather-kde3
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: geiseri
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-21 03:51 UTC by Richard Hartmann
Modified: 2006-12-28 14:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Hartmann 2006-09-21 03:51:33 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Debian testing/unstable Packages

As with most other kicker applets etc, kweather should show a balloon containing the weather information when you mouse over the weather applet. by balloon, i mean what the taskbar items or the desktop pager show when you mouse over.
Comment 1 Martin Koller 2006-12-25 23:26:56 UTC
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>&nbsp;</td><td>&nbsp;</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;
Comment 2 Richard Hartmann 2006-12-28 14:30:17 UTC
thanks!