diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-03-28 18:07:34 +0100 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-03-28 18:07:34 +0100 |
commit | 94d434ca1c60d4ff9e518fdcdcfd867abf03c4ac (patch) | |
tree | 40f85ce5978af4f6f1f0db1ce914d19f1f6a44b5 | |
parent | ff3e0c160733707ce0bb835362d2730b407b0126 (diff) | |
download | sowatch-94d434ca1c60d4ff9e518fdcdcfd867abf03c4ac.tar.gz sowatch-94d434ca1c60d4ff9e518fdcdcfd867abf03c4ac.zip |
add change mode command to workaround mode priorities
-rw-r--r-- | metawatch/metawatch.cpp | 21 | ||||
-rw-r--r-- | metawatch/metawatch.h | 4 | ||||
-rw-r--r-- | metawatch/metawatchdigital.cpp | 11 |
3 files changed, 25 insertions, 11 deletions
diff --git a/metawatch/metawatch.cpp b/metawatch/metawatch.cpp index f9979ed..bd7d852 100644 --- a/metawatch/metawatch.cpp +++ b/metawatch/metawatch.cpp @@ -245,6 +245,8 @@ void MetaWatch::displayIdleScreen() { _currentMode = IdleMode; _paintMode = IdleMode; + changeMode(_currentMode); + _ringTimer->stop(); _idleTimer->stop(); setVibrateMode(false, 0, 0, 0); @@ -254,6 +256,8 @@ void MetaWatch::displayNotification(Notification *notification) { _currentMode = NotificationMode; _paintMode = NotificationMode; + changeMode(_currentMode); + if (notification->type() == Notification::CallNotification) { timedRing(); _ringTimer->start(); @@ -269,6 +273,8 @@ void MetaWatch::displayApplication() { _currentMode = ApplicationMode; _paintMode = ApplicationMode; + changeMode(_currentMode); + _ringTimer->stop(); _idleTimer->stop(); } @@ -526,10 +532,15 @@ void MetaWatch::updateLcdDisplay(Mode mode, int startRow, int numRows) void MetaWatch::loadLcdTemplate(Mode mode, int templ) { - Message msg(LoadLcdTemplate, QByteArray(1, templ), mode & 0xF); + Message msg(LoadLcdTemplate, QByteArray(1, templ), mode & 0x3); send(msg); } +void MetaWatch::changeMode(Mode mode) +{ + send(Message(ChangeMode, QByteArray(), mode & 0x3)); +} + void MetaWatch::enableButton(Mode mode, Button button, ButtonPress press) { Message msg(EnableButton, QByteArray(5, 0)); @@ -692,14 +703,10 @@ void MetaWatch::settingChanged(const QString &key) _notificationTimeout = _settings->value(key, 15).toInt(); } else if (key == "day-month-order") { _dayMonthOrder = _settings->value(key, false).toBool(); - if (isConnected()) { - updateWatchProperties(); - } + if (isConnected()) updateWatchProperties(); } else if (key == "24h-mode") { _24hMode = _settings->value(key, false).toBool(); - if (isConnected()) { - updateWatchProperties(); - } + if (isConnected()) updateWatchProperties(); } } diff --git a/metawatch/metawatch.h b/metawatch/metawatch.h index 5401319..2fd2794 100644 --- a/metawatch/metawatch.h +++ b/metawatch/metawatch.h @@ -67,7 +67,8 @@ public: ReadBatteryVoltage = 0x56, ReadBatteryVoltageResponse = 0x57, ReadLightSensor = 0x58, - ReadLightSensorResponse = 0x59 + ReadLightSensorResponse = 0x59, + ChangeMode = 0xa6 }; enum Mode { @@ -229,6 +230,7 @@ protected: void configureLcdIdleSystemArea(bool entireScreen); void updateLcdDisplay(Mode mode, int startRow = 0, int numRows = 0); void loadLcdTemplate(Mode mode, int templ); + void changeMode(Mode mode); void enableButton(Mode mode, Button button, ButtonPress press); void disableButton(Mode mode, Button button, ButtonPress press); diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp index abe47a9..31f3276 100644 --- a/metawatch/metawatchdigital.cpp +++ b/metawatch/metawatchdigital.cpp @@ -104,8 +104,11 @@ void MetaWatchDigital::displayNotification(Notification *n) // Render the notification and display it before invoking haptic feedback _currentMode = NotificationMode; + changeMode(_currentMode); + renderNotification(n); + // This will trigger haptic feedback, etc. MetaWatch::displayNotification(n); } @@ -334,16 +337,18 @@ QImage MetaWatchDigital::iconForNotification(const Notification *n) void MetaWatchDigital::handleWatchConnected() { // Grab all of the buttons that are of interest to us - // We do not grab the D button, as it triggers the LED. - grabButton(IdleMode, BtnA); + // We do not grab the F button, as it triggers the LED. + grabButton(IdleMode, BtnA); // Required for app-switch + grabButton(IdleMode, BtnB); // What does this do? + grabButton(IdleMode, BtnD); // Currently not supported grabButton(NotificationMode, BtnA); grabButton(NotificationMode, BtnB); grabButton(NotificationMode, BtnC); grabButton(ApplicationMode, BtnA); grabButton(ApplicationMode, BtnB); grabButton(ApplicationMode, BtnC); + grabButton(ApplicationMode, BtnD); grabButton(ApplicationMode, BtnE); - grabButton(ApplicationMode, BtnF); // Configure to show watch-rendered clock in idle screen configureLcdIdleSystemArea(false); |