~ken-vandine/ubuntu-system-settings/no_s_i_d

« back to all changes in this revision

Viewing changes to tests/mocks/Ubuntu/Connectivity/MockNetworkingStatus.h

merged trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of system-settings
 
3
 *
 
4
 * Copyright (C) 2014-2016 Canonical Ltd.
 
5
 *
 
6
 * This program is free software: you can redistribute it and/or modify it
 
7
 * under the terms of the GNU General Public License version 3, as published
 
8
 * by the Free Software Foundation.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful, but
 
11
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
12
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
13
 * PURPOSE.  See the GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License along
 
16
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 *
 
18
 * Authors:
 
19
 *     Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
 
20
 */
 
21
 
 
22
#ifndef MOCK_NETWORKINGSTATUS_H
 
23
#define MOCK_NETWORKINGSTATUS_H
 
24
 
 
25
#include <QObject>
 
26
#include <QVector>
 
27
 
 
28
class Q_DECL_EXPORT MockNetworkingStatus : public QObject
 
29
{
 
30
    Q_OBJECT
 
31
    Q_DISABLE_COPY(MockNetworkingStatus)
 
32
 
 
33
    Q_ENUMS(Limitations)
 
34
    Q_ENUMS(Status)
 
35
 
 
36
    Q_PROPERTY(QVector<Limitations> limitations READ limitations NOTIFY limitationsChanged)
 
37
    Q_PROPERTY(Status status READ status NOTIFY statusChanged)
 
38
    Q_PROPERTY(bool online READ online NOTIFY onlineChanged)
 
39
    Q_PROPERTY(bool limitedBandwith READ limitedBandwith WRITE setLimitedBandwidth NOTIFY limitedBandwithChanged)
 
40
 
 
41
public:
 
42
    explicit MockNetworkingStatus(QObject *parent = 0);
 
43
    virtual ~MockNetworkingStatus();
 
44
 
 
45
    enum Limitations {
 
46
        Bandwith
 
47
    };
 
48
 
 
49
    enum Status {
 
50
        Offline,
 
51
        Connecting,
 
52
        Online
 
53
    };
 
54
 
 
55
    QVector<Limitations> limitations() const;
 
56
    Status status() const;
 
57
    bool online() const;
 
58
    bool limitedBandwith() const;
 
59
 
 
60
    void setLimitedBandwidth(bool limited); // mock only
 
61
    Q_INVOKABLE void setStatus(Status status); // mock only
 
62
 
 
63
Q_SIGNALS:
 
64
    void limitationsChanged();
 
65
    void statusChanged(Status value);
 
66
    void onlineChanged(bool value);
 
67
    void limitedBandwithChanged(bool value);
 
68
 
 
69
private:
 
70
    QVector<MockNetworkingStatus::Limitations> m_limitations;
 
71
    Status m_status;
 
72
};
 
73
 
 
74
Q_DECLARE_METATYPE(MockNetworkingStatus::Limitations)
 
75
Q_DECLARE_METATYPE(QVector<MockNetworkingStatus::Limitations>)
 
76
Q_DECLARE_METATYPE(MockNetworkingStatus::Status)
 
77
 
 
78
#endif // MOCK_NETWORKINGSTATUS_H