AbstractVideoDataOutput::AbstractVideoDataOutput() : AbstractVideoOutput(*new AbstractVideoDataOutputPrivate) { K_D(AbstractVideoDataOutput); d->isRunning = false; d->allowedFormats << VideoFrame2::Format_RGB888; }
void MediaControls::setMediaObject(MediaObject *media) { K_D(MediaControls); if (d->media) { disconnect(d->media, SIGNAL(destroyed()), this, SLOT(_k_mediaDestroyed())); disconnect(d->media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(_k_stateChanged(Phonon::State, Phonon::State))); disconnect(d->media, SIGNAL(finished()), this, SLOT(_k_finished())); disconnect(&d->playButton, SIGNAL(clicked()), d->media, SLOT(play())); disconnect(&d->pauseButton, SIGNAL(clicked()), d->media, SLOT(pause())); disconnect(&d->stopButton, SIGNAL(clicked()), d->media, SLOT(stop())); } d->media = media; if (media) { connect(media, SIGNAL(destroyed()), SLOT(_k_mediaDestroyed())); connect(media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(_k_stateChanged(Phonon::State, Phonon::State))); connect(d->media, SIGNAL(finished()), this, SLOT(_k_finished())); connect(&d->playButton, SIGNAL(clicked()), media, SLOT(play())); connect(&d->pauseButton, SIGNAL(clicked()), media, SLOT(pause())); connect(&d->stopButton, SIGNAL(clicked()), media, SLOT(stop())); } d->seekSlider.setMediaObject(media); }
SeekSlider::SeekSlider(QWidget *parent) : QWidget(parent) , k_ptr(new SeekSliderPrivate(this)) { K_D(SeekSlider); connect(&d->slider, SIGNAL(valueChanged(int)), SLOT(_k_seek(int))); }
void MediaObject::pause() { K_D(MediaObject); if (d->backendObject() && d->mediaSource.type() != MediaSource::Invalid) { INTERFACE_CALL(pause()); } }
AbstractAudioDataOutput::AbstractAudioDataOutput() : MediaNode(*new AbstractAudioDataOutputPrivate) { K_D(AbstractAudioDataOutput); d->isRunning = false; d->allowedFormats << AudioFormat(); }
void MediaObject::play() { K_D(MediaObject); if (d->backendObject() && isPlayable(d->mediaSource.type())) { INTERFACE_CALL(play()); } }
void MediaObject::setCurrentSource(const MediaSource &newSource) { K_D(MediaObject); if (!k_ptr->backendObject()) { d->mediaSource = newSource; return; } pDebug() << Q_FUNC_INFO << newSource.url(); stop(); // first call stop as that often is the expected state // for setting a new URL d->mediaSource = newSource; #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM d->kiofallback = 0; // kiofallback auto-deletes #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM //X if (url.scheme() == "http") { //X d->kiofallback = Platform::createMediaStream(url, this); //X if (d->kiofallback) { //X ... //X return; //X } //X } #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM if (d->mediaSource.type() == MediaSource::Stream) { Q_ASSERT(d->mediaSource.stream()); d->mediaSource.stream()->d_func()->setMediaObjectPrivate(d); } #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM INTERFACE_CALL(setSource(d->mediaSource)); }
void VideoWidget::setFullScreen(bool newFullScreen) { pDebug() << Q_FUNC_INFO << newFullScreen; K_D(VideoWidget); // TODO: disable screensaver? or should we leave that responsibility to the // application? Qt::WindowFlags flags = windowFlags(); if (newFullScreen) { if (!isFullScreen()) { //we only update that value if it is not already fullscreen d->changeFlags = flags & (Qt::Window | Qt::SubWindow); flags |= Qt::Window; flags ^= Qt::SubWindow; setWindowFlags(flags); #ifdef Q_WS_X11 // This works around a bug with Compiz // as the window must be visible before we can set the state show(); raise(); setWindowState( windowState() | Qt::WindowFullScreen ); // set #else setWindowState( windowState() | Qt::WindowFullScreen ); // set show(); #endif } } else if (isFullScreen()) { flags ^= (Qt::Window | Qt::SubWindow); //clear the flags... flags |= d->changeFlags; //then we reset the flags (window and subwindow) setWindowFlags(flags); setWindowState( windowState() ^ Qt::WindowFullScreen ); // reset show(); } }
Effect::Effect(const EffectDescription &description, QObject *parent) : QObject(parent), MediaNode(*new EffectPrivate) { K_D(Effect); d->description = description; d->createBackendObject(); }
void MediaObject::seek(qint64 time) { K_D(MediaObject); if (d->backendObject() && isPlayable(d->mediaSource.type())) { INTERFACE_CALL(seek(time)); } }
VideoWidget::VideoWidget(VideoWidgetPrivate &dd, QWidget *parent) : QWidget(parent), Phonon::AbstractVideoOutput(dd) { K_D(VideoWidget); d->init(); }
void VolumeSlider::setMutedIcon(const QIcon &icon) { K_D(VolumeSlider); pDebug() << Q_FUNC_INFO << icon; k_ptr->mutedIcon = icon; d->updateIcon(); }
VolumeSlider::VolumeSlider(AudioOutput *output, QWidget *parent) : QWidget(parent), k_ptr(new VolumeSliderPrivate(this)) { K_D(VolumeSlider); #ifndef QT_NO_TOOLTIP setToolTip(tr("Volume: %1%").arg(100)); #endif #ifndef QT_NO_WHATSTHIS setWhatsThis(tr("Use this slider to adjust the volume. The leftmost position is 0%, the rightmost is %1%").arg(100)); #endif connect(&d->slider, SIGNAL(valueChanged(int)), SLOT(_k_sliderChanged(int))); connect(&d->muteButton, SIGNAL(clicked()), SLOT(_k_buttonClicked())); if (output) { d->output = output; d->slider.setValue(qRound(100 * output->volume())); d->slider.setEnabled(true); d->muteButton.setEnabled(true); connect(output, SIGNAL(volumeChanged(qreal)), SLOT(_k_volumeChanged(qreal))); connect(output, SIGNAL(mutedChanged(bool)), SLOT(_k_mutedChanged(bool))); } setFocusProxy(&d->slider); }
void MediaObject::seek(qint64 time) { K_D(MediaObject); if (d->backendObject() && d->mediaSource.type() != MediaSource::Invalid) { INTERFACE_CALL(seek(time)); } }
QAction *KXmlGuiWindow::toolBarMenuAction() { K_D(KXmlGuiWindow); if ( !d->toolBarHandler ) return 0; return d->toolBarHandler->toolBarMenuAction(); }
KXMLGUIFactory *KXmlGuiWindow::guiFactory() { K_D(KXmlGuiWindow); if (!d->factory) { d->factory = new KXMLGUIFactory( this, this ); connect(d->factory, SIGNAL(makingChanges(bool)), this, SLOT(_k_slotFactoryMakingChanges(bool))); }
void Effect::setParameterValue(const EffectParameter ¶m, const QVariant &newValue) { K_D(Effect); d->parameterValues[param] = newValue; if (d->backendObject()) { INTERFACE_CALL(setParameterValue(param, newValue)); } }
EffectWidget::EffectWidget(Effect *effect, QWidget *parent) : QWidget(parent), k_ptr(new EffectWidgetPrivate(effect)) { K_D(EffectWidget); d->q_ptr = this; d->autogenerateUi(); }
void MediaObject::enqueue(const MediaSource &source) { K_D(MediaObject); if (d->mediaSource.type() == MediaSource::Invalid) { setCurrentSource(source); } else { d->sourceQueue << source; } }
VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) , Phonon::AbstractVideoOutput(*new VideoWidgetPrivate(this)) { K_D(VideoWidget); d->init(); d->createBackendObject(); setMouseTracking(true); }
void SeekSlider::setOrientation(Qt::Orientation o) { K_D(SeekSlider); Qt::Alignment align = (o == Qt::Horizontal ? Qt::AlignVCenter : Qt::AlignHCenter); d->layout.setAlignment(&d->iconLabel, align); d->layout.setAlignment(&d->slider, align); d->layout.setDirection(o == Qt::Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); d->slider.setOrientation(o); }
void VolumeSlider::setOrientation(Qt::Orientation o) { K_D(VolumeSlider); Qt::Alignment align = (o == Qt::Horizontal ? Qt::AlignVCenter : Qt::AlignHCenter); d->layout.setAlignment(&d->muteButton, align); d->layout.setAlignment(&d->slider, align); d->layout.setDirection(o == Qt::Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); d->slider.setOrientation(o); }
KXmlGuiWindow::KXmlGuiWindow( QWidget* parent, Qt::WindowFlags f ) : KMainWindow(*new KXmlGuiWindowPrivate, parent, f), KXMLGUIBuilder( this ) { K_D(KXmlGuiWindow); d->showHelpMenu = true; d->toolBarHandler = 0; d->showStatusBarAction = 0; d->factory = 0; new KMainWindowInterface(this); }
void MediaObject::enqueue(const MediaSource &source) { K_D(MediaObject); if (!isPlayable(d->mediaSource.type())) { // the current source is nothing valid so this source needs to become the current one setCurrentSource(source); } else { d->sourceQueue << source; } }
void AbstractAudioDataOutput::setRunning(bool running) { K_D(AbstractAudioDataOutput); Iface<AudioDataOutputInterface> iface(d); if (iface) { if (running) { iface->setFrontendObject(this); } else { iface->setFrontendObject(0); } } }
VolumeSlider::VolumeSlider(QWidget *parent) : QWidget(parent), k_ptr(new VolumeSliderPrivate(this)) { K_D(VolumeSlider); #ifndef QT_NO_TOOLTIP setToolTip(tr("Volume: %1%").arg(100)); #endif #ifndef QT_NO_WHATSTHIS setWhatsThis(tr("Use this slider to adjust the volume. The leftmost position is 0%, the rightmost is %1%").arg(100)); #endif connect(&d->slider, SIGNAL(valueChanged(int)), SLOT(_k_sliderChanged(int))); connect(&d->muteButton, SIGNAL(clicked()), SLOT(_k_buttonClicked())); setFocusProxy(&d->slider); }
PHONON_OBJECT_IMPL MediaObject::~MediaObject() { K_D(MediaObject); if (d->m_backendObject) { switch (state()) { case PlayingState: case BufferingState: case PausedState: stop(); break; case ErrorState: case StoppedState: case LoadingState: break; } } }
void MediaObject::setCurrentSource(const MediaSource &newSource) { K_D(MediaObject); if (!k_ptr->backendObject()) { d->mediaSource = newSource; return; } pDebug() << Q_FUNC_INFO << newSource.url(); stop(); // first call stop as that often is the expected state // for setting a new URL MediaSource::Type oldSourceType = d->mediaSource.type(); d->mediaSource = newSource; d->kiofallback = 0; // kiofallback auto-deletes //X if (url.scheme() == "http") { //X d->kiofallback = Platform::createMediaStream(url, this); //X if (d->kiofallback) { //X ... //X return; //X } //X } if (d->mediaSource.type() == MediaSource::Stream) { Q_ASSERT(d->mediaSource.stream()); d->mediaSource.stream()->d_func()->setMediaObjectPrivate(d); } else if (d->mediaSource.type() == MediaSource::Invalid) { pWarning() << "requested invalid MediaSource for the current source of MediaObject"; return; } if (d->mediaSource.type() == MediaSource::Url && oldSourceType != MediaSource::Url) { disconnect(d->m_backendObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SIGNAL(stateChanged(Phonon::State, Phonon::State))); connect(d->m_backendObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(_k_stateChanged(Phonon::State, Phonon::State))); } else if (d->mediaSource.type() != MediaSource::Url && oldSourceType == MediaSource::Url) { disconnect(d->m_backendObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(_k_stateChanged(Phonon::State, Phonon::State))); connect(d->m_backendObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SIGNAL(stateChanged(Phonon::State, Phonon::State))); } INTERFACE_CALL(setSource(d->mediaSource)); }
void SeekSlider::setMediaObject(MediaObject *media) { K_D(SeekSlider); if (d->media) { disconnect(d->media, 0, this, 0); } d->media = media; if (media) { connect(media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(_k_stateChanged(Phonon::State))); connect(media, SIGNAL(totalTimeChanged(qint64)), SLOT(_k_length(qint64))); connect(media, SIGNAL(tick(qint64)), SLOT(_k_tick(qint64))); connect(media, SIGNAL(seekableChanged(bool)), SLOT(_k_seekableChanged(bool))); connect(media, SIGNAL(currentSourceChanged(const Phonon::MediaSource&)), SLOT(_k_currentSourceChanged())); d->_k_stateChanged(media->state()); d->_k_seekableChanged(media->isSeekable()); d->_k_length(media->totalTime()); } else { d->_k_stateChanged(Phonon::StoppedState); d->_k_seekableChanged(false); } }
void VolumeSlider::setAudioOutput(AudioOutput *output) { K_D(VolumeSlider); if (d->output) { disconnect(d->output, 0, this, 0); } d->output = output; if (output) { d->slider.setValue(qRound(100 * output->volume())); d->slider.setEnabled(true); d->muteButton.setEnabled(true); d->_k_volumeChanged(output->volume()); d->_k_mutedChanged(output->isMuted()); connect(output, SIGNAL(volumeChanged(qreal)), SLOT(_k_volumeChanged(qreal))); connect(output, SIGNAL(mutedChanged(bool)), SLOT(_k_mutedChanged(bool))); } else { d->slider.setValue(100); d->slider.setEnabled(false); d->muteButton.setEnabled(false); } }