PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

/thirdparty/liblastfm2/src/ws/NetworkConnectionMonitor.cpp

http://github.com/tomahawk-player/tomahawk
C++ | 51 lines | 25 code | 7 blank | 19 comment | 3 complexity | 34663224bec6b530721ba113820a0074 MD5 | raw file
 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
23NetworkConnectionMonitor::NetworkConnectionMonitor( QObject* /*parent*/ )
24    : m_connected( true )
25{
26}
27
28NetworkConnectionMonitor::~NetworkConnectionMonitor()
29{
30}
31
32bool
33NetworkConnectionMonitor::isConnected() const
34{
35    return m_connected;
36}
37
38void
39NetworkConnectionMonitor::setConnected( bool connected )
40{
41    if ( m_connected != connected )
42    {
43        m_connected = connected;
44
45        if ( connected )
46            emit networkUp();
47        else
48            emit networkDown();
49    }
50}
51