Example #1
0
PixmapSource SkinContext::getPixmapSource(const QDomNode& pixmapNode) const {
    PixmapSource source;

    const SvgParser svgParser(*this);

    if (!pixmapNode.isNull()) {
        QDomNode svgNode = selectNode(pixmapNode, "svg");
        if (!svgNode.isNull()) {
            // inline svg
            const QByteArray rslt = svgParser.saveToQByteArray(
                svgParser.parseSvgTree(svgNode, m_xmlPath));
            source.setSVG(rslt);
        } else {
            // filename
            QString pixmapName = nodeToString(pixmapNode);
            if (!pixmapName.isEmpty()) {
                source.setPath(getSkinPath(pixmapName));
                if (source.isSVG()) {
                    const QByteArray rslt = svgParser.saveToQByteArray(
                            svgParser.parseSvgFile(source.getPath()));
                    source.setSVG(rslt);
                }
            }
        }
    }

    return source;
}
Example #2
0
void WDisplay::setPixmapBackground(PixmapSource source,
                                   Paintable::DrawMode mode) {
    m_pPixmapBack = WPixmapStore::getPaintable(source, mode);
    if (m_pPixmapBack.isNull() || m_pPixmapBack->isNull()) {
        qDebug() << metaObject()->className()
                 << "Error loading background pixmap:" << source.getPath();
    }
}
Example #3
0
void WVuMeter::setPixmapBackground(PixmapSource source, Paintable::DrawMode mode) {
    m_pPixmapBack = WPixmapStore::getPaintable(source, mode);
    if (m_pPixmapBack.isNull() || m_pPixmapBack->isNull()) {
        qDebug() << metaObject()->className()
                 << "Error loading background pixmap:" << source.getPath();
    } else if (mode == Paintable::FIXED) {
        setFixedSize(m_pPixmapBack->size());
    }
}
Example #4
0
void WSliderComposed::setSliderPixmap(PixmapSource sourceSlider) {
    m_pSlider = WPixmapStore::getPaintable(sourceSlider,
                                           Paintable::STRETCH);
    if (!m_pSlider) {
        qDebug() << "WSliderComposed: Error loading slider pixmap:" << sourceSlider.getPath();
    } else {
        // Set size of widget, using size of slider pixmap
        setFixedSize(m_pSlider->size());
    }
}
Example #5
0
void WBattery::setPixmap(PaintablePointer* ppPixmap, const PixmapSource& source,
                         Paintable::DrawMode mode) {
    PaintablePointer pPixmap = WPixmapStore::getPaintable(source, mode);
    if (pPixmap.isNull() || pPixmap->isNull()) {
        qDebug() << this << "Error loading pixmap:" << source.getPath();
    } else {
        *ppPixmap = pPixmap;
        setFixedSize(pPixmap->size());
    }
}
Example #6
0
void WVuMeter::setPixmaps(PixmapSource source,
                          bool bHorizontal, Paintable::DrawMode mode) {
    m_pPixmapVu = WPixmapStore::getPaintable(source, mode);
    if (m_pPixmapVu.isNull() || m_pPixmapVu->isNull()) {
        qDebug() << "WVuMeter: Error loading vu pixmap" << source.getPath();
    } else {
        m_bHorizontal = bHorizontal;
        if (m_bHorizontal) {
            m_iPixmapLength = m_pPixmapVu->width();
        } else {
            m_iPixmapLength = m_pPixmapVu->height();
        }
    }
}
Example #7
0
void WSliderComposed::setHandlePixmap(bool bHorizontal, PixmapSource sourceHandle) {
    m_bHorizontal = bHorizontal;
    m_pHandle = WPixmapStore::getPaintable(sourceHandle,
                                           Paintable::STRETCH);
    if (!m_pHandle) {
        qDebug() << "WSliderComposed: Error loading handle pixmap:" << sourceHandle.getPath();
    } else {
        m_iHandleLength = m_bHorizontal ?
                m_pHandle->width() : m_pHandle->height();

        // Value is unused in WSliderComposed.
        onConnectedControlChanged(getControlParameter(), 0);
        update();
    }
}
Example #8
0
void WStatusLight::setPixmap(int iState, PixmapSource source,
                             Paintable::DrawMode mode) {
    if (iState < 0 || iState >= m_pixmaps.size()) {
        return;
    }

    PaintablePointer pPixmap = WPixmapStore::getPaintable(source, mode);
    if (!pPixmap.isNull() && !pPixmap->isNull()) {
        m_pixmaps[iState] = pPixmap;
        if (mode == Paintable::FIXED) {
            setFixedSize(pPixmap->size());
        }
    } else {
        qDebug() << "WStatusLight: Error loading pixmap:" << source.getPath() << iState;
        m_pixmaps[iState].clear();
    }
}