From 7bd6dccac771a53bd4e69893066fa76929ff3aba Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 11 Jul 2015 12:46:55 +0200 Subject: [PATCH] + support user template parameter file for branding --- src/App/Application.cpp | 15 +++++++++++++++ src/App/Branding.cpp | 1 + 2 files changed, 16 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 6a2a35ab0..3bd6f60c3 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1410,6 +1410,21 @@ void Application::LoadParameters(void) try { if (_pcUserParamMngr->LoadOrCreateDocument(mConfig["UserParameter"].c_str()) && !(mConfig["Verbose"] == "Strict")) { + // The user parameter file doesn't exist. When an alternative parameter file is offered + // this will be used. + std::map::iterator it = mConfig.find("UserParameterTemplate"); + if (it != mConfig.end()) { + QString path = QString::fromUtf8(it->second.c_str()); + if (QDir(path).isRelative()) { + QString home = QString::fromUtf8(mConfig["AppHomePath"].c_str()); + path = QFileInfo(QDir(home), path).absoluteFilePath(); + } + QFileInfo fi(path); + if (fi.exists()) { + _pcUserParamMngr->LoadDocument(path.toUtf8().constData()); + } + } + // Configuration file optional when using as Python module if (!Py_IsInitialized()) { Console().Warning(" User settings not existing, write initial one\n"); diff --git a/src/App/Branding.cpp b/src/App/Branding.cpp index 4bbe5dc1a..173ba0f46 100644 --- a/src/App/Branding.cpp +++ b/src/App/Branding.cpp @@ -60,6 +60,7 @@ Branding::Branding() filter.push_back("ExeName"); filter.push_back("ExeVendor"); filter.push_back("NavigationStyle"); + filter.push_back("UserParameterTemplate"); } bool Branding::readFile(const QString& fn)