Debian Codegraph @

src/common/platform/PlatformChecker.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2017 Damir Porobic <https://github.com/damirporobic>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
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 // KSNIP_PLATFORMCHECKER_H