diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-04-17 15:44:10 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2018-04-04 16:52:40 -0400 |
commit | d7c2c9594897c39df6739b92610dfb5a7a1cb3ec (patch) | |
tree | 0b8355cffe4a206c43051ada4f2b796b2a6ccf2c | |
parent | fe6f27e6ea68a139d3a98b30a53706008ef8b132 (diff) |
Remove direct bitcoin calls from qt/intro.cpp
-rw-r--r-- | src/interface/node.cpp | 6 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 2 | ||||
-rw-r--r-- | src/qt/intro.cpp | 8 | ||||
-rw-r--r-- | src/qt/intro.h | 6 |
4 files changed, 14 insertions, 8 deletions
diff --git a/src/interface/node.cpp b/src/interface/node.cpp index e053080074..281164779d 100644 --- a/src/interface/node.cpp +++ b/src/interface/node.cpp @@ -113,7 +113,7 @@ class NodeImpl : public Node LOCK(::cs_main); tip = ::chainActive.Tip(); } - return GuessVerificationProgress(::Params().TxData(), tip); + return GuessVerificationProgress(Params().TxData(), tip); } bool isInitialBlockDownload() override { return IsInitialBlockDownload(); } bool getReindex() override { return ::fReindex; } @@ -166,7 +166,7 @@ class NodeImpl : public Node { return MakeHandler(::uiInterface.NotifyBlockTip.connect([fn](bool initial_download, const CBlockIndex* block) { fn(initial_download, block->nHeight, block->GetBlockTime(), - GuessVerificationProgress(::Params().TxData(), block)); + GuessVerificationProgress(Params().TxData(), block)); })); } std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) override @@ -174,7 +174,7 @@ class NodeImpl : public Node return MakeHandler( ::uiInterface.NotifyHeaderTip.connect([fn](bool initial_download, const CBlockIndex* block) { fn(initial_download, block->nHeight, block->GetBlockTime(), - GuessVerificationProgress(::Params().TxData(), block)); + GuessVerificationProgress(Params().TxData(), block)); })); } }; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index ba473bb4e8..279726d6df 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -602,7 +602,7 @@ int main(int argc, char *argv[]) /// 5. Now that settings and translations are available, ask user for data directory // User language is set up: pick a data directory - if (!Intro::pickDataDirectory()) + if (!Intro::pickDataDirectory(*node)) return EXIT_SUCCESS; /// 6. Determine availability of data and blocks directory and parse bitcoin.conf diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index e69f196238..4eb7482018 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -12,6 +12,7 @@ #include <qt/guiutil.h> +#include <interface/node.h> #include <util.h> #include <QFileDialog> @@ -186,7 +187,7 @@ QString Intro::getDefaultDataDirectory() return GUIUtil::boostPathToQString(GetDefaultDataDir()); } -bool Intro::pickDataDirectory() +bool Intro::pickDataDirectory(interface::Node& node) { QSettings settings; /* If data directory provided on command line, no need to look at settings @@ -233,8 +234,9 @@ bool Intro::pickDataDirectory() * override -datadir in the bitcoin.conf file in the default data directory * (to be consistent with bitcoind behavior) */ - if(dataDir != getDefaultDataDirectory()) - gArgs.SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting + if(dataDir != getDefaultDataDirectory()) { + node.softSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting + } return true; } diff --git a/src/qt/intro.h b/src/qt/intro.h index 5b428b379c..07d2025bb6 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -13,6 +13,10 @@ static const bool DEFAULT_CHOOSE_DATADIR = false; class FreespaceChecker; +namespace interface { + class Node; +} + namespace Ui { class Intro; } @@ -41,7 +45,7 @@ public: * @note do NOT call global GetDataDir() before calling this function, this * will cause the wrong path to be cached. */ - static bool pickDataDirectory(); + static bool pickDataDirectory(interface::Node& node); /** * Determine default data directory for operating system. |