Unity 8
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 
26 class 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 
33 public:
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 
47 public Q_SLOTS:
48  void updateSessionLocale(const QString &locale);
52  void skipUntilFinishedPage();
53 
54 Q_SIGNALS:
55  void wizardEnabledChanged();
56  void versionChanged();
57  void isUpdateChanged();
58 
59 private Q_SLOTS:
60  void watcherFileChanged();
61 
62 private:
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 QString readCurrentFramework();
69  static QString readWizardEnabled();
70  static bool wizardPathExists();
71 
72  QFileSystemWatcher m_fsWatcher;
73 };
74 
75 #endif