Commit 0f3665e0 authored by Scott Wheeler's avatar Scott Wheeler

Modified patches from Teemu Rytilahti to make JuK usable with the media

control applet.

CCMAIL:Teemu Rytilahti <teemu.rytilahti@d5k.net>, Stefan Gehn <sgehn@gmx.net>

svn path=/trunk/kdemultimedia/juk/; revision=229222
parent 88b63dd0
......@@ -54,6 +54,7 @@ servicemenu_DATA = jukservicemenu.desktop
METASOURCES = AUTO
KDE_ICON = AUTO
POFILES = AUTO
xdg_apps_DATA = juk.desktop
......
......@@ -32,17 +32,13 @@
// public methods
////////////////////////////////////////////////////////////////////////////////
ArtsPlayer::ArtsPlayer() : Player()
ArtsPlayer::ArtsPlayer() : Player(),
m_dispatcher(0),
m_server(0),
m_media(0),
m_volumeControl(0),
m_currentVolume(1.0)
{
// set pointers to null
m_server = 0;
m_volumeControl = 0;
m_media = 0;
m_dispatcher = 0;
// startup volume of "full" volume
m_currentVolume = 1.0;
setupPlayer();
}
......@@ -155,7 +151,7 @@ long ArtsPlayer::totalTime() const
long ArtsPlayer::currentTime() const
{
if(serverRunning() && m_media && m_media->state() == posPlaying)
if(serverRunning() && m_media && (m_media->state() == posPlaying || m_media->state() == posPaused))
return m_media->currentTime().seconds;
else
return -1;
......
......@@ -97,7 +97,7 @@ void JuK::play()
if(m_player->paused()) {
m_player->play();
m_statusLabel->setPlayingItemInfo(playingString(), m_splitter->playingList());
// Here, before doing anything, we want to make sure that the m_player did
// in fact start.
......@@ -122,6 +122,7 @@ void JuK::pause()
m_playTimer->stop();
m_player->pause();
m_statusLabel->setPlayingItemInfo(playingString(), m_splitter->playingList());
actionCollection()->action("pause")->setEnabled(false);
if(m_systemTray)
m_systemTray->slotPause();
......@@ -235,6 +236,12 @@ void JuK::openFile(const QString &file)
m_splitter->open(file);
}
void JuK::openFile(const QStringList &files)
{
for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
openFile(*it);
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
......@@ -597,7 +604,7 @@ bool JuK::queryClose()
return true;
}
void JuK::invokeEditSlot( const char *slotName, const char *slot )
void JuK::invokeEditSlot(const char *slotName, const char *slot)
{
QObject *object = focusWidget();
......@@ -618,6 +625,8 @@ void JuK::invokeEditSlot( const char *slotName, const char *slot )
QString JuK::playingString() const
{
QString s;
if(!m_player->playing() && !m_player->paused())
return i18n("No song playing");
if(m_splitter->playingArtist().isEmpty())
s = m_splitter->playingTrack().simplifyWhiteSpace();
......
......@@ -67,12 +67,6 @@ public slots:
void volumeDown();
void volumeMute();
/**
* Set the volume. 100 is the maximum.
*/
void setVolume(float volume);
signals:
void signalEdit();
void signalNewSong(const QString& songTitle);
......@@ -109,6 +103,20 @@ private:
void invokeEditSlot(const char *slotName, const char *slot);
QString playingString() const;
int currentTime() const { return m_player->currentTime(); }
int totalTime() const { return m_player->totalTime(); }
/**
* Set the volume. 100 is the maximum.
*/
void setVolume(float volume);
/**
* Set the position in the currently playing track (in seconds).
*/
void setTime(int time) { m_player->seek(time); }
void updatePlaylistInfo();
/**
......@@ -118,6 +126,7 @@ private:
void play(const QString &file);
void openFile(const QString &file);
void openFile(const QStringList &files);
/**
* Because we want to be able to reuse these actions in the main GUI classes,
......
......@@ -2,6 +2,7 @@
#define JUKIFACE_H
#include <dcopobject.h>
#include <qstringlist.h>
class JuKIface : virtual public DCOPObject
{
......@@ -9,6 +10,7 @@ class JuKIface : virtual public DCOPObject
k_dcop:
virtual void openFile( const QString &s )=0;
virtual void openFile(const QStringList &file) = 0;
virtual void play()=0;
virtual void pause()=0;
......@@ -24,7 +26,11 @@ k_dcop:
virtual void volumeDown()=0;
virtual void volumeMute()=0;
virtual void setVolume(float volume)=0;
virtual void setTime(int time) = 0;
virtual void startPlayingPlaylist()=0;
virtual QString playingString() const = 0;
virtual int currentTime() const = 0;
virtual int totalTime() const = 0;
};
#endif
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