Commit 5394794f authored by Frerich Raabe's avatar Frerich Raabe

- Sometimes looking for a bug requires so many recompiles that you can just

  as well add new features while the compiler is sweating:
  Loop the playlist (because this single bug takes indeed long, and I don't
  want to run out of music).

svn path=/trunk/kdemultimedia/juk/; revision=214724
parent 879a5457
......@@ -135,6 +135,7 @@ void JuK::setupActions()
m_stopAction = new KAction(i18n("&Stop"), "player_stop", 0, this, SLOT(slotStop()), actionCollection(), "stop");
m_backAction = new KAction(i18n("Skip &Back"), "player_start", 0, this, SLOT(slotBack()), actionCollection(), "back");
m_forwardAction = new KAction(i18n("Skip &Forward"), "player_end", 0, this, SLOT(slotForward()), actionCollection(), "forward");
m_loopPlaylistAction = new KToggleAction(i18n("Loop Playlist"), "reload", 0, actionCollection(), "loopPlaylist");
// tagger menu
new KAction(i18n("Save"), "filesave", "CTRL+t", m_splitter, SLOT(slotSaveTag()), actionCollection(), "saveItem");
......@@ -294,6 +295,8 @@ void JuK::readConfig()
}
bool randomPlay = config->readBoolEntry("RandomPlay", false);
m_randomPlayAction->setChecked(randomPlay);
const bool loopPlaylist = config->readBoolEntry("LoopPlaylist", false);
m_loopPlaylistAction->setChecked(loopPlaylist);
}
{ // view settings
KConfigGroupSaver saver(config, "View");
......@@ -331,6 +334,8 @@ void JuK::saveConfig()
config->writeEntry("Volume", m_sliderAction->getVolumeSlider()->value());
if(m_randomPlayAction)
config->writeEntry("RandomPlay", m_randomPlayAction->isChecked());
if(m_loopPlaylistAction)
config->writeEntry("LoopPlaylist", m_loopPlaylistAction->isChecked());
}
{ // view settings
KConfigGroupSaver saver(config, "View");
......@@ -520,7 +525,7 @@ void JuK::slotPlay()
else if(m_player->playing())
m_player->seekPosition(0);
else
play(m_splitter->playNextFile(m_randomPlayAction->isChecked()));
play(m_splitter->playNextFile(m_randomPlayAction->isChecked(), m_loopPlaylistAction->isChecked()));
}
void JuK::slotPause()
......@@ -566,7 +571,7 @@ void JuK::slotBack()
void JuK::slotForward()
{
play(m_splitter->playNextFile(m_randomPlayAction->isChecked()));
play(m_splitter->playNextFile(m_randomPlayAction->isChecked(), m_loopPlaylistAction->isChecked()));
}
////////////////////////////////////////////////////////////////////////////////
......@@ -686,7 +691,7 @@ void JuK::slotPollPlay()
m_playTimer->stop();
play(m_splitter->playNextFile(m_randomPlayAction->isChecked()));
play(m_splitter->playNextFile(m_randomPlayAction->isChecked(), m_loopPlaylistAction->isChecked()));
}
else if(!m_trackPositionDragging) {
m_sliderAction->getTrackPositionSlider()->setValue(m_player->position());
......
......@@ -159,6 +159,7 @@ private:
KAction *m_stopAction;
KAction *m_backAction;
KAction *m_forwardAction;
KToggleAction *m_loopPlaylistAction;
KAction *m_savePlaylistAction;
KAction *m_saveAsPlaylistAction;
......
......@@ -42,6 +42,7 @@
<Action name="stop"/>
<Action name="back"/>
<Action name="forward"/>
<Action name="loopPlaylist"/>
</Menu>
<Menu name="playlist"><text>Tagger</text>
<Action name="saveItem"/>
......@@ -86,4 +87,8 @@
<Action name="back"/>
<Action name="forward"/>
<Action name="trackPositionAction"/>
<Separator lineSeparator="false"/>
<Action name="loopPlaylist"/>
</kpartgui>
......@@ -102,7 +102,7 @@ QString PlaylistSplitter::uniquePlaylistName(const QString &startingWith, bool u
}
}
QString PlaylistSplitter::playNextFile(bool random)
QString PlaylistSplitter::playNextFile(bool random, bool loopPlaylist)
{
PlaylistItem *i;
......@@ -117,6 +117,8 @@ QString PlaylistSplitter::playNextFile(bool random)
else if(m_playingItem) {
Playlist *p = static_cast<Playlist *>(m_playingItem->listView());
i = p->nextItem(m_playingItem, random);
if(!i && loopPlaylist)
i = static_cast<PlaylistItem *>(visiblePlaylist()->firstChild());
}
else {
i = playlistSelection().getFirst();
......
......@@ -71,7 +71,7 @@ public:
* Returns the file name of the next item to be played and advances the next
* file.
*/
QString playNextFile(bool random = false);
QString playNextFile(bool random = false, bool loopPlaylist = false);
/**
* Returns the file name of the previous item and moves the playing indicator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment