Skip to content

Commit de83a9d

Browse files
authored
Merge pull request #22 from spiiroin/jb57114_os_version
[deviceinfo] Add os and firmware information properties. Fixes JB#57114
2 parents 0493fc0 + 9c31ca3 commit de83a9d

File tree

3 files changed

+136
-3
lines changed

3 files changed

+136
-3
lines changed

rpm/nemo-qml-plugin-systemsettings.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BuildRequires: pkgconfig(libcrypto)
2929
BuildRequires: pkgconfig(nemodbus) >= 2.1.16
3030
BuildRequires: pkgconfig(libsailfishkeyprovider) >= 0.0.14
3131
BuildRequires: pkgconfig(connman-qt5) >= 1.2.38
32-
BuildRequires: pkgconfig(ssu-sysinfo) >= 1.1.0
32+
BuildRequires: pkgconfig(ssu-sysinfo) >= 1.4.0
3333
BuildRequires: pkgconfig(packagekitqt5)
3434
BuildRequires: pkgconfig(glib-2.0)
3535
BuildRequires: pkgconfig(sailfishaccesscontrol)

src/deviceinfo.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017 Jolla Ltd. <[email protected]>
2+
* Copyright (c) 2017 - 2022 Jolla Ltd.
33
*
44
* You may use this file under the terms of the BSD license as follows:
55
*
@@ -48,6 +48,9 @@ class DeviceInfoPrivate
4848
QString m_designation;
4949
QString m_manufacturer;
5050
QString m_prettyName;
51+
QString m_osName;
52+
QString m_osVersion;
53+
QString m_adaptationVersion;
5154
};
5255

5356
DeviceInfoPrivate::DeviceInfoPrivate()
@@ -76,6 +79,9 @@ DeviceInfoPrivate::DeviceInfoPrivate()
7679
m_designation = ssusysinfo_device_designation(si);
7780
m_manufacturer = ssusysinfo_device_manufacturer(si);
7881
m_prettyName = ssusysinfo_device_pretty_name(si);
82+
m_osName = ssusysinfo_os_name(si);
83+
m_osVersion = ssusysinfo_os_version(si);
84+
m_adaptationVersion = ssusysinfo_hw_version(si);
7985

8086
ssusysinfo_delete(si);
8187
}
@@ -137,3 +143,21 @@ QString DeviceInfo::prettyName() const
137143
Q_D(const DeviceInfo);
138144
return d->m_prettyName;
139145
}
146+
147+
QString DeviceInfo::osName() const
148+
{
149+
Q_D(const DeviceInfo);
150+
return d->m_osName;
151+
}
152+
153+
QString DeviceInfo::osVersion() const
154+
{
155+
Q_D(const DeviceInfo);
156+
return d->m_osVersion;
157+
}
158+
159+
QString DeviceInfo::adaptationVersion() const
160+
{
161+
Q_D(const DeviceInfo);
162+
return d->m_adaptationVersion;
163+
}

src/deviceinfo.h

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017 Jolla Ltd. <[email protected]>
2+
* Copyright (c) 2017 - 2022 Jolla Ltd.
33
*
44
* You may use this file under the terms of the BSD license as follows:
55
*
@@ -48,6 +48,9 @@ class SYSTEMSETTINGS_EXPORT DeviceInfo: public QObject
4848
Q_PROPERTY(QString designation READ designation CONSTANT)
4949
Q_PROPERTY(QString manufacturer READ manufacturer CONSTANT)
5050
Q_PROPERTY(QString prettyName READ prettyName CONSTANT)
51+
Q_PROPERTY(QString osName READ osName CONSTANT)
52+
Q_PROPERTY(QString osVersion READ osVersion CONSTANT)
53+
Q_PROPERTY(QString adaptationVersion READ adaptationVersion CONSTANT)
5154

5255
public:
5356
enum Feature {
@@ -105,12 +108,118 @@ class SYSTEMSETTINGS_EXPORT DeviceInfo: public QObject
105108
Q_INVOKABLE bool hasFeature(DeviceInfo::Feature feature) const;
106109
Q_INVOKABLE bool hasHardwareKey(Qt::Key key) const;
107110

111+
/*!
112+
* Device model
113+
*
114+
* Returns values such as:
115+
* "SbJ"
116+
* "tbj"
117+
* "l500d"
118+
* "tk7001"
119+
* "SDK"
120+
* "SDK Target"
121+
* "UNKNOWN"
122+
*
123+
* Should be functionally equivalent with:
124+
* SsuDeviceInfo::deviceModel()
125+
*/
108126
QString model() const;
127+
128+
/*!
129+
* Device base model
130+
*
131+
* If the device is not an variant and there is no base model,
132+
* returns "UNKNOWN" - otherwise return values are similar as
133+
* what can be expected from #model().
134+
*
135+
* Should be functionally equivalent with:
136+
* SsuDeviceInfo::deviceVariant(false)
137+
*/
109138
QString baseModel() const;
139+
140+
/*!
141+
* Type designation, like NCC-1701.
142+
*
143+
* Returns values such as:
144+
* "JP-1301"
145+
* "JT-1501"
146+
* "Aqua Fish"
147+
* "TK7001"
148+
* "UNKNOWN"
149+
*
150+
* Should be functionally equivalent with:
151+
* SsuDeviceInfo::displayName(Ssu::DeviceDesignation)
152+
* QDeviceInfo::productName()
153+
*/
110154
QString designation() const;
155+
156+
/*!
157+
* Manufacturer, like ACME Corp.
158+
*
159+
* Returns values such as:
160+
* "Jolla"
161+
* "Intex"
162+
* "Turing Robotic Industries"
163+
* "UNKNOWN"
164+
*
165+
* Should be functionally equivalent with:
166+
* SsuDeviceInfo::displayName(Ssu::DeviceManufacturer)
167+
* QDeviceInfo::manufacturer()
168+
*/
111169
QString manufacturer() const;
170+
171+
/*!
172+
* Marketed device name, like Pogoblaster 3000.
173+
*
174+
* Returns values such as:
175+
* "Jolla"
176+
* "Jolla Tablet"
177+
* "Intex Aqua Fish"
178+
* "Turing Phone"
179+
* "UNKNOWN"
180+
*
181+
* Should be functionally equivalent with:
182+
* SsuDeviceInfo::displayName(Ssu::Ssu::DeviceModel)
183+
* QDeviceInfo::model()
184+
*/
112185
QString prettyName() const;
113186

187+
/*!
188+
* Operating system name
189+
*
190+
* Returns values such as:
191+
* "Sailfish OS"
192+
* "UNKNOWN"
193+
*
194+
* Should be functionally equivalent with:
195+
* QDeviceInfo::operatingSystemName()
196+
*/
197+
QString osName() const;
198+
199+
/*!
200+
* Operating system version
201+
*
202+
* Returns values such as:
203+
* "4.2.0.10"
204+
* "UNKNOWN"
205+
*
206+
* Should be functionally equivalent with:
207+
* QDeviceInfo::version(Os)
208+
*/
209+
QString osVersion() const;
210+
211+
/*!
212+
* Hardware adaptation version
213+
*
214+
* Returns values such as:
215+
* "4.2.0.10"
216+
* "UNKNOWN"
217+
*
218+
* Should be functionally equivalent with:
219+
* QDeviceInfo::version(Firmware)
220+
*/
221+
QString adaptationVersion() const;
222+
114223
private:
115224

116225
DeviceInfoPrivate *d_ptr;

0 commit comments

Comments
 (0)