Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set variable in color schemes #5

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions res/skins/Tango/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,6 @@
<SetVariable name="PotiMinAngle">-130</SetVariable>
<SetVariable name="PotiMaxAngle">130</SetVariable>

<SetVariable name="SignalColor_1">#5EBAFF</SetVariable>
<SetVariable name="SignalColor_2">#5EBAFF</SetVariable>
<SetVariable name="SignalColor_3">#DF4DF0</SetVariable>
<SetVariable name="SignalColor_4">#DF4DF0</SetVariable>

<SetVariable name="SignalRGBLowColor">#ff2a00</SetVariable>
<SetVariable name="SignalRGBMidColor">#33f600</SetVariable>
<SetVariable name="SignalRGBHighColor">#332acc</SetVariable>

<SetVariable name="PlayedOverlayColor">#99000000</SetVariable>

<!--################################################################
Expand Down
38 changes: 19 additions & 19 deletions src/skin/colorschemeparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,47 @@
void ColorSchemeParser::setupLegacyColorSchemes(QDomElement docElem,
UserSettingsPointer pConfig,
QString* pStyle,
const SkinContext& context) {
QDomNode colsch = docElem.namedItem("Schemes");
SkinContext& context) {
QDomNode schemesNode = docElem.namedItem("Schemes");

bool found = false;
bool bSelectedColorSchemeFound = false;

if (!colsch.isNull() && colsch.isElement()) {
QString schname = pConfig->getValueString(ConfigKey("[Config]","Scheme"));
QDomNode sch = colsch.firstChild();
if (!schemesNode.isNull() && schemesNode.isElement()) {
QString selectedSchemeName = pConfig->getValueString(ConfigKey("[Config]","Scheme"));
QDomNode schemeNode = schemesNode.firstChild();

if (schname.isEmpty()) {
// If no scheme stored, accept the first one in the file
found = true;
if (selectedSchemeName.isEmpty()) {
// If no scheme selected, accept the first one in the file
bSelectedColorSchemeFound = true;
}

while (!sch.isNull() && !found) {
QString thisname = XmlParse::selectNodeQString(sch, "Name");
if (thisname == schname) {
found = true;
while (!schemeNode.isNull() && !bSelectedColorSchemeFound) {
QString schemeName = XmlParse::selectNodeQString(schemeNode, "Name");
if (schemeName == selectedSchemeName) {
bSelectedColorSchemeFound = true;
} else {
sch = sch.nextSibling();
schemeNode = schemeNode.nextSibling();
}
}

if (found) {
if (bSelectedColorSchemeFound) {
QSharedPointer<ImgSource> imsrc =
QSharedPointer<ImgSource>(parseFilters(sch.namedItem("Filters")));
QSharedPointer<ImgSource>(parseFilters(schemeNode.namedItem("Filters")));
WPixmapStore::setLoader(imsrc);
WImageStore::setLoader(imsrc);
WSkinColor::setLoader(imsrc);

// ronso0 :: find <SetVariable> nodes, update them.
// This calls SkinContext::updateVariables in skincontext.cpp which
// iterates over all <SetVariable> nodes
m_pContext->updateVariables(context);
context.updateVariables(schemeNode);

if (pStyle) {
*pStyle = LegacySkinParser::getStyleFromNode(sch);
*pStyle = LegacySkinParser::getStyleFromNode(schemeNode);
}
}
}
if (!found) {
if (!bSelectedColorSchemeFound) {
QSharedPointer<ImgSource> imsrc =
QSharedPointer<ImgSource>(new ImgLoader());
WPixmapStore::setLoader(imsrc);
Expand Down
3 changes: 1 addition & 2 deletions src/skin/colorschemeparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ class ColorSchemeParser {
QDomElement docElem,
UserSettingsPointer pConfig,
QString* pStyle,
const SkinContext& context);
SkinContext& context);
private:
static ImgSource* parseFilters(QDomNode filter);
ColorSchemeParser() { }
~ColorSchemeParser() { }
SkinContext* m_pContext;
};

#endif /* COLORSCHEMEPARSER_H */