2017-03-02 10:50:31 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
|
|
|
|
|
|
|
class SysInfo : public QObject
|
|
|
|
{
|
2017-03-04 22:17:42 +01:00
|
|
|
|
2017-03-02 10:50:31 +01:00
|
|
|
public:
|
|
|
|
struct HyperionSysInfo
|
|
|
|
{
|
|
|
|
QString kernelType;
|
|
|
|
QString kernelVersion;
|
|
|
|
QString architecture;
|
|
|
|
QString wordSize;
|
2017-03-04 22:17:42 +01:00
|
|
|
QString productType;
|
|
|
|
QString productVersion;
|
|
|
|
QString prettyName;
|
|
|
|
QString hostName;
|
2017-03-21 17:55:46 +01:00
|
|
|
QString domainName;
|
2017-03-02 10:50:31 +01:00
|
|
|
};
|
|
|
|
|
2017-03-04 22:17:42 +01:00
|
|
|
~SysInfo();
|
2017-03-02 10:50:31 +01:00
|
|
|
static HyperionSysInfo get();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SysInfo();
|
2017-03-04 22:17:42 +01:00
|
|
|
|
2017-03-02 10:50:31 +01:00
|
|
|
static SysInfo* _instance;
|
|
|
|
|
|
|
|
HyperionSysInfo _sysinfo;
|
|
|
|
|
|
|
|
struct QUnixOSVersion
|
|
|
|
{
|
2017-03-04 22:17:42 +01:00
|
|
|
QString productType;
|
|
|
|
QString productVersion;
|
|
|
|
QString prettyName;
|
2017-03-02 10:50:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
QString machineHostName();
|
|
|
|
QString currentCpuArchitecture();
|
|
|
|
QString kernelType();
|
|
|
|
QString kernelVersion();
|
|
|
|
bool findUnixOsVersion(QUnixOSVersion &v);
|
|
|
|
|
|
|
|
QByteArray getEtcFileFirstLine(const char *fileName);
|
|
|
|
bool readEtcRedHatRelease(QUnixOSVersion &v);
|
|
|
|
bool readEtcDebianVersion(QUnixOSVersion &v);
|
|
|
|
|
|
|
|
bool readEtcOsRelease(SysInfo::QUnixOSVersion &v);
|
|
|
|
bool readEtcFile(SysInfo::QUnixOSVersion &v, const char *filename, const QByteArray &idKey, const QByteArray &versionKey, const QByteArray &prettyNameKey);
|
|
|
|
QByteArray getEtcFileContent(const char *filename);
|
|
|
|
QString unquote(const char *begin, const char *end);
|
|
|
|
bool readEtcLsbRelease(SysInfo::QUnixOSVersion &v);
|
|
|
|
};
|