Ejemplo n.º 1
0
void WTime::setTimeFormat(QDomNode node) {
    // if a custom format is defined, all other formatting flags are ignored
    if (selectNode(node, "CustomFormat").isNull()) {
        // check if seconds should be shown
        QString secondsFormat = selectNodeQString(node, "ShowSeconds");
       if(secondsFormat == "true" || secondsFormat == "yes") {
           m_sTimeFormat = "h:mm:ss";
           m_iInterval = s_iSecondInterval;
       } else {
           m_sTimeFormat = "h:mm";
           m_iInterval = s_iMinuteInterval;
       }
       // check if 24 hour format or 12 hour format is selected
       QString clockFormat = selectNodeQString(node, "ClockFormat");
       if (clockFormat == "24" || clockFormat == "24hrs") {
       } else if (clockFormat == "12" ||
                  clockFormat == "12hrs" ||
                  clockFormat == "12ap") {
           m_sTimeFormat += " ap";
       } else if (clockFormat == "12AP") {
           m_sTimeFormat += " AP";
       } else {
           qDebug() << "WTime: Unknown clock format: " << clockFormat;
       }
    } else {
        // set the time format to the custom format
        m_sTimeFormat = selectNodeQString(node, "CustomFormat");
    }
}
Ejemplo n.º 2
0
void WVuMeter::setup(QDomNode node)
{
    // Set pixmaps
    bool bHorizontal = false;
    if (!selectNode(node, "Horizontal").isNull() &&
        selectNodeQString(node, "Horizontal")=="true")
        bHorizontal = true;

    setPixmaps(getPath(selectNodeQString(node, "PathBack")),
               getPath(selectNodeQString(node, "PathVu")), bHorizontal);

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

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

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

    m_iPeakFallTime = selectNodeInt(node, "PeakFallTime");
    if(m_iPeakFallTime < 1 || m_iPeakFallTime > 1000)
        m_iPeakFallTime = DEFAULT_FALLTIME;
}
Ejemplo n.º 3
0
void WNumber::setup(QDomNode node)
{
    // Number of digits
    setNumDigits(selectNodeInt(node, "NumberOfDigits"));

    // Colors
    QPalette palette = m_pLabel->palette(); //we have to copy out the palette to edit it since it's const (probably for threadsafety)
    if (!WWidget::selectNode(node, "BgColor").isNull()) {
        m_qBgColor.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
        palette.setColor(this->backgroundRole(), WSkinColor::getCorrectColor(m_qBgColor));
        m_pLabel->setAutoFillBackground(true);
    }
    m_qFgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
    palette.setColor(this->foregroundRole(), WSkinColor::getCorrectColor(m_qFgColor));
    m_pLabel->setPalette(palette);

    // Text
    if (!selectNode(node, "Text").isNull())
        m_qsText = selectNodeQString(node, "Text");

    // FWI: Begin of font size patch
    if (!selectNode(node, "FontSize").isNull()) {
        int fontsize = 9;
        fontsize = selectNodeQString(node, "FontSize").toInt();
        m_pLabel->setFont( QFont("Helvetica",fontsize,QFont::Normal) );
    }
    // FWI: End of font size patch

    // Alignment
    if (!selectNode(node, "Alignment").isNull())
    {
        if (selectNodeQString(node, "Alignment")=="right")
            m_pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
        // FWI: Begin of font alignment patch
        else if (selectNodeQString(node, "Alignment")=="center")
            m_pLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
        // FWI: End of font alignment patch
    }

    // Constant factor
    if (!selectNode(node, "ConstFactor").isNull())
    {
        m_dConstFactor = selectNodeQString(node, "ConstFactor").toDouble();
        setValue(0.);
    }
}
Ejemplo n.º 4
0
void WKnobComposed::setup(QDomNode node) {
    clear();

    // Set background pixmap if available
    if (!selectNode(node, "BackPath").isNull()) {
        setPixmapBackground(getPath(selectNodeQString(node, "BackPath")));
    }

    // Set background pixmap if available
    if (!selectNode(node, "Knob").isNull()) {
        setPixmapKnob(getPath(selectNodeQString(node, "Knob")));
    }

    if (!selectNode(node, "MinAngle").isNull()) {
        m_dMinAngle = selectNodeDouble(node, "MinAngle");
    }

    if (!selectNode(node, "MaxAngle").isNull()) {
        m_dMaxAngle = selectNodeDouble(node, "MaxAngle");
    }
}
Ejemplo n.º 5
0
void WLabel::setup(QDomNode node)
{
    // Colors
    QPalette palette = m_pLabel->palette(); //we have to copy out the palette to edit it since it's const (probably for threadsafety)
    if (!WWidget::selectNode(node, "BgColor").isNull()) {
        m_qBgColor.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
        palette.setColor(this->backgroundRole(), WSkinColor::getCorrectColor(m_qBgColor));
        m_pLabel->setAutoFillBackground(true);
    }
    m_qFgColor.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
    palette.setColor(this->foregroundRole(), WSkinColor::getCorrectColor(m_qFgColor));
    m_pLabel->setPalette(palette);

    // Text
    if (!selectNode(node, "Text").isNull())
        m_qsText = selectNodeQString(node, "Text");
    m_pLabel->setText(m_qsText);

    // Alignment
    if (!selectNode(node, "Alignment").isNull()) {
        if (selectNodeQString(node, "Alignment")=="right")
            m_pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    }
}