Commit ca7d5942 authored by hjk's avatar hjk Committed by hjk
Browse files

coreplugin: simplify VariableManager

Change-Id: Id89dba3be538a29953b374e58df961835ea4207a
Reviewed-on: http://codereview.qt.nokia.com/1298

Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 258d168a
......@@ -45,7 +45,8 @@
namespace Core {
class VMMapExpander : public Utils::AbstractQtcMacroExpander {
class VMMapExpander : public Utils::AbstractQtcMacroExpander
{
public:
virtual bool resolveMacro(const QString &name, QString *ret)
{
......@@ -55,27 +56,25 @@ public:
}
};
class VariableManagerPrivate : public QObject
class VariableManagerPrivate
{
Q_OBJECT
public:
QHash<QString, QString> m_map;
VMMapExpander m_macroExpander;
QMap<QString, QString> m_descriptions;
static VariableManager *m_instance;
};
VariableManager *VariableManagerPrivate::m_instance = 0;
static VariableManager *variableManagerInstance = 0;
VariableManager::VariableManager() : d(new VariableManagerPrivate)
{
VariableManagerPrivate::m_instance = this;
variableManagerInstance = this;
}
VariableManager::~VariableManager()
{
VariableManagerPrivate::m_instance = 0;
variableManagerInstance = 0;
delete d;
}
void VariableManager::insert(const QString &variable, const QString &value)
......@@ -108,9 +107,9 @@ Utils::AbstractMacroExpander *VariableManager::macroExpander()
return &d->m_macroExpander;
}
VariableManager* VariableManager::instance()
VariableManager *VariableManager::instance()
{
return VariableManagerPrivate::m_instance;
return variableManagerInstance;
}
void VariableManager::registerVariable(const QString &variable, const QString &description)
......@@ -129,5 +128,3 @@ QString VariableManager::variableDescription(const QString &variable) const
}
} // namespace Core
#include "variablemanager.moc"
......@@ -44,6 +44,7 @@ class AbstractMacroExpander;
}
namespace Core {
class VariableManagerPrivate;
class CORE_EXPORT VariableManager : public QObject
......@@ -54,7 +55,7 @@ public:
VariableManager();
~VariableManager();
static VariableManager* instance();
static VariableManager *instance();
void insert(const QString &variable, const QString &value);
bool remove(const QString &variable);
......@@ -71,7 +72,7 @@ signals:
void variableUpdateRequested(const QString &variable);
private:
QScopedPointer<VariableManagerPrivate> d;
VariableManagerPrivate *d;
};
} // namespace Core
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment