summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--harmaccuweather/harmaccuweather.cpp7
-rw-r--r--libsowatch/weathernotification.h1
-rw-r--r--metawatch/metawatch.pro6
-rw-r--r--metawatch/metawatch.qrc (renamed from metawatch/uires.qrc)0
-rw-r--r--metawatch/metawatchdigital.cpp34
-rw-r--r--metawatch/metawatchdigital.h13
6 files changed, 36 insertions, 25 deletions
diff --git a/harmaccuweather/harmaccuweather.cpp b/harmaccuweather/harmaccuweather.cpp
index 158c115..99cc31b 100644
--- a/harmaccuweather/harmaccuweather.cpp
+++ b/harmaccuweather/harmaccuweather.cpp
@@ -13,7 +13,7 @@ HarmAccuWeather::HarmAccuWeather(QObject *parent) :
_watcher->addPath("/home/user/.config/AccuWeather, Inc./awxapp.conf");
connect(_watcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString)));
- _timer->setInterval(2000);
+ _timer->setInterval(5000);
_timer->setSingleShot(true);
connect(_timer, SIGNAL(timeout()), SLOT(update()));
@@ -134,11 +134,13 @@ WeatherNotification::WeatherType HarmAccuWeather::forecast()
switch (_lastWxCode) {
case 1:
case 2:
- case 3:
return Sunny;
+ case 3:
case 4:
case 5:
+ return PartlyCloudy;
+
case 6:
case 7:
case 8:
@@ -174,6 +176,7 @@ WeatherNotification::WeatherType HarmAccuWeather::forecast()
case 34:
return Sunny;
case 35:
+ return PartlyCloudy;
case 36:
case 37:
case 38:
diff --git a/libsowatch/weathernotification.h b/libsowatch/weathernotification.h
index 3065a53..de3152a 100644
--- a/libsowatch/weathernotification.h
+++ b/libsowatch/weathernotification.h
@@ -15,6 +15,7 @@ public:
enum WeatherType {
UnknownWeather = 0,
Sunny,
+ PartlyCloudy,
Cloudy,
Fog,
Rain,
diff --git a/metawatch/metawatch.pro b/metawatch/metawatch.pro
index 96518da..3435bb5 100644
--- a/metawatch/metawatch.pro
+++ b/metawatch/metawatch.pro
@@ -31,7 +31,7 @@ FORMS += \
metawatchsimulatorform.ui
RESOURCES += \
- uires.qrc
+ metawatch.qrc
OTHER_FILES += \
idle_sms.bmp \
@@ -73,7 +73,3 @@ unix:!symbian {
}
INSTALLS += target
}
-
-
-
-
diff --git a/metawatch/uires.qrc b/metawatch/metawatch.qrc
index 821a3dc..821a3dc 100644
--- a/metawatch/uires.qrc
+++ b/metawatch/metawatch.qrc
diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp
index 8a81f97..f35eab0 100644
--- a/metawatch/metawatchdigital.cpp
+++ b/metawatch/metawatchdigital.cpp
@@ -4,7 +4,8 @@ using namespace sowatch;
MetaWatchDigital::MetaWatchDigital(const QBluetoothAddress& address, QSettings* settings, QObject *parent) :
MetaWatch(address, settings, parent),
- _nMails(0), _nCalls(0), _nIms(0), _nSms(0), _nMms(0)
+ _nMails(0), _nCalls(0), _nIms(0), _nSms(0), _nMms(0),
+ _wForecast(WeatherNotification::UnknownWeather)
{
QImage baseImage(screenWidth, screenHeight, QImage::Format_MonoLSB);
baseImage.setColor(0, QColor(Qt::white).rgb());
@@ -75,8 +76,16 @@ void MetaWatchDigital::updateNotificationCount(Notification::Type type, int coun
void MetaWatchDigital::updateWeather(WeatherNotification *weather)
{
+ if (weather) {
+ _wForecast = weather->forecast();
+ _wBody = weather->body();
+ _wTemperature = weather->temperature();
+ _wMetric = weather->temperatureUnits() == WeatherNotification::Celsius;
+ } else {
+ _wForecast = WeatherNotification::UnknownWeather;
+ }
if (isConnected()) {
- renderIdleWeather(weather);
+ renderIdleWeather();
}
}
@@ -159,7 +168,7 @@ void MetaWatchDigital::renderIdleScreen()
renderIdleCounts();
}
-void MetaWatchDigital::renderIdleWeather(WeatherNotification* w)
+void MetaWatchDigital::renderIdleWeather()
{
_paintMode = IdleMode;
QFont sf("MetaWatch Small caps 8pt", 6);
@@ -171,35 +180,32 @@ void MetaWatchDigital::renderIdleWeather(WeatherNotification* w)
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");
+ if (_wForecast != WeatherNotification::UnknownWeather) {
+ QImage icon = iconForWeather(_wForecast);
+ QString unit = QString::fromUtf8(_wMetric ? "°C" : "°F");
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, w->body(), option);
+ p.drawText(bodyRect, _wBody, option);
p.drawImage(36, systemAreaHeight + 6, icon);
p.setFont(lf);
- 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"));
+ p.drawText(63, systemAreaHeight + 23, QString("%1 %2").arg(_wTemperature).arg(unit));
}
_paintMode = _currentMode;
}
-QImage MetaWatchDigital::iconForWeather(WeatherNotification *w)
+QImage MetaWatchDigital::iconForWeather(WeatherNotification::WeatherType w)
{
- switch (w->forecast()) {
+ switch (w) {
case WeatherNotification::Sunny:
return QImage(QString(":/metawatch/graphics/weather_sunny.bmp"));
+ case WeatherNotification::PartlyCloudy:
case WeatherNotification::Cloudy:
case WeatherNotification::Fog:
return QImage(QString(":/metawatch/graphics/weather_cloudy.bmp"));
diff --git a/metawatch/metawatchdigital.h b/metawatch/metawatchdigital.h
index a528eb2..7ce195b 100644
--- a/metawatch/metawatchdigital.h
+++ b/metawatch/metawatchdigital.h
@@ -31,14 +31,19 @@ public:
void update(Mode mode, const QList<QRect>& rects = QList<QRect>());
protected:
- // Notifications: Unread count
- uint _nMails, _nCalls, _nIms, _nSms, _nMms;
+ // Idle screen: notifications unread count
+ ushort _nMails, _nCalls, _nIms, _nSms, _nMms;
+ // Idle screen: weather information
+ WeatherNotification::WeatherType _wForecast;
+ QString _wBody;
+ short _wTemperature;
+ bool _wMetric;
void handleWatchConnected();
void renderIdleScreen();
- void renderIdleWeather(WeatherNotification *w = 0);
- QImage iconForWeather(WeatherNotification *w);
+ void renderIdleWeather();
+ QImage iconForWeather(WeatherNotification::WeatherType w);
void renderIdleCounts();
void renderNotification(Notification *n);