parley
Go to the documentation of this file.
19 using namespace Practice;
25 setIcon(KIcon(
"media-playback-start"));
26 setText(i18n(
"Play"));
27 setToolTip(i18n(
"Play"));
28 connect(
this, SIGNAL(clicked(
bool)),
this, SLOT(playAudio()));
34 setEnabled(!m_url.path().isEmpty() && m_url.isLocalFile());
37 void AudioButton::playAudio()
41 m_player = Phonon::createPlayer(Phonon::NotificationCategory, m_url);
42 m_player->setParent(
this);
43 connect(m_player, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
this, SLOT(playerStateChanged(Phonon::State)));
45 if (m_player->state() == Phonon::PlayingState) {
49 m_player->setCurrentSource(m_url);
54 void AudioButton::playerStateChanged(Phonon::State newState)
57 case Phonon::LoadingState:
case Phonon::BufferingState:
case Phonon::PlayingState:
58 setIcon(KIcon(
"media-playback-stop"));
59 setText(i18n(
"Stop"));
60 setToolTip(i18n(
"Stop"));
62 case Phonon::StoppedState:
case Phonon::PausedState:
case Phonon::ErrorState:
63 setIcon(KIcon(
"media-playback-start"));
64 setToolTip(i18n(
"Play"));
65 setText(i18n(
"Play"));
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:05 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.