summaryrefslogtreecommitdiffstats
path: root/src/libs/kdtools/environment.h
blob: 917da4f4591ac19f064c2fd092fade488a20304f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef LIBINSTALLER_ENVIRONMENT_H
#define LIBINSTALLER_ENVIRONMENT_H

#include "kdtoolsglobal.h"

#include <QString>
#include <QHash>

QT_BEGIN_NAMESPACE
class QProcess;
class QProcessEnvironment;
QT_END_NAMESPACE

namespace KDUpdater {

class KDTOOLS_EXPORT Environment
{
public:
    static Environment &instance();

    ~Environment() {}

    QString value(const QString &key, const QString &defaultValue = QString()) const;
    void setTemporaryValue(const QString &key, const QString &value);

    QProcessEnvironment applyTo(const QProcessEnvironment &qpe) const;
    void applyTo(QProcess *process);

private:
    Environment() {}

private:
    Q_DISABLE_COPY(Environment)
    QHash<QString, QString> m_tempValues;
};

} // namespace KDUpdater

#endif