summaryrefslogtreecommitdiff
path: root/liveview
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-05-11 20:15:36 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-05-11 20:15:36 +0200
commitac182bd9bf076b4d03d4812e85b989edae32d756 (patch)
tree7d05a80a2e6e44e3fe0dbd3384bf6c18321fa2b8 /liveview
parent505f7b1cf62c6934f5246c5e62eccb0a26cb1ce2 (diff)
downloadsowatch-ac182bd9bf076b4d03d4812e85b989edae32d756.tar.gz
sowatch-ac182bd9bf076b4d03d4812e85b989edae32d756.zip
able to navigate watchlets in liveview
Diffstat (limited to 'liveview')
-rw-r--r--liveview/liveview.cpp25
-rw-r--r--liveview/liveview.h7
-rw-r--r--liveview/liveviewpaintengine.cpp1
3 files changed, 26 insertions, 7 deletions
diff --git a/liveview/liveview.cpp b/liveview/liveview.cpp
index aa8a472..746c04a 100644
--- a/liveview/liveview.cpp
+++ b/liveview/liveview.cpp
@@ -14,6 +14,8 @@ LiveView::LiveView(ConfigKey* settings, QObject* parent) :
_watchlets(0),
_24hMode(settings->value("24h-mode", false).toBool()),
_screenWidth(0), _screenHeight(0),
+ _mode(RootMenuMode),
+ _paintEngine(0),
_sendTimer(new QTimer(this))
{
_sendTimer->setInterval(DelayBetweenMessages);
@@ -166,7 +168,7 @@ void LiveView::renderImage(int x, int y, const QImage &image)
buffer.open(QIODevice::WriteOnly);
if (image.save(&buffer, "PNG")) {
displayBitmap(x, y, buffer.buffer());
- qDebug() << "render image " << x << 'x' << y << "size" << image.size();
+ qDebug() << "render image at" << x << 'x' << y << "size" << image.size();
} else {
qWarning() << "Failed to encode image";
}
@@ -188,7 +190,8 @@ void LiveView::setupBluetoothWatch()
void LiveView::desetupBluetoothWatch()
{
-
+ _sendTimer->stop();
+ _sendingMsgs.clear();
}
void LiveView::refreshMenu()
@@ -361,14 +364,24 @@ void LiveView::handleNavigation(const Message &msg)
int event = msg.data[2];
qDebug() << "navigation" << event << item_id << menu_id;
- sendResponse(NavigationResponse, ResponseOk);
- // TODO
- if (event == 32) {
- qDebug() << "Navigation, requesting watchlet";
+ switch (event) {
+ case SelectLongPress:
+ if (_mode == ApplicationMode) {
+ sendResponse(NavigationResponse, ResponseCancel);
+ emit closeWatchledRequested();
+ return;
+ }
+ break;
+ case SelectMenu:
+ sendResponse(NavigationResponse, ResponseOk);
emit watchletRequested("com.javispedro.sowatch.neko");
+ return;
}
+
+ // Fallback case
+ sendResponse(NavigationResponse, ResponseOk);
}
void LiveView::handleMenuItemsRequest(const Message &msg)
diff --git a/liveview/liveview.h b/liveview/liveview.h
index 65ce523..bd8a3ac 100644
--- a/liveview/liveview.h
+++ b/liveview/liveview.h
@@ -105,6 +105,13 @@ protected:
ApplicationMode
};
+ enum NavigationEvent {
+ SelectPress = 13,
+ SelectLongPress = 14,
+ SelectDoublePress = 15,
+ SelectMenu = 32
+ };
+
struct Message {
MessageType type;
QByteArray data;
diff --git a/liveview/liveviewpaintengine.cpp b/liveview/liveviewpaintengine.cpp
index f774884..1caa1e3 100644
--- a/liveview/liveviewpaintengine.cpp
+++ b/liveview/liveviewpaintengine.cpp
@@ -7,7 +7,6 @@ using namespace sowatch;
LiveViewPaintEngine::LiveViewPaintEngine() :
WatchPaintEngine(), _watch(0)
{
- qDebug() << "SE CCONS";
}
bool LiveViewPaintEngine::begin(QPaintDevice *pdev)