Esempio n. 1
0
void Player::on_actionSkipNext_triggered()
{
    emit showStatusMessage(actionSkipNext->toolTip());
    if (m_scrubber->markers().size() > 0) {
        foreach (int x, m_scrubber->markers()) {
            if (x > m_position) {
                emit seeked(x);
                return;
            }
        }
        emit seeked(m_duration - 1);
    }
Esempio n. 2
0
PlayerContainer::PlayerContainer(const QString& busAddress, QObject* parent)
    : DataContainer(parent)
    , m_caps(NoCaps)
    , m_fetchesPending(0)
    , m_dbusAddress(busAddress)
    , m_currentRate(0.0)
{
    Q_ASSERT(!busAddress.isEmpty());
    Q_ASSERT(busAddress.startsWith(QLatin1String("org.mpris.MediaPlayer2.")));

    m_propsIface = new OrgFreedesktopDBusPropertiesInterface(
            busAddress, MPRIS2_PATH,
            QDBusConnection::sessionBus(), this);

    m_playerIface = new OrgMprisMediaPlayer2PlayerInterface(
            busAddress, MPRIS2_PATH,
            QDBusConnection::sessionBus(), this);

    m_rootIface = new OrgMprisMediaPlayer2Interface(
            busAddress, MPRIS2_PATH,
            QDBusConnection::sessionBus(), this);

    connect(m_propsIface, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
            this,         SLOT(propertiesChanged(QString,QVariantMap,QStringList)));

    connect(m_playerIface, SIGNAL(Seeked(qlonglong)),
            this,          SLOT(seeked(qlonglong)));

    refresh();
}
Esempio n. 3
0
void Player::loopPos()
{
    if(m_GstPlayer->pos() < 0) {
        QTimer::singleShot(100, this, SLOT(loopPos()));
    } else {
        Q_EMIT seeked(m_GstPlayer->pos() / 1000);
    }
}
Esempio n. 4
0
void TimelineDock::setPosition(int position)
{
    if (!m_model.tractor()) return;
    if (position <= m_model.tractor()->get_length()) {
        emit seeked(position);
    } else {
        m_position = m_model.tractor()->get_length();
        emit positionChanged();
    }
}
Esempio n. 5
0
void Player::seek(qint64 value)
{
    uint length = -m_GstPlayer->length().msecsTo(QTime());
    if (length != 0 && value > -1) {
        QTime pos;
        pos = pos.addMSecs(length * (value / 1000.0));
        m_GstPlayer->setPosition(pos);

        Q_EMIT seeked(length * (value / 1000.0) * 1000);
    }
}
Esempio n. 6
0
void Player::seek(int position)
{
    if (m_isSeekable) {
        if (position >= 0) {
            emit seeked(qMin(position, m_duration - 1));
        }
    }
    // Seek implies pause.
    actionPlay->setIcon(m_playIcon);
    actionPlay->setText(tr("Play"));
    actionPlay->setToolTip(tr("Start playback (L)"));
}
void MprisControlPlugin::addPlayer(const QString& service)
{
    QDBusInterface mprisInterface(service, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2");
    //FIXME: This call hangs and returns an empty string if KDED is still starting!
    const QString identity = mprisInterface.property("Identity").toString();
    playerList[identity] = service;
    qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Mpris addPlayer" << service << "->" << identity;
    sendPlayerList();

    OrgFreedesktopDBusPropertiesInterface* freedesktopInterface = new OrgFreedesktopDBusPropertiesInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus(), this);
    connect(freedesktopInterface, SIGNAL(PropertiesChanged(QString, QVariantMap, QStringList)), this, SLOT(propertiesChanged(QString, QVariantMap)));

    OrgMprisMediaPlayer2PlayerInterface* mprisInterface0  = new OrgMprisMediaPlayer2PlayerInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus());
    connect(mprisInterface0, SIGNAL(Seeked(qlonglong)), this, SLOT(seeked(qlonglong)));
}