/src/libtomahawk/LatchManager.h

http://github.com/tomahawk-player/tomahawk · C Header · 68 lines · 37 code · 13 blank · 18 comment · 0 complexity · 189397c8c5439f16338a39d67f334702 MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  4. * Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
  5. *
  6. * Tomahawk is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Tomahawk is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef LATCHMANAGER_H
  20. #define LATCHMANAGER_H
  21. #include "DllMacro.h"
  22. #include "Source.h"
  23. #include <QtCore/QObject>
  24. class QState;
  25. class QStateMachine;
  26. namespace Tomahawk
  27. {
  28. class DLLEXPORT LatchManager : public QObject
  29. {
  30. Q_OBJECT
  31. public:
  32. explicit LatchManager( QObject* parent = 0 );
  33. virtual ~LatchManager();
  34. bool isLatched( const source_ptr& src );
  35. public slots:
  36. void latchRequest( const Tomahawk::source_ptr& source );
  37. void unlatchRequest( const Tomahawk::source_ptr& source );
  38. void catchUpRequest();
  39. void latchModeChangeRequest( const Tomahawk::source_ptr& source, bool realtime );
  40. private slots:
  41. void playlistChanged( Tomahawk::playlistinterface_ptr );
  42. void audioPaused();
  43. private:
  44. enum State {
  45. NotLatched = 0,
  46. Latching,
  47. Latched
  48. };
  49. State m_state;
  50. source_ptr m_latchedOnTo;
  51. source_ptr m_waitingForLatch;
  52. playlistinterface_ptr m_latchedInterface;
  53. };
  54. }
  55. #endif // LATCHMANAGER_H