summaryrefslogtreecommitdiff
path: root/libsowatch
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-17 03:03:23 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-17 03:03:23 +0200
commit3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1 (patch)
treef330f63caec08b6626c808b5ae70c64cab0246a6 /libsowatch
parent0dca79a8c15b76ca53617c0ed3396ab6435f0152 (diff)
downloadsowatch-3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1.tar.gz
sowatch-3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1.zip
preparing for library package
Diffstat (limited to 'libsowatch')
-rw-r--r--libsowatch/declarativewatchlet.cpp96
-rw-r--r--libsowatch/declarativewatchlet.h39
-rw-r--r--libsowatch/declarativewatchwrapper.cpp42
-rw-r--r--libsowatch/declarativewatchwrapper.h44
-rw-r--r--libsowatch/graphicswatchlet.cpp47
-rw-r--r--libsowatch/graphicswatchlet.h31
-rw-r--r--libsowatch/libsowatch.pro100
-rw-r--r--libsowatch/libsowatch.pro.user549
-rw-r--r--libsowatch/main.cpp35
-rw-r--r--libsowatch/metawatch.cpp409
-rw-r--r--libsowatch/metawatch.h122
-rw-r--r--libsowatch/metawatchpaintengine.cpp82
-rw-r--r--libsowatch/metawatchpaintengine.h34
-rw-r--r--libsowatch/metawatchsimulator.cpp82
-rw-r--r--libsowatch/metawatchsimulator.h32
-rw-r--r--libsowatch/metawatchsimulatorform.cpp82
-rw-r--r--libsowatch/metawatchsimulatorform.h46
-rw-r--r--libsowatch/metawatchsimulatorform.ui294
-rw-r--r--libsowatch/qtc_packaging/debian_harmattan/README6
-rw-r--r--libsowatch/qtc_packaging/debian_harmattan/changelog5
-rw-r--r--libsowatch/qtc_packaging/debian_harmattan/compat1
-rw-r--r--libsowatch/qtc_packaging/debian_harmattan/control14
-rw-r--r--libsowatch/qtc_packaging/debian_harmattan/copyright40
-rw-r--r--libsowatch/qtc_packaging/debian_harmattan/manifest.aegis0
-rwxr-xr-xlibsowatch/qtc_packaging/debian_harmattan/rules91
-rw-r--r--libsowatch/sowatch.h12
-rw-r--r--libsowatch/sowatch_global.h12
-rw-r--r--libsowatch/testdeclarativewatchlet.cpp9
-rw-r--r--libsowatch/testdeclarativewatchlet.h19
-rw-r--r--libsowatch/testwatchlet.cpp40
-rw-r--r--libsowatch/testwatchlet.h29
-rw-r--r--libsowatch/watch.cpp62
-rw-r--r--libsowatch/watch.h49
-rw-r--r--libsowatch/watchlet.cpp44
-rw-r--r--libsowatch/watchlet.h48
-rw-r--r--libsowatch/watchmanager.cpp8
-rw-r--r--libsowatch/watchmanager.h23
-rw-r--r--libsowatch/watchpaintengine.cpp305
-rw-r--r--libsowatch/watchpaintengine.h62
-rw-r--r--libsowatch/watchserver.cpp57
-rw-r--r--libsowatch/watchserver.h46
-rw-r--r--libsowatch/watchsimulator.cpp11
-rw-r--r--libsowatch/watchsimulator.h20
43 files changed, 3179 insertions, 0 deletions
diff --git a/libsowatch/declarativewatchlet.cpp b/libsowatch/declarativewatchlet.cpp
new file mode 100644
index 0000000..7e6768e
--- /dev/null
+++ b/libsowatch/declarativewatchlet.cpp
@@ -0,0 +1,96 @@
+#include <QtCore/QDebug>
+#include <QtDeclarative/QtDeclarative>
+#include "watchserver.h"
+#include "declarativewatchwrapper.h"
+#include "declarativewatchlet.h"
+
+using namespace sowatch;
+
+bool DeclarativeWatchlet::_registered = false;
+
+DeclarativeWatchlet::DeclarativeWatchlet(WatchServer* server, const QString& id) :
+ GraphicsWatchlet(server, id),
+ _engine(0),
+ _component(0),
+ _item(0),
+ _wrapper(0)
+{
+ setScene(new QGraphicsScene(this));
+
+ if (!_registered) {
+ qmlRegisterUncreatableType<DeclarativeWatchWrapper>("com.javispedro.sowatch", 1, 0,
+ "Watch", "Watch is only available via the 'watch' object");
+ _registered = true;
+ }
+
+ _engine = new QDeclarativeEngine(this);
+ _wrapper = new DeclarativeWatchWrapper(server->watch(), this);
+
+ _engine->rootContext()->setContextProperty("watch", _wrapper);
+}
+
+void DeclarativeWatchlet::setSource(const QUrl &url)
+{
+ if (_item) {
+ scene()->removeItem(_item);
+ delete _item;
+ _item = 0;
+ }
+ if (_component) {
+ delete _component;
+ _component = 0;
+ }
+ if (!url.isEmpty()) {
+ _component = new QDeclarativeComponent(_engine, url, this);
+ connect(_component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
+ SLOT(handleComponentStatus(QDeclarativeComponent::Status)));
+ if (!_component->isLoading()) {
+ /* No signals are going to be generated for this. */
+ handleComponentStatus(_component->status());
+ } else {
+ connect(_component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
+ this, SLOT(handleComponentStatus(QDeclarativeComponent::Status)));
+ }
+ }
+}
+
+void DeclarativeWatchlet::activate()
+{
+ Watchlet::activate();
+ _wrapper->activate();
+ _scene->update();
+}
+
+void DeclarativeWatchlet::deactivate()
+{
+ Watchlet::deactivate();
+ _wrapper->deactivate();
+}
+
+void DeclarativeWatchlet::handleComponentStatus(QDeclarativeComponent::Status status)
+{
+ QObject *obj;
+ disconnect(_component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
+ this, SLOT(handleComponentStatus(QDeclarativeComponent::Status)));
+ switch (status) {
+ case QDeclarativeComponent::Null:
+ case QDeclarativeComponent::Loading:
+ /* Nothing to do */
+ break;
+ case QDeclarativeComponent::Ready:
+ obj = _component->create();
+ if (_component->isError()) {
+ qWarning() << "QML has instantation errors:";
+ qWarning() << _component->errors();
+ return;
+ }
+ Q_ASSERT(_item == 0);
+ _item = qobject_cast<QDeclarativeItem*>(obj);
+ scene()->addItem(_item);
+ break;
+ case QDeclarativeComponent::Error:
+ qWarning() << "QML has errors:";
+ qWarning() << _component->errors();
+ break;
+ }
+}
diff --git a/libsowatch/declarativewatchlet.h b/libsowatch/declarativewatchlet.h
new file mode 100644
index 0000000..1e94007
--- /dev/null
+++ b/libsowatch/declarativewatchlet.h
@@ -0,0 +1,39 @@
+#ifndef DECLARATIVEWATCHLET_H
+#define DECLARATIVEWATCHLET_H
+
+#include <QtDeclarative/QDeclarativeEngine>
+#include <QtDeclarative/QDeclarativeComponent>
+#include <QtDeclarative/QDeclarativeItem>
+#include "graphicswatchlet.h"
+
+namespace sowatch
+{
+
+class DeclarativeWatchWrapper;
+
+class DeclarativeWatchlet : public GraphicsWatchlet
+{
+ Q_OBJECT
+public:
+ explicit DeclarativeWatchlet(WatchServer* server, const QString& id);
+
+ void setSource(const QUrl& url);
+
+protected slots:
+ void handleComponentStatus(QDeclarativeComponent::Status status);
+
+protected:
+ void activate();
+ void deactivate();
+
+ static bool _registered;
+ QDeclarativeEngine* _engine;
+ QDeclarativeComponent* _component;
+ QDeclarativeItem* _item;
+ DeclarativeWatchWrapper* _wrapper;
+
+};
+
+}
+
+#endif // DECLARATIVEWATCHLET_H
diff --git a/libsowatch/declarativewatchwrapper.cpp b/libsowatch/declarativewatchwrapper.cpp
new file mode 100644
index 0000000..384a29d
--- /dev/null
+++ b/libsowatch/declarativewatchwrapper.cpp
@@ -0,0 +1,42 @@
+#include <QtCore/QDebug>
+#include "watch.h"
+#include "declarativewatchwrapper.h"
+
+using namespace sowatch;
+
+DeclarativeWatchWrapper::DeclarativeWatchWrapper(Watch* watch, QObject *parent) :
+ QObject(parent), _watch(watch), _active(false)
+{
+
+}
+
+QString DeclarativeWatchWrapper::model() const
+{
+ return _watch->model();
+}
+
+bool DeclarativeWatchWrapper::active() const
+{
+ return _active;
+}
+
+void DeclarativeWatchWrapper::activate()
+{
+ if (!_active) {
+ connect(_watch, SIGNAL(buttonPressed(int)), this, SIGNAL(buttonPressed(int)));
+ connect(_watch, SIGNAL(buttonReleased(int)), this, SIGNAL(buttonReleased(int)));
+ _active = true;
+ emit activeChanged();
+ }
+}
+
+void DeclarativeWatchWrapper::deactivate()
+{
+ if (_active) {
+ disconnect(this, SIGNAL(buttonPressed(int)));
+ disconnect(this, SIGNAL(buttonReleased(int)));
+ _active = false;
+ emit activeChanged();
+ }
+}
+
diff --git a/libsowatch/declarativewatchwrapper.h b/libsowatch/declarativewatchwrapper.h
new file mode 100644
index 0000000..5f78e75
--- /dev/null
+++ b/libsowatch/declarativewatchwrapper.h
@@ -0,0 +1,44 @@
+#ifndef DECLARATIVEWATCHWRAPPER_H
+#define DECLARATIVEWATCHWRAPPER_H
+
+#include <QtDeclarative/QtDeclarative>
+
+namespace sowatch
+{
+
+class Watch;
+class DeclarativeWatchlet;
+
+class DeclarativeWatchWrapper : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString model READ model CONSTANT)
+ Q_PROPERTY(bool active READ active NOTIFY activeChanged)
+
+public:
+ explicit DeclarativeWatchWrapper(Watch *watch, QObject *parent = 0);
+
+ Q_INVOKABLE QString model() const;
+ Q_INVOKABLE bool active() const;
+
+signals:
+ void buttonPressed(int button);
+ void buttonReleased(int button);
+
+ void activeChanged();
+
+protected:
+ Watch* _watch;
+ bool _active;
+
+ void activate();
+ void deactivate();
+
+friend class DeclarativeWatchlet;
+};
+
+}
+
+QML_DECLARE_TYPE(sowatch::DeclarativeWatchWrapper)
+
+#endif // DECLARATIVEWATCHWRAPPER_H
diff --git a/libsowatch/graphicswatchlet.cpp b/libsowatch/graphicswatchlet.cpp
new file mode 100644
index 0000000..538723a
--- /dev/null
+++ b/libsowatch/graphicswatchlet.cpp
@@ -0,0 +1,47 @@
+#include <QtCore/QDebug>
+#include <QtGui/QPainter>
+
+#include "watch.h"
+#include "graphicswatchlet.h"
+
+using namespace sowatch;
+
+GraphicsWatchlet::GraphicsWatchlet(WatchServer* server, const QString& id) :
+ Watchlet(server, id), _scene(0), _damaged()
+{
+}
+
+QGraphicsScene* GraphicsWatchlet::scene()
+{
+ return _scene;
+}
+
+void GraphicsWatchlet::setScene(QGraphicsScene *scene)
+{
+ if (_scene) {
+ disconnect(this, SLOT(sceneChanged(QList<QRectF>)));
+ }
+ _scene = scene;
+ if (_scene) {
+ connect(_scene, SIGNAL(changed(QList<QRectF>)),
+ this, SLOT(sceneChanged(QList<QRectF>)));
+ }
+}
+
+void GraphicsWatchlet::sceneChanged(const QList<QRectF> &region)
+{
+ foreach(const QRectF& r, region)
+ {
+ _damaged += r.toRect();
+ }
+
+ if (!_damaged.isEmpty() && _active && !watch()->busy()) {
+ const QVector<QRect> rects = _damaged.rects();
+ QPainter p(watch());
+ foreach(const QRect& r, rects)
+ {
+ _scene->render(&p, r, r, Qt::IgnoreAspectRatio);
+ }
+ _damaged = QRegion();
+ }
+}
diff --git a/libsowatch/graphicswatchlet.h b/libsowatch/graphicswatchlet.h
new file mode 100644
index 0000000..9754062
--- /dev/null
+++ b/libsowatch/graphicswatchlet.h
@@ -0,0 +1,31 @@
+#ifndef GRAPHICSWATCHLET_H
+#define GRAPHICSWATCHLET_H
+
+#include <QtGui/QGraphicsScene>
+#include <QtGui/QRegion>
+#include "watchlet.h"
+
+namespace sowatch
+{
+
+class GraphicsWatchlet : public Watchlet
+{
+ Q_OBJECT
+public:
+ explicit GraphicsWatchlet(WatchServer* server, const QString& id);
+
+ QGraphicsScene* scene();
+ void setScene(QGraphicsScene* scene);
+
+protected:
+ QGraphicsScene* _scene;
+ QRegion _damaged;
+
+protected slots:
+ void sceneChanged(const QList<QRectF>& region);
+
+};
+
+}
+
+#endif // GRAPHICSWATCHLET_H
diff --git a/libsowatch/libsowatch.pro b/libsowatch/libsowatch.pro
new file mode 100644
index 0000000..703845c
--- /dev/null
+++ b/libsowatch/libsowatch.pro
@@ -0,0 +1,100 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-09-16T23:45:06
+#
+#-------------------------------------------------
+
+QT += gui dbus declarative
+CONFIG += mobility
+MOBILITY += connectivity
+
+TARGET = libsowatch
+TEMPLATE = lib
+
+DEFINES += SOWATCH_LIBRARY
+
+SOURCES += \
+ watchsimulator.cpp \
+ watchserver.cpp \
+ watchpaintengine.cpp \
+ watchmanager.cpp \
+ watchlet.cpp \
+ watch.cpp \
+ testwatchlet.cpp \
+ testdeclarativewatchlet.cpp \
+ metawatchsimulatorform.cpp \
+ metawatchsimulator.cpp \
+ metawatchpaintengine.cpp \
+ metawatch.cpp \
+ main.cpp \
+ graphicswatchlet.cpp \
+ declarativewatchwrapper.cpp \
+ declarativewatchlet.cpp
+
+HEADERS +=\
+ watchsimulator.h \
+ watchserver.h \
+ watchpaintengine.h \
+ watchmanager.h \
+ watchlet.h \
+ watch.h \
+ testwatchlet.h \
+ testdeclarativewatchlet.h \
+ sowatch.h \
+ metawatchsimulatorform.h \
+ metawatchsimulator.h \
+ metawatchpaintengine.h \
+ metawatch.h \
+ graphicswatchlet.h \
+ declarativewatchwrapper.h \
+ declarativewatchlet.h \
+ sowatch_global.h
+
+FORMS += \
+ metawatchsimulatorform.ui
+
+OTHER_FILES += \
+ qtc_packaging/debian_harmattan/rules \
+ qtc_packaging/debian_harmattan/README \
+ qtc_packaging/debian_harmattan/copyright \
+ qtc_packaging/debian_harmattan/control \
+ qtc_packaging/debian_harmattan/compat \
+ qtc_packaging/debian_harmattan/changelog
+
+install_headers.files =\
+ watchsimulator.h \
+ watchserver.h \
+ watchpaintengine.h \
+ watchmanager.h \
+ watchlet.h \
+ watch.h \
+ testwatchlet.h \
+ testdeclarativewatchlet.h \
+ sowatch.h \
+ graphicswatchlet.h \
+ declarativewatchwrapper.h \
+ declarativewatchlet.h \
+ sowatch_global.h
+
+
+symbian {
+ MMP_RULES += EXPORTUNFROZEN
+ TARGET.UID3 = 0xE6B95AFF
+ TARGET.CAPABILITY =
+ TARGET.EPOCALLOWDLLDATA = 1
+ addFiles.sources = libsowatch.dll
+ addFiles.path = !:/sys/bin
+ DEPLOYMENT += addFiles
+}
+
+unix:!symbian {
+ install_headers.path = /usr/include/sowatch
+ maemo5 {
+ target.path = /opt/maemo/usr/lib
+ } else {
+ target.path = /usr/lib
+ }
+ INSTALLS += install_headers target
+}
+
+
diff --git a/libsowatch/libsowatch.pro.user b/libsowatch/libsowatch.pro.user
new file mode 100644
index 0000000..d20c31f
--- /dev/null
+++ b/libsowatch/libsowatch.pro.user
@@ -0,0 +1,549 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QtCreatorProject>
+<!-- Written by Qt Creator 2.3.0, 2011-09-17T03:00:57. -->
+<qtcreator>
+ <data>
+ <variable>ProjectExplorer.Project.ActiveTarget</variable>
+ <value type="int">0</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.EditorSettings</variable>
+ <valuemap type="QVariantMap">
+ <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
+ <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
+ <value type="QString" key="language">Cpp</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="bool" key="AlignAssignments">false</value>
+ <value type="QString" key="CurrentFallback">CppGlobal</value>
+ <value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">true</value>
+ <value type="bool" key="IndentAccessSpecifiers">false</value>
+ <value type="bool" key="IndentBlockBody">true</value>
+ <value type="bool" key="IndentBlockBraces">false</value>
+ <value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
+ <value type="bool" key="IndentClassBraces">false</value>
+ <value type="bool" key="IndentControlFlowRelativeToSwitchLabels">true</value>
+ <value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
+ <value type="bool" key="IndentEnumBraces">false</value>
+ <value type="bool" key="IndentFunctionBody">true</value>
+ <value type="bool" key="IndentFunctionBraces">false</value>
+ <value type="bool" key="IndentNamespaceBody">false</value>
+ <value type="bool" key="IndentNamespaceBraces">false</value>
+ <value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
+ <value type="bool" key="IndentSwitchLabels">false</value>
+ </valuemap>
+ </valuemap>
+ <value type="int" key="EditorConfiguration.CodeStyle.Count">1</value>
+ <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
+ <value type="QString" key="EditorConfiguration.CurrentFallback">Global</value>
+ <value type="int" key="EditorConfiguration.IndentSize">4</value>
+ <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
+ <value type="int" key="EditorConfiguration.PaddingMode">1</value>
+ <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
+ <value type="bool" key="EditorConfiguration.SmartBackspace">false</value>
+ <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
+ <valuemap type="QVariantMap" key="EditorConfiguration.Tab.0">
+ <value type="QString" key="language">Cpp</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="bool" key="AutoIndent">true</value>
+ <value type="bool" key="AutoSpacesForTabs">false</value>
+ <value type="QString" key="CurrentFallback">CppGlobal</value>
+ <value type="int" key="IndentSize">4</value>
+ <value type="int" key="PaddingMode">1</value>
+ <value type="bool" key="SmartBackspace">false</value>
+ <value type="bool" key="SpacesForTabs">true</value>
+ <value type="int" key="TabKeyBehavior">0</value>
+ <value type="int" key="TabSize">8</value>
+ </valuemap>
+ </valuemap>
+ <valuemap type="QVariantMap" key="EditorConfiguration.Tab.1">
+ <value type="QString" key="language">QmlJS</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="bool" key="AutoIndent">true</value>
+ <value type="bool" key="AutoSpacesForTabs">false</value>
+ <value type="QString" key="CurrentFallback">QmlJSGlobal</value>
+ <value type="int" key="IndentSize">4</value>
+ <value type="int" key="PaddingMode">1</value>
+ <value type="bool" key="SmartBackspace">false</value>
+ <value type="bool" key="SpacesForTabs">true</value>
+ <value type="int" key="TabKeyBehavior">0</value>
+ <value type="int" key="TabSize">8</value>
+ </valuemap>
+ </valuemap>
+ <value type="int" key="EditorConfiguration.Tab.Count">2</value>
+ <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
+ <value type="int" key="EditorConfiguration.TabSize">8</value>
+ <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+ <value type="int" key="EditorConfiguration.Utf8BomBehavior">2</value>
+ <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
+ <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
+ <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+ <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.0</variable>
+ <valuemap type="QVariantMap">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">1</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 4.7.4 for GCC (Qt SDK) Release</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/javier/maemo/qt/libsowatch-build-desktop-release</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">13</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 4.7.4 for GCC (Qt SDK) Debug</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/javier/maemo/qt/libsowatch-build-desktop-debug</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">13</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Create tarball</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoTarPackageCreationStep</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy tarball via SFTP upload</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoUploadAndInstallTarPackageStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedFiles"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedHosts"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedRemotePaths"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedTimes"/>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Tarball and Install to Linux Host</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">DeployToGenericLinux</value>
+ <value type="qulonglong" key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId">0</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">2</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
+ <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
+ <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.1</variable>
+ <valuemap type="QVariantMap">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Harmattan</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Harmattan</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.HarmattanDeviceTarget</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">Qt4ProjectManager.ToolChain.Maemo:/home/javier/opt/QtSDK/Madde/targets/harmattan-nokia-meego-api/bin/gcc.arm-linux-generic-elf-32bit./home/javier/opt/QtSDK/pythongdb/gdb</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MeeGo 1.2 Harmattan API (Qt SDK) Release</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/javier/maemo/qt/libsowatch-build-harmattan-release</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">10</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
+ <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">Qt4ProjectManager.ToolChain.Maemo:/home/javier/opt/QtSDK/Madde/targets/harmattan-nokia-meego-api/bin/gcc.arm-linux-generic-elf-32bit./home/javier/opt/QtSDK/pythongdb/gdb</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
+ <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
+ <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
+ <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
+ <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MeeGo 1.2 Harmattan API (Qt SDK) Debug</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/javier/maemo/qt/libsowatch-build-harmattan-debug</value>
+ <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">10</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Create Debian Package</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoDebianPackageCreationStep</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Install Debian package to sysroot</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoInstallDebianPackageToSysrootStep</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Debian package via SFTP upload</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoUploadAndInstallDpkgPackageStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedFiles"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedHosts"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedRemotePaths"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedTimes"/>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Debian Package and Install to Harmattan Device</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">DeployToHarmattan</value>
+ <value type="qulonglong" key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId">0</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
+ <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
+ <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.TargetCount</variable>
+ <value type="int">2</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
+ <value type="QString">{4e827e92-6882-4bad-8513-da5dad54ff3f}</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+ <value type="int">10</value>
+ </data>
+</qtcreator>
diff --git a/libsowatch/main.cpp b/libsowatch/main.cpp
new file mode 100644
index 0000000..d0eae3f
--- /dev/null
+++ b/libsowatch/main.cpp
@@ -0,0 +1,35 @@
+#include <QtGui/QApplication>
+#include <QtConnectivity/QBluetoothAddress>
+
+#include "metawatchsimulator.h"
+#include "metawatch.h"
+#include "watchserver.h"
+#include "testwatchlet.h"
+#include "testdeclarativewatchlet.h"
+
+using namespace sowatch;
+QTM_USE_NAMESPACE
+
+static Watch *watch;
+static WatchServer *server;
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ if (a.arguments().count() > 1) {
+ watch = new MetaWatch(QBluetoothAddress(a.arguments().at(1)));
+ } else {
+ watch = new MetaWatchSimulator();
+ }
+
+ /* D0:37:61:C3:C7:99 */
+ server = new WatchServer(watch);
+ new TestDeclarativeWatchlet(server);
+ new TestWatchlet(server);
+
+ server->runWatchlet("com.javispedro.sowatch.testdeclarativewatchlet");
+ //server->runWatchlet("com.javispedro.sowatch.testwatchlet");
+
+ return a.exec();
+}
diff --git a/libsowatch/metawatch.cpp b/libsowatch/metawatch.cpp
new file mode 100644
index 0000000..b968fad
--- /dev/null
+++ b/libsowatch/metawatch.cpp
@@ -0,0 +1,409 @@
+#include <QtCore/QDebug>
+#include <QtCore/QDateTime>
+
+#include "metawatchpaintengine.h"
+#include "metawatch.h"
+
+using namespace sowatch;
+QTM_USE_NAMESPACE
+
+#define SINGLE_LINE_UPDATE 0
+
+const quint8 MetaWatch::bitRevTable[16] = {
+ 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
+};
+
+const quint16 MetaWatch::crcTable[256] = {
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
+ 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
+ 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
+ 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
+ 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
+ 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
+ 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
+ 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
+ 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
+ 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
+ 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
+ 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
+ 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
+ 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
+ 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
+ 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
+ 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
+ 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
+ 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
+ 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
+ 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
+ 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
+ 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
+};
+
+#if 0 /* This snippet was used to build the table seen above. */
+ quint16 remainder;
+ int dividend;
+ quint8 bit;
+
+ for (dividend = 0; dividend < 256; dividend++) {
+ remainder = dividend << 8;
+ for (bit = 8; bit > 0; bit--) {
+ if (remainder & 0x8000) {
+ remainder = (remainder << 1) ^ 0x1021;
+ } else {
+ remainder = (remainder << 1);
+ }
+ }
+ if ((dividend % 8) == 0) {
+ printf(",\n0x%04hx", remainder);
+ } else {
+ printf(", 0x%04hx", remainder);
+ }
+ }
+#endif
+
+MetaWatch::MetaWatch(const QBluetoothAddress& address, QObject *parent) :
+ Watch(QImage(96, 96, QImage::Format_MonoLSB), parent),
+ _socket(new QBluetoothSocket(QBluetoothSocket::RfcommSocket)),
+ _sendTimer(new QTimer(this))
+{
+ connect(_socket, SIGNAL(connected()), SLOT(socketConnected()));
+ connect(_socket, SIGNAL(disconnected()), SLOT(socketDisconnected()));
+ connect(_socket, SIGNAL(readyRead()), SLOT(socketData()));
+ connect(_socket, SIGNAL(error(QBluetoothSocket::SocketError)),
+ SLOT(socketError(QBluetoothSocket::SocketError)));
+ connect(_socket, SIGNAL(stateChanged(QBluetoothSocket::SocketState)),
+ SLOT(socketState(QBluetoothSocket::SocketState)));
+
+ _sendTimer->setInterval(30);
+ connect(_sendTimer, SIGNAL(timeout()), SLOT(timedSend()));
+
+ _socket->connectToService(address, 1, QIODevice::ReadWrite | QIODevice::Unbuffered);
+}
+
+QPaintEngine* MetaWatch::paintEngine() const
+{
+ if (!_paintEngine) {
+ _paintEngine = new MetaWatchPaintEngine(const_cast<MetaWatch*>(this),
+ const_cast<QImage*>(&_image));
+ }
+
+ return _paintEngine;
+}
+
+QString MetaWatch::model() const
+{
+ return "metawatch-digital";
+}
+
+bool MetaWatch::isConnected() const
+{
+ return _socket->state() == QBluetoothSocket::ConnectedState;
+}
+
+bool MetaWatch::busy() const
+{
+ return _socket->state() != QBluetoothSocket::ConnectedState ||
+ _toSend.size() > 20;
+}
+
+void MetaWatch::update(const QList<QRect> &rects)
+{
+ if (_socket->state() != QBluetoothSocket::ConnectedState) return;
+ const QRect imageRect = _image.rect();
+ QVector<bool> lines(_image.height(), false);
+
+ foreach (const QRect& rect, rects) {
+ QRect r = rect.intersect(imageRect);
+ for (int i = r.top(); i <= r.bottom(); i++) {
+ lines[i] = true;
+ }
+ }
+
+ updateLines(ApplicationMode, _image, lines);
+ updateDisplay(ApplicationMode);
+}
+
+void MetaWatch::clear(bool white)
+{qDebug() << "MWclear" << white;
+ if (_socket->state() != QBluetoothSocket::ConnectedState) return;
+ loadTemplate(ApplicationMode, white ? 1 : 0);
+}
+
+void MetaWatch::vibrate(bool on)
+{
+
+}
+
+void MetaWatch::setDateTime(const QDateTime &dateTime)
+{
+ Message msg(SetRealTimeClock, QByteArray(10, 0));
+ const QDate& date = dateTime.date();
+ const QTime& time = dateTime.time();
+
+ msg.data[0] = date.year() & 0xF00;
+ msg.data[1] = date.year() & 0xFF;
+ msg.data[2] = date.month();
+ msg.data[3] = date.day();
+ msg.data[4] = date.dayOfWeek() - 1;
+ msg.data[5] = time.hour();
+ msg.data[6] = time.minute();
+ msg.data[7] = time.second();
+ msg.data[8] = 1;
+ msg.data[9] = 1;
+
+ send(msg);
+}
+
+quint16 MetaWatch::calcCrc(const QByteArray &data, int size)
+{
+ quint16 remainder = 0xFFFF;
+
+ for (int i = 0; i < size; i++) {
+ quint8 byte = data[i];
+ byte = (bitRevTable[byte & 0xF] << 4) | bitRevTable[(byte & 0xF0) >> 4];
+ remainder = crcTable[byte ^ (remainder >> 8)] ^ (remainder << 8);
+ }
+
+ return remainder;
+}
+
+quint16 MetaWatch::calcCrc(const Message& msg)
+{
+ QByteArray data;
+ const int msgSize = msg.data.size();
+
+ data.resize(msgSize + 4);
+ data[0] = 0x01;
+ data[1] = msgSize + 6;
+ data[2] = msg.type;
+ data[3] = msg.options;
+ data.replace(4, msgSize, msg.data);
+
+ return calcCrc(data, msgSize + 4);
+}
+
+void MetaWatch::send(const Message &msg)
+{
+ _toSend.enqueue(msg);
+ if (!_sendTimer->isActive()) {
+ _sendTimer->start();
+ }
+}
+
+void MetaWatch::handleMessage(const Message &msg)
+{
+ switch (msg.type) {
+ case StatusChangeEvent:
+ handleStatusChange(msg);
+ break;
+ case ButtonEvent:
+ handleButtonEvent(msg);
+ break;
+ default:
+ qWarning() << "Unknown message of type" << msg.type << "received";
+ break;
+ }
+}
+
+void MetaWatch::updateLine(Mode mode, const QImage& image, int line)
+{
+ Message msg(WriteBuffer, QByteArray(13, 0), (1 << 4) | (mode & 0xF));
+ const char * scanLine = (const char *) image.constScanLine(line);
+
+ msg.data[0] = line;
+ msg.data.replace(1, 12, scanLine, 12);
+
+ send(msg);
+}
+
+void MetaWatch::updateLines(Mode mode, const QImage& image, int lineA, int lineB)
+{
+ Message msg(WriteBuffer, QByteArray(26, 0), mode & 0xF);
+ const char * scanLine = (const char *) image.constScanLine(lineA);
+
+ msg.data[0] = lineA;
+ msg.data.replace(1, 12, scanLine, 12);
+
+ scanLine = (const char *) image.constScanLine(lineB);
+ msg.data[13] = lineB;
+ msg.data.replace(14, 12, scanLine, 12);
+
+ send(msg);
+}
+
+void MetaWatch::updateLines(Mode mode, const QImage& image, const QVector<bool>& lines)
+{
+ int lineCount = lines.count(true);
+ int lineA = -1;
+
+ if (lineCount == 0) return;
+
+ for (int line = 0; line < lines.size(); line++) {
+ if (lines[line]) {
+ lineCount--;
+#if SINGLE_LINE_UPDATE
+ updateLine(mode, image, line);
+ continue;
+#endif
+ if (lineA >= 0) {
+ // We have a pair of lines to send.
+ updateLines(mode, image, lineA, line);
+ lineA = -1;
+ } else if (lineCount > 0) {
+ // Still another line to send.
+ lineA = line;
+ } else {
+ updateLine(mode, image, line);
+ break; // No more lines
+ }
+ }
+ }
+}
+
+void MetaWatch::configureWatchMode(Mode mode, int timeout, bool invert)
+{
+ Message msg(ConfigureMode, QByteArray(2, 0), mode & 0xF);
+ msg.data[0] = timeout;
+ msg.data[1] = invert ? 1 : 0;
+ send(msg);
+}
+
+void MetaWatch::updateDisplay(Mode mode, bool copy)
+{
+ Message msg(UpdateDisplay, QByteArray(),
+ (copy ? 0x10 : 0) | (mode & 0xF));
+ send(msg);
+}
+
+void MetaWatch::loadTemplate(Mode mode, int templ)
+{
+ Message msg(LoadTemplate, QByteArray(1, templ), mode & 0xF);
+ send(msg);
+}
+
+void MetaWatch::handleStatusChange(const Message &msg)
+{
+ qDebug() << "watch status changed" << msg.data.size();
+}
+
+void MetaWatch::handleButtonEvent(const Message &msg)
+{
+ if (msg.data.size() < 1) return;
+ quint8 button = msg.data[0];
+
+ emit buttonPressed(button); // TODO This is completely broken
+}
+
+void MetaWatch::socketConnected()
+{
+ qDebug() << "connected";
+ _partialReceived.type = NoMessage;
+ _partialReceived.data.clear();
+ _buttonState = 0;
+ setDateTime(QDateTime::currentDateTime());
+ configureWatchMode(ApplicationMode);
+ emit connected();
+}
+
+void MetaWatch::socketDisconnected()
+{
+ _toSend.clear();
+ _sendTimer->stop();
+ emit disconnected();
+}
+
+void MetaWatch::socketData()
+{
+ qint64 dataRead;
+
+ if (_partialReceived.type == 0) {
+ if (_socket->bytesAvailable() < 4) return; /* Wait for more. */
+ char header[4];
+
+ dataRead = _socket->read(header, 4);
+ if (dataRead < 4 || header[0] != 0x01) {
+ qWarning() << "TODO: Resync/Handle Garbage";
+ return;
+ }
+
+ _partialReceived.type = static_cast<MessageType>(header[2]);
+ _partialReceived.data.resize(header[1] - 6);
+ _partialReceived.options = header[3];
+ }
+ if (_socket->bytesAvailable() < _partialReceived.data.size() + 2) {
+ return; /* Wait for more. */
+ }
+ dataRead = _socket->read(_partialReceived.data.data(), _partialReceived.data.size());
+ if (dataRead < _partialReceived.data.size()) {
+ qWarning() << "Short read";
+ return;
+ }
+
+ char tail[2];
+ dataRead = _socket->read(tail, 2);
+ if (dataRead < 2) {
+ qWarning() << "Short read";
+ return;
+ }
+
+ quint16 realCrc = calcCrc(_partialReceived);
+ quint16 expectedCrc = tail[1] << 8 | (tail[0] & 0xFFU);
+ if (realCrc == expectedCrc) {
+ handleMessage(_partialReceived);
+ } else {
+ qWarning() << "CRC error?";
+ }
+
+ _partialReceived.data.clear();
+ _partialReceived.type = NoMessage;
+}
+
+void MetaWatch::socketError(QBluetoothSocket::SocketError error)
+{
+ qWarning() << "Socket error:" << error;
+}
+
+void MetaWatch::socketState(QBluetoothSocket::SocketState error)
+{
+ qDebug() << "socket is in" << error;
+}
+
+void MetaWatch::timedSend()
+{
+ if (_toSend.count() > 0) {
+ realSend(_toSend.dequeue());
+ }
+ if (_toSend.count() == 0) {
+ _sendTimer->stop();
+ }
+}
+
+void MetaWatch::realSend(const Message &msg)
+{
+ const int msgSize = msg.data.size();
+ QByteArray data;
+ quint16 crc;
+
+ data.resize(msgSize + 6);
+ data[0] = 0x01;
+ data[1] = msgSize + 6;
+ data[2] = msg.type;
+ data[3] = msg.options;
+ data.replace(4, msgSize, msg.data);
+ crc = calcCrc(data, msgSize + 4);
+ data[msgSize+4] = crc & 0xFF;
+ data[msgSize+5] = crc >> 8;
+
+ //qDebug() << "Sending" << data.toHex();
+
+ _socket->write(data);
+}
diff --git a/libsowatch/metawatch.h b/libsowatch/metawatch.h
new file mode 100644
index 0000000..80a1894
--- /dev/null
+++ b/libsowatch/metawatch.h
@@ -0,0 +1,122 @@
+#ifndef METAWATCH_H
+#define METAWATCH_H
+
+#include <QtConnectivity/QBluetoothAddress>
+#include <QtConnectivity/QBluetoothSocket>
+#include <QtCore/QQueue>
+#include <QtCore/QTimer>
+#include "watch.h"
+
+using QTM_PREPEND_NAMESPACE(QBluetoothSocket);
+using QTM_PREPEND_NAMESPACE(QBluetoothAddress);
+
+namespace sowatch
+{
+
+class MetaWatch : public Watch
+{
+ Q_OBJECT
+ Q_ENUMS(MessageType Mode)
+
+public:
+ explicit MetaWatch(const QBluetoothAddress& address, QObject *parent = 0);
+
+ QPaintEngine* paintEngine() const;
+
+ QString model() const;
+ bool isConnected() const;
+ bool busy() const;
+ void update(const QList<QRect>& rects);
+ void clear(bool white = false);
+ void vibrate(bool on);
+
+ void setDateTime(const QDateTime& dateTime);
+
+ enum MessageType {
+ NoMessage = 0,
+ GetDeviceType = 0x01,
+ GetDeviceTypeResponse = 0x02,
+ GetInformationString = 0x03,
+ GetInformationStringResponse = 0x04,
+ AdvanceWatchHands = 0x20,
+ SetVibrateMode = 0x23,
+ SetRealTimeClock = 0x26,
+ GetRealTimeClock = 0x27,
+ GetRealTimeClockResponse = 0x28,
+ StatusChangeEvent = 0x33,
+ ButtonEvent = 0x34,
+ WriteBuffer = 0x40,
+ ConfigureMode = 0x41,
+ ConfigureIdleBufferSize = 0x42,
+ UpdateDisplay = 0x43,
+ LoadTemplate = 0x44,
+ EnableButton = 0x46,
+ DisableButton = 0x47,
+ ReadButtonConfiguration = 0x48,
+ ReadButtonConfigurationResponse = 0x49,
+ BatteryConfiguration = 0x53,
+ LowBatteryWarning = 0x54,
+ LowBatteryBluetoothOff = 0x55,
+ ReadBatteryVoltage = 0x56,
+ ReadBatteryVoltageResponse = 0x57,
+ Accelerometer = 0xea
+ };
+
+ enum Mode {
+ IdleMode = 0,
+ ApplicationMode = 1
+ };
+
+protected:
+ QBluetoothSocket* _socket;
+
+ struct Message {
+ MessageType type;
+ quint8 options;
+ QByteArray data;
+ Message(MessageType ntype = NoMessage, QByteArray ndata = QByteArray(), quint8 noptions = 0) :
+ type(ntype), options(noptions), data(ndata)
+ {
+
+ }
+ };
+
+ QQueue<Message> _toSend;
+ QTimer* _sendTimer;
+ Message _partialReceived;
+
+ quint8 _buttonState;
+
+ static const quint8 bitRevTable[16];
+ static const quint16 crcTable[256];
+ quint16 calcCrc(const QByteArray& data, int size);
+ quint16 calcCrc(const Message& msg);
+
+ void send(const Message& msg);
+ void handleMessage(const Message& msg);
+
+ void updateLine(Mode mode, const QImage& image, int line);
+ void updateLines(Mode mode, const QImage& image, int lineA, int lineB);
+ void updateLines(Mode mode, const QImage& image, const QVector<bool>& lines);
+ void configureWatchMode(Mode mode, int timeout = 10, bool invert = false);
+ void updateDisplay(Mode mode, bool copy = true);
+ void loadTemplate(Mode mode, int templ);
+
+ void handleStatusChange(const Message& msg);
+ void handleButtonEvent(const Message& msg);
+
+protected slots:
+ void socketConnected();
+ void socketDisconnected();
+ void socketData();
+ void socketError(QBluetoothSocket::SocketError error);
+ void socketState(QBluetoothSocket::SocketState error);
+ void timedSend();
+
+private:
+ void realSend(const Message& msg);
+};
+
+}
+
+#endif // METAWATCH_H
diff --git a/libsowatch/metawatchpaintengine.cpp b/libsowatch/metawatchpaintengine.cpp
new file mode 100644
index 0000000..71ad452
--- /dev/null
+++ b/libsowatch/metawatchpaintengine.cpp
@@ -0,0 +1,82 @@
+#include "metawatch.h"
+#include "metawatchpaintengine.h"
+
+using namespace sowatch;
+
+MetaWatchPaintEngine::MetaWatchPaintEngine(MetaWatch* watch, QImage* image) :
+ WatchPaintEngine(watch, image), _watch(watch),
+ _imageRect(image->rect())
+{
+}
+
+void MetaWatchPaintEngine::drawRects(const QRectF *rects, int rectCount)
+{
+ int i;
+ for (i = 0; i < rectCount; i++) {
+ const QRectF& r = rects[i];
+ if (_hasBrush && fillsEntireImage(r.toRect()) && (_isBrushBlack | _isBrushWhite)) {
+ _watch->clear(_isBrushWhite);
+ _damaged = QRegion();
+ continue;
+ }
+ if (_hasBrush) {
+ damageRect(r);
+ }
+ if (_hasPen) {
+ damagePenStroke(QLineF(r.left(), r.top(), r.right(), r.top()));
+ damagePenStroke(QLineF(r.right(), r.top(), r.right(), r.bottom()));
+ damagePenStroke(QLineF(r.left(), r.bottom(), r.right(), r.bottom()));
+ damagePenStroke(QLineF(r.left(), r.top(), r.left(), r.bottom()));
+ }
+ }
+ _painter.drawRects(rects, rectCount);
+}
+
+void MetaWatchPaintEngine::drawRects(const QRect *rects, int rectCount)
+{
+ int i;
+ for (i = 0; i < rectCount; i++) {
+ const QRect& r = rects[i];
+ if (_hasBrush && fillsEntireImage(r) && (_isBrushBlack | _isBrushWhite)) {
+ _watch->clear(_isBrushWhite);
+ _damaged = QRegion();
+ continue;
+ }
+ if (_hasBrush) {
+ damageRect(r);
+ }
+ if (_hasPen) {
+ damagePenStroke(QLine(r.left(), r.top(), r.right(), r.top()));
+ damagePenStroke(QLine(r.right(), r.top(), r.right(), r.bottom()));
+ damagePenStroke(QLine(r.left(), r.bottom(), r.right(), r.bottom()));
+ damagePenStroke(QLine(r.left(), r.top(), r.left(), r.bottom()));
+ }
+ }
+
+ _painter.drawRects(rects, rectCount);
+}
+
+void MetaWatchPaintEngine::updateState(const QPaintEngineState &state)
+{
+ WatchPaintEngine::updateState(state);
+ if (state.state() & QPaintEngine::DirtyBrush) {
+ QBrush brush = state.brush();
+ _isBrushBlack = false;
+ _isBrushWhite = false;
+ if (brush.style() == Qt::SolidPattern) {
+ const QColor color = brush.color();
+ if (color == Qt::black) {
+ _isBrushBlack = true;
+ } else if (color == Qt::white) {
+ _isBrushWhite = true;
+ }
+ }
+ }
+}
+
+bool MetaWatchPaintEngine::fillsEntireImage(const QRect& rect)
+{
+ return rect == _imageRect &&
+ (!_clipEnabled ||
+ (_clipRegion.numRects() == 1 && _clipRegion.rects().at(0) == _imageRect));
+}
diff --git a/libsowatch/metawatchpaintengine.h b/libsowatch/metawatchpaintengine.h
new file mode 100644
index 0000000..efc3d6e
--- /dev/null
+++ b/libsowatch/metawatchpaintengine.h
@@ -0,0 +1,34 @@
+#ifndef METAWATCHPAINTENGINE_H
+#define METAWATCHPAINTENGINE_H
+
+#include <QtCore/QRect>
+#include "watchpaintengine.h"
+
+namespace sowatch
+{
+
+class MetaWatch;
+
+/** This WatchPaintEngine accelerates fillRects by using the MetaWatch's template command. */
+class MetaWatchPaintEngine : public WatchPaintEngine
+{
+public:
+ explicit MetaWatchPaintEngine(MetaWatch* watch, QImage* image);
+
+ void drawRects(const QRectF *rects, int rectCount);
+ void drawRects(const QRect *rects, int rectCount);
+
+ void updateState(const QPaintEngineState &state);
+
+protected:
+ bool fillsEntireImage(const QRect& rect);
+
+ MetaWatch* _watch;
+ QRect _imageRect;
+ bool _isBrushBlack;
+ bool _isBrushWhite;
+};
+
+}
+
+#endif // METAWATCHPAINTENGINE_H
diff --git a/libsowatch/metawatchsimulator.cpp b/libsowatch/metawatchsimulator.cpp
new file mode 100644
index 0000000..11b938a
--- /dev/null
+++ b/libsowatch/metawatchsimulator.cpp
@@ -0,0 +1,82 @@
+#include <QtCore/QDebug>
+#include <QtGui/QPainter>
+
+#include "metawatchsimulator.h"
+
+#define SIMULATE_DAMAGES 1
+#define SIMULATE_FRAMERATE 1
+
+using namespace sowatch;
+
+MetaWatchSimulator::MetaWatchSimulator(QObject *parent) :
+ WatchSimulator(QImage(96, 96, QImage::Format_Mono), parent),
+ _screen(96, 96),
+ _form(new MetaWatchSimulatorForm),
+ _nextFrame(QTime::currentTime())
+{
+ _form->showNormal();
+ connect(_form, SIGNAL(destroyed()), SIGNAL(disconnected()));
+ connect(_form, SIGNAL(buttonPressed(int)), SIGNAL(buttonPressed(int)));
+ connect(_form, SIGNAL(buttonReleased(int)), SIGNAL(buttonReleased(int)));
+}
+
+MetaWatchSimulator::~MetaWatchSimulator()
+{
+ delete _form;
+}
+
+QString MetaWatchSimulator::model() const
+{
+ return "metawatch-digital";
+}
+
+bool MetaWatchSimulator::isConnected() const
+{
+ return true;
+}
+
+bool MetaWatchSimulator::busy() const
+{
+#if SIMULATE_FRAMERATE
+ return _nextFrame > QTime::currentTime();
+#else
+ return false;
+#endif
+}
+
+void MetaWatchSimulator::update(const QList<QRect> &rects)
+{
+#if SIMULATE_DAMAGES
+ const QRect imageRect = _image.rect();
+ QPainter p;
+ QVector<bool> rows(96, false);
+ unsigned total = 0, totalRows;
+
+ p.begin(&_screen);
+ foreach (const QRect& rect, rects) {
+ QRect r = rect.intersect(imageRect);
+ for (int i = r.top(); i <= r.bottom(); i++) {
+ rows[i] = true;
+ }
+ total += r.width() * r.height();
+
+ p.drawImage(r, _image, r);
+ }
+ p.end();
+
+ totalRows = rows.count(true);
+
+ _form->refreshScreen(_screen);
+
+ qDebug() << "updated " << total << " pixels " << totalRows << " lines";
+ _nextFrame = QTime::currentTime().addMSecs(((totalRows / 2) + 1) * 30);
+#else
+ _form->refreshScreen(QPixmap::fromImage(_image));
+ _nextFrame = QTime::currentTime().addMSecs(30);
+#endif
+}
+
+void MetaWatchSimulator::vibrate(bool on)
+{
+ qDebug() << "vibrate" << on;
+}
diff --git a/libsowatch/metawatchsimulator.h b/libsowatch/metawatchsimulator.h
new file mode 100644
index 0000000..674c3c6
--- /dev/null
+++ b/libsowatch/metawatchsimulator.h
@@ -0,0 +1,32 @@
+#ifndef METAWATCHSIMULATOR_H
+#define METAWATCHSIMULATOR_H
+
+#include <QtCore/QTime>
+#include "watchsimulator.h"
+#include "metawatchsimulatorform.h"
+
+namespace sowatch {
+
+class MetaWatchSimulator : public WatchSimulator
+{
+ Q_OBJECT
+public:
+ explicit MetaWatchSimulator(QObject *parent = 0);
+ ~MetaWatchSimulator();
+
+ QString model() const;
+ bool isConnected() const;
+ bool busy() const;
+
+ void update(const QList<QRect> &rects);
+ void vibrate(bool on);
+
+protected:
+ QPixmap _screen;
+ MetaWatchSimulatorForm* _form;
+ QTime _nextFrame;
+};
+
+}
+
+#endif // METAWATCHSIMULATOR_H
diff --git a/libsowatch/metawatchsimulatorform.cpp b/libsowatch/metawatchsimulatorform.cpp
new file mode 100644
index 0000000..f2323bd
--- /dev/null
+++ b/libsowatch/metawatchsimulatorform.cpp
@@ -0,0 +1,82 @@
+#include "metawatchsimulatorform.h"
+#include "ui_metawatchsimulatorform.h"
+
+using namespace sowatch;
+
+MetaWatchSimulatorForm::MetaWatchSimulatorForm(QWidget* parent) :
+ QWidget(parent),
+ ui(new Ui::MetaWatchSimulatorForm)
+{
+ ui->setupUi(this);
+}
+
+MetaWatchSimulatorForm::~MetaWatchSimulatorForm()
+{
+ delete ui;
+}
+
+void MetaWatchSimulatorForm::refreshScreen(const QPixmap& pixmap)
+{
+ ui->lblDisplay->setPixmap(pixmap);
+ ui->lblDisplay->update();
+}
+
+void MetaWatchSimulatorForm::btnAPressed()
+{
+ emit buttonPressed(0);
+}
+
+void MetaWatchSimulatorForm::btnAReleased()
+{
+ emit buttonReleased(0);
+}
+
+void MetaWatchSimulatorForm::btnBPressed()
+{
+ emit buttonPressed(1);
+}
+
+void MetaWatchSimulatorForm::btnBReleased()
+{
+ emit buttonReleased(1);
+}
+
+void MetaWatchSimulatorForm::btnCPressed()
+{
+ emit buttonPressed(2);
+}
+
+void MetaWatchSimulatorForm::btnCReleased()
+{
+ emit buttonReleased(2);
+}
+
+void MetaWatchSimulatorForm::btnDPressed()
+{
+ emit buttonPressed(3);
+}
+
+void MetaWatchSimulatorForm::btnDReleased()
+{
+ emit buttonReleased(3);
+}
+
+void MetaWatchSimulatorForm::btnEPressed()
+{
+ emit buttonPressed(4);
+}
+
+void MetaWatchSimulatorForm::btnEReleased()
+{
+ emit buttonReleased(4);
+}
+
+void MetaWatchSimulatorForm::btnFPressed()
+{
+ emit buttonPressed(5);
+}
+
+void MetaWatchSimulatorForm::btnFReleased()
+{
+ emit buttonReleased(5);
+}
diff --git a/libsowatch/metawatchsimulatorform.h b/libsowatch/metawatchsimulatorform.h
new file mode 100644
index 0000000..0b45746
--- /dev/null
+++ b/libsowatch/metawatchsimulatorform.h
@@ -0,0 +1,46 @@
+#ifndef METAWATCHSIMULATORFORM_H
+#define METAWATCHSIMULATORFORM_H
+
+#include <QWidget>
+
+namespace Ui {
+ class MetaWatchSimulatorForm;
+}
+
+namespace sowatch {
+
+class MetaWatchSimulatorForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MetaWatchSimulatorForm(QWidget *parent = 0);
+ ~MetaWatchSimulatorForm();
+
+ void refreshScreen(const QPixmap& screen);
+
+signals:
+ void buttonPressed(int button);
+ void buttonReleased(int button);
+
+protected slots:
+ void btnAPressed();
+ void btnAReleased();
+ void btnBPressed();
+ void btnBReleased();
+ void btnCPressed();
+ void btnCReleased();
+ void btnDPressed();
+ void btnDReleased();
+ void btnEPressed();
+ void btnEReleased();
+ void btnFPressed();
+ void btnFReleased();
+
+private:
+ Ui::MetaWatchSimulatorForm *ui;
+};
+
+}
+
+#endif // METAWATCHSIMULATORFORM_H
diff --git a/libsowatch/metawatchsimulatorform.ui b/libsowatch/metawatchsimulatorform.ui
new file mode 100644
index 0000000..39280b3
--- /dev/null
+++ b/libsowatch/metawatchsimulatorform.ui
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MetaWatchSimulatorForm</class>
+ <widget class="QWidget" name="MetaWatchSimulatorForm">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>262</width>
+ <height>113</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MetaWatch-Digital Simulator</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="btnsLeft">
+ <item>
+ <widget class="QPushButton" name="btnA">
+ <property name="text">
+ <string>A</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnB">
+ <property name="text">
+ <string>B</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnC">
+ <property name="text">
+ <string>C</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblDisplay">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="btnsRight">
+ <item>
+ <widget class="QPushButton" name="btnD">
+ <property name="text">
+ <string>D</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnE">
+ <property name="text">
+ <string>E</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnF">
+ <property name="text">
+ <string>F</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>btnA</sender>
+ <signal>pressed()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnAPressed()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>44</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>105</x>
+ <y>4</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnA</sender>
+ <signal>released()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnAReleased()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>71</x>
+ <y>21</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>4</x>
+ <y>10</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnB</sender>
+ <signal>pressed()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnBPressed()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>68</x>
+ <y>57</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>98</x>
+ <y>75</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnB</sender>
+ <signal>released()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnBReleased()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>86</x>
+ <y>56</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>98</x>
+ <y>58</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnC</sender>
+ <signal>pressed()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnCPressed()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>37</x>
+ <y>90</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>73</x>
+ <y>108</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnC</sender>
+ <signal>released()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnCReleased()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>21</x>
+ <y>89</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>19</x>
+ <y>105</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnD</sender>
+ <signal>pressed()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnDPressed()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>203</x>
+ <y>18</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>205</x>
+ <y>5</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnD</sender>
+ <signal>released()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnDReleased()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>244</x>
+ <y>22</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>258</x>
+ <y>21</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnE</sender>
+ <signal>pressed()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnEPressed()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>237</x>
+ <y>50</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>256</x>
+ <y>51</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnE</sender>
+ <signal>released()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnEReleased()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>174</x>
+ <y>46</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>164</x>
+ <y>40</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnF</sender>
+ <signal>pressed()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnFPressed()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>236</x>
+ <y>89</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>258</x>
+ <y>87</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>btnF</sender>
+ <signal>released()</signal>
+ <receiver>MetaWatchSimulatorForm</receiver>
+ <slot>btnFReleased()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>185</x>
+ <y>90</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>187</x>
+ <y>108</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>btnAPressed()</slot>
+ <slot>btnAReleased()</slot>
+ <slot>btnBPressed()</slot>
+ <slot>btnBReleased()</slot>
+ <slot>btnCPressed()</slot>
+ <slot>btnCReleased()</slot>
+ <slot>btnDPressed()</slot>
+ <slot>btnDReleased()</slot>
+ <slot>btnEPressed()</slot>
+ <slot>btnEReleased()</slot>
+ <slot>btnFPressed()</slot>
+ <slot>btnFReleased()</slot>
+ </slots>
+</ui>
diff --git a/libsowatch/qtc_packaging/debian_harmattan/README b/libsowatch/qtc_packaging/debian_harmattan/README
new file mode 100644
index 0000000..e9d95a7
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/README
@@ -0,0 +1,6 @@
+The Debian Package libsowatch
+----------------------------
+
+Comments regarding the Package
+
+ -- Javier <javier@unknown> Fri, 16 Sep 2011 23:45:08 +0200
diff --git a/libsowatch/qtc_packaging/debian_harmattan/changelog b/libsowatch/qtc_packaging/debian_harmattan/changelog
new file mode 100644
index 0000000..a893c9c
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/changelog
@@ -0,0 +1,5 @@
+libsowatch (0.0.1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Javier <javier@unknown> Fri, 16 Sep 2011 23:45:08 +0200
diff --git a/libsowatch/qtc_packaging/debian_harmattan/compat b/libsowatch/qtc_packaging/debian_harmattan/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/compat
@@ -0,0 +1 @@
+7
diff --git a/libsowatch/qtc_packaging/debian_harmattan/control b/libsowatch/qtc_packaging/debian_harmattan/control
new file mode 100644
index 0000000..0319078
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/control
@@ -0,0 +1,14 @@
+Source: libsowatch
+Section: user/other
+Priority: optional
+Maintainer: Javier <javier@unknown>
+Build-Depends: debhelper (>= 5), libqt4-dev
+Standards-Version: 3.7.3
+Homepage: <insert the upstream URL, if relevant>
+
+Package: libsowatch
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: <insert up to 60 chars description>
+ <insert long description, indented with spaces>
+XSBC-Maemo-Display-Name: libsowatch
diff --git a/libsowatch/qtc_packaging/debian_harmattan/copyright b/libsowatch/qtc_packaging/debian_harmattan/copyright
new file mode 100644
index 0000000..33b2cc7
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/copyright
@@ -0,0 +1,40 @@
+This package was debianized by Javier <javier@unknown> on
+Fri, 16 Sep 2011 23:45:08 +0200.
+
+It was downloaded from <url://example.com>
+
+Upstream Author(s):
+
+ <put author's name and email here>
+ <likewise for another author>
+
+Copyright:
+
+ <Copyright (C) YYYY Name OfAuthor>
+ <likewise for another author>
+
+License:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2011, Javier <javier@unknown> and
+is licensed under the GPL, see above.
+
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
diff --git a/libsowatch/qtc_packaging/debian_harmattan/manifest.aegis b/libsowatch/qtc_packaging/debian_harmattan/manifest.aegis
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/manifest.aegis
diff --git a/libsowatch/qtc_packaging/debian_harmattan/rules b/libsowatch/qtc_packaging/debian_harmattan/rules
new file mode 100755
index 0000000..f87e675
--- /dev/null
+++ b/libsowatch/qtc_packaging/debian_harmattan/rules
@@ -0,0 +1,91 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ # $(MAKE) # Uncomment this line for use without Qt Creator
+ #docbook-to-man debian/libsowatch.sgml > libsowatch.1
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ $(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/libsowatch.
+ $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/libsowatch install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ # dh_shlibdeps # Uncomment this line for use without Qt Creator
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/libsowatch/sowatch.h b/libsowatch/sowatch.h
new file mode 100644
index 0000000..a5044b3
--- /dev/null
+++ b/libsowatch/sowatch.h
@@ -0,0 +1,12 @@
+#ifndef SOWATCH_H
+#define SOWATCH_H
+
+#include "sowatch_global.h"
+#include "watch.h"
+#include "watchlet.h"
+#include "graphicswatchlet.h"
+#include "declarativewatchlet.h"
+#include "watchserver.h"
+#include "watchsimulator.h"
+
+#endif // SOWATCH_H
diff --git a/libsowatch/sowatch_global.h b/libsowatch/sowatch_global.h
new file mode 100644
index 0000000..a3b40e6
--- /dev/null
+++ b/libsowatch/sowatch_global.h
@@ -0,0 +1,12 @@
+#ifndef SOWATCH_GLOBAL_H
+#define SOWATCH_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(SOWATCH_LIBRARY)
+# define SOWATCH_EXPORT Q_DECL_EXPORT
+#else
+# define SOWATCH_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // SOWATCH_GLOBAL_H
diff --git a/libsowatch/testdeclarativewatchlet.cpp b/libsowatch/testdeclarativewatchlet.cpp
new file mode 100644
index 0000000..432d525
--- /dev/null
+++ b/libsowatch/testdeclarativewatchlet.cpp
@@ -0,0 +1,9 @@
+#include "testdeclarativewatchlet.h"
+
+using namespace sowatch;
+
+TestDeclarativeWatchlet::TestDeclarativeWatchlet(WatchServer* server) :
+ DeclarativeWatchlet(server, "com.javispedro.sowatch.testdeclarativewatchlet")
+{
+ setSource(QUrl("qrc:/testdeclarativewatchlet.qml"));
+}
diff --git a/libsowatch/testdeclarativewatchlet.h b/libsowatch/testdeclarativewatchlet.h
new file mode 100644
index 0000000..b7b6dcd
--- /dev/null
+++ b/libsowatch/testdeclarativewatchlet.h
@@ -0,0 +1,19 @@
+#ifndef TESTDECLARATIVEWATCHLET_H
+#define TESTDECLARATIVEWATCHLET_H
+
+#include "declarativewatchlet.h"
+
+namespace sowatch
+{
+
+class TestDeclarativeWatchlet : public DeclarativeWatchlet
+{
+ Q_OBJECT
+public:
+ explicit TestDeclarativeWatchlet(WatchServer* server);
+
+};
+
+}
+
+#endif // TESTDECLARATIVEWATCHLET_H
diff --git a/libsowatch/testwatchlet.cpp b/libsowatch/testwatchlet.cpp
new file mode 100644
index 0000000..ffc4097
--- /dev/null
+++ b/libsowatch/testwatchlet.cpp
@@ -0,0 +1,40 @@
+#include <QtCore/QDebug>
+#include <QtGui/QPainter>
+
+#include "testwatchlet.h"
+#include "watch.h"
+
+using namespace sowatch;
+
+TestWatchlet::TestWatchlet(WatchServer* server) :
+ Watchlet(server, "com.javispedro.sowatch.testwatchlet"), _timer(new QTimer(this)), _y(0)
+{
+ _timer->setInterval(50);
+ connect(_timer, SIGNAL(timeout()), SLOT(interv()));
+ connect(this, SIGNAL(activated()), SLOT(handleActivated()));
+ connect(this, SIGNAL(deactivated()), SLOT(handleDeactivated()));
+}
+
+void TestWatchlet::interv()
+{
+ QPainter p(watch());
+ //p.fillRect(8, _y, 8, 1, Qt::black);
+ _y = (_y + 1) % watch()->height();
+ p.fillRect(0, _y, _y, 2, Qt::black);
+ //p.fillRect(0, 0, watch()->width(), watch()->height(), Qt::black);
+}
+
+
+void TestWatchlet::handleActivated()
+{
+ qDebug() << "test watchlet activated";
+ QPainter p(watch());
+ p.fillRect(0, 0, watch()->width(), watch()->height(), Qt::white);
+ _timer->start();
+}
+
+void TestWatchlet::handleDeactivated()
+{
+ _timer->stop();
+ qDebug() << "test watchlet deactivated";
+}
diff --git a/libsowatch/testwatchlet.h b/libsowatch/testwatchlet.h
new file mode 100644
index 0000000..caa68da
--- /dev/null
+++ b/libsowatch/testwatchlet.h
@@ -0,0 +1,29 @@
+#ifndef TESTWATCHLET_H
+#define TESTWATCHLET_H
+
+#include <QtCore/QTimer>
+#include "watchlet.h"
+
+namespace sowatch
+{
+
+class TestWatchlet : public Watchlet
+{
+ Q_OBJECT
+public:
+ explicit TestWatchlet(WatchServer* server);
+
+protected slots:
+ void interv();
+ void handleActivated();
+ void handleDeactivated();
+
+private:
+ QTimer *_timer;
+ int _y;
+
+};
+
+}
+
+#endif // TESTWATCHLET_H
diff --git a/libsowatch/watch.cpp b/libsowatch/watch.cpp
new file mode 100644
index 0000000..e8da790
--- /dev/null
+++ b/libsowatch/watch.cpp
@@ -0,0 +1,62 @@
+#include "watch.h"
+#include "watchpaintengine.h"
+
+using namespace sowatch;
+
+Watch::Watch(const QImage& image, QObject* parent) :
+ QObject(parent), _image(image), _paintEngine(0)
+{
+
+}
+
+Watch::~Watch()
+{
+ if (_paintEngine) {
+ delete _paintEngine;
+ }
+}
+
+QPaintEngine* Watch::paintEngine() const
+{
+ if (!_paintEngine) {
+ _paintEngine = new WatchPaintEngine(const_cast<Watch*>(this),
+ const_cast<QImage*>(&_image));
+ }
+
+ return _paintEngine;
+}
+
+int Watch::metric(PaintDeviceMetric metric) const
+{
+ switch (metric) {
+ case PdmWidth:
+ return _image.width();
+ case PdmHeight:
+ return _image.height();
+ case PdmWidthMM:
+ return _image.widthMM();
+ case PdmHeightMM:
+ return _image.heightMM();
+ case PdmNumColors:
+ return _image.numColors();
+ case PdmDepth:
+ return _image.depth();
+ case PdmDpiX:
+ return _image.logicalDpiX();
+ case PdmDpiY:
+ return _image.logicalDpiY();
+ case PdmPhysicalDpiX:
+ return _image.physicalDpiX();
+ case PdmPhysicalDpiY:
+ return _image.physicalDpiY();
+ }
+
+ return -1;
+}
+
+void Watch::update(const QRect &rect)
+{
+ QList<QRect> rects;
+ rects << rect;
+ update(rects);
+}
diff --git a/libsowatch/watch.h b/libsowatch/watch.h
new file mode 100644
index 0000000..3581ada
--- /dev/null
+++ b/libsowatch/watch.h
@@ -0,0 +1,49 @@
+#ifndef WATCH_H
+#define WATCH_H
+
+#include <QtCore/QObject>
+#include <QtGui/QPaintDevice>
+#include <QtGui/QImage>
+
+namespace sowatch
+{
+
+class Watch : public QObject, public QPaintDevice
+{
+ Q_OBJECT
+ Q_PROPERTY(QString model READ model)
+ Q_PROPERTY(bool connected READ isConnected)
+public:
+ explicit Watch(const QImage& image, QObject* parent = 0);
+ ~Watch();
+
+ QPaintEngine* paintEngine() const;
+ int metric(PaintDeviceMetric metric) const;
+
+ Q_INVOKABLE virtual QString model() const = 0;
+ Q_INVOKABLE virtual bool isConnected() const = 0;
+
+ /** Indicates if watch is too busy atm and we should limit frame rate. */
+ Q_INVOKABLE virtual bool busy() const = 0;
+
+signals:
+ void connected();
+ void disconnected();
+ void buttonPressed(int button);
+ void buttonReleased(int button);
+
+public slots:
+ virtual void update(const QList<QRect>& rects) = 0;
+ virtual void update(const QRect& rect);
+ virtual void vibrate(bool on) = 0;
+
+protected:
+ QImage _image;
+ mutable QPaintEngine* _paintEngine;
+
+friend class WatchPaintEngine;
+};
+
+}
+
+#endif // WATCH_H
diff --git a/libsowatch/watchlet.cpp b/libsowatch/watchlet.cpp
new file mode 100644
index 0000000..6d7fe68
--- /dev/null
+++ b/libsowatch/watchlet.cpp
@@ -0,0 +1,44 @@
+#include "watchlet.h"
+#include "watchserver.h"
+
+using namespace sowatch;
+
+Watchlet::Watchlet(WatchServer *server, const QString& id) :
+ QObject(server), _id(id), _active(false), _server(server)
+{
+ _server->registerWatchlet(this);
+}
+
+WatchServer* Watchlet::server()
+{
+ return _server;
+}
+
+Watch* Watchlet::watch()
+{
+ return _server->watch();
+}
+
+QString Watchlet::id() const
+{
+ return _id;
+}
+
+bool Watchlet::isActive() const
+{
+ return _active;
+}
+
+void Watchlet::activate()
+{
+ _active = true;
+ emit activeChanged();
+ emit activated();
+}
+
+void Watchlet::deactivate()
+{
+ _active = false;
+ emit activeChanged();
+ emit deactivated();
+}
diff --git a/libsowatch/watchlet.h b/libsowatch/watchlet.h
new file mode 100644
index 0000000..06e43a0
--- /dev/null
+++ b/libsowatch/watchlet.h
@@ -0,0 +1,48 @@
+#ifndef WATCHLET_H
+#define WATCHLET_H
+
+#include <QtCore/QObject>
+#include "sowatch_global.h"
+
+namespace sowatch
+{
+
+class Watch;
+class WatchServer;
+
+class SOWATCH_EXPORT Watchlet : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString id READ id CONSTANT)
+ Q_PROPERTY(bool isActive READ isActive NOTIFY activeChanged)
+
+public:
+ explicit Watchlet(WatchServer *server, const QString& id);
+
+ WatchServer* server();
+ Watch* watch();
+
+ Q_INVOKABLE QString id() const;
+ Q_INVOKABLE bool isActive() const;
+
+signals:
+ void activeChanged();
+ void activated();
+ void deactivated();
+
+protected:
+ virtual void activate();
+ virtual void deactivate();
+
+ const QString _id;
+ bool _active;
+
+private:
+ WatchServer* _server;
+
+friend class WatchServer;
+};
+
+}
+
+#endif // WATCHLET_H
diff --git a/libsowatch/watchmanager.cpp b/libsowatch/watchmanager.cpp
new file mode 100644
index 0000000..b511a31
--- /dev/null
+++ b/libsowatch/watchmanager.cpp
@@ -0,0 +1,8 @@
+#include "watchmanager.h"
+
+using namespace sowatch;
+
+WatchManager::WatchManager(QObject *parent) :
+ QObject(parent)
+{
+}
diff --git a/libsowatch/watchmanager.h b/libsowatch/watchmanager.h
new file mode 100644
index 0000000..6d945ff
--- /dev/null
+++ b/libsowatch/watchmanager.h
@@ -0,0 +1,23 @@
+#ifndef WATCHMANAGER_H
+#define WATCHMANAGER_H
+
+#include <QObject>
+
+namespace sowatch
+{
+
+class WatchManager : public QObject
+{
+ Q_OBJECT
+public:
+ explicit WatchManager(QObject *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+}
+
+#endif // WATCHMANAGER_H
diff --git a/libsowatch/watchpaintengine.cpp b/libsowatch/watchpaintengine.cpp
new file mode 100644
index 0000000..18cfb60
--- /dev/null
+++ b/libsowatch/watchpaintengine.cpp
@@ -0,0 +1,305 @@
+#include <QtCore/QDebug>
+#include <math.h>
+
+#include "watch.h"
+#include "watchpaintengine.h"
+
+using namespace sowatch;
+
+WatchPaintEngine::WatchPaintEngine(Watch* watch, QImage* image)
+ : QPaintEngine(QPaintEngine::AllFeatures),
+ _watch(watch), _painter(),
+ _hasPen(false), _hasBrush(false), _clipEnabled(false)
+{
+ Q_UNUSED(image);
+}
+
+bool WatchPaintEngine::begin(QPaintDevice *pdev)
+{
+ _damaged = QRegion();
+ _watch = static_cast<Watch*>(pdev);
+
+ return _painter.begin(&_watch->_image);
+}
+
+bool WatchPaintEngine::end()
+{
+ bool ret = _painter.end();
+ if (ret) {
+ _watch->update(_damaged.rects().toList());
+ }
+ return ret;
+}
+
+void WatchPaintEngine::damageMappedRect(const QRect &r)
+{
+ if (_clipEnabled) {
+ _damaged += _clipRegion.intersected(r);
+ } else {
+ _damaged += r;
+ }
+}
+
+void WatchPaintEngine::damageRect(const QRect &r)
+{
+ damageMappedRect(_transform.mapRect(r));
+}
+
+void WatchPaintEngine::damageRect(const QRectF &r)
+{
+ damageMappedRect(_transform.mapRect(r).toRect());
+}
+
+void WatchPaintEngine::damagePenStroke(const QLineF &line)
+{
+ if (!_hasPen) return;
+
+ const qreal a = line.angle();
+ const qreal sn = sinf(a);
+ const qreal cs = cosf(a);
+ const qreal w = _penWidth = 0.0 ? 1.0 : _penWidth;
+ const qreal x1 = line.x1();
+ const qreal x2 = line.x2();
+ const qreal y1 = line.x1();
+ const qreal y2 = line.y2();
+
+ damageRect(QRectF(x1-(w*sn/2.0f), y1+(w*cs/2.0f), x2+(w*sn/2.0f), y2-(w*cs/2.0f)).normalized());
+}
+
+void WatchPaintEngine::updateClipRegion(const QRegion& region, Qt::ClipOperation op)
+{
+ switch(op) {
+ case Qt::NoClip:
+ _clipEnabled = false;
+ _clipRegion = QRegion(0, 0, _watch->width(), _watch->height());
+ break;
+ case Qt::ReplaceClip:
+ _clipEnabled = true;
+ _clipRegion = region;
+ break;
+ case Qt::IntersectClip:
+ _clipEnabled = true;
+ _clipRegion &= region;
+ break;
+ case Qt::UniteClip:
+ _clipEnabled = true;
+ _clipRegion |= region;
+ break;
+ }
+}
+
+void WatchPaintEngine::drawEllipse(const QRectF &r)
+{
+ damageRect(r);
+ _painter.drawEllipse(r);
+}
+
+void WatchPaintEngine::drawEllipse(const QRect &r)
+{
+ damageRect(r);
+ _painter.drawEllipse(r);
+}
+
+void WatchPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags)
+{
+ damageRect(r);
+ _painter.drawImage(r, pm, sr, flags);
+}
+
+void WatchPaintEngine::drawLines(const QLineF *lines, int lineCount)
+{
+ int i;
+ for (i = 0; i < lineCount; i++) {
+ const QLineF& line = lines[i];
+ damagePenStroke(line);
+ }
+ _painter.drawLines(lines, lineCount);
+}
+
+void WatchPaintEngine::drawLines(const QLine *lines, int lineCount)
+{
+ int i;
+ for (i = 0; i < lineCount; i++) {
+ const QLine& line = lines[i];
+ damagePenStroke(line);
+ }
+ _painter.drawLines(lines, lineCount);
+}
+
+void WatchPaintEngine::drawPath(const QPainterPath &path)
+{
+ damageRect(path.boundingRect());
+ _painter.drawPath(path);
+}
+
+void WatchPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
+{
+ damageRect(r);
+ _painter.drawPixmap(r, pm, sr);
+}
+
+void WatchPaintEngine::drawPoints(const QPointF *points, int pointCount)
+{
+ const qreal penWidth = _painter.pen().widthF();
+ int i;
+ for (i = 0; i < pointCount; i++) {
+ const QPointF& p = points[i];
+ damageRect(QRect(p.x() - penWidth/2, p.y() - penWidth/2,
+ p.x() + penWidth/2, p.y() + penWidth/2));
+ }
+ _painter.drawPoints(points, pointCount);
+}
+
+void WatchPaintEngine::drawPoints(const QPoint *points, int pointCount)
+{
+ const qreal penWidth = _painter.pen().widthF();
+ int i;
+ for (i = 0; i < pointCount; i++) {
+ const QPoint& p = points[i];
+ damageRect(QRect(p.x() - penWidth/2, p.y() - penWidth/2,
+ p.x() + penWidth/2, p.y() + penWidth/2));
+ }
+ _painter.drawPoints(points, pointCount);
+}
+
+void WatchPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
+{
+ QPolygonF p(pointCount);
+ int i;
+ for (i = 0; i < pointCount; i++) {
+ p[i] = points[i];
+ }
+ damageRect(p.boundingRect());
+ _painter.drawPolygon(points, pointCount,
+ mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill);
+}
+
+void WatchPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
+{
+ QPolygon p(pointCount);
+ int i;
+ for (i = 0; i < pointCount; i++) {
+ p[i] = points[i];
+ }
+ damageRect(p.boundingRect());
+ _painter.drawPolygon(points, pointCount,
+ mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill);
+}
+
+void WatchPaintEngine::drawRects(const QRectF *rects, int rectCount)
+{
+ int i;
+ for (i = 0; i < rectCount; i++) {
+ const QRectF& r = rects[i];
+ if (_hasBrush) {
+ damageRect(r);
+ }
+ if (_hasPen) {
+ damagePenStroke(QLineF(r.left(), r.top(), r.right(), r.top()));
+ damagePenStroke(QLineF(r.right(), r.top(), r.right(), r.bottom()));
+ damagePenStroke(QLineF(r.left(), r.bottom(), r.right(), r.bottom()));
+ damagePenStroke(QLineF(r.left(), r.top(), r.left(), r.bottom()));
+ }
+ }
+ _painter.drawRects(rects, rectCount);
+}
+
+void WatchPaintEngine::drawRects(const QRect *rects, int rectCount)
+{
+ int i;
+ for (i = 0; i < rectCount; i++) {
+ const QRect& r = rects[i];
+ if (_hasBrush) {
+ damageRect(r);
+ }
+ if (_hasPen) {
+ damagePenStroke(QLine(r.left(), r.top(), r.right(), r.top()));
+ damagePenStroke(QLine(r.right(), r.top(), r.right(), r.bottom()));
+ damagePenStroke(QLine(r.left(), r.bottom(), r.right(), r.bottom()));
+ damagePenStroke(QLine(r.left(), r.top(), r.left(), r.bottom()));
+ }
+ }
+
+ _painter.drawRects(rects, rectCount);
+}
+
+void WatchPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
+{
+ const qreal height = textItem.ascent() + textItem.descent();
+ damageRect(QRect(p.x(), p.y(), p.x() + textItem.width(), p.y() + height));
+ _painter.drawTextItem(p, textItem);
+}
+
+void WatchPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s)
+{
+ damageRect(r);
+ _painter.drawTiledPixmap(r, pixmap, s);
+}
+
+QPaintEngine::Type WatchPaintEngine::type() const
+{
+ return QPaintEngine::Raster;
+}
+
+void WatchPaintEngine::updateState(const QPaintEngineState &state)
+{
+ const QPaintEngine::DirtyFlags flags = state.state();
+ if (flags & QPaintEngine::DirtyBackground)
+ {
+ _painter.setBackground(state.backgroundBrush());
+ }
+ if (flags & QPaintEngine::DirtyBackgroundMode)
+ {
+ _painter.setBackgroundMode(state.backgroundMode());
+ }
+ if (flags & QPaintEngine::DirtyBrush)
+ {
+ QBrush brush = state.brush();
+ _hasBrush = brush.style() != Qt::NoBrush;
+ _painter.setBrush(brush);
+ }
+ if (flags & QPaintEngine::DirtyBrushOrigin)
+ {
+ _painter.setBrushOrigin(state.brushOrigin());
+ }
+ if (flags & QPaintEngine::DirtyClipEnabled)
+ {
+ _clipEnabled = state.isClipEnabled();
+ _painter.setClipping(_clipEnabled);
+ }
+ if (flags & QPaintEngine::DirtyClipPath)
+ {
+ QRegion region = state.clipPath().boundingRect().toRect();
+ updateClipRegion(region, state.clipOperation());
+ _painter.setClipPath(state.clipPath(), state.clipOperation());
+ }
+ if (flags & QPaintEngine::DirtyClipRegion)
+ {
+ updateClipRegion(state.clipRegion(), state.clipOperation());
+ _painter.setClipRegion(state.clipRegion(), state.clipOperation());
+ }
+ if (flags & QPaintEngine::DirtyCompositionMode)
+ {
+ _painter.setCompositionMode(state.compositionMode());
+ }
+ if (flags & QPaintEngine::DirtyFont)
+ {
+ _painter.setFont(state.font());
+ }
+ if (flags & QPaintEngine::DirtyHints)
+ {
+ _painter.setRenderHints(state.renderHints());
+ }
+ if (flags & QPaintEngine::DirtyPen)
+ {
+ QPen pen = state.pen();
+ _hasPen = pen.style() != Qt::NoPen;
+ _penWidth = pen.widthF();
+ _painter.setPen(pen);
+ }
+ if (flags & QPaintEngine::DirtyTransform)
+ {
+ _transform = state.transform();
+ _painter.setTransform(_transform);
+ }
+}
diff --git a/libsowatch/watchpaintengine.h b/libsowatch/watchpaintengine.h
new file mode 100644
index 0000000..14181fa
--- /dev/null
+++ b/libsowatch/watchpaintengine.h
@@ -0,0 +1,62 @@
+#ifndef WATCHPAINTENGINE_H
+#define WATCHPAINTENGINE_H
+
+#include <QtGui/QPaintEngine>
+
+namespace sowatch
+{
+
+class Watch;
+
+class WatchPaintEngine : public QPaintEngine
+{
+public:
+ WatchPaintEngine(Watch* watch, QImage* image);
+
+ bool begin(QPaintDevice *pdev);
+ bool end();
+
+ void drawEllipse(const QRectF &r);
+ void drawEllipse(const QRect &r);
+ void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
+ void drawLines(const QLineF *lines, int lineCount);
+ void drawLines(const QLine *lines, int lineCount);
+ void drawPath(const QPainterPath &path);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
+ void drawPoints(const QPointF *points, int pointCount);
+ void drawPoints(const QPoint *points, int pointCount);
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
+ void drawRects(const QRectF *rects, int rectCount);
+ void drawRects(const QRect *rects, int rectCount);
+ void drawTextItem(const QPointF &p, const QTextItem &textItem);
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
+
+ Type type() const;
+ void updateState(const QPaintEngineState &state);
+
+protected:
+ void damageMappedRect(const QRect& r);
+ void damageRect(const QRect& r);
+ void damageRect(const QRectF& r);
+ void damagePenStroke(const QLineF& line);
+ void updateClipRegion(const QRegion& region, Qt::ClipOperation op);
+
+ Watch* _watch;
+ QPainter _painter;
+ QRegion _damaged;
+
+ bool _hasPen;
+ qreal _penWidth;
+
+ bool _hasBrush;
+
+ bool _clipEnabled;
+ QRegion _clipRegion;
+
+ QTransform _transform;
+};
+
+}
+
+#endif // WATCHPAINTENGINE_H
diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp
new file mode 100644
index 0000000..ad49995
--- /dev/null
+++ b/libsowatch/watchserver.cpp
@@ -0,0 +1,57 @@
+#include "watch.h"
+#include "watchlet.h"
+#include "watchserver.h"
+
+using namespace sowatch;
+
+WatchServer::WatchServer(Watch* watch, QObject* parent) :
+ QObject(parent), _watch(watch), _currentWatchlet(0)
+{
+ connect(_watch, SIGNAL(connected()), SLOT(watchConnected()));
+ connect(_watch, SIGNAL(disconnected()), SLOT(watchDisconnected()));
+}
+
+Watch* WatchServer::watch()
+{
+ return _watch;
+}
+
+void WatchServer::runWatchlet(const QString& id)
+{
+ if (_currentWatchlet) {
+ closeWatchlet();
+ }
+ _currentWatchlet = watchlets[id];
+ if (_watch->isConnected()) {
+ _currentWatchlet->activate();
+ }
+}
+
+void WatchServer::closeWatchlet()
+{
+ Q_ASSERT(_currentWatchlet != 0);
+ if (_watch->isConnected()) {
+ _currentWatchlet->deactivate();
+ }
+ _currentWatchlet = 0;
+}
+
+void WatchServer::registerWatchlet(Watchlet *watchlet)
+{
+ Q_ASSERT(watchlet->_server == this);
+ watchlets[watchlet->id()] = watchlet;
+}
+
+void WatchServer::watchConnected()
+{
+ if (_currentWatchlet) {
+ _currentWatchlet->activate();
+ }
+}
+
+void WatchServer::watchDisconnected()
+{
+ if (_currentWatchlet) {
+ _currentWatchlet->deactivate();
+ }
+}
diff --git a/libsowatch/watchserver.h b/libsowatch/watchserver.h
new file mode 100644
index 0000000..78454d4
--- /dev/null
+++ b/libsowatch/watchserver.h
@@ -0,0 +1,46 @@
+#ifndef WATCHSERVER_H
+#define WATCHSERVER_H
+
+#include <QtCore/QObject>
+#include <QtCore/QMap>
+
+namespace sowatch
+{
+
+class Watch;
+class Watchlet;
+
+class WatchServer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Watch* watch READ watch)
+public:
+ explicit WatchServer(Watch* watch, QObject* parent = 0);
+
+ Watch* watch();
+
+ void runWatchlet(const QString& id);
+ void closeWatchlet();
+
+signals:
+
+public slots:
+
+protected:
+ Watch* _watch;
+ Watchlet* _currentWatchlet;
+
+ QMap<QString, Watchlet*> watchlets;
+
+ void registerWatchlet(Watchlet *watchlet);
+
+protected slots:
+ void watchConnected();
+ void watchDisconnected();
+
+friend class Watchlet;
+};
+
+}
+
+#endif // WATCHSERVER_H
diff --git a/libsowatch/watchsimulator.cpp b/libsowatch/watchsimulator.cpp
new file mode 100644
index 0000000..464f3a5
--- /dev/null
+++ b/libsowatch/watchsimulator.cpp
@@ -0,0 +1,11 @@
+#include <QtGui/QPainter>
+
+#include "watchsimulator.h"
+
+using namespace sowatch;
+
+WatchSimulator::WatchSimulator(const QImage& image, QObject* parent) :
+ Watch(image, parent)
+{
+
+}
diff --git a/libsowatch/watchsimulator.h b/libsowatch/watchsimulator.h
new file mode 100644
index 0000000..564118c
--- /dev/null
+++ b/libsowatch/watchsimulator.h
@@ -0,0 +1,20 @@
+#ifndef WATCHSIMULATOR_H
+#define WATCHSIMULATOR_H
+
+#include <QtGui/QImage>
+
+#include "watch.h"
+
+namespace sowatch
+{
+
+class WatchSimulator : public Watch
+{
+ Q_OBJECT
+public:
+ explicit WatchSimulator(const QImage& image, QObject *parent = 0);
+};
+
+}
+
+#endif // WATCHSIMULATOR_H