diff --git a/res/skins/Shade/effect_parameters.xml b/res/skins/Shade/effect_parameters.xml
index 7de6ef87ef31..f3dbe12b69a5 100644
--- a/res/skins/Shade/effect_parameters.xml
+++ b/res/skins/Shade/effect_parameters.xml
@@ -8,66 +8,66 @@
Effect: the effect
-->
-
- e,45
- horizontal
-
-
-
- 1
-
-
- 1
-
-
- 2
-
-
- 2
-
-
- 3
-
-
- 3
-
-
- 4
-
-
- 4
-
-
- 5
-
-
- 5
-
-
- 6
-
-
- 6
-
-
- 7
-
-
- 7
-
-
- 8
-
-
- 8
-
-
-
+
+ e,45
+ horizontal
+
+
+
+ 1
+
+
+ 1
+
+
+ 2
+
+
+ 2
+
+
+ 3
+
+
+ 3
+
+
+ 4
+
+
+ 4
+
+
+ 5
+
+
+ 5
+
+
+ 6
+
+
+ 6
+
+
+ 7
+
+
+ 7
+
+
+ 8
+
+
+ 8
+
+
+
diff --git a/res/skins/Shade/effect_selector.xml b/res/skins/Shade/effect_selector.xml
deleted file mode 100644
index 18043220af7c..000000000000
--- a/res/skins/Shade/effect_selector.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- Effect
- 500,40
- horizontal
-
-
-
- 1
-
-
- me,max
-
-
-
-
diff --git a/res/skins/Shade/effect_selector_button.xml b/res/skins/Shade/effect_selector_button.xml
index b7ba335821f9..6c8b3281a52b 100644
--- a/res/skins/Shade/effect_selector_button.xml
+++ b/res/skins/Shade/effect_selector_button.xml
@@ -9,24 +9,27 @@
-->
- horizontal
-
-
-
+
+
+
+ 4,4
+
+
2
- 0
- btn_kill_down.png
- btn_kill.png
+ 0
+ btn_kill_down.png
+ btn_kill.png
1
@@ -34,33 +37,33 @@
btn_kill_over.png
- [EffectRack1_EffectUnit_Effect],enabled
- LeftButton
+ [EffectRack1_EffectUnit_Effect],enabled
+ LeftButton
-
-
- 20f,20f
- 1
-
- 0
- btn_previous_over.png
- btn_previous.png
-
-
- [EffectRack1_EffectUnit_Effect],prev_effect
+
+
+ 20f,20f
+ 1
+
+ 0
+ btn_previous_over.png
+ btn_previous.png
+
+
+ [EffectRack1_EffectUnit_Effect],prev_effect
LeftButton
-
-
+
+
-
- 110,e
- 1
-
-
- middle
-
+
+ 110,e
+ 1
+
+
+ middle
+
20f,20f
1
@@ -68,10 +71,10 @@
0
btn_next_over.png
btn_next.png
-
+
- [EffectRack1_EffectUnit_Effect],next_effect
- LeftButton
+ [EffectRack1_EffectUnit_Effect],next_effect
+ LeftButton
diff --git a/res/skins/Shade/effectunit.xml b/res/skins/Shade/effectunit.xml
index a798ce4f8c92..931d09714557 100644
--- a/res/skins/Shade/effectunit.xml
+++ b/res/skins/Shade/effectunit.xml
@@ -2,8 +2,8 @@
0,0
508,104
- 508,104
- f,f
+ 508,104
+ f,f
1,0
@@ -16,39 +16,55 @@
style/style_bg_effectunit
- 9,5
- 170,90
- vertical
+ style/style_bg_effect1_high
+ 5,5
+ 495,45
+ horizontal
-
+
+ 1
+ 1
+
+
1
-
-
- 2
-
+
+ highlight
+
+ 1
+
+
+
- 170,5
- 300,90
- vertical
+ style/style_bg_effect2_high
+ 5,50
+ 495,45
+ horizontal
-
- 1
-
+
+ 1
+ 2
+
2
-
+
+ highlight
+
+ 2
+
+
+
diff --git a/res/skins/Shade/style/style_bg_effect1_high.png b/res/skins/Shade/style/style_bg_effect1_high.png
new file mode 100644
index 000000000000..19b25370fc4e
Binary files /dev/null and b/res/skins/Shade/style/style_bg_effect1_high.png differ
diff --git a/res/skins/Shade/style/style_bg_effect2_high.png b/res/skins/Shade/style/style_bg_effect2_high.png
new file mode 100644
index 000000000000..9cd9b28f7db8
Binary files /dev/null and b/res/skins/Shade/style/style_bg_effect2_high.png differ
diff --git a/src/skin/legacyskinparser.cpp b/src/skin/legacyskinparser.cpp
index 851d91fce1b3..dd9005c379f5 100644
--- a/src/skin/legacyskinparser.cpp
+++ b/src/skin/legacyskinparser.cpp
@@ -610,17 +610,12 @@ QWidget* LegacySkinParser::parseSplitter(const QDomElement& node) {
return pSplitter;
}
-QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
- WWidgetGroup* pGroup = new WWidgetGroup(m_pParent);
- commonWidgetSetup(node, pGroup);
- pGroup->setup(node, *m_pContext);
- pGroup->Init();
-
+void LegacySkinParser::parseChildren(
+ const QDomElement& node,
+ WWidgetGroup* pGroup) {
QDomNode childrenNode = m_pContext->selectNode(node, "Children");
-
QWidget* pOldParent = m_pParent;
m_pParent = pGroup;
-
if (!childrenNode.isNull()) {
// Descend children
QDomNodeList children = childrenNode.childNodes();
@@ -628,7 +623,6 @@ QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
QDomNode node = children.at(i);
if (node.isElement()) {
QList children = parseNode(node.toElement());
-
foreach (QWidget* pChild, children) {
if (pChild == NULL) {
continue;
@@ -639,6 +633,14 @@ QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
}
}
m_pParent = pOldParent;
+}
+
+QWidget* LegacySkinParser::parseWidgetGroup(const QDomElement& node) {
+ WWidgetGroup* pGroup = new WWidgetGroup(m_pParent);
+ commonWidgetSetup(node, pGroup);
+ pGroup->setup(node, *m_pContext);
+ pGroup->Init();
+ parseChildren(node, pGroup);
return pGroup;
}
diff --git a/src/skin/legacyskinparser.h b/src/skin/legacyskinparser.h
index bd7d4b2eaa51..75d450464091 100644
--- a/src/skin/legacyskinparser.h
+++ b/src/skin/legacyskinparser.h
@@ -23,6 +23,7 @@ class SkinContext;
class WLabel;
class ControlObject;
class LaunchImage;
+class WWidgetGroup;
class LegacySkinParser : public QObject, public SkinParser {
Q_OBJECT
@@ -125,6 +126,7 @@ class LegacySkinParser : public QObject, public SkinParser {
bool* created);
QString parseLaunchImageStyle(const QDomNode& node);
+ void parseChildren(const QDomElement& node, WWidgetGroup* pGroup);
UserSettingsPointer m_pConfig;
KeyboardEventFilter* m_pKeyboard;
diff --git a/src/util/valuetransformer.cpp b/src/util/valuetransformer.cpp
index 7bd6d97337ee..f62da80ad2ea 100644
--- a/src/util/valuetransformer.cpp
+++ b/src/util/valuetransformer.cpp
@@ -51,6 +51,13 @@ ValueTransformer* ValueTransformer::parseFromXml(QDomElement transformElement,
}
} else if (element.nodeName() == "Not") {
pTransformer->addTransformer(new TransformNot());
+ } else if (element.nodeName() == "IsEqual") {
+ QString value = context.nodeToString(element);
+ bool ok = false;
+ double compareValue = value.toDouble(&ok);
+ if (ok) {
+ pTransformer->addTransformer(new TransformIsEqual(compareValue));
+ }
}
}
diff --git a/src/util/valuetransformer.h b/src/util/valuetransformer.h
index 834af2c1994f..7d84369202e6 100644
--- a/src/util/valuetransformer.h
+++ b/src/util/valuetransformer.h
@@ -57,6 +57,27 @@ class TransformNot : public TransformNode {
}
};
+class TransformIsEqual : public TransformNode {
+ public:
+ TransformIsEqual(double compareValue) :
+ m_compareValue(compareValue) {
+ }
+
+ double transform(double argument) const {
+ return argument == m_compareValue;
+ }
+
+ double transformInverse(double argument) const {
+ if (argument > 0.0) {
+ return m_compareValue;
+ }
+ return 0.0;
+ }
+
+ private:
+ double m_compareValue;
+};
+
class ValueTransformer {
public:
~ValueTransformer();
diff --git a/src/widget/wwidgetgroup.cpp b/src/widget/wwidgetgroup.cpp
index a8013a27435d..4c64aed75355 100644
--- a/src/widget/wwidgetgroup.cpp
+++ b/src/widget/wwidgetgroup.cpp
@@ -13,7 +13,9 @@
WWidgetGroup::WWidgetGroup(QWidget* pParent)
: QFrame(pParent),
WBaseWidget(this),
- m_pPixmapBack(nullptr) {
+ m_pPixmapBack(nullptr),
+ m_pPixmapBackHighlighted(nullptr),
+ m_highlight(0) {
setObjectName("WidgetGroup");
}
@@ -99,8 +101,18 @@ void WWidgetGroup::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));
+ setPixmapBackground(
+ context.getPixmapSource(backPathNode),
+ context.selectScaleMode(backPathNode, Paintable::TILE));
+ }
+
+ // Set background pixmap for the highlighted state
+ QDomElement backPathNodeHighlighted =
+ context.selectElement(node, "BackPathHighlighted");
+ if (!backPathNodeHighlighted.isNull()) {
+ setPixmapBackgroundHighlighted(
+ context.getPixmapSource(backPathNodeHighlighted),
+ context.selectScaleMode(backPathNodeHighlighted, Paintable::TILE));
}
QLayout* pLayout = nullptr;
@@ -134,11 +146,23 @@ void WWidgetGroup::setup(const QDomNode& node, const SkinContext& context) {
}
}
-void WWidgetGroup::setPixmapBackground(PixmapSource source, Paintable::DrawMode mode) {
+void WWidgetGroup::setPixmapBackground(
+ PixmapSource source, Paintable::DrawMode mode) {
// Load background pixmap
m_pPixmapBack = WPixmapStore::getPaintable(source, mode);
if (!m_pPixmapBack) {
- qDebug() << "WWidgetGroup: Error loading background pixmap:" << source.getPath();
+ qWarning() << "WWidgetGroup: Error loading background pixmap:"
+ << source.getPath();
+ }
+}
+
+void WWidgetGroup::setPixmapBackgroundHighlighted(
+ PixmapSource source, Paintable::DrawMode mode) {
+ // Load background pixmap for the highlighted state
+ m_pPixmapBackHighlighted = WPixmapStore::getPaintable(source, mode);
+ if (!m_pPixmapBackHighlighted) {
+ qWarning() << "WWidgetGroup: Error loading background highlighted pixmap:"
+ << source.getPath();
}
}
@@ -152,9 +176,16 @@ void WWidgetGroup::addWidget(QWidget* pChild) {
void WWidgetGroup::paintEvent(QPaintEvent* pe) {
QFrame::paintEvent(pe);
- if (m_pPixmapBack) {
- QStylePainter p(this);
- m_pPixmapBack->draw(rect(), &p);
+ if (m_highlight > 0) {
+ if (m_pPixmapBackHighlighted) {
+ QStylePainter p(this);
+ m_pPixmapBackHighlighted->draw(rect(), &p);
+ }
+ } else {
+ if (m_pPixmapBack) {
+ QStylePainter p(this);
+ m_pPixmapBack->draw(rect(), &p);
+ }
}
}
@@ -176,3 +207,13 @@ void WWidgetGroup::fillDebugTooltip(QStringList* debug) {
<< QString("LayoutContentsMargins: %1").arg(toDebugString(layoutContentsMargins()))
<< QString("LayoutSpacing: %1").arg(layoutSpacing());
}
+
+int WWidgetGroup::getHighlight() const {
+ return m_highlight;
+}
+
+void WWidgetGroup::setHighlight(int highlight) {
+ m_highlight = highlight;
+ update();
+ emit highlightChanged(m_highlight);
+}
diff --git a/src/widget/wwidgetgroup.h b/src/widget/wwidgetgroup.h
index 0ed14fae6f60..c12de825d5d7 100644
--- a/src/widget/wwidgetgroup.h
+++ b/src/widget/wwidgetgroup.h
@@ -24,7 +24,7 @@ class WWidgetGroup : public QFrame, public WBaseWidget {
// style the layout properties using the QProperty support in Qt style
// sheets:
//
- // WWidgetGroup {
+ // WidgetGroup {
// qproperty-layoutSpacing: 10;
// qproperty-layoutContentsMargins: rect(1 1 1 1);
// qproperty-layoutAlignment: 'AlignRight | AlignBottom';
@@ -35,17 +35,44 @@ class WWidgetGroup : public QFrame, public WBaseWidget {
Q_PROPERTY(QRect layoutContentsMargins READ layoutContentsMargins WRITE setLayoutContentsMargins DESIGNABLE true);
Q_PROPERTY(Qt::Alignment layoutAlignment READ layoutAlignment WRITE setLayoutAlignment DESIGNABLE true);
+ // A WWidgetGroup can also be used to highlight a group of widgets by
+ // changing the background or any other css style option.
+ // Example skin:
+ //
+ // style/style_bg_effect1_high
+ //
+ // [EffectRack1_EffectUnit1],single_effect_focus
+ // highlight
+ //
+ // 2
+ //
+ //
+ //
+
+ // The highlight property is used to restyle the widget with CSS.
+ // The declaration #MyGroup[highlight="1"] { } will define the style
+ // for the highlighted state. Note: The background property does not
+ // support color schemes for images, a workaround is to set the background
+ // image via and from the skin.
+ Q_PROPERTY(int highlight READ getHighlight WRITE setHighlight NOTIFY highlightChanged)
+
int layoutSpacing() const;
void setLayoutSpacing(int spacing);
QRect layoutContentsMargins() const;
void setLayoutContentsMargins(QRect rectMargins);
Qt::Alignment layoutAlignment() const;
void setLayoutAlignment(int alignment);
+ int getHighlight() const;
+ void setHighlight(int highlight);
- void setup(const QDomNode& node, const SkinContext& context);
+ virtual void setup(const QDomNode& node, const SkinContext& context);
void setPixmapBackground(PixmapSource source, Paintable::DrawMode mode);
+ void setPixmapBackgroundHighlighted(PixmapSource source, Paintable::DrawMode mode);
void addWidget(QWidget* pChild);
+ signals:
+ void highlightChanged(int highlight);
+
protected:
void paintEvent(QPaintEvent* pe) override;
void resizeEvent(QResizeEvent* re) override;
@@ -55,6 +82,8 @@ class WWidgetGroup : public QFrame, public WBaseWidget {
private:
// Associated background pixmap
PaintablePointer m_pPixmapBack;
+ PaintablePointer m_pPixmapBackHighlighted;
+ int m_highlight;
};
#endif // WWIDGETGROUP_H