1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 10:48:33 +01:00

Rename ShuffleRepeatWidget to PlaylistSequence

This commit is contained in:
David Sansome 2010-03-08 18:05:41 +00:00
parent 85d5e398da
commit 67214bf4dc
8 changed files with 53 additions and 53 deletions

View File

@ -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

View File

@ -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 ){

View File

@ -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_;

View File

@ -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());
}

View File

@ -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

View File

@ -1,13 +1,13 @@
#include "shufflerepeatwidget.h"
#include "playlistsequence.h"
#include <QMenu>
#include <QActionGroup>
#include <QSettings>
#include <QtDebug>
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) {

View File

@ -1,17 +1,17 @@
#ifndef SHUFFLEREPEATWIDGET_H
#define SHUFFLEREPEATWIDGET_H
#ifndef PLAYLISTSEQUENCE_H
#define PLAYLISTSEQUENCE_H
#include <QWidget>
#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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ShuffleRepeatWidget</class>
<widget class="QWidget" name="ShuffleRepeatWidget">
<class>PlaylistSequence</class>
<widget class="QWidget" name="PlaylistSequence">
<property name="geometry">
<rect>
<x>0</x>