1 /* 2 Copyright 2010 Last.fm Ltd. 3 - Primarily authored by Max Howell, Jono Cole and Doug Mansell 4 5 This file is part of liblastfm. 6 7 liblastfm is free software: you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation, either version 3 of the License, or 10 (at your option) any later version. 11 12 liblastfm is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with liblastfm. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include "NetworkConnectionMonitor.h" 22 23 class lastfm::NetworkConnectionMonitorPrivate 24 { 25 public: 26 bool connected; 27 }; 28 NetworkConnectionMonitor(QObject *)29lastfm::NetworkConnectionMonitor::NetworkConnectionMonitor( QObject* /*parent*/ ) 30 : d( new NetworkConnectionMonitorPrivate ) 31 { 32 d->connected = true; 33 } 34 ~NetworkConnectionMonitor()35lastfm::NetworkConnectionMonitor::~NetworkConnectionMonitor() 36 { 37 delete d; 38 } 39 40 bool isConnected() const41lastfm::NetworkConnectionMonitor::isConnected() const 42 { 43 return d->connected; 44 } 45 46 void setConnected(bool connected)47lastfm::NetworkConnectionMonitor::setConnected( bool connected ) 48 { 49 if ( d->connected != connected ) 50 { 51 d->connected = connected; 52 53 if ( connected ) 54 emit networkUp(); 55 else 56 emit networkDown(); 57 } 58 } 59 60