From f61dfc6557303a8bba5301927f42e5b2a7ffcac6 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 7 Jul 2013 13:50:28 +0200 Subject: add some notification support to liveview --- metawatch/metawatchanalog.cpp | 4 +- metawatch/metawatchanalog.h | 2 +- metawatch/metawatchdigital.cpp | 104 +---------------------------------------- 3 files changed, 5 insertions(+), 105 deletions(-) (limited to 'metawatch') diff --git a/metawatch/metawatchanalog.cpp b/metawatch/metawatchanalog.cpp index 5d35266..7159d78 100644 --- a/metawatch/metawatchanalog.cpp +++ b/metawatch/metawatchanalog.cpp @@ -95,7 +95,7 @@ void MetaWatchAnalog::clear(Mode mode, bool black) // TODO Still need to understand this } -void MetaWatchAnalog::handleWatchConnected() +void MetaWatchAnalog::setupBluetoothWatch() { - + // TODO } diff --git a/metawatch/metawatchanalog.h b/metawatch/metawatchanalog.h index a0a4db2..ca40798 100644 --- a/metawatch/metawatchanalog.h +++ b/metawatch/metawatchanalog.h @@ -30,7 +30,7 @@ public: void update(Mode mode, const QList& rects = QList()); protected: - void handleWatchConnected(); + void setupBluetoothWatch(); }; } diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp index ccb0da3..737ae84 100644 --- a/metawatch/metawatchdigital.cpp +++ b/metawatch/metawatchdigital.cpp @@ -90,106 +90,6 @@ void MetaWatchDigital::update(Mode mode, const QList &rects) } } -#if 0 -QUrl MetaWatchDigital::iconForNotification(const Notification *n) -{ - switch (n->type()) { - case Notification::CallNotification: - case Notification::MissedCallNotification: - return QUrl::fromLocalFile(SOWATCH_RESOURCES_DIR "/metawatch/graphics/phone.png"); - break; - case Notification::SmsNotification: - case Notification::MmsNotification: - case Notification::ImNotification: - return QUrl::fromLocalFile(SOWATCH_RESOURCES_DIR "/metawatch/graphics/message.png"); - break; - case Notification::EmailNotification: - return QUrl::fromLocalFile(SOWATCH_RESOURCES_DIR "/metawatch/graphics/email.bmp"); - break; - case Notification::CalendarNotification: - return QUrl::fromLocalFile(SOWATCH_RESOURCES_DIR "/metawatch/graphics/timer.bmp"); - break; - default: - return QUrl(); - } -} - -void MetaWatchDigital::renderIdleWeather() -{ - _paintMode = IdleMode; - QFont sf("MetaWatch Small caps 8pt"); - QFont lf("MetaWatch Large 16pt"); - QPainter p(this); - - sf.setPixelSize(8); - lf.setPixelSize(16); - - p.fillRect(0, systemAreaHeight + 6, screenWidth, systemAreaHeight - 6, Qt::white); - - 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, _wBody, option); - - p.drawImage(36, systemAreaHeight + 6, icon); - - p.setFont(lf); - p.drawText(63, systemAreaHeight + 23, QString("%1 %2").arg(_wTemperature).arg(unit)); - } - - _paintMode = _currentMode; -} - -QImage MetaWatchDigital::iconForWeather(WeatherNotification::WeatherType w) -{ - switch (w) { - case WeatherNotification::Sunny: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/weather_sunny.bmp")); - case WeatherNotification::PartlyCloudy: - case WeatherNotification::Cloudy: - case WeatherNotification::Fog: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/weather_cloudy.bmp")); - case WeatherNotification::Rain: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/weather_rain.bmp")); - case WeatherNotification::Thunderstorm: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/weather_thunderstorm.bmp")); - case WeatherNotification::Snow: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/weather_snow.bmp")); - default: - return QImage(); - } -} - -QImage MetaWatchDigital::iconForNotification(const Notification *n) -{ - switch (n->type()) { - case Notification::CallNotification: - case Notification::MissedCallNotification: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/phone.bmp")); - break; - case Notification::SmsNotification: - case Notification::MmsNotification: - case Notification::ImNotification: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/message.bmp")); - break; - case Notification::EmailNotification: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/email.bmp")); - break; - case Notification::CalendarNotification: - return QImage(QString(SOWATCH_RESOURCES_DIR "/metawatch/graphics/timer.bmp")); - break; - default: - return QImage(); - } -} -#endif - void MetaWatchDigital::setupBluetoothWatch() { MetaWatch::setupBluetoothWatch(); // Call generic setup @@ -198,7 +98,7 @@ void MetaWatchDigital::setupBluetoothWatch() // We do not grab the F button, as it triggers the LED. grabButton(IdleMode, BtnA); // Required for app-switch grabButton(NotificationMode, BtnA); - grabButton(NotificationMode, BtnB); // Scrolling + grabButton(NotificationMode, BtnB); // Scrolling notifications grabButton(NotificationMode, BtnC); grabButton(ApplicationMode, BtnA); grabButton(ApplicationMode, BtnB); @@ -207,5 +107,5 @@ void MetaWatchDigital::setupBluetoothWatch() grabButton(ApplicationMode, BtnE); // Configure to show watch-rendered clock in idle screen - // configureLcdIdleSystemArea(false); // No need to. + // configureLcdIdleSystemArea(false); // No need to do this in recent firmware. } -- cgit v1.2.3