Browse Source

Адаптирован для более гибкого использования

master
Тим 10 months ago
parent
commit
16db0cff18
2 changed files with 12 additions and 3 deletions
  1. 10
    2
      Environments.cpp
  2. 2
    1
      Environments.h

+ 10
- 2
Environments.cpp View File

@@ -9,9 +9,17 @@ stEnvironment::stEnvironment(const QString &unparsed)
stEnvironment(parser.cap(1), parser.cap(2));
}

Environments::Environments(QObject *parent) : QObject(parent)
Environments::Environments(bool includeSystem, QObject *parent) : QObject(parent)
{
for (auto &unparsed : QProcess::systemEnvironment())
if (includeSystem)
for (auto &unparsed : QProcess::systemEnvironment())
_envs.push_back(stEnvironment(unparsed));
}

Environments::Environments(QStringList envs, bool includeSystem, QObject *parent)
{
Environments(includeSystem, parent);
for (auto &unparsed : envs)
_envs.push_back(stEnvironment(unparsed));
}


+ 2
- 1
Environments.h View File

@@ -15,7 +15,8 @@ class Environments : public QObject
{
Q_OBJECT
public:
explicit Environments(QObject *parent = nullptr);
explicit Environments(bool includeSystem = true, QObject *parent = nullptr);
explicit Environments(QStringList envs, bool includeSystem = true, QObject *parent = nullptr);

virtual void addEnvironment(const QString &key, const QString &value);
virtual void addEnvironment(const stEnvironment &env);

Loading…
Cancel
Save