summaryrefslogtreecommitdiff
path: root/rockworkd/platformintegration/testing/testingplatform.cpp
blob: aa0c45adab5624d0e8ecf658e745dc1ceb86848f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "testingplatform.h"

#include <QQuickView>
#include <QDebug>
#include <QQmlContext>

TestingPlatform::TestingPlatform(QObject *parent):
    PlatformInterface(parent)
{
    m_view = new QQuickView();
    m_view->rootContext()->setContextProperty("handler", this);
    qmlRegisterUncreatableType<Pebble>("PebbleTest", 1, 0, "Pebble", "Dont");
    m_view->setSource(QUrl("qrc:///testui/Main.qml"));
    m_view->show();
}

void TestingPlatform::sendMusicControlCommand(MusicControlButton command)
{
    qDebug() << "Testing platform received music command from pebble" << command;
}

MusicMetaData TestingPlatform::musicMetaData() const
{
    return MusicMetaData("TestArtist", "TestAlbum", "TestTitle");
}

void TestingPlatform::sendNotification(int type, const QString &from, const QString &subject, const QString &text)
{
    qDebug() << "Injecting mock notification" << type;
    Notification n("test_app_" + QString::number(type));
    n.setSourceName("Test button " + QString::number(type));
    n.setSender(from);
    n.setSubject(subject);
    n.setBody(text);
    n.setActToken("tralala");
    emit notificationReceived(n);
}

void TestingPlatform::fakeIncomingCall(uint cookie, const QString &number, const QString &name)
{
    emit incomingCall(cookie, number, name);
}

void TestingPlatform::endCall(uint cookie, bool missed)
{
    emit callEnded(cookie, missed);
}

void TestingPlatform::hangupCall(uint cookie)
{
    qDebug() << "Testing platform received a hangup call event";
    emit callEnded(cookie, false);
}

QList<CalendarEvent> TestingPlatform::organizerItems() const
{
    return QList<CalendarEvent>();
}

void TestingPlatform::actionTriggered(const QString &actToken)
{
    qDebug() << "action triggered" << actToken;
}