Rename ShuffleRepeatWidget to PlaylistSequence
This commit is contained in:
parent
85d5e398da
commit
67214bf4dc
@ -55,7 +55,7 @@ set(CLEMENTINE-SOURCES
|
|||||||
albumcoverloader.cpp
|
albumcoverloader.cpp
|
||||||
m3uparser.cpp
|
m3uparser.cpp
|
||||||
playlistmanager.cpp
|
playlistmanager.cpp
|
||||||
shufflerepeatwidget.cpp
|
playlistsequence.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# Header files that have Q_OBJECT in
|
# Header files that have Q_OBJECT in
|
||||||
@ -104,7 +104,7 @@ set(CLEMENTINE-MOC-HEADERS
|
|||||||
albumcoverloader.h
|
albumcoverloader.h
|
||||||
m3uparser.h
|
m3uparser.h
|
||||||
playlistmanager.h
|
playlistmanager.h
|
||||||
shufflerepeatwidget.h
|
playlistsequence.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# UI files
|
# UI files
|
||||||
@ -124,7 +124,7 @@ set(CLEMENTINE-UI
|
|||||||
addstreamdialog.ui
|
addstreamdialog.ui
|
||||||
shortcutsdialog.ui
|
shortcutsdialog.ui
|
||||||
albumcovermanager.ui
|
albumcovermanager.ui
|
||||||
shufflerepeatwidget.ui
|
playlistsequence.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
# Resource files
|
# Resource files
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "albumcovermanager.h"
|
#include "albumcovermanager.h"
|
||||||
#include "m3uparser.h"
|
#include "m3uparser.h"
|
||||||
#include "playlistmanager.h"
|
#include "playlistmanager.h"
|
||||||
#include "shufflerepeatwidget.h"
|
#include "playlistsequence.h"
|
||||||
|
|
||||||
#include "qxtglobalshortcut.h"
|
#include "qxtglobalshortcut.h"
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
|
|||||||
tray_icon_(new SystemTrayIcon(this)),
|
tray_icon_(new SystemTrayIcon(this)),
|
||||||
osd_(new OSD(tray_icon_, this)),
|
osd_(new OSD(tray_icon_, this)),
|
||||||
track_slider_(new TrackSlider(this)),
|
track_slider_(new TrackSlider(this)),
|
||||||
shuffle_repeat_widget_(new ShuffleRepeatWidget(this)),
|
playlist_sequence_(new PlaylistSequence(this)),
|
||||||
edit_tag_dialog_(new EditTagDialog(this)),
|
edit_tag_dialog_(new EditTagDialog(this)),
|
||||||
multi_loading_indicator_(new MultiLoadingIndicator(this)),
|
multi_loading_indicator_(new MultiLoadingIndicator(this)),
|
||||||
library_config_dialog_(new LibraryConfigDialog(this)),
|
library_config_dialog_(new LibraryConfigDialog(this)),
|
||||||
@ -266,7 +266,7 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
|
|||||||
ui_.analyzer->set_engine(player_->GetEngine());
|
ui_.analyzer->set_engine(player_->GetEngine());
|
||||||
|
|
||||||
// Statusbar widgets
|
// Statusbar widgets
|
||||||
ui_.statusBar->addPermanentWidget(shuffle_repeat_widget_);
|
ui_.statusBar->addPermanentWidget(playlist_sequence_);
|
||||||
ui_.statusBar->addPermanentWidget(track_slider_);
|
ui_.statusBar->addPermanentWidget(track_slider_);
|
||||||
ui_.statusBar->addWidget(multi_loading_indicator_);
|
ui_.statusBar->addWidget(multi_loading_indicator_);
|
||||||
multi_loading_indicator_->hide();
|
multi_loading_indicator_->hide();
|
||||||
@ -690,7 +690,7 @@ void MainWindow::SetCurrentPlaylist(PlaylistView* pCurrent){
|
|||||||
current_playlist_ = qobject_cast< Playlist* >( pCurrent->model() );
|
current_playlist_ = qobject_cast< Playlist* >( pCurrent->model() );
|
||||||
player_->SetCurrentPlaylist(current_playlist_);
|
player_->SetCurrentPlaylist(current_playlist_);
|
||||||
|
|
||||||
current_playlist_->set_shuffle_repeat_widget(shuffle_repeat_widget_);
|
current_playlist_->set_sequence(playlist_sequence_);
|
||||||
|
|
||||||
// connects !! :)
|
// connects !! :)
|
||||||
|
|
||||||
@ -710,9 +710,6 @@ void MainWindow::SetCurrentPlaylist(PlaylistView* pCurrent){
|
|||||||
connect(player_, SIGNAL(Stopped()), current_playlist_view_, SLOT(StopGlowing()));
|
connect(player_, SIGNAL(Stopped()), current_playlist_view_, SLOT(StopGlowing()));
|
||||||
|
|
||||||
connect(radio_model_, SIGNAL(StreamMetadataFound(QUrl,Song)), current_playlist_, SLOT(SetStreamMetadata(QUrl,Song)));
|
connect(radio_model_, SIGNAL(StreamMetadataFound(QUrl,Song)), current_playlist_, SLOT(SetStreamMetadata(QUrl,Song)));
|
||||||
|
|
||||||
connect(shuffle_repeat_widget_, SIGNAL(ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode)),
|
|
||||||
current_playlist_, SLOT(ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::CurrentTabChanged(int index ){
|
void MainWindow::CurrentTabChanged(int index ){
|
||||||
|
@ -25,7 +25,7 @@ class About;
|
|||||||
class AddStreamDialog;
|
class AddStreamDialog;
|
||||||
class ShortcutsDialog;
|
class ShortcutsDialog;
|
||||||
class AlbumCoverManager;
|
class AlbumCoverManager;
|
||||||
class ShuffleRepeatWidget;
|
class PlaylistSequence;
|
||||||
|
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
class SystemTrayIcon;
|
class SystemTrayIcon;
|
||||||
@ -108,7 +108,7 @@ class MainWindow : public QMainWindow {
|
|||||||
SystemTrayIcon* tray_icon_;
|
SystemTrayIcon* tray_icon_;
|
||||||
OSD* osd_;
|
OSD* osd_;
|
||||||
TrackSlider* track_slider_;
|
TrackSlider* track_slider_;
|
||||||
ShuffleRepeatWidget* shuffle_repeat_widget_;
|
PlaylistSequence* playlist_sequence_;
|
||||||
EditTagDialog* edit_tag_dialog_;
|
EditTagDialog* edit_tag_dialog_;
|
||||||
MultiLoadingIndicator* multi_loading_indicator_;
|
MultiLoadingIndicator* multi_loading_indicator_;
|
||||||
LibraryConfigDialog* library_config_dialog_;
|
LibraryConfigDialog* library_config_dialog_;
|
||||||
|
@ -31,7 +31,7 @@ Playlist::Playlist(QObject *parent) :
|
|||||||
ignore_sorting_(false),
|
ignore_sorting_(false),
|
||||||
title_(""),
|
title_(""),
|
||||||
index_(-1),
|
index_(-1),
|
||||||
shuffle_repeat_widget_(NULL)
|
playlist_sequence_(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,19 +115,19 @@ int Playlist::current_index() const {
|
|||||||
return current_item_.isValid() ? current_item_.row() : -1;
|
return current_item_.isValid() ? current_item_.row() : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode mode) {
|
void Playlist::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) {
|
||||||
is_shuffled_ = (mode != ShuffleRepeatWidget::Shuffle_Off);
|
is_shuffled_ = (mode != PlaylistSequence::Shuffle_Off);
|
||||||
ReshuffleIndices();
|
ReshuffleIndices();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Playlist::NextVirtualIndex(int i) const {
|
int Playlist::NextVirtualIndex(int i) const {
|
||||||
ShuffleRepeatWidget::RepeatMode repeat_mode = shuffle_repeat_widget_->repeat_mode();
|
PlaylistSequence::RepeatMode repeat_mode = playlist_sequence_->repeat_mode();
|
||||||
ShuffleRepeatWidget::ShuffleMode shuffle_mode = shuffle_repeat_widget_->shuffle_mode();
|
PlaylistSequence::ShuffleMode shuffle_mode = playlist_sequence_->shuffle_mode();
|
||||||
bool album_only = repeat_mode == ShuffleRepeatWidget::Repeat_Album ||
|
bool album_only = repeat_mode == PlaylistSequence::Repeat_Album ||
|
||||||
shuffle_mode == ShuffleRepeatWidget::Shuffle_Album;
|
shuffle_mode == PlaylistSequence::Shuffle_Album;
|
||||||
|
|
||||||
// This one's easy - if we have to repeat the current track then just return i
|
// This one's easy - if we have to repeat the current track then just return i
|
||||||
if (repeat_mode == ShuffleRepeatWidget::Repeat_Track)
|
if (repeat_mode == PlaylistSequence::Repeat_Track)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
// If we're not bothered about whether a song is on the same album then
|
// If we're not bothered about whether a song is on the same album then
|
||||||
@ -159,10 +159,10 @@ int Playlist::next_index() const {
|
|||||||
if (next_virtual_index >= virtual_items_.count()) {
|
if (next_virtual_index >= virtual_items_.count()) {
|
||||||
// We've gone off the end of the playlist.
|
// We've gone off the end of the playlist.
|
||||||
|
|
||||||
switch (shuffle_repeat_widget_->repeat_mode()) {
|
switch (playlist_sequence_->repeat_mode()) {
|
||||||
case ShuffleRepeatWidget::Repeat_Off:
|
case PlaylistSequence::Repeat_Off:
|
||||||
return -1;
|
return -1;
|
||||||
case ShuffleRepeatWidget::Repeat_Track:
|
case PlaylistSequence::Repeat_Track:
|
||||||
next_virtual_index = current_virtual_index_;
|
next_virtual_index = current_virtual_index_;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -688,7 +688,10 @@ void Playlist::ReshuffleIndices() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::set_shuffle_repeat_widget(ShuffleRepeatWidget* w) {
|
void Playlist::set_sequence(PlaylistSequence* v) {
|
||||||
shuffle_repeat_widget_ = w;
|
playlist_sequence_ = v;
|
||||||
ShuffleModeChanged(w->shuffle_mode());
|
connect(v, SIGNAL(ShuffleModeChanged(PlaylistSequence::ShuffleMode)),
|
||||||
|
SLOT(ShuffleModeChanged(PlaylistSequence::ShuffleMode)));
|
||||||
|
|
||||||
|
ShuffleModeChanged(v->shuffle_mode());
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "playlistitem.h"
|
#include "playlistitem.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "radioitem.h"
|
#include "radioitem.h"
|
||||||
#include "shufflerepeatwidget.h"
|
#include "playlistsequence.h"
|
||||||
|
|
||||||
class RadioService;
|
class RadioService;
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ class Playlist : public QAbstractListModel {
|
|||||||
void SetPlaylistIndex( int ipos ) { index_ = ipos ; }
|
void SetPlaylistIndex( int ipos ) { index_ = ipos ; }
|
||||||
int GetPlaylistIndex() const { return index_ ; }
|
int GetPlaylistIndex() const { return index_ ; }
|
||||||
|
|
||||||
void set_shuffle_repeat_widget(ShuffleRepeatWidget* w);
|
void set_sequence(PlaylistSequence* v);
|
||||||
ShuffleRepeatWidget* shuffle_repeat_widget() const { return shuffle_repeat_widget_; }
|
PlaylistSequence* sequence() const { return playlist_sequence_; }
|
||||||
|
|
||||||
// Scrobbling
|
// Scrobbling
|
||||||
int scrobble_point() const { return scrobble_point_; }
|
int scrobble_point() const { return scrobble_point_; }
|
||||||
@ -118,7 +118,7 @@ class Playlist : public QAbstractListModel {
|
|||||||
void Clear();
|
void Clear();
|
||||||
void Shuffle();
|
void Shuffle();
|
||||||
|
|
||||||
void ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode mode);
|
void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void CurrentSongChanged(const Song& metadata);
|
void CurrentSongChanged(const Song& metadata);
|
||||||
@ -152,7 +152,7 @@ class Playlist : public QAbstractListModel {
|
|||||||
QString title_;
|
QString title_;
|
||||||
int index_ ;
|
int index_ ;
|
||||||
|
|
||||||
ShuffleRepeatWidget* shuffle_repeat_widget_;
|
PlaylistSequence* playlist_sequence_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLAYLIST_H
|
#endif // PLAYLIST_H
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include "shufflerepeatwidget.h"
|
#include "playlistsequence.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
const char* ShuffleRepeatWidget::kSettingsGroup = "ShuffleRepeat";
|
const char* PlaylistSequence::kSettingsGroup = "PlaylistSequence";
|
||||||
|
|
||||||
ShuffleRepeatWidget::ShuffleRepeatWidget(QWidget *parent)
|
PlaylistSequence::PlaylistSequence(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
repeat_menu_(new QMenu(this)),
|
repeat_menu_(new QMenu(this)),
|
||||||
shuffle_menu_(new QMenu(this)),
|
shuffle_menu_(new QMenu(this)),
|
||||||
@ -38,7 +38,7 @@ ShuffleRepeatWidget::ShuffleRepeatWidget(QWidget *parent)
|
|||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleRepeatWidget::Load() {
|
void PlaylistSequence::Load() {
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void ShuffleRepeatWidget::Load() {
|
|||||||
loading_ = false;
|
loading_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleRepeatWidget::Save() {
|
void PlaylistSequence::Save() {
|
||||||
if (loading_) return;
|
if (loading_) return;
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
@ -58,7 +58,7 @@ void ShuffleRepeatWidget::Save() {
|
|||||||
s.setValue("repeat_mode", repeat_mode_);
|
s.setValue("repeat_mode", repeat_mode_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleRepeatWidget::RepeatActionTriggered(QAction* action) {
|
void PlaylistSequence::RepeatActionTriggered(QAction* action) {
|
||||||
RepeatMode mode = Repeat_Off;
|
RepeatMode mode = Repeat_Off;
|
||||||
if (action == ui_.action_repeat_track) mode = Repeat_Track;
|
if (action == ui_.action_repeat_track) mode = Repeat_Track;
|
||||||
if (action == ui_.action_repeat_album) mode = Repeat_Album;
|
if (action == ui_.action_repeat_album) mode = Repeat_Album;
|
||||||
@ -67,7 +67,7 @@ void ShuffleRepeatWidget::RepeatActionTriggered(QAction* action) {
|
|||||||
SetRepeatMode(mode);
|
SetRepeatMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleRepeatWidget::ShuffleActionTriggered(QAction* action) {
|
void PlaylistSequence::ShuffleActionTriggered(QAction* action) {
|
||||||
ShuffleMode mode = Shuffle_Off;
|
ShuffleMode mode = Shuffle_Off;
|
||||||
if (action == ui_.action_shuffle_all) mode = Shuffle_All;
|
if (action == ui_.action_shuffle_all) mode = Shuffle_All;
|
||||||
if (action == ui_.action_shuffle_album) mode = Shuffle_Album;
|
if (action == ui_.action_shuffle_album) mode = Shuffle_Album;
|
||||||
@ -75,7 +75,7 @@ void ShuffleRepeatWidget::ShuffleActionTriggered(QAction* action) {
|
|||||||
SetShuffleMode(mode);
|
SetShuffleMode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleRepeatWidget::SetRepeatMode(RepeatMode mode) {
|
void PlaylistSequence::SetRepeatMode(RepeatMode mode) {
|
||||||
ui_.repeat->setChecked(mode != Repeat_Off);
|
ui_.repeat->setChecked(mode != Repeat_Off);
|
||||||
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
@ -91,7 +91,7 @@ void ShuffleRepeatWidget::SetRepeatMode(RepeatMode mode) {
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleRepeatWidget::SetShuffleMode(ShuffleMode mode) {
|
void PlaylistSequence::SetShuffleMode(ShuffleMode mode) {
|
||||||
ui_.shuffle->setChecked(mode != Shuffle_Off);
|
ui_.shuffle->setChecked(mode != Shuffle_Off);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
@ -1,17 +1,17 @@
|
|||||||
#ifndef SHUFFLEREPEATWIDGET_H
|
#ifndef PLAYLISTSEQUENCE_H
|
||||||
#define SHUFFLEREPEATWIDGET_H
|
#define PLAYLISTSEQUENCE_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui_shufflerepeatwidget.h"
|
#include "ui_playlistsequence.h"
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
|
||||||
class ShuffleRepeatWidget : public QWidget {
|
class PlaylistSequence : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShuffleRepeatWidget(QWidget *parent = 0);
|
PlaylistSequence(QWidget *parent = 0);
|
||||||
|
|
||||||
enum RepeatMode {
|
enum RepeatMode {
|
||||||
Repeat_Off = 0,
|
Repeat_Off = 0,
|
||||||
@ -31,12 +31,12 @@ class ShuffleRepeatWidget : public QWidget {
|
|||||||
ShuffleMode shuffle_mode() const { return shuffle_mode_; }
|
ShuffleMode shuffle_mode() const { return shuffle_mode_; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SetRepeatMode(ShuffleRepeatWidget::RepeatMode mode);
|
void SetRepeatMode(PlaylistSequence::RepeatMode mode);
|
||||||
void SetShuffleMode(ShuffleRepeatWidget::ShuffleMode mode);
|
void SetShuffleMode(PlaylistSequence::ShuffleMode mode);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void RepeatModeChanged(ShuffleRepeatWidget::RepeatMode mode);
|
void RepeatModeChanged(PlaylistSequence::RepeatMode mode);
|
||||||
void ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode mode);
|
void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void RepeatActionTriggered(QAction*);
|
void RepeatActionTriggered(QAction*);
|
||||||
@ -47,7 +47,7 @@ class ShuffleRepeatWidget : public QWidget {
|
|||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ShuffleRepeatWidget ui_;
|
Ui::PlaylistSequence ui_;
|
||||||
|
|
||||||
QMenu* repeat_menu_;
|
QMenu* repeat_menu_;
|
||||||
QMenu* shuffle_menu_;
|
QMenu* shuffle_menu_;
|
||||||
@ -57,4 +57,4 @@ class ShuffleRepeatWidget : public QWidget {
|
|||||||
ShuffleMode shuffle_mode_;
|
ShuffleMode shuffle_mode_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHUFFLEREPEATWIDGET_H
|
#endif // PLAYLISTSEQUENCE_H
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ShuffleRepeatWidget</class>
|
<class>PlaylistSequence</class>
|
||||||
<widget class="QWidget" name="ShuffleRepeatWidget">
|
<widget class="QWidget" name="PlaylistSequence">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
Loading…
x
Reference in New Issue
Block a user