コード例 #1
0
ファイル: wstatuslight.cpp プロジェクト: Adna1206/mixxx
void WStatusLight::setup(QDomNode node, const SkinContext& context) {
    // Number of states. Add one to account for the background.
    setNoPos(context.selectInt(node, "NumberPos") + 1);

    // Set pixmaps
    for (int i = 0; i < m_pixmaps.size(); ++i) {
        // Accept either PathStatusLight or PathStatusLight1 for value 1,
        QString nodeName = QString("PathStatusLight%1").arg(i);
        if (context.hasNode(node, nodeName)) {
            QString mode = context.selectAttributeString(
                context.selectElement(node, nodeName), "sizemode", "FIXED");
            setPixmap(i, context.getSkinPath(context.selectString(node, nodeName)),
                                             SizeModeFromString(mode));
        } else if (i == 0 && context.hasNode(node, "PathBack")) {
            QString mode = context.selectAttributeString(
                context.selectElement(node, "PathBack"), "sizemode", "FIXED");
            setPixmap(i, context.getSkinPath(context.selectString(node, "PathBack")),
                                             SizeModeFromString(mode));
        } else if (i == 1 && context.hasNode(node, "PathStatusLight")) {
            QString mode = context.selectAttributeString(
                context.selectElement(node, "PathStatusLight"), "sizemode", "FIXED");
            setPixmap(i, context.getSkinPath(context.selectString(node, "PathStatusLight")),
                                             SizeModeFromString(mode));
        } else {
            m_pixmaps[i].clear();
        }
    }
}
コード例 #2
0
ファイル: wvumeter.cpp プロジェクト: davidkohr/mixxx
void WVuMeter::setup(QDomNode node, const SkinContext& context) {
    // Set pixmaps
    bool bHorizontal = context.hasNode(node, "Horizontal") &&
            context.selectString(node, "Horizontal") == "true";

    // Set background pixmap if available
    if (context.hasNode(node, "PathBack")) {
        setPixmapBackground(context.getSkinPath(context.selectString(node, "PathBack")));
    }

    setPixmaps(context.getSkinPath(context.selectString(node, "PathVu")), bHorizontal);

    m_iPeakHoldSize = context.selectInt(node, "PeakHoldSize");
    if (m_iPeakHoldSize < 0 || m_iPeakHoldSize > 100)
        m_iPeakHoldSize = DEFAULT_HOLDSIZE;

    m_iPeakFallStep = context.selectInt(node, "PeakFallStep");
    if (m_iPeakFallStep < 1 || m_iPeakFallStep > 1000)
        m_iPeakFallStep = DEFAULT_FALLSTEP;

    m_iPeakHoldTime = context.selectInt(node, "PeakHoldTime");
    if (m_iPeakHoldTime < 1 || m_iPeakHoldTime > 3000)
        m_iPeakHoldTime = DEFAULT_HOLDTIME;

    m_iPeakFallTime = context.selectInt(node, "PeakFallTime");
    if (m_iPeakFallTime < 1 || m_iPeakFallTime > 1000)
        m_iPeakFallTime = DEFAULT_FALLTIME;
}
コード例 #3
0
ファイル: wdisplay.cpp プロジェクト: suyoghc/mixxx
void WDisplay::setup(QDomNode node, const SkinContext& context) {
    // Set background pixmap if available
    if (context.hasNode(node, "BackPath")) {
        setPixmapBackground(context.getSkinPath(
            context.selectString(node, "BackPath")));
    }

    // Number of states
    setPositions(context.selectInt(node, "NumberStates"));


    // Load knob pixmaps
    QString path = context.selectString(node, "Path");
    for (int i = 0; i < m_pixmaps.size(); ++i) {
        setPixmap(&m_pixmaps, i, context.getSkinPath(path.arg(i)));
    }

    // See if disabled images is defined, and load them...
    if (context.hasNode(node, "DisabledPath")) {
        QString disabledPath = context.selectString(node, "DisabledPath");
        for (int i = 0; i < m_disabledPixmaps.size(); ++i) {
            setPixmap(&m_disabledPixmaps, i,
                      context.getSkinPath(disabledPath.arg(i)));
        }
        m_bDisabledLoaded = true;
    }
}
コード例 #4
0
ファイル: woverview.cpp プロジェクト: cardinot/mixxx
void WOverview::setup(QDomNode node, const SkinContext& context) {
    m_signalColors.setup(node, context);

    m_qColorBackground = m_signalColors.getBgColor();

    // Clear the background pixmap, if it exists.
    m_backgroundPixmap = QPixmap();
    m_backgroundPixmapPath = context.selectString(node, "BgPixmap");
    if (m_backgroundPixmapPath != "") {
        m_backgroundPixmap = QPixmap(context.getSkinPath(m_backgroundPixmapPath));
    }

    m_endOfTrackColor = QColor(200, 25, 20);
    const QString endOfTrackColorName = context.selectString(node, "EndOfTrackColor");
    if (!endOfTrackColorName.isNull()) {
        m_endOfTrackColor.setNamedColor(endOfTrackColorName);
        m_endOfTrackColor = WSkinColor::getCorrectColor(m_endOfTrackColor);
    }

    QPalette palette; //Qt4 update according to http://doc.trolltech.com/4.4/qwidget-qt3.html#setBackgroundColor (this could probably be cleaner maybe?)
    palette.setColor(this->backgroundRole(), m_qColorBackground);
    setPalette(palette);

    //setup hotcues and cue and loop(s)
    m_marks.setup(m_group, node, context, m_signalColors);

    for (int i = 0; i < m_marks.size(); ++i) {
        WaveformMark& mark = m_marks[i];
        if (mark.m_pointControl) {
            connect(mark.m_pointControl, SIGNAL(valueChanged(double)),
                    this, SLOT(onMarkChanged(double)));
        }
    }
コード例 #5
0
WaveformMarkProperties::WaveformMarkProperties(const QDomNode& node,
                                               const SkinContext& context,
                                               const WaveformSignalColors& signalColors) {
    m_color = context.selectString(node, "Color");
    if (!m_color.isValid()) {
        // As a fallback, grab the color from the parent's AxesColor
        m_color = signalColors.getAxesColor();
        qDebug() << "Didn't get mark <Color>, using parent's <AxesColor>:" << m_color;
    } else {
        m_color = WSkinColor::getCorrectColor(m_color);
    }

    m_textColor = context.selectString(node, "TextColor");
    if (!m_textColor.isValid()) {
        // Read the text color, otherwise use the parent's BgColor.
        m_textColor = signalColors.getBgColor();
        qDebug() << "Didn't get mark <TextColor>, using parent's <BgColor>:" << m_textColor;
    }

    QString markAlign = context.selectString(node, "Align");
    m_align = decodeAlignmentFlags(markAlign, Qt::AlignBottom | Qt::AlignHCenter);

    m_text = context.selectString(node, "Text");
    m_pixmapPath = context.selectString(node, "Pixmap");
    if (!m_pixmapPath.isEmpty()) {
        m_pixmapPath = context.getSkinPath(m_pixmapPath);
    }
}
コード例 #6
0
ファイル: wknobcomposed.cpp プロジェクト: suyoghc/mixxx
void WKnobComposed::setup(QDomNode node, const SkinContext& context) {
    clear();

    // Set background pixmap if available
    if (context.hasNode(node, "BackPath")) {
        setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
    }

    // Set background pixmap if available
    if (context.hasNode(node, "Knob")) {
        setPixmapKnob(context.getSkinPath(context.selectString(node, "Knob")));
    }

    if (context.hasNode(node, "MinAngle")) {
        m_dMinAngle = context.selectDouble(node, "MinAngle");
    }

    if (context.hasNode(node, "MaxAngle")) {
        m_dMaxAngle = context.selectDouble(node, "MaxAngle");
    }
}
コード例 #7
0
ファイル: wdisplay.cpp プロジェクト: DigitalBillMusic/mixxx
void WDisplay::setup(const QDomNode& node, const SkinContext& context) {
    // Set background pixmap if available

    QDomElement backPathNode = context.selectElement(node, "BackPath");
    if (!backPathNode.isNull()) {
        setPixmapBackground(context.getPixmapSource(backPathNode),
                            context.selectScaleMode(backPathNode, Paintable::TILE));
    }

    // Number of states
    setPositions(context.selectInt(node, "NumberStates"));

    // Load knob pixmaps
    QDomElement pathNode = context.selectElement(node, "Path");
    QString path = context.nodeToString(pathNode);
    // The implicit default in <1.12.0 was FIXED so we keep it for
    // backwards compatibility.
    Paintable::DrawMode pathMode =
            context.selectScaleMode(pathNode, Paintable::FIXED);
    for (int i = 0; i < m_pixmaps.size(); ++i) {
        setPixmap(&m_pixmaps, i, context.getSkinPath(path.arg(i)), pathMode);
    }

    // See if disabled images is defined, and load them...
    QDomElement disabledNode = context.selectElement(node, "DisabledPath");
    if (!disabledNode.isNull()) {
        QString disabledPath = context.nodeToString(disabledNode);
        // The implicit default in <1.12.0 was FIXED so we keep it for
        // backwards compatibility.
        Paintable::DrawMode disabledMode =
            context.selectScaleMode(disabledNode, Paintable::FIXED);
        for (int i = 0; i < m_disabledPixmaps.size(); ++i) {
            setPixmap(&m_disabledPixmaps, i,
                      context.getSkinPath(disabledPath.arg(i)), disabledMode);
        }
        m_bDisabledLoaded = true;
    }
}
コード例 #8
0
ファイル: wwidgetgroup.cpp プロジェクト: suyoghc/mixxx
void WWidgetGroup::setup(QDomNode node, const SkinContext& context) {
    setContentsMargins(0, 0, 0, 0);

    // Set background pixmap if available
    if (context.hasNode(node, "BackPath")) {
        setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
    }

    QLayout* pLayout = NULL;
    if (context.hasNode(node, "Layout")) {
        QString layout = context.selectString(node, "Layout");
        if (layout == "vertical") {
            pLayout = new QVBoxLayout();
            pLayout->setSpacing(0);
            pLayout->setContentsMargins(0, 0, 0, 0);
            pLayout->setAlignment(Qt::AlignCenter);
        } else if (layout == "horizontal") {
            pLayout = new QHBoxLayout();
            pLayout->setSpacing(0);
            pLayout->setContentsMargins(0, 0, 0, 0);
            pLayout->setAlignment(Qt::AlignCenter);
        }
    }

    if (pLayout && context.hasNode(node, "SizeConstraint")) {
        QMap<QString, QLayout::SizeConstraint> constraints;
        constraints["SetDefaultConstraint"] = QLayout::SetDefaultConstraint;
        constraints["SetFixedSize"] = QLayout::SetFixedSize;
        constraints["SetMinimumSize"] = QLayout::SetMinimumSize;
        constraints["SetMaximumSize"] = QLayout::SetMaximumSize;
        constraints["SetMinAndMaxSize"] = QLayout::SetMinAndMaxSize;
        constraints["SetNoConstraint"] = QLayout::SetNoConstraint;

        QString sizeConstraintStr = context.selectString(node, "SizeConstraint");
        if (constraints.contains(sizeConstraintStr)) {
            pLayout->setSizeConstraint(constraints[sizeConstraintStr]);
        } else {
            qDebug() << "Could not parse SizeConstraint:" << sizeConstraintStr;
        }
    }

    if (pLayout) {
        setLayout(pLayout);
    }
}
コード例 #9
0
ファイル: wpushbutton.cpp プロジェクト: CorgiMan/mixxx
void WPushButton::setup(QDomNode node, const SkinContext& context) {
    // Number of states
    int iNumStates = context.selectInt(node, "NumberStates");
    setStates(iNumStates);

    // Set background pixmap if available
    if (context.hasNode(node, "BackPath")) {
        QString mode_str = context.selectAttributeString(
                context.selectElement(node, "BackPath"), "scalemode", "TILE");
        setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")),
                            Paintable::DrawModeFromString(mode_str));
    }

    // Load pixmaps for associated states
    QDomNode state = context.selectNode(node, "State");
    while (!state.isNull()) {
        if (state.isElement() && state.nodeName() == "State") {
            int iState = context.selectInt(state, "Number");
            if (iState < m_iNoStates) {
                if (context.hasNode(state, "Pressed")) {
                    setPixmap(iState, true,
                              context.getSkinPath(context.selectString(state, "Pressed")));
                }
                if (context.hasNode(state, "Unpressed")) {
                    setPixmap(iState, false,
                              context.getSkinPath(context.selectString(state, "Unpressed")));
                }
                m_text.replace(iState, context.selectString(state, "Text"));
            }
        }
        state = state.nextSibling();
    }

    ControlParameterWidgetConnection* leftConnection = NULL;
    if (m_leftConnections.isEmpty()) {
        if (!m_connections.isEmpty()) {
            // If no left connection is set, the this is the left connection
            leftConnection = m_connections.at(0);
        }
    } else {
        leftConnection = m_leftConnections.at(0);
    }

    if (leftConnection) {
        bool leftClickForcePush = context.selectBool(node, "LeftClickIsPushButton", false);
        m_leftButtonMode = ControlPushButton::PUSH;
        if (!leftClickForcePush) {
            const ConfigKey& configKey = leftConnection->getKey();
            ControlPushButton* p = dynamic_cast<ControlPushButton*>(
                    ControlObject::getControl(configKey));
            if (p) {
                m_leftButtonMode = p->getButtonMode();
            }
        }
        if (leftConnection->getEmitOption() &
                ControlParameterWidgetConnection::EMIT_DEFAULT) {
            switch (m_leftButtonMode) {
                case ControlPushButton::PUSH:
                case ControlPushButton::LONGPRESSLATCHING:
                case ControlPushButton::POWERWINDOW:
                    leftConnection->setEmitOption(
                            ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE);
                    break;
                default:
                    leftConnection->setEmitOption(
                            ControlParameterWidgetConnection::EMIT_ON_PRESS);
                    break;
            }
        }
        if (leftConnection->getDirectionOption() &
                        ControlParameterWidgetConnection::DIR_DEFAULT) {
            if (m_pDisplayConnection == leftConnection) {
                leftConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_FROM_AND_TO_WIDGET);
            } else {
                leftConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_FROM_WIDGET);
                if (m_pDisplayConnection->getDirectionOption() &
                        ControlParameterWidgetConnection::DIR_DEFAULT) {
                    m_pDisplayConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_TO_WIDGET);
                }
            }
        }
    }

    if (!m_rightConnections.isEmpty()) {
        ControlParameterWidgetConnection* rightConnection = m_rightConnections.at(0);
        bool rightClickForcePush = context.selectBool(node, "RightClickIsPushButton", false);
        m_rightButtonMode = ControlPushButton::PUSH;
        if (!rightClickForcePush) {
            const ConfigKey configKey = rightConnection->getKey();
            ControlPushButton* p = dynamic_cast<ControlPushButton*>(
                    ControlObject::getControl(configKey));
            if (p) {
                m_rightButtonMode = p->getButtonMode();
                if (m_rightButtonMode != ControlPushButton::PUSH) {
                    qWarning()
                            << "WPushButton::setup: Connecting a Pushbutton not in PUSH mode is not implemented\n"
                            << "Please set <RightClickIsPushButton>true</RightClickIsPushButton>";
                }
            }
        }
        if (rightConnection->getEmitOption() &
                ControlParameterWidgetConnection::EMIT_DEFAULT) {
            switch (m_rightButtonMode) {
                case ControlPushButton::PUSH:
                case ControlPushButton::LONGPRESSLATCHING:
                case ControlPushButton::POWERWINDOW:
                    leftConnection->setEmitOption(
                            ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE);
                    break;
                default:
                    leftConnection->setEmitOption(
                            ControlParameterWidgetConnection::EMIT_ON_PRESS);
                    break;
            }
        }
        if (rightConnection->getDirectionOption() &
                        ControlParameterWidgetConnection::DIR_DEFAULT) {
            rightConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_FROM_WIDGET);
        }
    }
}
コード例 #10
0
ファイル: wspinny.cpp プロジェクト: CorgiMan/mixxx
void WSpinny::setup(QDomNode node, const SkinContext& context, QString group) {
    m_group = group;

    // Set images
    m_pBgImage = WImageStore::getImage(context.getSkinPath(context.selectString(node,
                                                    "PathBackground")));
    m_pFgImage = WImageStore::getImage(context.getSkinPath(context.selectString(node,
                                                    "PathForeground")));
    m_pGhostImage = WImageStore::getImage(context.getSkinPath(context.selectString(node,
                                                    "PathGhost")));
    if (m_pBgImage && !m_pBgImage->isNull()) {
        setFixedSize(m_pBgImage->size());
    }

#ifdef __VINYLCONTROL__
    // Find the vinyl input we should listen to reports about.
    if (m_pVCManager) {
        m_iVinylInput = m_pVCManager->vinylInputFromGroup(m_group);
    }
    m_iVinylScopeSize = MIXXX_VINYL_SCOPE_SIZE;
    m_qImage = QImage(m_iVinylScopeSize, m_iVinylScopeSize, QImage::Format_ARGB32);
    // fill with transparent black
    m_qImage.fill(qRgba(0,0,0,0));
#endif

    m_pPlay = new ControlObjectThread(
            group, "play");
    m_pPlayPos = new ControlObjectThread(
            group, "playposition");
    m_pVisualPlayPos = VisualPlayPosition::getVisualPlayPosition(group);

    m_pTrackSamples = new ControlObjectThread(
            group, "track_samples");
    m_pTrackSampleRate = new ControlObjectThread(
            group, "track_samplerate");

    m_pScratch = new ControlObjectThread(
            group, "scratch2");
    m_pScratchToggle = new ControlObjectThread(
            group, "scratch_position_enable");
    m_pScratchPos = new ControlObjectThread(
            group, "scratch_position");

    m_pSlipEnabled = new ControlObjectThread(
            group, "slip_enabled");
    m_pSlipPosition = new ControlObjectThread(
            group, "slip_playposition");

#ifdef __VINYLCONTROL__
    m_pVinylControlSpeedType = new ControlObjectThread(
            group, "vinylcontrol_speed_type");
    if (m_pVinylControlSpeedType)
    {
        //Initialize the rotational speed.
        this->updateVinylControlSpeed(m_pVinylControlSpeedType->get());
    }

    m_pVinylControlEnabled = new ControlObjectThread(
            group, "vinylcontrol_enabled");
    connect(m_pVinylControlEnabled, SIGNAL(valueChanged(double)),
            this, SLOT(updateVinylControlEnabled(double)));

    m_pSignalEnabled = new ControlObjectThread(
            group, "vinylcontrol_signal_enabled");
    connect(m_pSignalEnabled, SIGNAL(valueChanged(double)),
            this, SLOT(updateVinylControlSignalEnabled(double)));

    //Match the vinyl control's set RPM so that the spinny widget rotates at the same
    //speed as your physical decks, if you're using vinyl control.
    connect(m_pVinylControlSpeedType, SIGNAL(valueChanged(double)),
            this, SLOT(updateVinylControlSpeed(double)));



#else
    //if no vinyl control, just call it 33
    this->updateVinylControlSpeed(33.0);
#endif
}