コード例 #1
0
/*!
    Creates and returns a source with the specified \a parent that reads
    from the system's default source of satellite update information, or the
    highest priority available plugin.

    Returns 0 if the system has no default satellite source, no valid plugins
    could be found or the user does not have the permission to access the satellite data.
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
{
    QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
    foreach (const QJsonObject &obj, plugins) {
        if (obj.value(QStringLiteral("Satellite")).isBool()
                && obj.value(QStringLiteral("Satellite")).toBool())
        {
            const QString testableKey = QStringLiteral("Testable");
            if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
                static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
                if (inTest)
                    continue;
            }
            QGeoPositionInfoSourcePrivate d;
            d.metaData = obj;
            d.loadPlugin();
            QGeoSatelliteInfoSource *s = 0;
            if (d.factory)
                s = d.factory->satelliteInfoSource(parent);
            if (s)
                s->d->providerName = d.metaData.value(QStringLiteral("Provider")).toString();
            return s;
        }
    }

    return 0;
}
コード例 #2
0
/*!
    Creates and returns a source with the given \a parent,
    by loading the plugin named \a sourceName.

    Returns 0 if the plugin cannot be found.
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &sourceName, QObject *parent)
{
    QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
    QHash<QString, QJsonObject> plugins = QGeoPositionInfoSourcePrivate::plugins();
    if (plugins.contains(sourceName)) {
        d->metaData = plugins.value(sourceName);
        d->loadPlugin();
        QGeoSatelliteInfoSource *src = d->factory->satelliteInfoSource(parent);
        if (src) {
            delete d;
            return src;
        }
    }

    delete d;
    return 0;
}
コード例 #3
0
/*!
    Creates and returns a source with the given \a parent,
    by loading the plugin named \a sourceName.

    Returns 0 if the plugin cannot be found.
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createSource(const QString &sourceName, QObject *parent)
{
    QHash<QString, QJsonObject> plugins = QGeoPositionInfoSourcePrivate::plugins();
    if (plugins.contains(sourceName)) {
        QGeoPositionInfoSourcePrivate d;
        d.metaData = plugins.value(sourceName);
        d.loadPlugin();
        QGeoSatelliteInfoSource *src = 0;
        if (d.factory)
            src = d.factory->satelliteInfoSource(parent);
        if (src)
            src->d->providerName = d.metaData.value(QStringLiteral("Provider")).toString();
        return src;
    }

    return 0;
}
コード例 #4
0
/*!
    Creates and returns a source with the specified \a parent that reads
    from the system's default source of satellite update information, or the
    highest priority available plugin.

    Returns 0 if the system has no default position source, no valid plugins
    could be found or the user does not have the permission to access the satellite data.
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
{
    QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;

    QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
    foreach (const QJsonObject &obj, plugins) {
        if (obj.value(QStringLiteral("Satellite")).isBool()
                && obj.value(QStringLiteral("Satellite")).toBool()) {
            d->metaData = obj;
            d->loadPlugin();
            QGeoSatelliteInfoSource *s = d->factory->satelliteInfoSource(parent);
            if (s) {
                delete d;
                return s;
            }
        }
    }

    delete d;
    return 0;
}
コード例 #5
0
/*!
    Creates and returns a source with the specified \a parent that reads
    from the system's default source of satellite update information, or the
    highest priority available plugin.

    Returns 0 if the system has no default satellite source, no valid plugins
    could be found or the user does not have the permission to access the satellite data.
*/
QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *parent)
{
    QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
    foreach (const QJsonObject &obj, plugins) {
        if (obj.value(QStringLiteral("Satellite")).isBool()
                && obj.value(QStringLiteral("Satellite")).toBool())
        {
            QGeoPositionInfoSourcePrivate d;
            d.metaData = obj;
            d.loadPlugin();
            QGeoSatelliteInfoSource *s = 0;
            if (d.factory)
                s = d.factory->satelliteInfoSource(parent);
            if (s)
                s->d->providerName = d.metaData.value(QStringLiteral("Provider")).toString();
            return s;
        }
    }

    return 0;
}