/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #ifndef FAKE_NETWORKING_STATUS_H #define FAKE_NETWORKING_STATUS_H #include #include class Q_DECL_EXPORT NetworkingStatus : public QObject { Q_OBJECT Q_DISABLE_COPY(NetworkingStatus) Q_PROPERTY(QVector limitations READ limitations NOTIFY limitationsChanged) Q_PROPERTY(Status status READ status WRITE setStatus NOTIFY statusChanged) Q_PROPERTY(bool online READ online NOTIFY onlineChanged) Q_PROPERTY(bool limitedBandwidth READ limitedBandwidth WRITE setLimitedBandwidth NOTIFY limitedBandwidthChanged) public: explicit NetworkingStatus(QObject *parent = 0); virtual ~NetworkingStatus(); enum Limitations { Bandwidth }; Q_ENUM(Limitations) enum Status { Offline, Connecting, Online }; Q_ENUM(Status) QVector limitations() const; NetworkingStatus::Status status() const; bool online() const; bool limitedBandwidth() const; // Only in the fake one void setLimitedBandwidth(bool limited); void setStatus(NetworkingStatus::Status status); Q_SIGNALS: void limitationsChanged(); void statusChanged(NetworkingStatus::Status status); void onlineChanged(bool value); void limitedBandwidthChanged(bool value); private: QVector m_limitations; NetworkingStatus::Status m_status; }; Q_DECLARE_METATYPE(NetworkingStatus::Limitations) Q_DECLARE_METATYPE(QVector) Q_DECLARE_METATYPE(NetworkingStatus::Status) #endif // FAKE_NETWORKING_STATUS_H