summaryrefslogtreecommitdiff
path: root/metawatch/metawatchdigital.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-10-16 23:38:49 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-10-16 23:38:49 +0200
commite86bf7a875ed3decda48fc146598a19685a4a27d (patch)
tree06bc62ead478444fb361728211c3d383717b32a3 /metawatch/metawatchdigital.cpp
parent2c8f42cc6ad1c67c5ee0110393c7ee756d14044e (diff)
downloadsowatch-e86bf7a875ed3decda48fc146598a19685a4a27d.tar.gz
sowatch-e86bf7a875ed3decda48fc146598a19685a4a27d.zip
adding more weather descriptions
Diffstat (limited to 'metawatch/metawatchdigital.cpp')
-rw-r--r--metawatch/metawatchdigital.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp
index ae13e49..df7d015 100644
--- a/metawatch/metawatchdigital.cpp
+++ b/metawatch/metawatchdigital.cpp
@@ -169,18 +169,24 @@ void MetaWatchDigital::renderIdleWeather(WeatherNotification* w)
sf.setPixelSize(8);
lf.setPixelSize(16);
- p.fillRect(0, systemAreaHeight + 6, screenWidth, systemAreaHeight - 12, Qt::white);
+ p.fillRect(0, systemAreaHeight + 6, screenWidth, systemAreaHeight - 6, Qt::white);
if (w) {
QImage icon = iconForWeather(w);
bool metric = w->temperatureUnits() == WeatherNotification::Celsius;
QString unit = QString::fromUtf8(metric ? "°C" : "°F");
- QRect bodyRect(4, systemAreaHeight + 6, 36, systemAreaHeight - 10);
+
+ QRect bodyRect(3, systemAreaHeight + 6, 36, systemAreaHeight - 6);
+ QTextOption option;
+ option.setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+ option.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
p.setFont(sf);
- p.drawText(bodyRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextWordWrap, w->body());
+ p.drawText(bodyRect, w->body(), option);
+
p.drawImage(36, systemAreaHeight + 6, icon);
+
p.setFont(lf);
- p.drawText(64, systemAreaHeight + 22, QString("%1 %2").arg(w->temperature()).arg(unit));
+ p.drawText(63, systemAreaHeight + 23, QString("%1 %2").arg(w->temperature()).arg(unit));
} else {
p.setFont(sf);
p.drawText(32, systemAreaHeight + 18, tr("No data"));
@@ -195,13 +201,14 @@ QImage MetaWatchDigital::iconForWeather(WeatherNotification *w)
case WeatherNotification::Sunny:
return QImage(QString(":/metawatch/graphics/weather_sunny.bmp"));
case WeatherNotification::Cloudy:
+ case WeatherNotification::Fog:
return QImage(QString(":/metawatch/graphics/weather_cloudy.bmp"));
case WeatherNotification::Rain:
return QImage(QString(":/metawatch/graphics/weather_rain.bmp"));
- case WeatherNotification::Snow:
- return QImage(QString(":/metawatch/graphics/weather_snow.bmp"));
case WeatherNotification::Thunderstorm:
return QImage(QString(":/metawatch/graphics/weather_thunderstorm.bmp"));
+ case WeatherNotification::Snow:
+ return QImage(QString(":/metawatch/graphics/weather_snow.bmp"));
default:
return QImage();
}