Skip to content

Commit

Permalink
[nemo-qml-plugin-systemsettings] Expose available location data sourc…
Browse files Browse the repository at this point in the history
…es. Contributes to JB#33753
  • Loading branch information
Chris Adams committed Dec 21, 2018
1 parent 866bf9f commit be5e77e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/locationsettings.cpp
Expand Up @@ -79,6 +79,17 @@ namespace {
{ LocationSettings::QzssData, QStringLiteral("allowed_data_sources\\qzss") },
{ LocationSettings::SbasData, QStringLiteral("allowed_data_sources\\sbas") }
};
// TODO: in future, read this from some per-variant configuration settings file,
// e.g. if the device doesn't support gps or bluetooth or wlan etc, remove from
// the available data sources; also add GNSS constellation options in the future.
const QVector<LocationSettings::DataSource> AvailableDataSources {
LocationSettings::OnlineDataSources,
LocationSettings::DeviceSensorsData,
LocationSettings::BluetoothData,
LocationSettings::WlanData,
LocationSettings::CellTowerData,
LocationSettings::GpsData
};
}

IniFile::IniFile(const QString &fileName)
Expand Down Expand Up @@ -185,6 +196,7 @@ LocationSettingsPrivate::LocationSettingsPrivate(LocationSettings::Mode mode, Lo
, m_locationMode(LocationSettings::CustomMode)
, m_settingLocationMode(true)
, m_settingMultipleSettings(false)
, m_availableDataSources(AvailableDataSources)
, m_allowedDataSources(static_cast<LocationSettings::DataSources>(std::numeric_limits<quint32>::max()))
, m_connMan(Q_NULLPTR)
, m_gpsTech(Q_NULLPTR)
Expand Down Expand Up @@ -538,6 +550,12 @@ void LocationSettings::setLocationMode(LocationMode locationMode)
d->m_settingLocationMode = false;
}

QVector<LocationSettings::DataSource> LocationSettings::availableDataSources() const
{
Q_D(const LocationSettings);
return d->m_availableDataSources;
}

LocationSettings::DataSources LocationSettings::allowedDataSources() const
{
Q_D(const LocationSettings);
Expand Down
4 changes: 4 additions & 0 deletions src/locationsettings.h
Expand Up @@ -37,6 +37,7 @@

#include <QObject>
#include <QString>
#include <QVector>

#define LOCATION_SETTINGS_LAST_DATA_SOURCE_BIT 31

Expand All @@ -60,6 +61,7 @@ class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject

Q_PROPERTY(LocationMode locationMode READ locationMode WRITE setLocationMode NOTIFY locationModeChanged)

Q_PROPERTY(QVector<DataSource> availableDataSources READ availableDataSources CONSTANT)
Q_PROPERTY(DataSources allowedDataSources READ allowedDataSources WRITE setAllowedDataSources NOTIFY allowedDataSourcesChanged)

Q_ENUMS(OnlineAGpsState)
Expand Down Expand Up @@ -133,7 +135,9 @@ class SYSTEMSETTINGS_EXPORT LocationSettings : public QObject
};
Q_DECLARE_FLAGS(DataSources, DataSource)
Q_FLAG(DataSources)
Q_ENUM(DataSource)

QVector<DataSource> availableDataSources() const;
DataSources allowedDataSources() const;
void setAllowedDataSources(DataSources dataSources);

Expand Down
1 change: 1 addition & 0 deletions src/locationsettings_p.h
Expand Up @@ -73,6 +73,7 @@ class LocationSettingsPrivate : public QObject
LocationSettings::LocationMode m_locationMode;
bool m_settingLocationMode;
bool m_settingMultipleSettings;
QVector<LocationSettings::DataSource> m_availableDataSources;
LocationSettings::DataSources m_allowedDataSources;
NetworkManager *m_connMan;
NetworkTechnology *m_gpsTech;
Expand Down

0 comments on commit be5e77e

Please sign in to comment.