- provide a custom member for the audio media object
svn path=/trunk/KDE/kdebase/apps/; revision=952886
m_url(),
m_playButton(0),
m_stopButton(0),
m_url(),
m_playButton(0),
m_stopButton(0),
m_media(0),
m_seekSlider(0),
m_videoPlayer(0)
m_media(0),
m_seekSlider(0),
m_videoPlayer(0)
if (m_url != url) {
stop(); // emits playingStopped() signal
m_url = url;
if (m_url != url) {
stop(); // emits playingStopped() signal
m_url = url;
{
if (m_mode != mode) {
stop(); // emits playingStopped() signal
{
if (m_mode != mode) {
stop(); // emits playingStopped() signal
- if (m_mode == Audio) {
- m_videoPlayer->hide();
- m_media = 0;
- }
QWidget::hideEvent(event);
if (!event->spontaneous()) {
stop();
QWidget::hideEvent(event);
if (!event->spontaneous()) {
stop();
- if (m_videoPlayer != 0) {
- m_videoPlayer->hide();
- }
{
switch (m_mode) {
case Audio:
{
switch (m_mode) {
case Audio:
- if (m_media == 0) {
- m_media = Phonon::createPlayer(Phonon::MusicCategory, m_url);
- m_media->setParent(this);
+ if (m_audioMedia == 0) {
+ // Creating an audio player might take up to 2 seconds when doing
+ // it the first time. To prevent that the user interface gets
+ // noticable blocked, the creation is delayed until the play button
+ // has been pressed.
+ m_audioMedia = Phonon::createPlayer(Phonon::MusicCategory, m_url);
+ m_audioMedia->setParent(this);
+ m_media = m_audioMedia;
m_media->setCurrentSource(m_url);
break;
m_media->setCurrentSource(m_url);
break;
m_stopButton->hide();
m_playButton->show();
}
m_stopButton->hide();
m_playButton->show();
}
+
+ if (m_videoPlayer != 0) {
+ m_videoPlayer->hide();
+ }
KUrl m_url;
QToolButton *m_playButton;
QToolButton *m_stopButton;
KUrl m_url;
QToolButton *m_playButton;
QToolButton *m_stopButton;
+ Phonon::MediaObject *m_audioMedia;
Phonon::MediaObject *m_media;
Phonon::SeekSlider *m_seekSlider;
Phonon::VideoPlayer *m_videoPlayer;
Phonon::MediaObject *m_media;
Phonon::SeekSlider *m_seekSlider;
Phonon::VideoPlayer *m_videoPlayer;