summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-07-07 13:50:28 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-07-07 13:50:28 +0200
commitf61dfc6557303a8bba5301927f42e5b2a7ffcac6 (patch)
treefdba31b412015684d46c7a3cb070b8a57ff37ef4
parent92475d094cfddf7dd3036f5f1a9d6845a83ee350 (diff)
downloadsowatch-f61dfc6557303a8bba5301927f42e5b2a7ffcac6.tar.gz
sowatch-f61dfc6557303a8bba5301927f42e5b2a7ffcac6.zip
add some notification support to liveview
-rw-r--r--libsowatch/declarativewatchlet.cpp2
-rw-r--r--libsowatchbt/bluetoothwatch.cpp2
-rw-r--r--liveview/liveview.cpp65
-rw-r--r--liveview/liveview.h16
-rw-r--r--liveview/liveview.pro3
-rw-r--r--liveview/liveviewscanner.cpp1
-rw-r--r--liveview/qml/com/javispedro/sowatch/liveview/LVPage.qml7
-rw-r--r--liveview/qml/com/javispedro/sowatch/liveview/qmldir2
-rw-r--r--liveview/qml/liveview-config.qml53
-rw-r--r--liveviewwatchlets/liveview-notification.qml41
-rw-r--r--liveviewwatchlets/liveviewnotificationwatchlet.cpp11
-rw-r--r--liveviewwatchlets/liveviewnotificationwatchlet.h20
-rw-r--r--liveviewwatchlets/liveviewwatchlets.pro32
-rw-r--r--liveviewwatchlets/liveviewwatchletsplugin.cpp44
-rw-r--r--liveviewwatchlets/liveviewwatchletsplugin.h25
-rw-r--r--metawatch/metawatchanalog.cpp4
-rw-r--r--metawatch/metawatchanalog.h2
-rw-r--r--metawatch/metawatchdigital.cpp104
-rw-r--r--metawatchwatchlets/metawatchwatchletsplugin.cpp2
-rw-r--r--metawatchwatchlets/metawatchwatchletsplugin.h2
-rw-r--r--sowatch.pro3
-rw-r--r--sysinfowatchlet/sysinfowatchlet.pro2
-rw-r--r--testnotification/testnotificationprovider.cpp2
23 files changed, 328 insertions, 117 deletions
diff --git a/libsowatch/declarativewatchlet.cpp b/libsowatch/declarativewatchlet.cpp
index 4683dcb..da66316 100644
--- a/libsowatch/declarativewatchlet.cpp
+++ b/libsowatch/declarativewatchlet.cpp
@@ -123,6 +123,8 @@ void DeclarativeWatchlet::activate()
qDebug() << "Resizing root object to height" << watch->width();
_item->setHeight(watch->height());
}
+ } else {
+ qWarning() << "Declarative watchlet will not render: missing root object";
}
GraphicsWatchlet::activate();
_wrapper->activate();
diff --git a/libsowatchbt/bluetoothwatch.cpp b/libsowatchbt/bluetoothwatch.cpp
index d8a2451..50d521b 100644
--- a/libsowatchbt/bluetoothwatch.cpp
+++ b/libsowatchbt/bluetoothwatch.cpp
@@ -32,7 +32,7 @@ BluetoothWatch::BluetoothWatch(const QBluetoothAddress& address, QObject *parent
// (To give time for other plugins to initialize, etc.)
scheduleConnect();
} else {
- qDebug() << "Not starting MetaWatch connection because BT is off";
+ qDebug() << "Not starting watch connection because BT is off";
}
}
diff --git a/liveview/liveview.cpp b/liveview/liveview.cpp
index 450e802..754bf2f 100644
--- a/liveview/liveview.cpp
+++ b/liveview/liveview.cpp
@@ -6,7 +6,7 @@
using namespace sowatch;
QTM_USE_NAMESPACE
-#define PROTOCOL_DEBUG 1
+#define PROTOCOL_DEBUG 0
const int LiveView::MaxBitmapSize = 64;
QMap<LiveView::MessageType, LiveView::MessageType> LiveView::_ackMap;
@@ -17,7 +17,7 @@ LiveView::LiveView(ConfigKey* settings, QObject* parent) :
_settings(settings->getSubkey(QString(), this)),
_watchlets(0), _notifications(0),
_24hMode(settings->value("24h-mode", false).toBool()),
- _screenWidth(0), _screenHeight(0),
+ _screenWidth(128), _screenHeight(128),
_mode(RootMenuMode),
_paintEngine(0),
_rootMenuFirstWatchlet(0),
@@ -131,6 +131,7 @@ void LiveView::displayIdleScreen()
{
qDebug() << "LiveView display idle screen (cur mode=" << _mode << ")";
if (_mode != RootMenuMode) {
+ displayClear();
_mode = RootMenuMode;
refreshMenu();
}
@@ -139,17 +140,22 @@ void LiveView::displayIdleScreen()
void LiveView::displayNotification(Notification *notification)
{
qDebug() << "LiveView display notification" << notification->title();
+ _mode = NotificationMode;
+ setScreenMode(ScreenMax);
+ setMenuSize(0);
+ enableLed(Qt::green, 0, 250);
+ vibrate(0, 200);
}
void LiveView::displayApplication()
{
_mode = ApplicationMode;
- setMenuSize(0); // TODO
+ setMenuSize(0); // This clears up the menu.
}
void LiveView::vibrate(int msecs)
{
- // TODO
+ vibrate(0, msecs);
}
void LiveView::setWatchletsModel(WatchletsModel *model)
@@ -166,7 +172,6 @@ void LiveView::setWatchletsModel(WatchletsModel *model)
void LiveView::setNotificationsModel(NotificationsModel *model)
{
- qDebug() << Q_FUNC_INFO;
if (_notifications) {
disconnect(_notifications, 0, this, 0);
}
@@ -219,6 +224,8 @@ void LiveView::initializeAckMap()
_ackMap[DisplayClear] = DisplayClearResponse;
//_ackMap[SetMenuSize] = SetMenuSizeResponse; // fw does not send this, for some reason.
_ackMap[EnableLed] = EnableLedResponse;
+ _ackMap[Vibrate] = VibrateResponse;
+ _ackMap[SetScreenMode] = SetScreenModeResponse;
}
}
@@ -366,7 +373,9 @@ void LiveView::send(const Message &msg)
if (_waitingForAck == NoMessage) {
sendMessageFromQueue();
} else {
+#if PROTOCOL_DEBUG
qDebug() << "Enqueing message while waiting for ack" << _waitingForAck;
+#endif
}
}
@@ -480,11 +489,31 @@ void LiveView::enableLed(const QColor& color, unsigned short delay, unsigned sho
send(Message(EnableLed, data));
}
+void LiveView::vibrate(unsigned short delay, unsigned short time)
+{
+ QByteArray data;
+
+ data.append((delay & 0xFF00U) >> 8);
+ data.append(delay & 0x00FFU);
+ data.append((time & 0xFF00U) >> 8);
+ data.append(time & 0x00FFU);
+
+ send(Message(Vibrate, data));
+}
+
+void LiveView::setScreenMode(ScreenBrigthness mode)
+{
+ qDebug() << "Set screenmode to" << mode;
+ send(Message(SetScreenMode, QByteArray(1, mode)));
+}
+
void LiveView::handleMessage(const Message &msg)
{
send(Message(Ack, QByteArray(1, msg.type)));
if (msg.type == _waitingForAck) {
+#if PROTOCOL_DEBUG
qDebug() << "Got ack to" << _waitingForAck;
+#endif
_waitingForAck = NoMessage;
sendMessageFromQueue();
}
@@ -512,11 +541,15 @@ void LiveView::handleMessage(const Message &msg)
handleDateTimeRequest(msg);
break;
case EnableLedResponse:
+ case VibrateResponse:
// Nothing to do
break;
case GetDisplayPropertiesResponse:
handleDisplayProperties(msg);
break;
+ case SetScreenModeResponse:
+ // Nothing to do
+ break;
case GetSoftwareVersionResponse:
handleSoftwareVersion(msg);
break;
@@ -530,6 +563,21 @@ void LiveView::handleDeviceStatusChange(const Message &msg)
if (msg.data.size() == 1) {
DeviceStatus status = static_cast<DeviceStatus>(msg.data.at(0));
qDebug() << "liveview device status change" << status;
+ switch (status) {
+ case DeviceOff:
+ if (_mode == NotificationMode) {
+ emit idling();
+ }
+ break;
+ case DeviceOn:
+ if (_notifications && _notifications->size() > 0) {
+ enableLed(Qt::green, 0, 250);
+ }
+ break;
+ case DeviceMenu:
+ qDebug() << "Device in menu";
+ break;
+ }
}
sendResponse(DeviceStatusChangeResponse, ResponseOk);
}
@@ -652,6 +700,10 @@ void LiveView::handleNavigation(const Message &msg)
sendResponse(NavigationResponse, ResponseCancel);
emit closeWatchledRequested();
return;
+ } else if (_mode == NotificationMode) {
+ sendResponse(NavigationResponse, ResponseCancel);
+ emit nextWatchletRequested();
+ return;
} else if (_mode == NotificationListMode) {
sendResponse(NavigationResponse, ResponseCancel);
_mode = RootMenuMode;
@@ -684,6 +736,7 @@ void LiveView::handleNavigation(const Message &msg)
void LiveView::handleMenuItemsRequest(const Message &msg)
{
+ Q_UNUSED(msg);
qDebug() << "Sending menu items";
if (_mode == NotificationListMode) {
_mode = RootMenuMode; // Switch to the root menu
@@ -829,8 +882,10 @@ void LiveView::handleDataReceived()
}
_receivingMsg.data.resize(data_size);
+#if PROTOCOL_DEBUG
qDebug() << "got header (type=" << _receivingMsg.type <<
"size=" << data_size << ")";
+#endif
}
/* We have the header; now, try to get the complete packet. */
diff --git a/liveview/liveview.h b/liveview/liveview.h
index b85a574..13a8f0a 100644
--- a/liveview/liveview.h
+++ b/liveview/liveview.h
@@ -79,7 +79,11 @@ protected:
DateTimeResponse = 39,
EnableLed = 40,
EnableLedResponse = 41,
+ Vibrate = 42,
+ VibrateResponse = 43,
Ack = 44,
+ SetScreenMode = 64,
+ SetScreenModeResponse = 65,
GetSoftwareVersion = 68,
GetSoftwareVersionResponse = 69
};
@@ -106,6 +110,7 @@ protected:
enum Mode {
RootMenuMode = 0,
ApplicationMode,
+ NotificationMode,
NotificationListMode
};
@@ -128,6 +133,12 @@ protected:
NotificationShowPrev = 4
};
+ enum ScreenBrigthness {
+ ScreenOff = 49,
+ ScreenDim = 50,
+ ScreenMax = 51
+ };
+
struct Message {
MessageType type;
QByteArray data;
@@ -183,6 +194,8 @@ protected:
void sendMenuItem(unsigned char id, MenuItemType type, unsigned short unread, const QString& text, const QByteArray& image);
void sendNotification(unsigned short id, unsigned short unread, unsigned short count, const QString& date, const QString& header, const QString& body, const QByteArray& image);
void enableLed(const QColor& color, unsigned short delay, unsigned short time);
+ void vibrate(unsigned short delay, unsigned short time);
+ void setScreenMode(ScreenBrigthness mode);
void handleMessage(const Message& msg);
void handleDeviceStatusChange(const Message& msg);
@@ -207,12 +220,15 @@ private:
WatchletsModel *_watchlets;
NotificationsModel *_notifications;
+ // Configurable settings
bool _24hMode : 1;
+ // Watch properties
int _screenWidth;
int _screenHeight;
QStringList _buttons;
+ // Runtime variables
Mode _mode;
int _curNotificationIndex;
diff --git a/liveview/liveview.pro b/liveview/liveview.pro
index bb7ccee..21e7a94 100644
--- a/liveview/liveview.pro
+++ b/liveview/liveview.pro
@@ -21,6 +21,7 @@ HEADERS += liveviewplugin.h \
liveviewpaintengine.h
res_files.files += res/graphics res/fonts
+qml_files.files += qml/com qml/liveview-config.qml
LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
INCLUDEPATH += $$PWD/../libsowatch
@@ -40,4 +41,4 @@ DEPENDPATH += $$PWD/../libsowatchbt
res_files.path = /usr/share/sowatch/liveview
qml_files.path = /usr/share/sowatch/qml
}
-INSTALLS += target res_files
+INSTALLS += target res_files qml_files
diff --git a/liveview/liveviewscanner.cpp b/liveview/liveviewscanner.cpp
index dbb47f3..4645906 100644
--- a/liveview/liveviewscanner.cpp
+++ b/liveview/liveviewscanner.cpp
@@ -20,6 +20,7 @@ void LiveViewScanner::handleDiscoveredService(const QBluetoothServiceInfo &info)
foundInfo["driver"] = QString("liveview");
foundInfo["address"] = dev.address().toString();
foundInfo["name"] = deviceName;
+ foundInfo["notification-watchlet"] = QString("com.javispedro.sowatch.liveview.notification");
emit watchFound(foundInfo);
}
}
diff --git a/liveview/qml/com/javispedro/sowatch/liveview/LVPage.qml b/liveview/qml/com/javispedro/sowatch/liveview/LVPage.qml
new file mode 100644
index 0000000..f3eaf96
--- /dev/null
+++ b/liveview/qml/com/javispedro/sowatch/liveview/LVPage.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+Rectangle {
+ width: 128
+ height: 128
+ color: "black"
+}
diff --git a/liveview/qml/com/javispedro/sowatch/liveview/qmldir b/liveview/qml/com/javispedro/sowatch/liveview/qmldir
new file mode 100644
index 0000000..82dc2a2
--- /dev/null
+++ b/liveview/qml/com/javispedro/sowatch/liveview/qmldir
@@ -0,0 +1,2 @@
+LVPage 1.0 LVPage.qml
+LVLabel 1.0 LVLabel.qml
diff --git a/liveview/qml/liveview-config.qml b/liveview/qml/liveview-config.qml
new file mode 100644
index 0000000..f6c84b0
--- /dev/null
+++ b/liveview/qml/liveview-config.qml
@@ -0,0 +1,53 @@
+import QtQuick 1.1
+import com.nokia.meego 1.1
+import com.javispedro.sowatch 1.0
+
+Column {
+ property string configKey;
+
+ Item {
+ id: hourModeItem
+ width: parent.width
+ height: UiConstants.ListItemHeightDefault
+
+ GConfKey {
+ id: hourModeKey
+ key: configKey + "/24h-mode"
+ }
+ MouseArea {
+ id: hourModeArea
+ anchors.fill: parent
+ onClicked: hourModeSelect.open();
+ }
+ SelectionDialog {
+ id: hourModeSelect
+ titleText: qsTr("Time format")
+ selectedIndex: hourModeKey.value ? 1 : 0
+ model: ListModel {
+ ListElement { name: QT_TR_NOOP("12 hour") }
+ ListElement { name: QT_TR_NOOP("24 hour") }
+ }
+ onSelectedIndexChanged: hourModeKey.value = selectedIndex == 1
+ }
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+
+ Label {
+ text: qsTr("Time format")
+ font: UiConstants.TitleFont
+ }
+
+ Label {
+ text: qsTr(hourModeSelect.model.get(hourModeSelect.selectedIndex).name)
+ font: UiConstants.FieldLabelFont
+ color: UiConstants.FieldLabelColor
+ }
+ }
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ source: "image://theme/meegotouch-combobox-indicator" + (theme.inverted ? "-inverted" : "")
+ }
+ }
+}
diff --git a/liveviewwatchlets/liveview-notification.qml b/liveviewwatchlets/liveview-notification.qml
new file mode 100644
index 0000000..364b596
--- /dev/null
+++ b/liveviewwatchlets/liveview-notification.qml
@@ -0,0 +1,41 @@
+import Qt 4.7
+import com.javispedro.sowatch.liveview 1.0
+
+LVPage {
+ id: page
+
+ property QtObject curNotification: null;
+
+ Column {
+ id: container
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.leftMargin: 1
+ anchors.rightMargin: 1
+
+ LVLabel {
+ text: curNotification ? curNotification.title : ""
+ anchors.left: parent.left
+ anchors.right: parent.right
+ font.pixelSize: 22
+ wrapMode: Text.WordWrap
+ }
+
+ LVLabel {
+ text: curNotification ? curNotification.body : ""
+ anchors.left: parent.left
+ anchors.right: parent.right
+ wrapMode: Text.WordWrap
+ }
+ }
+
+ function handlesNotification(notification) {
+ return false;
+ }
+
+ function openNotification(notification) {
+ //scrollable.scrollTop();
+ curNotification = notification;
+ }
+}
diff --git a/liveviewwatchlets/liveviewnotificationwatchlet.cpp b/liveviewwatchlets/liveviewnotificationwatchlet.cpp
new file mode 100644
index 0000000..eecc485
--- /dev/null
+++ b/liveviewwatchlets/liveviewnotificationwatchlet.cpp
@@ -0,0 +1,11 @@
+#include "liveviewnotificationwatchlet.h"
+
+using namespace sowatch;
+
+const QLatin1String LiveViewNotificationWatchlet::myId("com.javispedro.sowatch.liveview.notification");
+
+LiveViewNotificationWatchlet::LiveViewNotificationWatchlet(Watch *watch) :
+ DeclarativeWatchlet(watch, myId)
+{
+ setSource(QUrl(SOWATCH_QML_DIR "/liveviewwatchlets/" + watch->model() + "-notification.qml"));
+}
diff --git a/liveviewwatchlets/liveviewnotificationwatchlet.h b/liveviewwatchlets/liveviewnotificationwatchlet.h
new file mode 100644
index 0000000..6598d04
--- /dev/null
+++ b/liveviewwatchlets/liveviewnotificationwatchlet.h
@@ -0,0 +1,20 @@
+#ifndef LIVEVIEWNOTIFICATIONWATCHLET_H
+#define LIVEVIEWNOTIFICATIONWATCHLET_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class LiveViewNotificationWatchlet : public DeclarativeWatchlet
+{
+ Q_OBJECT
+public:
+ explicit LiveViewNotificationWatchlet(Watch* watch);
+
+ static const QLatin1String myId;
+};
+
+}
+
+#endif // LIVEVIEWNOTIFICATIONWATCHLET_H
diff --git a/liveviewwatchlets/liveviewwatchlets.pro b/liveviewwatchlets/liveviewwatchlets.pro
new file mode 100644
index 0000000..5af74e2
--- /dev/null
+++ b/liveviewwatchlets/liveviewwatchlets.pro
@@ -0,0 +1,32 @@
+TARGET = liveviewwatchlets
+TEMPLATE = lib
+CONFIG += plugin
+
+SOURCES += liveviewwatchletsplugin.cpp \
+ liveviewnotificationwatchlet.cpp
+
+HEADERS += liveviewwatchletsplugin.h \
+ liveviewnotificationwatchlet.h \
+ liveviewnotificationwatchlet.h
+
+qml_files.files = liveview-notification.qml
+
+LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+QML_IMPORT_PATH += $$PWD/../liveview/qml
+
+unix:!symbian {
+ !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 {
+ QMAKE_RPATHDIR += /opt/sowatch/lib
+ target.path = /opt/sowatch/lib/watchlets
+ qml_files.path = /opt/sowatch/qml/$$TARGET
+ } else {
+ target.path = /usr/lib/sowatch/watchlets
+ qml_files.path = /usr/share/sowatch/qml/$$TARGET
+ }
+ INSTALLS += target qml_files
+}
+
+OTHER_FILES += \
+ liveview-notification.qml
diff --git a/liveviewwatchlets/liveviewwatchletsplugin.cpp b/liveviewwatchlets/liveviewwatchletsplugin.cpp
new file mode 100644
index 0000000..cf93ec5
--- /dev/null
+++ b/liveviewwatchlets/liveviewwatchletsplugin.cpp
@@ -0,0 +1,44 @@
+#include "liveviewnotificationwatchlet.h"
+#include "liveviewwatchletsplugin.h"
+
+using namespace sowatch;
+
+LiveViewWatchletsPlugin::LiveViewWatchletsPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+LiveViewWatchletsPlugin::~LiveViewWatchletsPlugin()
+{
+}
+
+QStringList LiveViewWatchletsPlugin::watchlets()
+{
+ QStringList l;
+ l << LiveViewNotificationWatchlet::myId;
+ return l;
+}
+
+WatchletPluginInterface::WatchletInfo LiveViewWatchletsPlugin::describeWatchlet(const QString &id, const QString& watchModel)
+{
+ WatchletInfo info;
+ if (id == LiveViewNotificationWatchlet::myId) {
+ if (watchModel == "metawatch-digital") {
+ info.name = "MetaWatch Notification Watchlet";
+ // Keep non visible
+ }
+ }
+ return info;
+}
+
+Watchlet* LiveViewWatchletsPlugin::getWatchlet(const QString& id, ConfigKey *settings, Watch *watch)
+{
+ Q_UNUSED(settings);
+ if (id == LiveViewNotificationWatchlet::myId) {
+ return new LiveViewNotificationWatchlet(watch);
+ } else {
+ return 0;
+ }
+}
+
+Q_EXPORT_PLUGIN2(liveviewwatchlets, LiveViewWatchletsPlugin)
diff --git a/liveviewwatchlets/liveviewwatchletsplugin.h b/liveviewwatchlets/liveviewwatchletsplugin.h
new file mode 100644
index 0000000..eae923d
--- /dev/null
+++ b/liveviewwatchlets/liveviewwatchletsplugin.h
@@ -0,0 +1,25 @@
+#ifndef LIVEVIEWWATCHLETSPLUGIN_H
+#define LIVEVIEWWATCHLETSPLUGIN_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class LiveViewWatchletsPlugin : public QObject, public WatchletPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(sowatch::WatchletPluginInterface)
+
+public:
+ explicit LiveViewWatchletsPlugin(QObject *parent = 0);
+ ~LiveViewWatchletsPlugin();
+
+ QStringList watchlets();
+ WatchletInfo describeWatchlet(const QString &id, const QString& watchModel);
+ Watchlet* getWatchlet(const QString& id, ConfigKey *settings, Watch* watch);
+};
+
+}
+
+#endif // LIVEVIEWWATCHLETSPLUGIN_H
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<QRect>& rects = QList<QRect>());
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<QRect> &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.
}
diff --git a/metawatchwatchlets/metawatchwatchletsplugin.cpp b/metawatchwatchlets/metawatchwatchletsplugin.cpp
index 4acf721..a075fa6 100644
--- a/metawatchwatchlets/metawatchwatchletsplugin.cpp
+++ b/metawatchwatchlets/metawatchwatchletsplugin.cpp
@@ -49,4 +49,4 @@ Watchlet* MetaWatchWatchletsPlugin::getWatchlet(const QString& id, ConfigKey *se
}
}
-Q_EXPORT_PLUGIN2(notificationswatchlet, MetaWatchWatchletsPlugin)
+Q_EXPORT_PLUGIN2(metawatchwatchlets, MetaWatchWatchletsPlugin)
diff --git a/metawatchwatchlets/metawatchwatchletsplugin.h b/metawatchwatchlets/metawatchwatchletsplugin.h
index 44fd944..193df89 100644
--- a/metawatchwatchlets/metawatchwatchletsplugin.h
+++ b/metawatchwatchlets/metawatchwatchletsplugin.h
@@ -22,4 +22,4 @@ public:
}
-#endif // NEKOWATCHLETPLUGIN_H
+#endif // METAWATCHWATCHLETSPLUGIN_H
diff --git a/sowatch.pro b/sowatch.pro
index 47f39ad..627af02 100644
--- a/sowatch.pro
+++ b/sowatch.pro
@@ -16,8 +16,9 @@ metawatch.depends = libsowatch libsowatchbt
metawatchwatchlets.depends = metawatch
# LiveView driver plugin
-SUBDIRS += liveview
+SUBDIRS += liveview liveviewwatchlets
liveview.depends = libsowatch libsowatchbt
+liveviewwatchlets.depends = liveview
# Some watchlets
# This just shows a list of pending notifications and has no dependencies.
diff --git a/sysinfowatchlet/sysinfowatchlet.pro b/sysinfowatchlet/sysinfowatchlet.pro
index 1af927b..16fb337 100644
--- a/sysinfowatchlet/sysinfowatchlet.pro
+++ b/sysinfowatchlet/sysinfowatchlet.pro
@@ -15,7 +15,7 @@ SOURCES += sysinfoplugin.cpp sysinfowatchlet.cpp
HEADERS += sysinfoplugin.h sysinfowatchlet.h
-qml_files.files = metawatch-digital.qml icon.png metawatch-digital-icon.png liveview-icon.png
+qml_files.files = metawatch-digital.qml liveview.qml icon.png metawatch-digital-icon.png liveview-icon.png
LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
diff --git a/testnotification/testnotificationprovider.cpp b/testnotification/testnotificationprovider.cpp
index 1e9fcdc..49e49b1 100644
--- a/testnotification/testnotificationprovider.cpp
+++ b/testnotification/testnotificationprovider.cpp
@@ -10,7 +10,7 @@ TestNotificationProvider::TestNotificationProvider(QObject *parent) :
NotificationProvider(parent),
_timer(new QTimer(this))
{
- const int initial_delay = 2000;
+ const int initial_delay = 4000;
const int burst_num = 1;
const int burst_delay = 500;
const int extra_delay = 100 * 1000;