Exemple #1
0
STDMETHODIMP HostWrap::COMGETTER(OperatingSystem)(BSTR *aOperatingSystem)
{
    LogRelFlow(("{%p} %s: enter aOperatingSystem=%p\n", this, "Host::getOperatingSystem", aOperatingSystem));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        CheckComArgOutPointerValidThrow(aOperatingSystem);

        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = getOperatingSystem(BSTROutConverter(aOperatingSystem).str());
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave *aOperatingSystem=%ls hrc=%Rhrc\n", this, "Host::getOperatingSystem", *aOperatingSystem, hrc));
    return hrc;
}
Exemple #2
0
int main(int argc, char *argv[])
{
    bool simulator = isSimulator();

    //expose an enum of operating systems types to QML
    qmlRegisterUncreatableType<OperatingSystem>("OperatingSystem", 1, 0, "OperatingSystem", "");
    int OperatingSystemId = getOperatingSystem();

    //expose an enum of windowing system types to QML
    qmlRegisterUncreatableType<WindowingSystem>("WindowingSystem", 1, 0, "WindowingSystem", "");
    int WindowingSystemId = getWindowingSystem();

    /*
    QT Simulator running on OSX gives:
    simulator is : true
    operating system is : Mac64 --> Q_OS_MAC64
    windowing system is : Simulator --> Q_WS_SIMULATOR)

    SailfishOS Emulator hosted on OSX gives:
    simulator is : false
    operating system is : Unix --> Q_OS_UNIX
    windowing system is : X11 --> Q_WS_X11

    Nokia N9 Harmattan gives:
    simulator is : false
    operating system is : Unix --> Q_OS_UNIX
    windowing system is : X11 --> Q_WS_X11
    */

//TODO: if both harmattan and sailfish import to QML as Torch, and offer the same apis
//then we can hide from the QML code that we are using 2 different C++ implementations!
    //qmlRegisterType<LandedTorch>("LandedTorch",1,0,"LandedTorch"); //harmattan
    qmlRegisterType<GstTorch>("GstTorch",1,0,"GstTorch");
    qmlRegisterType<TelepathyHelper>("TelepathyHelper",1,0,"TelepathyHelper");
    qmlRegisterType<SatInfoSource>("SatInfoSource",1,0,"SatInfoSource");
    qmlRegisterSingletonType<LandedTheme>("LandedTheme", 1, 0, "LandedTheme", theme_singletontype_provider);
    qmlRegisterSingletonType<JSONStorage>("JSONStorage",1,0,"JSONStorage", jsonStorage_singletontype_provider);

    QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
    QScopedPointer<QQuickView> view(SailfishApp::createView());

    view->rootContext()->setContextProperty("OperatingSystemId",  OperatingSystemId);
    view->rootContext()->setContextProperty("WindowingSystemId",  WindowingSystemId);
    view->rootContext()->setContextProperty("simulator",  simulator);

    //change the directory where the shared DB is stored, Sailfish as standard stores in the application install directory
    //Landed shared the LocalStorage DB with LandedSettings
    qDebug() << "offlineStoragPath orig: " << view->engine()->offlineStoragePath();
    QString storagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString(), QStandardPaths::LocateDirectory) + "landedcommon";
    view->engine()->setOfflineStoragePath(storagePath);
    qDebug() << "offlineStoragPath new: " << view->engine()->offlineStoragePath();

    view->setSource(SailfishApp::pathTo("qml/landed26_QT5.qml"));
    view->show();
    view->showFullScreen();
    return app->exec();

}
Exemple #3
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{

    bool simulator = isSimulator();

    //expose an enum of operating systems types to QML
    qmlRegisterUncreatableType<OperatingSystem>("OperatingSystem", 1, 0, "OperatingSystem", "");
    int OperatingSystemId = getOperatingSystem();

    //expose an enum of windowing system types to QML
    qmlRegisterUncreatableType<WindowingSystem>("WindowingSystem", 1, 0, "WindowingSystem", "");
    int WindowingSystemId = getWindowingSystem();

    /*
    QT Simulator running on OSX gives:
    simulator is : true
    operating system is : Mac64 --> Q_OS_MAC64
    windowing system is : Simulator --> Q_WS_SIMULATOR)

    SailfishOS Emulator hosted on OSX gives:
    simulator is : false
    operating system is : Unix --> Q_OS_UNIX
    windowing system is : X11 --> Q_WS_X11

    Nokia N9 Harmattan gives:
    simulator is : false
    operating system is : Unix --> Q_OS_UNIX
    windowing system is : X11 --> Q_WS_X11
    */

    QScopedPointer<QApplication> app(createApplication(argc, argv));

    qmlRegisterType<TelepathyHelper>("TelepathyHelper",1,0,"TelepathyHelper");
    qmlRegisterType<LandedTorch>("LandedTorch",1,0,"LandedTorch");
    qmlRegisterType<SatInfoSource>("SatInfoSource",1,0,"SatInfoSource");

    QmlApplicationViewer viewer;
    viewer.rootContext()->setContextProperty("OperatingSystemId",  OperatingSystemId);
    viewer.rootContext()->setContextProperty("WindowingSystemId",  WindowingSystemId);
    viewer.rootContext()->setContextProperty("simulator",  simulator);
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/landed25/main.qml"));
    viewer.showExpanded();

    return app->exec();
}