Commit 319350af authored by Michael Pyne's avatar Michael Pyne

Fix bug 89113 (Add functionality to switch to next/prev album in album random...

Fix bug 89113 (Add functionality to switch to next/prev album in album random play), except for the previous album part.

It appears in the Player menu at this point (appropriately disabled depending
on whether album random play is enabled and whether or not we're playing).

The default shortcut is Alt + Ctrl + Up (or Ctrl + MultimediaNext), both of
which are global shortcuts.

Also, include the Makefile.am change from last commit, although I'm pretty sure
-lm would have ended up linked in regardless.

GUI:89113

svn path=/trunk/kdemultimedia/juk/; revision=376262
parent 38a75e26
......@@ -80,7 +80,7 @@ mblibs = -lmusicbrainz -ltunepimp
endif
##################################################
juk_LDADD = $(LDADD_GST) $(mblibs) $(LIB_KIO) $(taglib_libs) $(LIB_KHTML) $(LIB_ARTS)
juk_LDADD = -lm $(LDADD_GST) $(mblibs) $(LIB_KIO) $(taglib_libs) $(LIB_KHTML) $(LIB_ARTS)
juk_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LDFLAGS_GST)
tagguessertest_LDADD = $(LIB_KDECORE)
......
......@@ -135,6 +135,7 @@ void JuK::setupActions()
ka = new KRadioAction(i18n("Use &Album Random Play"), "roll", 0, actions(), "albumRandomPlay");
ka->setExclusiveGroup("randomPlayGroup");
connect(ka, SIGNAL(toggled(bool)), SLOT(slotCheckAlbumNextAction(bool)));
actionMenu->insert(ka);
new KAction(i18n("&Play"), "player_play", 0, m_player, SLOT(play()), actions(), "play");
......@@ -241,6 +242,7 @@ void JuK::setupGlobalAccels()
KeyDialog::insert(m_accel, "VolumeDown", i18n("Volume Down"), action("volumeDown"), SLOT(activate()));
KeyDialog::insert(m_accel, "Mute", i18n("Mute"), action("mute"), SLOT(activate()));
KeyDialog::insert(m_accel, "ShowHide", i18n("Show / Hide"), this, SLOT(slotShowHide()));
KeyDialog::insert(m_accel, "ForwardAlbum", i18n("Play Next Album"), action("forwardAlbum"), SLOT(activate()));
m_accel->setConfigGroup("Shortcuts");
m_accel->readSettings();
......@@ -453,4 +455,15 @@ void JuK::slotUndo()
TagTransactionManager::instance()->undo();
}
void JuK::slotCheckAlbumNextAction(bool albumRandomEnabled)
{
// If album random play is enabled, then enable the Play Next Album action
// unless we're not playing right now.
if(albumRandomEnabled && !m_player->playing())
albumRandomEnabled = false;
action("forwardAlbum")->setEnabled(albumRandomEnabled);
}
#include "juk.moc"
......@@ -72,6 +72,7 @@ private slots:
void slotConfigureTagGuesser();
void slotConfigureFileRenamer();
void slotUndo();
void slotCheckAlbumNextAction(bool albumRandomEnabled);
private:
PlaylistSplitter *m_splitter;
......
<!DOCTYPE kpartgui>
<kpartgui name="juk" version="7">
<kpartgui name="juk" version="8">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_new"/>
......@@ -47,6 +47,10 @@
<Action name="stop"/>
<Action name="forward"/>
<Action name="back"/>
<Separator/>
<Action name="forwardAlbum"/>
</Menu>
<Menu name="playlist"><text>&amp;Tagger</text>
<Action name="saveItem"/>
......
<!-- PLEASE UPDATE jukui-rtl.rc WHEN UPDATING THIS FILE -->
<!DOCTYPE kpartgui>
<kpartgui name="juk" version="7">
<kpartgui name="juk" version="8">
<MenuBar>
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_new"/>
......@@ -49,6 +49,10 @@
<Action name="stop"/>
<Action name="forward"/>
<Action name="back"/>
<Separator/>
<Action name="forwardAlbum"/>
</Menu>
<Menu name="playlist"><text>&amp;Tagger</text>
<Action name="saveItem"/>
......
......@@ -42,6 +42,10 @@ const KeyDialog::KeyInfo KeyDialog::keyInfo[] = {
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_Right, KKey::QtWIN+Qt::ALT+Qt::Key_Right },
{ Qt::Key_MediaNext, Qt::Key_MediaNext } } },
{ "ForwardAlbum",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::ALT+Qt::Key_Up, KKey::QtWIN+Qt::ALT+Qt::Key_Up },
{ Qt::CTRL+Qt::Key_MediaNext, Qt::CTRL+Qt::Key_MediaNext } } },
{ "SeekBack",
{ { KShortcut::null(), KShortcut::null() },
{ Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Left, KKey::QtWIN+Qt::SHIFT+Qt::ALT+Qt::Key_Left },
......
......@@ -268,8 +268,8 @@ void PlayerManager::play(const FileHandle &file)
action("pause")->setEnabled(true);
action("stop")->setEnabled(true);
action("forward")->setEnabled(true);
// if(action<KToggleAction>("albumRandomPlay")->isChecked())
// action("forwardAlbum")->setEnabled(true);
if(action<KToggleAction>("albumRandomPlay")->isChecked())
action("forwardAlbum")->setEnabled(true);
action("back")->setEnabled(true);
if(m_sliderAction->trackPositionSlider())
......@@ -323,7 +323,7 @@ void PlayerManager::stop()
action("stop")->setEnabled(false);
action("back")->setEnabled(false);
action("forward")->setEnabled(false);
// action("forwardAlbum")->setEnabled(false);
action("forwardAlbum")->setEnabled(false);
if(m_sliderAction->trackPositionSlider()) {
m_sliderAction->trackPositionSlider()->setValue(0);
......@@ -560,7 +560,7 @@ void PlayerManager::setup()
if(!action("pause") ||
!action("stop") ||
!action("back") ||
// !action("forwardAlbum") ||
!action("forwardAlbum") ||
!action("forward") ||
!action("trackPositionAction"))
{
......@@ -574,7 +574,7 @@ void PlayerManager::setup()
action("stop")->setEnabled(false);
action("back")->setEnabled(false);
action("forward")->setEnabled(false);
// action("forwardAlbum")->setEnabled(false);
action("forwardAlbum")->setEnabled(false);
// setup sliders
......
......@@ -439,6 +439,22 @@ void Playlist::playFirst()
action("forward")->activate();
}
void Playlist::playNextAlbum()
{
PlaylistItem *current = TrackSequenceManager::instance()->currentItem();
if(!current)
return; // No next album if we're not already playing.
QString currentAlbum = current->file().tag()->album();
current = TrackSequenceManager::instance()->nextItem();
while(current && current->file().tag()->album() == currentAlbum)
current = TrackSequenceManager::instance()->nextItem();
TrackSequenceManager::instance()->setNextItem(current);
action("forward")->activate();
}
void Playlist::playNext()
{
TrackSequenceManager::instance()->setCurrentPlaylist(this);
......
......@@ -82,6 +82,12 @@ public:
*/
void playFirst();
/**
* Plays the next album in the playlist. Only useful when in album random
* play mode.
*/
void playNextAlbum();
/**
* Saves the file to the currently set file name. If there is no filename
* currently set, the default behavior is to prompt the user for a file
......
......@@ -99,6 +99,13 @@ void PlaylistCollection::playFirst()
currentChanged();
}
void PlaylistCollection::playNextAlbum()
{
m_playing = true;
currentPlaylist()->playNextAlbum();
currentChanged();
}
void PlaylistCollection::playPrevious()
{
m_playing = true;
......@@ -754,7 +761,9 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
#endif
createAction(i18n("Play First Track"),SLOT(slotPlayFirst()), "playFirst");
createAction(i18n("Play First Track"),SLOT(slotPlayFirst()), "playFirst");
createAction(i18n("Play Next Album"), SLOT(slotPlayNextAlbum()), "forwardAlbum", "next");
createAction(i18n("Open..."), SLOT(slotOpen()), "file_open", "fileopen", "CTRL+o");
createAction(i18n("Add &Folder..."), SLOT(slotAddFolder()), "openDirectory", "fileopen");
createAction(i18n("&Rename..."), SLOT(slotRename()), "renamePlaylist", "lineedit");
......
......@@ -56,6 +56,7 @@ public:
virtual bool playing() const;
void playFirst();
void playNextAlbum();
virtual QStringList playlists() const;
virtual void createPlaylist(const QString &name);
......@@ -196,7 +197,8 @@ private:
const QString &icon = QString::null,
const KShortcut &shortcut = KShortcut());
private slots:
void slotPlayFirst() { m_collection->playFirst(); }
void slotPlayFirst() { m_collection->playFirst(); }
void slotPlayNextAlbum() { m_collection->playNextAlbum(); }
void slotOpen() { m_collection->open(); }
void slotAddFolder() { m_collection->addFolder(); }
......
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