Lomiri
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
33public:
34 System();
35 ~System() = default;
36
40 bool wizardEnabled() const;
41
42 QString version() const;
43 bool isUpdate() const;
44
45 void setWizardEnabled(bool enabled);
46
47public Q_SLOTS:
48 void updateSessionLocale(const QString &locale);
52 void skipUntilFinishedPage();
53
54Q_SIGNALS:
55 void wizardEnabledChanged();
56 void versionChanged();
57 void isUpdateChanged();
58
59private Q_SLOTS:
60 void watcherFileChanged();
61
62private:
63 Q_DISABLE_COPY(System)
64
65 static QString wizardEnabledPath();
66 static QString currentFrameworkPath();
67 static void setSessionVariable(const QString &variable, const QString &value);
68 static void restartUnit(const QString &variable);
69 static QString readCurrentFramework();
70 static QString readWizardEnabled();
71 static bool wizardPathExists();
72
73 QFileSystemWatcher m_fsWatcher;
74};
75
76#endif