qmlFrontend/hwengine.cpp
branchqmlfrontend
changeset 10404 1baaab44a0b2
parent 10402 3313336c1ee0
child 10416 1c301054694d
equal deleted inserted replaced
10402:3313336c1ee0 10404:1baaab44a0b2
     1 #include <QLibrary>
     1 #include <QLibrary>
     2 #include <QtQml>
     2 #include <QtQml>
       
     3 #include <QDebug>
     3 
     4 
     4 #include "hwengine.h"
     5 #include "hwengine.h"
     5 
     6 
     6 extern "C" {
     7 extern "C" {
     7     void (*RunEngine)(int argc, char ** argv);
     8     void (*RunEngine)(int argc, char ** argv);
     8 }
     9 }
     9 
    10 
    10 HWEngine::HWEngine(QObject *parent) :
    11 HWEngine::HWEngine(QObject *parent) :
    11     QObject(parent)
    12     QObject(parent)
    12 {
    13 {
    13     QLibrary hwlib("hwengine");
    14     QLibrary hwlib("./libhwengine.so");
    14 
    15 
    15     if(!hwlib.load())
    16     if(!hwlib.load())
    16         qWarning("Engine library not found");
    17         qWarning() << "Engine library not found" << hwlib.errorString();
    17 
    18 
    18     RunEngine = (void (*)(int, char **))hwlib.resolve("RunEngine");
    19     RunEngine = (void (*)(int, char **))hwlib.resolve("RunEngine");
    19 }
    20 }
    20 
    21 
    21 HWEngine::~HWEngine()
    22 HWEngine::~HWEngine()
    23 
    24 
    24 }
    25 }
    25 
    26 
    26 void HWEngine::run()
    27 void HWEngine::run()
    27 {
    28 {
    28     RunEngine(0, nullptr);
    29     char* args[2] = {"", "--help"};
       
    30     RunEngine(2, args);
    29 }
    31 }
    30 
    32 
    31 static QObject *hwengine_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
    33 static QObject *hwengine_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
    32 {
    34 {
    33     Q_UNUSED(engine)
    35     Q_UNUSED(engine)