Commit 26f20480 authored by spiiroin's avatar spiiroin

[deviceinfo] Add model and manufacturer related properties. JB#42860

Allows lightweight access to model and manufacturer related information
without doing D-Bus IPC potentially requiring starting of SSU daemon.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 2b8b1c69
......@@ -43,6 +43,11 @@ public:
QSet<DeviceInfo::Feature> m_features;
QSet<Qt::Key> m_keys;
QString m_model;
QString m_baseModel;
QString m_designation;
QString m_manufacturer;
QString m_prettyName;
};
DeviceInfoPrivate::DeviceInfoPrivate()
......@@ -65,6 +70,13 @@ DeviceInfoPrivate::DeviceInfoPrivate()
free(keys);
}
/* Note: These queries always return non-null C string */
m_model = ssusysinfo_device_model(si);
m_baseModel = ssusysinfo_device_base_model(si);
m_designation = ssusysinfo_device_designation(si);
m_manufacturer = ssusysinfo_device_manufacturer(si);
m_prettyName = ssusysinfo_device_pretty_name(si);
ssusysinfo_delete(si);
}
......@@ -95,3 +107,33 @@ bool DeviceInfo::hasHardwareKey(Qt::Key key) const
Q_D(const DeviceInfo);
return d->m_keys.contains(key);
}
QString DeviceInfo::model() const
{
Q_D(const DeviceInfo);
return d->m_model;
}
QString DeviceInfo::baseModel() const
{
Q_D(const DeviceInfo);
return d->m_baseModel;
}
QString DeviceInfo::designation() const
{
Q_D(const DeviceInfo);
return d->m_designation;
}
QString DeviceInfo::manufacturer() const
{
Q_D(const DeviceInfo);
return d->m_manufacturer;
}
QString DeviceInfo::prettyName() const
{
Q_D(const DeviceInfo);
return d->m_prettyName;
}
......@@ -43,6 +43,11 @@ class DeviceInfoPrivate;
class SYSTEMSETTINGS_EXPORT DeviceInfo: public QObject
{
Q_OBJECT
Q_PROPERTY(QString model READ model CONSTANT)
Q_PROPERTY(QString baseModel READ baseModel CONSTANT)
Q_PROPERTY(QString designation READ designation CONSTANT)
Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
Q_PROPERTY(QString prettyName READ prettyName CONSTANT)
public:
enum Feature {
......@@ -100,6 +105,12 @@ public:
Q_INVOKABLE bool hasFeature(DeviceInfo::Feature feature) const;
Q_INVOKABLE bool hasHardwareKey(Qt::Key key) const;
QString model() const;
QString baseModel() const;
QString designation() const;
QString manufacturer() const;
QString prettyName() const;
private:
DeviceInfoPrivate *d_ptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment