toTemplateEdit::toTemplateEdit(std::map<QString, QString> &pairs,
                               QWidget *parent, const char *name) :
        QDialog(parent),//, name, true, Qt::WStyle_Maximize),
        toHelpContext(QString::fromLatin1("template.html#editor")),
        TemplateMap(pairs)
{
    setupUi(this);
    toHelp::connectDialog(this);
    LastTemplate = TemplateMap.end();
    updateFromMap();
    Description->setWrapMode(QsciScintilla::WrapWord);
}
Esempio n. 2
0
Mpris2Player::Mpris2Player(const QString &service, QObject *parent)
    : QObject(parent)
    , m_serviceName(service)
    , m_fetchesPending(0)
    , m_capabilities(NoCapabilities)
    , m_metadata(new QQmlPropertyMap(this))
    , m_status(QStringLiteral("Stopped"))
    , m_fullScreen(false)
    , m_position(0)
    , m_rate(0)
    , m_minimumRate(0)
    , m_maximumRate(0)
    , m_volume(0)
{
    // Create D-Bus adaptors
    m_propsInterface = new OrgFreedesktopDBusPropertiesInterface(service, objectPath,
                                                                 QDBusConnection::sessionBus(),
                                                                 this);
    m_interface = new OrgMprisMediaPlayer2Interface(service, objectPath,
                                                    QDBusConnection::sessionBus(),
                                                    this);
    m_playerInterface = new OrgMprisMediaPlayer2PlayerInterface(service, objectPath,
                                                                QDBusConnection::sessionBus(),
                                                                this);

    // Receive properties changes
    connect(m_propsInterface, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged,
            [=](const QString &interface, const QVariantMap &changedProperties, const QStringList &invalidatedProperties) {
        Q_UNUSED(interface);

        updateFromMap(changedProperties);
        if (!invalidatedProperties.isEmpty())
            retrieveData();
    });
    connect(m_playerInterface, &OrgMprisMediaPlayer2PlayerInterface::Seeked, [=](qlonglong offset) {
        m_position = offset;
        Q_EMIT positionChanged();
    });

    // Retrieve data
    retrieveData();
}
Esempio n. 3
0
void Mpris2Player::propertiesFinished(QDBusPendingCallWatcher *watcher)
{
    QDBusPendingReply<QVariantMap> propsReply = *watcher;
    watcher->deleteLater();

    if (m_fetchesPending < 1)
        return;

    if (propsReply.isError()) {
        qCWarning(MPRIS2_PLAYER) << m_serviceName << "does not implement"
                                 << OrgFreedesktopDBusPropertiesInterface::staticInterfaceName()
                                 << "correctly";
        qCDebug(MPRIS2_PLAYER) << "Error message was" << propsReply.error().name() << propsReply.error().message();
        m_fetchesPending = 0;
        Q_EMIT initialFetchFailed();
        return;
    }

    updateFromMap(propsReply.value());

    --m_fetchesPending;
    if (m_fetchesPending == 0)
        Q_EMIT initialFetchFinished();
}