Sayonara Player
PlaylistMode.h
1 /* PlaylistMode.h */
2 
3 /* Copyright (C) 2011 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program 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  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef PLAYLISTMODE_H_
22 #define PLAYLISTMODE_H_
23 
24 #include "Utils/Pimpl.h"
25 
26 namespace Playlist
27 {
32  class Mode final
33  {
34  PIMPL(Mode)
35 
36  public:
37  enum State
38  {
39  Off = 0,
40  On = 1,
41  Disabled = 2 // this has to be because of consistence
42  };
43 
44  public:
45  Mode();
46  ~Mode();
47  Mode(const Mode& other);
48  Mode& operator=(const Mode& other);
49 
50  Playlist::Mode::State rep1() const;
51  Playlist::Mode::State repAll() const;
52  Playlist::Mode::State append() const;
53  Playlist::Mode::State shuffle() const;
54  Playlist::Mode::State dynamic() const;
55  Playlist::Mode::State gapless() const;
56 
57  void setRep1(Playlist::Mode::State state);
58  void setRepAll(Playlist::Mode::State state);
59  void setAppend(Playlist::Mode::State state);
60  void setShuffle(Playlist::Mode::State state);
61  void setDynamic(Playlist::Mode::State state);
62  void setGapless(Playlist::Mode::State state);
63 
64  void setRep1(bool on, bool enabled=true);
65  void setRepAll(bool on, bool enabled=true);
66  void setAppend(bool on, bool enabled=true);
67  void setShuffle(bool on, bool enabled=true);
68  void setDynamic(bool on, bool enabled=true);
69  void setGapless(bool on, bool enabled=true);
70 
71  static bool isActive(Playlist::Mode::State pl);
72  static bool isEnabled(Playlist::Mode::State pl);
73  static bool isActiveAndEnabled(Playlist::Mode::State pl);
74 
75  void print();
76 
77  QString toString() const;
78 
79  static Playlist::Mode fromString(const QString& str);
80 
81  bool operator==(const Playlist::Mode& pm) const;
82  };
83 }
84 
85 #endif
The Mode class.
Definition: PlaylistMode.h:32