diff --git a/src/BlockchainBackend.cpp b/src/BlockchainBackend.cpp index cd1ad93..22541d0 100644 --- a/src/BlockchainBackend.cpp +++ b/src/BlockchainBackend.cpp @@ -2,9 +2,16 @@ #include #include #include +#include #include #include +namespace { + const char kSettingsOrg[] = "Logos"; + const char kSettingsApp[] = "BlockchainUI"; + const char kConfigPathKey[] = "configPath"; +} + BlockchainBackend::BlockchainBackend(LogosAPI* logosAPI, QObject* parent) : QObject(parent), m_status(NotStarted), @@ -13,8 +20,13 @@ BlockchainBackend::BlockchainBackend(LogosAPI* logosAPI, QObject* parent) m_logos(nullptr), m_blockchainModule(nullptr) { - - m_configPath = QString::fromUtf8(qgetenv("LB_CONFIG_PATH")); + QSettings s(kSettingsOrg, kSettingsApp); + QString saved = s.value(kConfigPathKey).toString(); + if (!saved.isEmpty()) { + m_configPath = saved; + } else { + m_configPath = QString::fromUtf8(qgetenv("LB_CONFIG_PATH")); + } if (!logosAPI) { logosAPI = new LogosAPI("core", this); @@ -54,6 +66,8 @@ void BlockchainBackend::setConfigPath(const QString& path) const QString localPath = QUrl::fromUserInput(path).toLocalFile(); if (m_configPath != localPath) { m_configPath = localPath; + QSettings s(kSettingsOrg, kSettingsApp); + s.setValue(kConfigPathKey, m_configPath); emit configPathChanged(); } }