本文整理汇总了C++中SkinContext类的典型用法代码示例。如果您正苦于以下问题:C++ SkinContext类的具体用法?C++ SkinContext怎么用?C++ SkinContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkinContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
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)));
}
}
示例2: setup
void WaveformMarkRange::setup(const QString& group, const QDomNode& node,
const SkinContext& context,
const WaveformSignalColors& signalColors) {
m_activeColor = context.selectString(node, "Color");
if (m_activeColor == "") {
//vRince kind of legacy fallback ...
// As a fallback, grab the mark color from the parent's MarkerColor
m_activeColor = signalColors.getAxesColor();
qDebug() << "Didn't get mark Color, using parent's <AxesColor>:" << m_activeColor;
} else {
m_activeColor = WSkinColor::getCorrectColor(m_activeColor);
}
m_disabledColor = context.selectString(node, "DisabledColor");
if (m_disabledColor == "") {
//vRince kind of legacy fallback ...
// Read the text color, otherwise use the parent's SignalColor.
m_disabledColor = signalColors.getSignalColor();
qDebug() << "Didn't get mark TextColor, using parent's <SignalColor>:" << m_disabledColor;
}
m_markStartPointControl = new ControlObjectThread(
group, context.selectString(node, "StartControl"));
m_markEndPointControl = new ControlObjectThread(
group, context.selectString(node, "EndControl"));
m_markEnabledControl = new ControlObjectThread(
group, context.selectString(node, "EnabledControl"));
}
示例3: setTimeFormat
void WTime::setTimeFormat(QDomNode node, const SkinContext& context) {
// if a custom format is defined, all other formatting flags are ignored
if (!context.hasNode(node, "CustomFormat")) {
// check if seconds should be shown
QString secondsFormat = context.selectString(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 = context.selectString(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 = context.selectString(node, "CustomFormat");
}
}
示例4: setup
void WNumber::setup(QDomNode node, const SkinContext& context) {
WLabel::setup(node, context);
// Number of digits after the decimal.
if (context.hasNode(node, "NumberOfDigits")) {
m_iNoDigits = context.selectInt(node, "NumberOfDigits");
}
setValue(0.);
}
示例5: setup
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;
}
}
示例6: setup
void WSplitter::setup(QDomNode node, const SkinContext& context) {
// Default orientation is horizontal.
if (context.hasNode(node, "Orientation")) {
QString layout = context.selectString(node, "Orientation");
if (layout == "vertical") {
setOrientation(Qt::Vertical);
} else if (layout == "horizontal") {
setOrientation(Qt::Horizontal);
}
}
}
示例7: setup
void WSliderComposed::setup(QDomNode node, const SkinContext& context) {
// Setup pixmaps
unsetPixmaps();
if (context.hasNode(node, "Slider")) {
PixmapSource sourceSlider = context.getPixmapSource(context.selectNode(node, "Slider"));
setSliderPixmap(sourceSlider);
}
PixmapSource sourceHandle = context.getPixmapSource(context.selectNode(node, "Handle"));
bool h = context.selectBool(node, "Horizontal", false);
setHandlePixmap(h, sourceHandle);
if (context.hasNode(node, "EventWhileDrag")) {
if (context.selectString(node, "EventWhileDrag").contains("no")) {
m_bEventWhileDrag = false;
}
}
if (!m_connections.isEmpty()) {
ControlParameterWidgetConnection* defaultConnection = m_connections.at(0);
if (defaultConnection) {
if (defaultConnection->getEmitOption() &
ControlParameterWidgetConnection::EMIT_DEFAULT) {
// ON_PRESS means here value change on mouse move during press
defaultConnection->setEmitOption(
ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE);
}
}
}
}
示例8: setup
void WEffectButtonParameter::setup(QDomNode node, const SkinContext& context) {
bool rackOk = false;
int rackNumber = context.selectInt(node, "EffectRack", &rackOk) - 1;
bool chainOk = false;
int chainNumber = context.selectInt(node, "EffectUnit", &chainOk) - 1;
bool effectOk = false;
int effectNumber = context.selectInt(node, "Effect", &effectOk) - 1;
bool parameterOk = false;
int parameterNumber = context.selectInt(node, "EffectButtonParameter", ¶meterOk) - 1;
// Tolerate no <EffectRack>. Use the default one.
if (!rackOk) {
rackNumber = 0;
}
if (!chainOk) {
qDebug() << "EffectButtonParameterName node had invalid EffectUnit number:" << chainNumber;
}
if (!effectOk) {
qDebug() << "EffectButtonParameterName node had invalid Effect number:" << effectNumber;
}
if (!parameterOk) {
qDebug() << "EffectButtonParameterName node had invalid ButtonParameter number:" << parameterNumber;
}
EffectRackPointer pRack = m_pEffectsManager->getEffectRack(rackNumber);
if (pRack) {
EffectChainSlotPointer pChainSlot = pRack->getEffectChainSlot(chainNumber);
if (pChainSlot) {
EffectSlotPointer pEffectSlot = pChainSlot->getEffectSlot(effectNumber);
if (pEffectSlot) {
EffectParameterSlotBasePointer pParameterSlot =
pEffectSlot->getEffectButtonParameterSlot(parameterNumber);
if (pParameterSlot) {
setEffectParameterSlot(pParameterSlot);
} else {
qDebug() << "EffectButtonParameterName node had invalid ButtonParameter number:" << parameterNumber;
}
} else {
qDebug() << "EffectButtonParameterName node had invalid Effect number:" << effectNumber;
}
} else {
qDebug() << "EffectButtonParameterName node had invalid EffectUnit number:" << chainNumber;
}
} else {
qDebug() << "EffectButtonParameterName node had invalid EffectRack number:" << rackNumber;
}
}
示例9: it
SkinContext::SkinContext(const SkinContext& parent)
: m_xmlPath(parent.m_xmlPath),
m_skinBasePath(parent.m_skinBasePath),
m_pConfig(parent.m_pConfig),
m_variables(parent.variables()),
m_pScriptEngine(parent.m_pScriptEngine),
m_pScriptDebugger(parent.m_pScriptDebugger),
m_parentGlobal(m_pScriptEngine->globalObject()),
m_pSingletons(parent.m_pSingletons) {
// we generate a new global object to preserve the scope between
// a context and its children
QScriptValue context = m_pScriptEngine->pushContext()->activationObject();
QScriptValue newGlobal = m_pScriptEngine->newObject();
QScriptValueIterator it(m_parentGlobal);
while (it.hasNext()) {
it.next();
newGlobal.setProperty(it.name(), it.value());
}
m_pScriptEngine->setGlobalObject(newGlobal);
for (QHash<QString, QString>::const_iterator it = m_variables.begin();
it != m_variables.end(); ++it) {
m_pScriptEngine->globalObject().setProperty(it.key(), it.value());
}
}
示例10: it
SkinContext::SkinContext(const SkinContext& parent)
: m_skinBasePath(parent.m_skinBasePath),
m_pConfig(parent.m_pConfig),
m_variables(parent.variables()),
m_pScriptEngine(parent.m_pScriptEngine),
m_pScriptDebugger(parent.m_pScriptDebugger),
m_parentGlobal(m_pScriptEngine->globalObject()),
m_hookRx(parent.m_hookRx),
m_pSvgCache(parent.m_pSvgCache),
m_pSingletons(parent.m_pSingletons),
m_scaleFactor(parent.m_scaleFactor) {
// we generate a new global object to preserve the scope between
// a context and its children
setXmlPath(parent.m_xmlPath);
QScriptValue context = m_pScriptEngine->pushContext()->activationObject();
QScriptValue newGlobal = m_pScriptEngine->newObject();
QScriptValueIterator it(m_parentGlobal);
while (it.hasNext()) {
it.next();
newGlobal.setProperty(it.name(), it.value());
}
for (auto it = m_variables.constBegin();
it != m_variables.constEnd(); ++it) {
newGlobal.setProperty(it.key(), it.value());
}
m_pScriptEngine->setGlobalObject(newGlobal);
}
示例11: setup
void WaveformRenderMark::setup(const QDomNode& node, const SkinContext& context) {
WaveformSignalColors signalColors = *m_waveformRenderer->getWaveformSignalColors();
m_marks.setup(m_waveformRenderer->getGroup(), node, context, signalColors);
WaveformMarkPointer defaultMark(m_marks.getDefaultMark());
QColor defaultColor = defaultMark
? defaultMark->getProperties().fillColor()
: signalColors.getAxesColor();
m_predefinedColorsRepresentation = context.getCueColorRepresentation(node, defaultColor);
}
示例12: setup
void WComboBox::setup(const QDomNode& node, const SkinContext& context) {
// Load pixmaps for associated states
QDomNode state = context.selectNode(node, "State");
while (!state.isNull()) {
if (state.isElement() && state.nodeName() == "State") {
int iState;
if (!context.hasNodeSelectInt(state, "Number", &iState)) {
SKIN_WARNING(state, context)
<< "WComboBox ignoring <State> without <Number> node.";
continue;
}
QString text = context.selectString(state, "Text");
QString icon = context.selectString(state, "Icon");
addItem(QIcon(icon), text, QVariant(iState));
}
state = state.nextSibling();
}
}
示例13: setup
void WaveformRendererEndOfTrack::setup(const QDomNode& node, const SkinContext& context) {
m_color = QColor(200, 25, 20);
const QString endOfTrackColorName = context.selectString(node, "EndOfTrackColor");
if (!endOfTrackColorName.isNull()) {
m_color.setNamedColor(endOfTrackColorName);
m_color = WSkinColor::getCorrectColor(m_color);
}
m_pen = QPen(QBrush(m_color), 2.5);
}
示例14: qDebug
WaveformMarkRange::WaveformMarkRange(
const QString& group,
const QDomNode& node,
const SkinContext& context,
const WaveformSignalColors& signalColors)
: m_activeColor(context.selectString(node, "Color")),
m_disabledColor(context.selectString(node, "DisabledColor")),
m_durationTextColor(context.selectString(node, "DurationTextColor")) {
if (!m_activeColor.isValid()) {
//vRince kind of legacy fallback ...
// As a fallback, grab the mark color from the parent's MarkerColor
m_activeColor = signalColors.getAxesColor();
qDebug() << "Didn't get mark Color, using parent's <AxesColor>:" << m_activeColor;
} else {
m_activeColor = WSkinColor::getCorrectColor(m_activeColor);
}
if (!m_disabledColor.isValid()) {
//vRince kind of legacy fallback ...
// Read the text color, otherwise use the parent's SignalColor.
m_disabledColor = signalColors.getSignalColor();
qDebug() << "Didn't get mark TextColor, using parent's <SignalColor>:" << m_disabledColor;
}
QString startControl = context.selectString(node, "StartControl");
if (!startControl.isEmpty()) {
DEBUG_ASSERT(!m_markStartPointControl); // has not been created yet
m_markStartPointControl = std::make_unique<ControlProxy>(group, startControl);
}
QString endControl = context.selectString(node, "EndControl");
if (!endControl.isEmpty()) {
DEBUG_ASSERT(!m_markEndPointControl); // has not been created yet
m_markEndPointControl = std::make_unique<ControlProxy>(group, endControl);
}
QString enabledControl = context.selectString(node, "EnabledControl");
if (!enabledControl.isEmpty()) {
DEBUG_ASSERT(!m_markEnabledControl); // has not been created yet
m_markEnabledControl = std::make_unique<ControlProxy>(group, enabledControl);
}
QString visibilityControl = context.selectString(node, "VisibilityControl");
if (!visibilityControl.isEmpty()) {
DEBUG_ASSERT(!m_markVisibleControl); // has not been created yet
ConfigKey key = ConfigKey::parseCommaSeparated(visibilityControl);
m_markVisibleControl = std::make_unique<ControlProxy>(key);
}
QString durationTextLocation = context.selectString(node, "DurationTextLocation");
if (durationTextLocation == "before") {
m_durationTextLocation = DurationTextLocation::Before;
} else {
m_durationTextLocation = DurationTextLocation::After;
}
}
示例15: setTimeFormat
void WTime::setTimeFormat(QDomNode node, const SkinContext& context) {
// if a custom format is defined, all other formatting flags are ignored
if (!context.hasNode(node, "CustomFormat")) {
// check if seconds should be shown
QString secondsFormat = context.selectString(node, "ShowSeconds");
// long format is equivalent to showing seconds
QLocale::FormatType format;
if(secondsFormat == "true" || secondsFormat == "yes") {
format = QLocale::LongFormat;
m_iInterval = s_iSecondInterval;
} else {
format = QLocale::ShortFormat;
m_iInterval = s_iMinuteInterval;
}
m_sTimeFormat = QLocale().timeFormat(format);
} else {
// set the time format to the custom format
m_sTimeFormat = context.selectString(node, "CustomFormat");
}
}