Lomiri
Loading...
Searching...
No Matches
System.h
1/*
2 * Copyright (C) 2018 The UBports project
3 * Copyright (C) 2014-2016 Canonical Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 3, as published
7 * by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranties of
11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef WIZARD_SYSTEM_H
19#define WIZARD_SYSTEM_H
20
21#include <QFileSystemWatcher>
22#include <QVersionNumber>
23#include <QObject>
24#include <QString>
25
26class System : public QObject
27{
28 Q_OBJECT
29 Q_PROPERTY(bool wizardEnabled READ wizardEnabled WRITE setWizardEnabled NOTIFY wizardEnabledChanged)
30 Q_PROPERTY(QString version READ version NOTIFY versionChanged)
31 Q_PROPERTY(bool isUpdate READ isUpdate NOTIFY isUpdateChanged)
32 Q_PROPERTY(QString distroName READ distroName CONSTANT)
33
34public:
35 System();
36 ~System() = default;
37
41 bool wizardEnabled() const;
42
43 QString version() const;
44 bool isUpdate() const;
45 QString distroName() const;
46
47 void setWizardEnabled(bool enabled);
48
49public Q_SLOTS:
50 void updateSessionLocale(const QString &locale);
54 void skipUntilFinishedPage();
55
56Q_SIGNALS:
57 void wizardEnabledChanged();
58 void versionChanged();
59 void isUpdateChanged();
60
61private Q_SLOTS:
62 void watcherFileChanged();
63
64private:
65 Q_DISABLE_COPY(System)
66
67 static QString wizardEnabledPath();
68 static QString currentFrameworkPath();
69 static void setSessionVariable(const QString &variable, const QString &value);
70 static void restartUnit(const QString &variable);
71 static QString readCurrentFramework();
72 static QString readWizardEnabled();
73 static bool wizardPathExists();
74
75 QFileSystemWatcher m_fsWatcher;
76};
77
78#endif