1 /* This file is part of Clementine. 2 Copyright 2010, David Sansome <me@davidsansome.com> 3 4 Clementine is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 Clementine 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 14 You should have received a copy of the GNU General Public License 15 along with Clementine. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef PLAYLISTSEQUENCE_H 19 #define PLAYLISTSEQUENCE_H 20 21 #include <memory> 22 23 #include <QWidget> 24 25 #include "core/settingsprovider.h" 26 27 class QMenu; 28 29 class Ui_PlaylistSequence; 30 31 class PlaylistSequence : public QWidget { 32 Q_OBJECT 33 34 public: 35 PlaylistSequence(QWidget* parent = nullptr, SettingsProvider* settings = 0); 36 ~PlaylistSequence(); 37 38 enum RepeatMode { 39 Repeat_Off = 0, 40 Repeat_Track = 1, 41 Repeat_Album = 2, 42 Repeat_Playlist = 3, 43 Repeat_OneByOne = 4, 44 Repeat_Intro = 5, 45 }; 46 enum ShuffleMode { 47 Shuffle_Off = 0, 48 Shuffle_All = 1, 49 Shuffle_InsideAlbum = 2, 50 Shuffle_Albums = 3, 51 }; 52 53 static const char* kSettingsGroup; 54 55 RepeatMode repeat_mode() const; 56 ShuffleMode shuffle_mode() const; 57 repeat_menu()58 QMenu* repeat_menu() const { return repeat_menu_; } shuffle_menu()59 QMenu* shuffle_menu() const { return shuffle_menu_; } 60 61 public slots: 62 void SetRepeatMode(PlaylistSequence::RepeatMode mode); 63 void SetShuffleMode(PlaylistSequence::ShuffleMode mode); 64 void CycleShuffleMode(); 65 void CycleRepeatMode(); 66 void SetUsingDynamicPlaylist(bool dynamic); 67 68 signals: 69 void RepeatModeChanged(PlaylistSequence::RepeatMode mode); 70 void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode); 71 72 private slots: 73 void RepeatActionTriggered(QAction*); 74 void ShuffleActionTriggered(QAction*); 75 76 private: 77 void Load(); 78 void Save(); 79 static QIcon AddDesaturatedIcon(const QIcon& icon); 80 static QPixmap DesaturatedPixmap(const QPixmap& pixmap); 81 82 private: 83 Ui_PlaylistSequence* ui_; 84 std::unique_ptr<SettingsProvider> settings_; 85 86 QMenu* repeat_menu_; 87 QMenu* shuffle_menu_; 88 89 bool loading_; 90 RepeatMode repeat_mode_; 91 ShuffleMode shuffle_mode_; 92 bool dynamic_; 93 }; 94 95 #endif // PLAYLISTSEQUENCE_H 96