1
/***************************************************************************
2
* Copyright (c) 2015 Werner Mayer <wmayer[at]users.sourceforge.net> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 51 Franklin Street, *
19
* Fifth Floor, Boston, MA 02110-1301, USA *
21
***************************************************************************/
24
#include "PreCompiled.h"
35
filter.push_back("Application");
36
filter.push_back("WindowTitle");
37
filter.push_back("CopyrightInfo");
38
filter.push_back("MaintainerUrl");
39
filter.push_back("WindowIcon");
40
filter.push_back("ProgramLogo");
41
filter.push_back("ProgramIcons");
42
filter.push_back("StyleSheet");
44
filter.push_back("BuildVersionMajor");
45
filter.push_back("BuildVersionMinor");
46
filter.push_back("BuildRevision");
47
filter.push_back("BuildRevisionDate");
49
filter.push_back("SplashScreen");
50
filter.push_back("SplashAlignment");
51
filter.push_back("SplashTextColor");
52
filter.push_back("SplashInfoColor");
54
filter.push_back("StartWorkbench");
56
filter.push_back("ExeName");
57
filter.push_back("ExeVendor");
58
filter.push_back("NavigationStyle");
59
filter.push_back("UserParameterTemplate");
62
bool Branding::readFile(const QString& fn)
65
if (!file.open(QFile::ReadOnly))
67
if (!evaluateXML(&file, domDocument))
73
Branding::XmlConfig Branding::getUserDefines() const
76
QDomElement root = domDocument.documentElement();
79
child = root.firstChildElement();
80
while (!child.isNull()) {
81
std::string name = child.localName().toLatin1().constData();
82
std::string value = child.text().toUtf8().constData();
83
if (std::find(filter.begin(), filter.end(), name) != filter.end())
85
child = child.nextSiblingElement();
91
bool Branding::evaluateXML(QIODevice *device, QDomDocument& xmlDocument)
97
if (!xmlDocument.setContent(device, true, &errorStr, &errorLine,
102
QDomElement root = xmlDocument.documentElement();
103
if (root.tagName() != QLatin1String("Branding")) {
106
else if (root.hasAttribute(QLatin1String("version"))) {
107
QString attr = root.attribute(QLatin1String("version"));
108
if (attr != QLatin1String("1.0"))