| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef KSNIP_PLATFORMCHECKER_H |
| 21 |
#define KSNIP_PLATFORMCHECKER_H |
| 22 |
|
| 23 |
#include <QString> |
| 24 |
#include <QRegularExpression> |
| 25 |
#include <QSharedPointer> |
| 26 |
#include <QProcess> |
| 27 |
|
| 28 |
#include "IPlatformChecker.h" |
| 29 |
#include "ICommandRunner.h" |
| 30 |
#include "src/common/enum/Platform.h" |
| 31 |
#include "src/common/enum/Environment.h" |
| 32 |
#include "src/common/enum/PackageManager.h" |
| 33 |
|
| 34 |
class PlatformChecker : public IPlatformChecker |
| 35 |
{ |
| 36 |
public: |
| 37 |
explicit PlatformChecker(const QSharedPointer<ICommandRunner> &commandRunner); |
| 38 |
~PlatformChecker() override = default; |
| 39 |
|
| 40 |
bool isX11() override; |
| 41 |
bool isWayland() override; |
| 42 |
bool isKde() override; |
| 43 |
bool isGnome() override; |
| 44 |
bool isSnap() override; |
| 45 |
int gnomeVersion() override; |
| 46 |
|
| 47 |
private: |
| 48 |
QSharedPointer<ICommandRunner> mCommandRunner; |
| 49 |
Platform mPlatform; |
| 50 |
Environment mEnvironment; |
| 51 |
PackageManager mPackageManager; |
| 52 |
int mGnomeVersion; |
| 53 |
bool mIsPlatformChecked; |
| 54 |
bool mIsEnvironmentChecked; |
| 55 |
bool mIsPacketManagerChecked; |
| 56 |
bool mIsGnomeVersionChecked; |
| 57 |
|
| 58 |
void checkPlatform(); |
| 59 |
void checkEnvironment(); |
| 60 |
void checkPackageManager(); |
| 61 |
static bool outputContainsValue(const QString& output, const QString& value); |
| 62 |
void checkVersion(); |
| 63 |
}; |
| 64 |
|
| 65 |
#endif |