strawberry-audio-player-win.../src/playlist/playlistsequence.h

102 lines
2.5 KiB
C
Raw Normal View History

2018-02-27 18:06:05 +01:00
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
2021-03-20 21:14:47 +01:00
* Copyright 2020-2021, Jonas Kvinge <jonas@jkvinge.net>
2018-02-27 18:06:05 +01:00
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
2018-08-09 18:39:44 +02:00
*
2018-02-27 18:06:05 +01:00
*/
#ifndef PLAYLISTSEQUENCE_H
#define PLAYLISTSEQUENCE_H
#include "config.h"
#include <QObject>
2018-02-27 18:06:05 +01:00
#include <QWidget>
#include <QString>
#include <QIcon>
#include <QPixmap>
2020-02-08 15:03:11 +01:00
#include "core/scoped_ptr.h"
2020-02-08 15:03:11 +01:00
class QMenu;
class QAction;
2018-02-27 18:06:05 +01:00
class SettingsProvider;
2018-02-27 18:06:05 +01:00
class Ui_PlaylistSequence;
class PlaylistSequence : public QWidget {
Q_OBJECT
public:
2020-06-15 21:55:05 +02:00
explicit PlaylistSequence(QWidget *parent = nullptr, SettingsProvider *settings = nullptr);
~PlaylistSequence() override;
2018-02-27 18:06:05 +01:00
2023-02-18 14:09:27 +01:00
enum class RepeatMode {
Off = 0,
Track = 1,
Album = 2,
Playlist = 3,
OneByOne = 4,
Intro = 5
2018-02-27 18:06:05 +01:00
};
2023-02-18 14:09:27 +01:00
enum class ShuffleMode {
Off = 0,
All = 1,
InsideAlbum = 2,
Albums = 3
2018-02-27 18:06:05 +01:00
};
RepeatMode repeat_mode() const;
ShuffleMode shuffle_mode() const;
QMenu *repeat_menu() const { return repeat_menu_; }
QMenu *shuffle_menu() const { return shuffle_menu_; }
public slots:
void SetRepeatMode(const PlaylistSequence::RepeatMode mode);
void SetShuffleMode(const PlaylistSequence::ShuffleMode mode);
2018-02-27 18:06:05 +01:00
void CycleShuffleMode();
void CycleRepeatMode();
signals:
void RepeatModeChanged(const PlaylistSequence::RepeatMode mode);
void ShuffleModeChanged(const PlaylistSequence::ShuffleMode mode);
2018-02-27 18:06:05 +01:00
private slots:
2021-06-12 20:53:23 +02:00
void RepeatActionTriggered(QAction *action);
void ShuffleActionTriggered(QAction *action);
2018-02-27 18:06:05 +01:00
private:
void Load();
void Save();
2021-06-12 20:53:23 +02:00
static QIcon AddDesaturatedIcon(const QIcon &icon);
static QPixmap DesaturatedPixmap(const QPixmap &pixmap);
2018-02-27 18:06:05 +01:00
private:
Ui_PlaylistSequence *ui_;
ScopedPtr<SettingsProvider> settings_;
2018-02-27 18:06:05 +01:00
QMenu *repeat_menu_;
QMenu *shuffle_menu_;
bool loading_;
RepeatMode repeat_mode_;
ShuffleMode shuffle_mode_;
};
#endif // PLAYLISTSEQUENCE_H