summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/3rdparty/kdtools
diff options
context:
space:
mode:
authorhjk <qthjk@ovi.com>2011-11-19 23:58:21 +0100
committerTim Jenssen <tim.jenssen@nokia.com>2011-11-21 13:16:07 +0100
commit05c6a59c05d8b2b1168e5822da6b10bce79548fc (patch)
tree6b1ebfd55e935d7cc2dcc03a5991e0433cf6e719 /installerbuilder/libinstaller/3rdparty/kdtools
parentfbd95005bf185b74269b5c397b1f247f6404582b (diff)
De-pimpl KDUpdater::Environment
Change-Id: Icbb8642da87643fb6635429570f857fbc57797bd Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller/3rdparty/kdtools')
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/environment.cpp32
-rw-r--r--installerbuilder/libinstaller/3rdparty/kdtools/environment.h10
2 files changed, 12 insertions, 30 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/environment.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/environment.cpp
index 8bdabb5c5..4b031ecc4 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/environment.cpp
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/environment.cpp
@@ -6,48 +6,30 @@
using namespace KDUpdater;
-class Environment::Private
-{
-public:
- static Environment s_instance;
- QHash<QString, QString> tempValues;
-};
-
-Environment Environment::Private::s_instance;
-
-Environment::Environment()
- : d(new Private)
-{
-}
-
-Environment::~Environment()
-{
- delete d;
-}
-
Environment &Environment::instance()
{
- return Private::s_instance;
+ static Environment s_instance;
+ return s_instance;
}
QString Environment::value(const QString &key, const QString &defvalue) const
{
- const QHash<QString, QString>::ConstIterator it = d->tempValues.constFind(key);
- if (it != d->tempValues.constEnd())
+ const QHash<QString, QString>::ConstIterator it = m_tempValues.constFind(key);
+ if (it != m_tempValues.constEnd())
return *it;
return QProcessEnvironment::systemEnvironment().value(key, defvalue);
}
void Environment::setTemporaryValue(const QString &key, const QString &value)
{
- d->tempValues.insert(key, value);
+ m_tempValues.insert(key, value);
}
QProcessEnvironment Environment::applyTo(const QProcessEnvironment &qpe_) const
{
QProcessEnvironment qpe(qpe_);
- QHash<QString, QString>::ConstIterator it = d->tempValues.constBegin();
- const QHash<QString, QString>::ConstIterator end = d->tempValues.constEnd();
+ QHash<QString, QString>::ConstIterator it = m_tempValues.constBegin();
+ const QHash<QString, QString>::ConstIterator end = m_tempValues.constEnd();
for ( ; it != end; ++it)
qpe.insert(it.key(), it.value());
return qpe;
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/environment.h b/installerbuilder/libinstaller/3rdparty/kdtools/environment.h
index 5446b2730..917da4f45 100644
--- a/installerbuilder/libinstaller/3rdparty/kdtools/environment.h
+++ b/installerbuilder/libinstaller/3rdparty/kdtools/environment.h
@@ -1,9 +1,10 @@
#ifndef LIBINSTALLER_ENVIRONMENT_H
#define LIBINSTALLER_ENVIRONMENT_H
-#include "kdupdaterupdateoperation.h"
+#include "kdtoolsglobal.h"
#include <QString>
+#include <QHash>
QT_BEGIN_NAMESPACE
class QProcess;
@@ -17,7 +18,7 @@ class KDTOOLS_EXPORT Environment
public:
static Environment &instance();
- ~Environment();
+ ~Environment() {}
QString value(const QString &key, const QString &defaultValue = QString()) const;
void setTemporaryValue(const QString &key, const QString &value);
@@ -26,12 +27,11 @@ public:
void applyTo(QProcess *process);
private:
- Environment();
+ Environment() {}
private:
Q_DISABLE_COPY(Environment)
- class Private;
- Private *const d;
+ QHash<QString, QString> m_tempValues;
};
} // namespace KDUpdater