~mixxxdevelopers/mixxx/engine-control-refactor

« back to all changes in this revision

Viewing changes to mixxx/src/waveform/renderers/waveformmark.cpp

  • Committer: RJ Ryan
  • Date: 2013-06-04 00:41:29 UTC
  • mfrom: (2890.22.101 mixxx)
  • Revision ID: rryan@mixxx.org-20130604004129-8jjxkicsb3givu4a
MergingĀ fromĀ lp:mixxx.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <QDebug>
 
2
 
1
3
#include "waveformmark.h"
2
4
 
 
5
#include "waveformwidgetrenderer.h"
3
6
#include "controlobject.h"
4
 
#include "widget/wwidget.h"
5
 
#include <QDomNode>
6
 
 
7
 
#include <QDebug>
 
7
#include "controlobjectthreadmain.h"
 
8
#include "xmlparse.h"
 
9
#include "widget/wskincolor.h"
8
10
 
9
11
WaveformMark::WaveformMark()
10
12
    : m_pointControl(NULL) {
11
13
}
12
14
 
13
 
void WaveformMark::setup(const QString& group, const QDomNode& node) {
14
 
    QString item = WWidget::selectNodeQString( node, "Control");
15
 
    m_pointControl = ControlObject::getControl( ConfigKey(group, item));
16
 
 
17
 
    m_color = WWidget::selectNodeQString( node, "Color");
18
 
    if( m_color == "") {
19
 
 
20
 
        // As a fallback, grab the mark color from the parent's MarkerColor
21
 
        m_color = WWidget::selectNodeQString(node.parentNode(), "MarkerColor");
22
 
        qDebug() << "Didn't get mark 'Color', using parent's 'MarkerColor':" << m_color;
23
 
    }
24
 
 
25
 
    m_textColor = WWidget::selectNodeQString(node, "TextColor");
26
 
    if( m_textColor == "") {
 
15
void WaveformMark::setup(const QString& group, const QDomNode& node, const WaveformSignalColors& signalColors) {
 
16
    QString item = XmlParse::selectNodeQString(node, "Control");
 
17
    ControlObject* pPointControl = ControlObject::getControl(ConfigKey(group, item));
 
18
    if (pPointControl) {
 
19
        m_pointControl = new ControlObjectThreadMain(pPointControl);
 
20
    }
 
21
 
 
22
    m_color = XmlParse::selectNodeQString(node, "Color");
 
23
    if (m_color == "") {
 
24
        // As a fallback, grab the color from the parent's AxesColor
 
25
        m_color = signalColors.getAxesColor();
 
26
        qDebug() << "Didn't get mark <Color>, using parent's <AxesColor>:" << m_color;
 
27
    } else {
 
28
        m_color = WSkinColor::getCorrectColor(m_color);
 
29
    }
 
30
 
 
31
    m_textColor = XmlParse::selectNodeQString(node, "TextColor");
 
32
    if (m_textColor == "") {
27
33
        // Read the text color, otherwise use the parent's BgColor.
28
 
        m_textColor = WWidget::selectNodeQString(node.parentNode(), "BgColor");
29
 
        qDebug() << "Didn't get mark TextColor, using parent's BgColor:" << m_textColor;
 
34
        m_textColor = signalColors.getBgColor();
 
35
        qDebug() << "Didn't get mark <TextColor>, using parent's <BgColor>:" << m_textColor;
30
36
    }
31
37
 
32
 
    QString markAlign = WWidget::selectNodeQString(node, "Align");
 
38
    QString markAlign = XmlParse::selectNodeQString(node, "Align");
33
39
    if (markAlign.contains("bottom", Qt::CaseInsensitive)) {
34
40
        m_align = Qt::AlignBottom;
35
41
    } else {
36
42
        m_align = Qt::AlignTop; // Default
37
43
    }
38
44
 
39
 
    m_text = WWidget::selectNodeQString(node, "Text");
40
 
    m_pixmapPath = WWidget::selectNodeQString(node,"Pixmap");
 
45
    m_text = XmlParse::selectNodeQString(node, "Text");
 
46
    m_pixmapPath = XmlParse::selectNodeQString(node,"Pixmap");
41
47
}
42
48