File indexing completed on 2024-04-21 16:12:23
0001 /******************************************************************* 0002 * systeminformation.h 0003 * SPDX-FileCopyrightText: 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com> 0004 * SPDX-FileCopyrightText: 2019-2022 Harald Sitter <sitter@kde.org> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 * 0008 ******************************************************************/ 0009 0010 #ifndef SYSTEMINFORMATION__H 0011 #define SYSTEMINFORMATION__H 0012 0013 #include <QObject> 0014 0015 class SystemInformation : public QObject 0016 { 0017 Q_OBJECT 0018 public: 0019 struct Config { 0020 Config(); 0021 0022 // Overrides m_operatingSystem value 0023 QString basicOperatingSystem; 0024 // Path to lsb_release executable 0025 QString lsbReleasePath; 0026 // Path to os-release file 0027 QString osReleasePath; 0028 // Function pointer to uname override 0029 void *unameFunc = nullptr; 0030 }; 0031 0032 explicit SystemInformation(Config infoConfig = Config(), QObject *parent = nullptr); 0033 ~SystemInformation() override; 0034 0035 // TODO why is this on here rather than the reportinterface. same for compiled sources. the heck 0036 Q_PROPERTY(QString bugzillaPlatform READ bugzillaPlatform WRITE setBugzillaPlatform) 0037 QString bugzillaPlatform() const; 0038 void setBugzillaPlatform(const QString &); 0039 Q_SIGNAL void bugzillaPlatformChanged(); 0040 0041 QString operatingSystem() const; 0042 QString bugzillaOperatingSystem() const; 0043 0044 QString distributionPrettyName() const; 0045 0046 Q_PROPERTY(bool compiledSources READ compiledSources WRITE setCompiledSources) 0047 bool compiledSources() const; 0048 void setCompiledSources(bool); 0049 Q_SIGNAL void compiledSourcesChanged(); 0050 0051 QString qtVersion() const; 0052 QString frameworksVersion() const; 0053 QString windowSystem() const; 0054 0055 /// All helpers finished and the data is complete 0056 bool complete() const; 0057 0058 private Q_SLOTS: 0059 void lsbReleaseFinished(); 0060 0061 private: 0062 QString fetchOSDetailInformation() const; 0063 QString fetchOSReleaseInformation(); 0064 0065 QString guessBugzillaPlatform(const QString &) const; 0066 0067 void tryToSetBugzillaPlatform(); 0068 void tryToSetBugzillaPlatformFromExternalInfo(); 0069 0070 QString m_operatingSystem; 0071 QString m_bugzillaOperatingSystem; 0072 QString m_bugzillaPlatform; 0073 0074 QString m_distributionPrettyName; 0075 0076 bool m_compiledSources; 0077 0078 bool m_complete; // all available data retrieved 0079 0080 Config m_infoConfig; 0081 }; 0082 0083 #endif