playlist.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. Copyright (C) 2025 mio <stigma@disroot.org>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. */
  14. #ifndef PLAYLIST_H
  15. #define PLAYLIST_H
  16. #include <tqobject.h>
  17. #include <kurl.h>
  18. class Playlist : public TQObject
  19. {
  20. TQ_OBJECT
  21. public:
  22. explicit Playlist(TQObject *parent = nullptr);
  23. ~Playlist();
  24. /*! Add a new item */
  25. void append(const KURL& mrl);
  26. /*! Append multiple items to the playist. */
  27. void append(const KURL::List& items);
  28. /*! Is the playlist empty */
  29. bool isEmpty() const;
  30. /*! Returns the number of items in the playlist. */
  31. int count() const;
  32. /*! Returns the index of the current item in the playlist. */
  33. int currentIndex() const;
  34. /*! Returns the current item in the playlist. */
  35. KURL currentItem() const;
  36. /*! The MRL for the item at \p index */
  37. KURL at(int index) const;
  38. signals:
  39. /*!
  40. * Emitted whenever the playlist index changes.
  41. *
  42. * \see currentIndex()
  43. */
  44. void currentIndexChanged(int index);
  45. /*!
  46. * Emitted whenever the playlist index changes.
  47. *
  48. * \see currentItem()
  49. */
  50. void currentItemChanged(const KURL& item);
  51. void itemsInserted(int start, int end);
  52. // void itemRemoved(int);
  53. public slots:
  54. /*! Advance to the next playlist item. */
  55. void next();
  56. /*! Return to the previous playlist item. */
  57. void previous();
  58. /*! Navigate to the playlist item at \a index. */
  59. void setCurrentIndex(int index);
  60. private:
  61. class PlaylistPrivate* d;
  62. };
  63. #endif /* PLAYLIST_H */