* the problem: application may be launched using python executable,
* to use environment variable (at least for the current moment)
*/
- if (prefix.empty()) {
- char* anEnv = getenv("PLUGINS_CONFIG_FILE");
- if (anEnv) {
- prefix = std::string(anEnv);
- }
- }
+ if (prefix.empty())
+ prefix = pluginConfigFile();
+
#ifdef WIN32
prefix += "\\";
#else
xmlFreeDoc(myXmlDoc);
}
+std::string Config_XMLReader::pluginConfigFile()
+{
+ std::string aValue;
+ char* anEnv = getenv("PLUGINS_CONFIG_FILE");
+ if (anEnv) {
+ aValue = std::string(anEnv);
+ }
+ return aValue;
+}
+
void Config_XMLReader::readAll()
{
xmlNodePtr aRoot = findRoot();
*/
CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);
CONFIG_EXPORT virtual ~Config_XMLReader();
+ /*!
+ * Returns value of PLUGINS_CONFIG_FILE env variable, a path to the plugins.xml file
+ * \return string value
+ */
+ CONFIG_EXPORT static std::string pluginConfigFile();
/*!
* Read all nodes in associated xml file,
* recursively if processChildren(xmlNode) is true for the xmlNode.
// Created: 28 Jul 2015
// Author: Vitaly SMETANNIKOV
-
#include "ModuleBase_IconFactory.h"
+#include "Config_XMLReader.h"
+
+#include <QDir>
+
ModuleBase_IconFactory* MYIconFactory = 0;
QIcon ModuleBase_IconFactory::loadIcon(const QString& theValue)
{
- QIcon anIcon(theValue);
-
- if (anIcon.isNull()) {
-
+ QPixmap aPixmap(theValue);
+
+ if (aPixmap.isNull()) {
+ std::string aPluginPath = Config_XMLReader::pluginConfigFile();
+ QString anIconPath = QString::fromStdString(aPluginPath) + QDir::separator() +
+ theValue;
+ if (QFile::exists(anIconPath))
+ aPixmap = QPixmap(anIconPath);
}
-
- return anIcon;
+ return QIcon(aPixmap);
}