Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Planella
juk
Commits
bf66593c
Commit
bf66593c
authored
Apr 18, 2004
by
Scott Wheeler
Browse files
DCOP is back.
svn path=/trunk/kdemultimedia/juk/; revision=304639
parent
68bc8db0
Changes
10
Hide whitespace changes
Inline
Side-by-side
artsplayer.cpp
View file @
bf66593c
...
...
@@ -152,7 +152,7 @@ bool ArtsPlayer::paused() const
return
false
;
}
long
ArtsPlayer
::
totalTime
()
const
int
ArtsPlayer
::
totalTime
()
const
{
if
(
serverRunning
()
&&
m_playobject
)
return
m_playobject
->
overallTime
().
seconds
;
...
...
@@ -160,7 +160,7 @@ long ArtsPlayer::totalTime() const
return
-
1
;
}
long
ArtsPlayer
::
currentTime
()
const
int
ArtsPlayer
::
currentTime
()
const
{
if
(
serverRunning
()
&&
m_playobject
&&
(
m_playobject
->
state
()
==
Arts
::
posPlaying
||
...
...
@@ -190,7 +190,7 @@ int ArtsPlayer::position() const
// player seek functions
/////////////////////////////////////////////////////////////////////////////////
void
ArtsPlayer
::
seek
(
long
seekTime
)
void
ArtsPlayer
::
seek
(
int
seekTime
)
{
if
(
serverRunning
()
&&
m_playobject
)
{
Arts
::
poTime
poSeekTime
;
...
...
artsplayer.h
View file @
bf66593c
...
...
@@ -57,11 +57,11 @@ public:
virtual
bool
playing
()
const
;
virtual
bool
paused
()
const
;
virtual
long
totalTime
()
const
;
virtual
long
currentTime
()
const
;
virtual
int
totalTime
()
const
;
virtual
int
currentTime
()
const
;
virtual
int
position
()
const
;
// in this case not really the percent
virtual
void
seek
(
long
seekTime
);
virtual
void
seek
(
int
seekTime
);
virtual
void
seekPosition
(
int
position
);
private
slots
:
...
...
gstreamerplayer.cpp
View file @
bf66593c
...
...
@@ -96,12 +96,12 @@ bool GStreamerPlayer::paused() const
return
m_player
->
getState
()
==
Element
::
STATE_PAUSED
;
}
long
GStreamerPlayer
::
totalTime
()
const
int
GStreamerPlayer
::
totalTime
()
const
{
return
m_durationNs
/
1000000000L
;
}
long
GStreamerPlayer
::
currentTime
()
const
int
GStreamerPlayer
::
currentTime
()
const
{
return
m_positionNs
/
1000000000L
;
}
...
...
@@ -118,7 +118,7 @@ int GStreamerPlayer::position() const
// m_player seek functions
/////////////////////////////////////////////////////////////////////////////////
void
GStreamerPlayer
::
seek
(
long
seekTime
)
void
GStreamerPlayer
::
seek
(
int
seekTime
)
{
// seek time in seconds?
m_player
->
seekToTime
(
seekTime
*
1000000000
);
...
...
gstreamerplayer.h
View file @
bf66593c
...
...
@@ -45,11 +45,11 @@ public:
virtual
bool
playing
()
const
;
virtual
bool
paused
()
const
;
virtual
long
totalTime
()
const
;
virtual
long
currentTime
()
const
;
virtual
int
totalTime
()
const
;
virtual
int
currentTime
()
const
;
virtual
int
position
()
const
;
// in this case not really the percent
virtual
void
seek
(
long
seekTime
);
virtual
void
seek
(
int
seekTime
);
virtual
void
seekPosition
(
int
position
);
public
slots
:
...
...
juk.cpp
View file @
bf66593c
...
...
@@ -44,6 +44,7 @@ using namespace ActionCollection;
JuK
::
JuK
(
QWidget
*
parent
,
const
char
*
name
)
:
KMainWindow
(
parent
,
name
,
WDestructiveClose
),
DCOPObject
(
"Collection"
),
m_player
(
PlayerManager
::
instance
()),
m_shuttingDown
(
false
)
{
...
...
juk.h
View file @
bf66593c
...
...
@@ -23,9 +23,9 @@
#include <kmainwindow.h>
#include <kpopupmenu.h>
#include "playermanager.h"
#include "playlistsplitter.h"
#include "jukIface.h"
class
QTimer
;
class
QListViewItem
;
...
...
@@ -34,7 +34,7 @@ class SliderAction;
class
StatusLabel
;
class
SystemTray
;
class
JuK
:
public
KMainWindow
class
JuK
:
public
KMainWindow
,
public
CollectionIface
{
Q_OBJECT
...
...
jukIface.h
View file @
bf66593c
...
...
@@ -4,33 +4,42 @@
#include <dcopobject.h>
#include <qstringlist.h>
class
JuK
Iface
:
virtual
public
DCOPObject
class
Collection
Iface
:
virtual
public
DCOPObject
{
K_DCOP
K_DCOP
public:
CollectionIface
()
:
DCOPObject
(
"Collection"
)
{}
k_dcop:
virtual
void
openFile
(
const
QString
&
s
)
=
0
;
virtual
void
openFile
(
const
QStringList
&
file
)
=
0
;
virtual
void
openFile
(
const
QString
&
s
)
=
0
;
virtual
void
openFile
(
const
QStringList
&
file
)
=
0
;
};
virtual
void
play
()
=
0
;
virtual
void
pause
()
=
0
;
virtual
void
stop
()
=
0
;
virtual
void
playPause
()
=
0
;
class
PlayerIface
:
virtual
public
DCOPObject
{
K_DCOP
public:
PlayerIface
()
:
DCOPObject
(
"Player"
)
{}
k_dcop:
virtual
void
play
()
=
0
;
virtual
void
pause
()
=
0
;
virtual
void
stop
()
=
0
;
virtual
void
playPause
()
=
0
;
virtual
void
back
()
=
0
;
virtual
void
forward
()
=
0
;
virtual
void
seekBack
()
=
0
;
virtual
void
seekForward
()
=
0
;
virtual
void
back
()
=
0
;
virtual
void
forward
()
=
0
;
virtual
void
seekBack
()
=
0
;
virtual
void
seekForward
()
=
0
;
virtual
void
volumeUp
()
=
0
;
virtual
void
volumeDown
()
=
0
;
virtual
void
volumeM
ute
()
=
0
;
virtual
void
setVolume
(
float
volume
)
=
0
;
virtual
void
se
tTim
e
(
int
time
)
=
0
;
virtual
void
startPlayingPlaylist
()
=
0
;
virtual
void
volumeUp
()
=
0
;
virtual
void
volumeDown
()
=
0
;
virtual
void
m
ute
()
=
0
;
virtual
void
setVolume
(
float
volume
)
=
0
;
virtual
void
see
k
(
int
time
)
=
0
;
//
virtual void startPlayingPlaylist() = 0;
virtual
QString
playingString
()
const
=
0
;
virtual
int
currentTime
()
const
=
0
;
virtual
int
totalTime
()
const
=
0
;
//
virtual QString playingString() const = 0;
virtual
int
currentTime
()
const
=
0
;
virtual
int
totalTime
()
const
=
0
;
};
#endif
player.h
View file @
bf66593c
...
...
@@ -38,11 +38,11 @@ public:
virtual
bool
playing
()
const
=
0
;
virtual
bool
paused
()
const
=
0
;
virtual
long
totalTime
()
const
=
0
;
virtual
long
currentTime
()
const
=
0
;
virtual
int
totalTime
()
const
=
0
;
virtual
int
currentTime
()
const
=
0
;
virtual
int
position
()
const
=
0
;
// in this case not really the percent
virtual
void
seek
(
long
seekTime
)
=
0
;
virtual
void
seek
(
int
seekTime
)
=
0
;
virtual
void
seekPosition
(
int
position
)
=
0
;
protected:
...
...
playermanager.cpp
View file @
bf66593c
...
...
@@ -69,7 +69,8 @@ static Player *createPlayer(int system = ArtsBackend)
////////////////////////////////////////////////////////////////////////////////
PlayerManager
::
PlayerManager
()
:
QObject
(
0
,
"PlayerManager"
),
Player
(),
DCOPObject
(
"Player"
),
m_sliderAction
(
0
),
m_playlistInterface
(
0
),
m_statusLabel
(
0
),
...
...
@@ -121,7 +122,7 @@ float PlayerManager::volume() const
return
player
()
->
volume
();
}
long
PlayerManager
::
totalTime
()
const
int
PlayerManager
::
totalTime
()
const
{
if
(
!
player
())
return
0
;
...
...
@@ -129,7 +130,7 @@ long PlayerManager::totalTime() const
return
player
()
->
totalTime
();
}
long
PlayerManager
::
currentTime
()
const
int
PlayerManager
::
currentTime
()
const
{
if
(
!
player
())
return
0
;
...
...
@@ -216,6 +217,11 @@ void PlayerManager::play(const FileHandle &file)
m_timer
->
start
(
m_pollInterval
);
}
void
PlayerManager
::
play
()
{
play
(
FileHandle
::
null
());
}
void
PlayerManager
::
pause
()
{
if
(
!
player
())
...
...
@@ -260,7 +266,7 @@ void PlayerManager::setVolume(float volume)
player
()
->
setVolume
(
volume
);
}
void
PlayerManager
::
seek
(
long
seekTime
)
void
PlayerManager
::
seek
(
int
seekTime
)
{
if
(
!
player
())
return
;
...
...
@@ -414,7 +420,7 @@ void PlayerManager::slotUpdateTime(int position)
float
positionFraction
=
float
(
position
)
/
m_sliderAction
->
trackPositionSlider
()
->
maxValue
();
float
totalTime
=
float
(
player
()
->
totalTime
());
long
seekTime
=
long
(
positionFraction
*
totalTime
+
0.5
);
// "+0.5" for rounding
int
seekTime
=
int
(
positionFraction
*
totalTime
+
0.5
);
// "+0.5" for rounding
m_statusLabel
->
setItemCurrentTime
(
seekTime
);
}
...
...
playermanager.h
View file @
bf66593c
...
...
@@ -18,21 +18,22 @@
#ifndef PLAYERMANAGER_H
#define PLAYERMANAGER_H
#include "player.h"
#include "filehandle.h"
#include "jukIface.h"
class
QTimer
;
class
KSelectAction
;
class
SliderAction
;
class
StatusLabel
;
class
PlaylistInterface
;
class
Player
;
/**
* This class serves as a proxy to the Player interface and handles managing
* the actions from the top-level mainwindow.
*/
class
PlayerManager
:
public
QObject
class
PlayerManager
:
public
Player
,
public
PlayerIface
{
Q_OBJECT
...
...
@@ -46,8 +47,8 @@ public:
bool
playing
()
const
;
bool
paused
()
const
;
float
volume
()
const
;
long
totalTime
()
const
;
long
currentTime
()
const
;
int
totalTime
()
const
;
int
currentTime
()
const
;
int
position
()
const
;
void
setPlaylistInterface
(
PlaylistInterface
*
interface
);
...
...
@@ -57,11 +58,12 @@ public:
public
slots
:
void
play
(
const
FileHandle
&
file
=
FileHandle
::
null
());
void
play
(
const
FileHandle
&
file
);
void
play
();
void
pause
();
void
stop
();
void
setVolume
(
float
volume
=
1.0
);
void
seek
(
long
seekTime
);
void
seek
(
int
seekTime
);
void
seekPosition
(
int
position
);
void
seekForward
();
void
seekBack
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment