summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.cpp
blob: 003b098d47c55418b582697ad21b6b9168230c13 (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
#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);
}