/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. This file is part of liblastfm.
  5. liblastfm is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. liblastfm is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with liblastfm. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "NetworkConnectionMonitor.h"
  17. NetworkConnectionMonitor::NetworkConnectionMonitor( QObject* /*parent*/ )
  18. : m_connected( true )
  19. {
  20. }
  21. NetworkConnectionMonitor::~NetworkConnectionMonitor()
  22. {
  23. }
  24. bool
  25. NetworkConnectionMonitor::isConnected() const
  26. {
  27. return m_connected;
  28. }
  29. void
  30. NetworkConnectionMonitor::setConnected( bool connected )
  31. {
  32. if ( m_connected != connected )
  33. {
  34. m_connected = connected;
  35. if ( connected )
  36. emit networkUp();
  37. else
  38. emit networkDown();
  39. }
  40. }