Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeosatelliteinfosource.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
7#include <QPluginLoader>
8#include <QStringList>
9#include <QCryptographicHash>
10#include <QtCore/private/qfactoryloader_p.h>
11#include <QFile>
12
14
63
68
74
81
89{
90 Q_D(const QGeoSatelliteInfoSource);
91 return d->providerName;
92}
93
94
118{
120 d->interval = msec;
121}
122
124{
125 Q_D(const QGeoSatelliteInfoSource);
126 return d->interval.value();
127}
128
130{
132 return QBindable<int>(&d->interval);
133}
134
145{
148 return false;
149}
150
163
165{
166 QGeoSatelliteInfoSource *s = nullptr;
168 if (factory)
169 s = factory->satelliteInfoSource(parent, parameters);
170 if (s)
171 s->d_func()->providerName = meta.value(QStringLiteral("Provider")).toString();
172
173 return s;
174}
175
189
200
215{
216 const QList<QCborMap> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
217 for (const QCborMap &obj : plugins) {
218 if (obj.value(QStringLiteral("Satellite")).isBool()
219 && obj.value(QStringLiteral("Satellite")).toBool())
220 {
221 const QString testableKey = QStringLiteral("Testable");
222 if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
223 static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
224 if (inTest)
225 continue;
226 }
228 }
229 }
230
231 return nullptr;
232}
233
245{
247 if (plugins.contains(sourceName))
248 return QGeoSatelliteInfoSourcePrivate::createSourceReal(plugins.value(sourceName), parameters, parent);
249 return nullptr;
250}
251
257{
258 QStringList plugins;
259 const auto meta = QGeoPositionInfoSourcePrivate::plugins();
260 for (auto it = meta.cbegin(), end = meta.cend(); it != end; ++it) {
261 if (it.value().value(QStringLiteral("Satellite")).isBool()
262 && it.value().value(QStringLiteral("Satellite")).toBool()) {
263 plugins << it.key();
264 }
265 }
266
267 return plugins;
268}
269
389
390#include "moc_qgeosatelliteinfosource.cpp"
\inmodule QtCore\reentrant
Definition qcbormap.h:21
QCborValue value(qint64 key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
Definition qcbormap.h:248
QString toString(const QString &defaultValue={}) const
Returns the string value stored in this QCborValue, if it is of the string type.
static QMultiHash< QString, QCborMap > plugins(bool reload=false)
static QList< QCborMap > pluginsSorted()
static QGeoPositionInfoSourceFactory * loadFactory(const QCborMap &meta)
static QGeoSatelliteInfoSource * createSourceReal(const QCborMap &meta, const QVariantMap &parameters, QObject *parent)
virtual ~QGeoSatelliteInfoSourcePrivate()
Creates a satellite source with the specified parent.
\inmodule QtPositioning
virtual ~QGeoSatelliteInfoSource()
Destroys the satellite source.
static QStringList availableSources()
Returns a list of available source plugins, including the default system backend if one is available.
virtual QVariant backendProperty(const QString &name) const
virtual bool setBackendProperty(const QString &name, const QVariant &value)
static QGeoSatelliteInfoSource * createSource(const QString &sourceName, QObject *parent)
Creates and returns a source with the given parent, by loading the plugin named sourceName.
virtual void setUpdateInterval(int msec)
QBindable< int > bindableUpdateInterval()
QString sourceName() const
Returns the unique name of the satellite source implementation in use.
static QGeoSatelliteInfoSource * createDefaultSource(QObject *parent)
Creates and returns a source with the specified parent that reads from the system's default source of...
int updateInterval
This property holds the requested interval in milliseconds between each update.
QObject * parent
Definition qobject.h:73
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
const_iterator cbegin() const noexcept
Definition qset.h:138
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QMap< QString, QVariant > QVariantMap
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint GLuint end
GLuint name
GLhandleARB obj
[2]
GLdouble s
[6]
Definition qopenglext.h:235
#define QStringLiteral(str)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
#define Q_UNUSED(x)
QItemEditorFactory * factory