Commit db1d21f8 authored by Andrew den Exter's avatar Andrew den Exter

Merge branch 'jb33941' into 'master'

[aboutsettings] Add a softwareVersionId property to AboutSettings. Contributes to JB#33941



See merge request !4
parents 1b4980da 48d1293b
......@@ -49,9 +49,11 @@
namespace
{
QMap<QString, QString> parseReleaseFile(const QString &filename)
void parseReleaseFile(const QString &filename, QMap<QString, QString> *result)
{
QMap<QString, QString> result;
if (!result->isEmpty()) {
return;
}
// Specification of the format:
// http://www.freedesktop.org/software/systemd/man/os-release.html
......@@ -109,13 +111,11 @@ QMap<QString, QString> parseReleaseFile(const QString &filename)
// following shell style."
value = value.replace(QRegularExpression("\\\\(.)"), "\\1");
result[key] = value;
(*result)[key] = value;
}
release.close();
}
return result;
}
struct StorageInfo {
......@@ -238,12 +238,23 @@ QString AboutSettings::serial() const
QString AboutSettings::softwareVersion() const
{
return parseReleaseFile("/etc/os-release")["VERSION"];
parseReleaseFile(QStringLiteral("/etc/os-release"), &m_osRelease);
return m_osRelease["VERSION"];
}
QString AboutSettings::softwareVersionId() const
{
parseReleaseFile(QStringLiteral("/etc/os-release"), &m_osRelease);
return m_osRelease["VERSION_ID"];
}
QString AboutSettings::adaptationVersion() const
{
return parseReleaseFile("/etc/hw-release")["VERSION_ID"];
parseReleaseFile(QStringLiteral("/etc/hw-release"), &m_hardwareRelease);
return m_hardwareRelease["VERSION_ID"];
}
void AboutSettings::refreshStorageModels()
......
......@@ -47,6 +47,7 @@ class AboutSettings: public QObject
Q_PROPERTY(QString imei READ imei CONSTANT)
Q_PROPERTY(QString serial READ serial CONSTANT)
Q_PROPERTY(QString softwareVersion READ softwareVersion CONSTANT)
Q_PROPERTY(QString softwareVersionId READ softwareVersionId CONSTANT)
Q_PROPERTY(QString adaptationVersion READ adaptationVersion CONSTANT)
Q_PROPERTY(QVariant internalStorageUsageModel READ diskUsageModel NOTIFY storageChanged)
......@@ -77,6 +78,7 @@ public:
QString imei() const;
QString serial() const;
QString softwareVersion() const;
QString softwareVersionId() const;
QString adaptationVersion() const;
signals:
......@@ -89,6 +91,8 @@ private:
QVariantList m_internalStorage;
QVariantList m_externalStorage;
mutable QMap<QString, QString> m_osRelease;
mutable QMap<QString, QString> m_hardwareRelease;
};
#endif
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