on e2ced2d help sign in
unity8/tests/mocks/Ubuntu/SystemImage/MockSystemImage.h
56 lines 1.8 kB history raw
1/*
2 * Copyright (C) 2014-2016 Canonical, Ltd.
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; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef MOCK_SYSTEMIMAGE_H
18#define MOCK_SYSTEMIMAGE_H
20#include <QObject>
22class MockSystemImage : public QObject
24 Q_OBJECT
25 Q_DISABLE_COPY(MockSystemImage)
27 Q_PROPERTY(bool updateDownloaded READ updateDownloaded CONSTANT)
28 Q_PROPERTY(QString availableVersion READ availableVersion CONSTANT)
29 Q_PROPERTY(QString updateSize READ updateSize CONSTANT)
30 Q_PROPERTY(bool updateApplying READ updateApplying NOTIFY updateApplyingChanged)
32public:
33 explicit MockSystemImage(QObject *parent = nullptr);
35 Q_INVOKABLE void checkForUpdate();
36 Q_INVOKABLE void applyUpdate();
37 Q_INVOKABLE void factoryReset();
39 bool updateApplying() const { return m_updateApplying; }
40 // these are const only in mock
41 bool updateDownloaded() const { return true; }
42 QString availableVersion() const { return QStringLiteral("42"); }
43 QString updateSize() const { return QStringLiteral("4.2 MB"); }
45Q_SIGNALS:
46 void resettingDevice(); // only for mock
47 void updateApplyingChanged();
49private Q_SLOTS:
50 void setUpdateApplying(bool status);
52private:
53 bool m_updateApplying = false;
54};
56#endif // MOCK_SYSTEMIMAGE_H