Qmmp
playstate_p.h
1 /***************************************************************************
2  * Copyright (C) 2007-2022 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program 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 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef _PLAYSTATE_H
22 #define _PLAYSTATE_H
23 
24 #include "playlistmodel.h"
25 
30 class PlayState
31 {
32 public:
33 
37  virtual bool next() = 0;
38 
42  virtual bool previous() = 0;
46  virtual int nextIndex() = 0;
50  virtual void resetState()
51  {
52  ;
53  }
57  virtual void prepare()
58  {
59  ;
60  }
61  virtual ~PlayState()
62  {
63  ;
64  }
65  explicit PlayState(PlayListModel* model);
66 
67 protected:
69  PlayListModel* m_model;
70  QmmpUiSettings *m_ui_settings;
71 };
72 
77 class NormalPlayState : public PlayState
78 {
79 public:
80  virtual bool next() override;
81  virtual bool previous() override;
82  virtual int nextIndex() override;
83  explicit NormalPlayState(PlayListModel* model);
84 };
85 
90 class ShufflePlayState : public PlayState
91 {
92 public:
93  virtual bool next() override;
94  virtual bool previous() override;
95  virtual int nextIndex() override;
96  virtual void prepare() override;
97  explicit ShufflePlayState(PlayListModel* model);
98  virtual void resetState() override;
99 private:
100 
102  int m_shuffled_current = 0;
103 
105  QList<int> m_shuffled_indexes;
106 };
107 
108 
109 #endif
The PlayListModel class provides a data model for the playlist.
Definition: playlistmodel.h:97
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition: qmmpuisettings.h:37