summaryrefslogtreecommitdiff
path: root/SDL_Core/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.cpp
blob: a89d1efcb4cc11cda1b786b3a1e97ed3d340fa0a (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
#include "fordsdlcore_plugin.h"
#include "smartdevicelink.h"
#include <QDebug>
#include <qqml.h>
#include "sdlalert.h"
#include <QQmlEngine>
#include <QQmlContext>

QObject* sdlSingleton(QQmlEngine * engine, QJSEngine * js) {
    Q_UNUSED(engine)
    Q_UNUSED(js)

    engine->rootContext()->setContextProperty("MediaApps", SmartDeviceLink::getInstance().getMediaApps());

    return (QObject *) &SmartDeviceLink::getInstance();
}

QObject* mediaAppsSingleton(QQmlEngine * engine, QJSEngine * js) {
    Q_UNUSED(engine)
    Q_UNUSED(js)

    return (QObject *) SmartDeviceLink::getInstance().getMediaApps();
}

void FordSdlCorePlugin::registerTypes(const char *uri)
{
    qmlRegisterSingletonType<SdlAppsListModel>(uri, 1, 0, "MediaApps", mediaAppsSingleton);
    qmlRegisterSingletonType<SmartDeviceLink>(uri, 1, 0, "AppLink", sdlSingleton);
}