From 67214bf4dc555fbc1103792ef08a189cac103074 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 8 Mar 2010 18:05:41 +0000 Subject: [PATCH] Rename ShuffleRepeatWidget to PlaylistSequence --- src/CMakeLists.txt | 6 ++-- src/mainwindow.cpp | 11 +++---- src/mainwindow.h | 4 +-- src/playlist.cpp | 31 ++++++++++--------- src/playlist.h | 10 +++--- ...erepeatwidget.cpp => playlistsequence.cpp} | 18 +++++------ ...ufflerepeatwidget.h => playlistsequence.h} | 22 ++++++------- ...flerepeatwidget.ui => playlistsequence.ui} | 4 +-- 8 files changed, 53 insertions(+), 53 deletions(-) rename src/{shufflerepeatwidget.cpp => playlistsequence.cpp} (85%) rename src/{shufflerepeatwidget.h => playlistsequence.h} (59%) rename src/{shufflerepeatwidget.ui => playlistsequence.ui} (97%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 596670b3a..329ab3adf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,7 +55,7 @@ set(CLEMENTINE-SOURCES albumcoverloader.cpp m3uparser.cpp playlistmanager.cpp - shufflerepeatwidget.cpp + playlistsequence.cpp ) # Header files that have Q_OBJECT in @@ -104,7 +104,7 @@ set(CLEMENTINE-MOC-HEADERS albumcoverloader.h m3uparser.h playlistmanager.h - shufflerepeatwidget.h + playlistsequence.h ) # UI files @@ -124,7 +124,7 @@ set(CLEMENTINE-UI addstreamdialog.ui shortcutsdialog.ui albumcovermanager.ui - shufflerepeatwidget.ui + playlistsequence.ui ) # Resource files diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bdc3529be..d926d9731 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -22,7 +22,7 @@ #include "albumcovermanager.h" #include "m3uparser.h" #include "playlistmanager.h" -#include "shufflerepeatwidget.h" +#include "playlistsequence.h" #include "qxtglobalshortcut.h" @@ -51,7 +51,7 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent) tray_icon_(new SystemTrayIcon(this)), osd_(new OSD(tray_icon_, this)), track_slider_(new TrackSlider(this)), - shuffle_repeat_widget_(new ShuffleRepeatWidget(this)), + playlist_sequence_(new PlaylistSequence(this)), edit_tag_dialog_(new EditTagDialog(this)), multi_loading_indicator_(new MultiLoadingIndicator(this)), library_config_dialog_(new LibraryConfigDialog(this)), @@ -266,7 +266,7 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent) ui_.analyzer->set_engine(player_->GetEngine()); // Statusbar widgets - ui_.statusBar->addPermanentWidget(shuffle_repeat_widget_); + ui_.statusBar->addPermanentWidget(playlist_sequence_); ui_.statusBar->addPermanentWidget(track_slider_); ui_.statusBar->addWidget(multi_loading_indicator_); multi_loading_indicator_->hide(); @@ -690,7 +690,7 @@ void MainWindow::SetCurrentPlaylist(PlaylistView* pCurrent){ current_playlist_ = qobject_cast< Playlist* >( pCurrent->model() ); player_->SetCurrentPlaylist(current_playlist_); - current_playlist_->set_shuffle_repeat_widget(shuffle_repeat_widget_); + current_playlist_->set_sequence(playlist_sequence_); // connects !! :) @@ -710,9 +710,6 @@ void MainWindow::SetCurrentPlaylist(PlaylistView* pCurrent){ connect(player_, SIGNAL(Stopped()), current_playlist_view_, SLOT(StopGlowing())); 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 ){ diff --git a/src/mainwindow.h b/src/mainwindow.h index 7fd35dc4e..bc8267d2b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -25,7 +25,7 @@ class About; class AddStreamDialog; class ShortcutsDialog; class AlbumCoverManager; -class ShuffleRepeatWidget; +class PlaylistSequence; class QSortFilterProxyModel; class SystemTrayIcon; @@ -108,7 +108,7 @@ class MainWindow : public QMainWindow { SystemTrayIcon* tray_icon_; OSD* osd_; TrackSlider* track_slider_; - ShuffleRepeatWidget* shuffle_repeat_widget_; + PlaylistSequence* playlist_sequence_; EditTagDialog* edit_tag_dialog_; MultiLoadingIndicator* multi_loading_indicator_; LibraryConfigDialog* library_config_dialog_; diff --git a/src/playlist.cpp b/src/playlist.cpp index 4972ed0fe..f4122c7ec 100644 --- a/src/playlist.cpp +++ b/src/playlist.cpp @@ -31,7 +31,7 @@ Playlist::Playlist(QObject *parent) : ignore_sorting_(false), title_(""), 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; } -void Playlist::ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode mode) { - is_shuffled_ = (mode != ShuffleRepeatWidget::Shuffle_Off); +void Playlist::ShuffleModeChanged(PlaylistSequence::ShuffleMode mode) { + is_shuffled_ = (mode != PlaylistSequence::Shuffle_Off); ReshuffleIndices(); } int Playlist::NextVirtualIndex(int i) const { - ShuffleRepeatWidget::RepeatMode repeat_mode = shuffle_repeat_widget_->repeat_mode(); - ShuffleRepeatWidget::ShuffleMode shuffle_mode = shuffle_repeat_widget_->shuffle_mode(); - bool album_only = repeat_mode == ShuffleRepeatWidget::Repeat_Album || - shuffle_mode == ShuffleRepeatWidget::Shuffle_Album; + PlaylistSequence::RepeatMode repeat_mode = playlist_sequence_->repeat_mode(); + PlaylistSequence::ShuffleMode shuffle_mode = playlist_sequence_->shuffle_mode(); + bool album_only = repeat_mode == PlaylistSequence::Repeat_Album || + shuffle_mode == PlaylistSequence::Shuffle_Album; // 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; // 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()) { // We've gone off the end of the playlist. - switch (shuffle_repeat_widget_->repeat_mode()) { - case ShuffleRepeatWidget::Repeat_Off: + switch (playlist_sequence_->repeat_mode()) { + case PlaylistSequence::Repeat_Off: return -1; - case ShuffleRepeatWidget::Repeat_Track: + case PlaylistSequence::Repeat_Track: next_virtual_index = current_virtual_index_; break; @@ -688,7 +688,10 @@ void Playlist::ReshuffleIndices() { } } -void Playlist::set_shuffle_repeat_widget(ShuffleRepeatWidget* w) { - shuffle_repeat_widget_ = w; - ShuffleModeChanged(w->shuffle_mode()); +void Playlist::set_sequence(PlaylistSequence* v) { + playlist_sequence_ = v; + connect(v, SIGNAL(ShuffleModeChanged(PlaylistSequence::ShuffleMode)), + SLOT(ShuffleModeChanged(PlaylistSequence::ShuffleMode))); + + ShuffleModeChanged(v->shuffle_mode()); } diff --git a/src/playlist.h b/src/playlist.h index 1abc27d09..494d4d89c 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -7,7 +7,7 @@ #include "playlistitem.h" #include "song.h" #include "radioitem.h" -#include "shufflerepeatwidget.h" +#include "playlistsequence.h" class RadioService; @@ -75,8 +75,8 @@ class Playlist : public QAbstractListModel { void SetPlaylistIndex( int ipos ) { index_ = ipos ; } int GetPlaylistIndex() const { return index_ ; } - void set_shuffle_repeat_widget(ShuffleRepeatWidget* w); - ShuffleRepeatWidget* shuffle_repeat_widget() const { return shuffle_repeat_widget_; } + void set_sequence(PlaylistSequence* v); + PlaylistSequence* sequence() const { return playlist_sequence_; } // Scrobbling int scrobble_point() const { return scrobble_point_; } @@ -118,7 +118,7 @@ class Playlist : public QAbstractListModel { void Clear(); void Shuffle(); - void ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode mode); + void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode); signals: void CurrentSongChanged(const Song& metadata); @@ -152,7 +152,7 @@ class Playlist : public QAbstractListModel { QString title_; int index_ ; - ShuffleRepeatWidget* shuffle_repeat_widget_; + PlaylistSequence* playlist_sequence_; }; #endif // PLAYLIST_H diff --git a/src/shufflerepeatwidget.cpp b/src/playlistsequence.cpp similarity index 85% rename from src/shufflerepeatwidget.cpp rename to src/playlistsequence.cpp index c012b708c..28af86165 100644 --- a/src/shufflerepeatwidget.cpp +++ b/src/playlistsequence.cpp @@ -1,13 +1,13 @@ -#include "shufflerepeatwidget.h" +#include "playlistsequence.h" #include #include #include #include -const char* ShuffleRepeatWidget::kSettingsGroup = "ShuffleRepeat"; +const char* PlaylistSequence::kSettingsGroup = "PlaylistSequence"; -ShuffleRepeatWidget::ShuffleRepeatWidget(QWidget *parent) +PlaylistSequence::PlaylistSequence(QWidget *parent) : QWidget(parent), repeat_menu_(new QMenu(this)), shuffle_menu_(new QMenu(this)), @@ -38,7 +38,7 @@ ShuffleRepeatWidget::ShuffleRepeatWidget(QWidget *parent) Load(); } -void ShuffleRepeatWidget::Load() { +void PlaylistSequence::Load() { QSettings s; s.beginGroup(kSettingsGroup); @@ -48,7 +48,7 @@ void ShuffleRepeatWidget::Load() { loading_ = false; } -void ShuffleRepeatWidget::Save() { +void PlaylistSequence::Save() { if (loading_) return; QSettings s; @@ -58,7 +58,7 @@ void ShuffleRepeatWidget::Save() { s.setValue("repeat_mode", repeat_mode_); } -void ShuffleRepeatWidget::RepeatActionTriggered(QAction* action) { +void PlaylistSequence::RepeatActionTriggered(QAction* action) { RepeatMode mode = Repeat_Off; if (action == ui_.action_repeat_track) mode = Repeat_Track; if (action == ui_.action_repeat_album) mode = Repeat_Album; @@ -67,7 +67,7 @@ void ShuffleRepeatWidget::RepeatActionTriggered(QAction* action) { SetRepeatMode(mode); } -void ShuffleRepeatWidget::ShuffleActionTriggered(QAction* action) { +void PlaylistSequence::ShuffleActionTriggered(QAction* action) { ShuffleMode mode = Shuffle_Off; if (action == ui_.action_shuffle_all) mode = Shuffle_All; if (action == ui_.action_shuffle_album) mode = Shuffle_Album; @@ -75,7 +75,7 @@ void ShuffleRepeatWidget::ShuffleActionTriggered(QAction* action) { SetShuffleMode(mode); } -void ShuffleRepeatWidget::SetRepeatMode(RepeatMode mode) { +void PlaylistSequence::SetRepeatMode(RepeatMode mode) { ui_.repeat->setChecked(mode != Repeat_Off); switch(mode) { @@ -91,7 +91,7 @@ void ShuffleRepeatWidget::SetRepeatMode(RepeatMode mode) { Save(); } -void ShuffleRepeatWidget::SetShuffleMode(ShuffleMode mode) { +void PlaylistSequence::SetShuffleMode(ShuffleMode mode) { ui_.shuffle->setChecked(mode != Shuffle_Off); switch (mode) { diff --git a/src/shufflerepeatwidget.h b/src/playlistsequence.h similarity index 59% rename from src/shufflerepeatwidget.h rename to src/playlistsequence.h index edfa5ea1f..361c98452 100644 --- a/src/shufflerepeatwidget.h +++ b/src/playlistsequence.h @@ -1,17 +1,17 @@ -#ifndef SHUFFLEREPEATWIDGET_H -#define SHUFFLEREPEATWIDGET_H +#ifndef PLAYLISTSEQUENCE_H +#define PLAYLISTSEQUENCE_H #include -#include "ui_shufflerepeatwidget.h" +#include "ui_playlistsequence.h" class QMenu; -class ShuffleRepeatWidget : public QWidget { +class PlaylistSequence : public QWidget { Q_OBJECT public: - ShuffleRepeatWidget(QWidget *parent = 0); + PlaylistSequence(QWidget *parent = 0); enum RepeatMode { Repeat_Off = 0, @@ -31,12 +31,12 @@ class ShuffleRepeatWidget : public QWidget { ShuffleMode shuffle_mode() const { return shuffle_mode_; } public slots: - void SetRepeatMode(ShuffleRepeatWidget::RepeatMode mode); - void SetShuffleMode(ShuffleRepeatWidget::ShuffleMode mode); + void SetRepeatMode(PlaylistSequence::RepeatMode mode); + void SetShuffleMode(PlaylistSequence::ShuffleMode mode); signals: - void RepeatModeChanged(ShuffleRepeatWidget::RepeatMode mode); - void ShuffleModeChanged(ShuffleRepeatWidget::ShuffleMode mode); + void RepeatModeChanged(PlaylistSequence::RepeatMode mode); + void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode); private slots: void RepeatActionTriggered(QAction*); @@ -47,7 +47,7 @@ class ShuffleRepeatWidget : public QWidget { void Save(); private: - Ui::ShuffleRepeatWidget ui_; + Ui::PlaylistSequence ui_; QMenu* repeat_menu_; QMenu* shuffle_menu_; @@ -57,4 +57,4 @@ class ShuffleRepeatWidget : public QWidget { ShuffleMode shuffle_mode_; }; -#endif // SHUFFLEREPEATWIDGET_H +#endif // PLAYLISTSEQUENCE_H diff --git a/src/shufflerepeatwidget.ui b/src/playlistsequence.ui similarity index 97% rename from src/shufflerepeatwidget.ui rename to src/playlistsequence.ui index c7ac65770..b2e281507 100644 --- a/src/shufflerepeatwidget.ui +++ b/src/playlistsequence.ui @@ -1,7 +1,7 @@ - ShuffleRepeatWidget - + PlaylistSequence + 0