Remove direct bitcoin calls from qt/intro.cpp
This commit is contained in:
parent
fe6f27e6ea
commit
d7c2c95948
4 changed files with 14 additions and 8 deletions
|
@ -113,7 +113,7 @@ class NodeImpl : public Node
|
||||||
LOCK(::cs_main);
|
LOCK(::cs_main);
|
||||||
tip = ::chainActive.Tip();
|
tip = ::chainActive.Tip();
|
||||||
}
|
}
|
||||||
return GuessVerificationProgress(::Params().TxData(), tip);
|
return GuessVerificationProgress(Params().TxData(), tip);
|
||||||
}
|
}
|
||||||
bool isInitialBlockDownload() override { return IsInitialBlockDownload(); }
|
bool isInitialBlockDownload() override { return IsInitialBlockDownload(); }
|
||||||
bool getReindex() override { return ::fReindex; }
|
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) {
|
return MakeHandler(::uiInterface.NotifyBlockTip.connect([fn](bool initial_download, const CBlockIndex* block) {
|
||||||
fn(initial_download, block->nHeight, block->GetBlockTime(),
|
fn(initial_download, block->nHeight, block->GetBlockTime(),
|
||||||
GuessVerificationProgress(::Params().TxData(), block));
|
GuessVerificationProgress(Params().TxData(), block));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) override
|
std::unique_ptr<Handler> handleNotifyHeaderTip(NotifyHeaderTipFn fn) override
|
||||||
|
@ -174,7 +174,7 @@ class NodeImpl : public Node
|
||||||
return MakeHandler(
|
return MakeHandler(
|
||||||
::uiInterface.NotifyHeaderTip.connect([fn](bool initial_download, const CBlockIndex* block) {
|
::uiInterface.NotifyHeaderTip.connect([fn](bool initial_download, const CBlockIndex* block) {
|
||||||
fn(initial_download, block->nHeight, block->GetBlockTime(),
|
fn(initial_download, block->nHeight, block->GetBlockTime(),
|
||||||
GuessVerificationProgress(::Params().TxData(), block));
|
GuessVerificationProgress(Params().TxData(), block));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -602,7 +602,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/// 5. Now that settings and translations are available, ask user for data directory
|
/// 5. Now that settings and translations are available, ask user for data directory
|
||||||
// User language is set up: pick a data directory
|
// User language is set up: pick a data directory
|
||||||
if (!Intro::pickDataDirectory())
|
if (!Intro::pickDataDirectory(*node))
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
/// 6. Determine availability of data and blocks directory and parse bitcoin.conf
|
/// 6. Determine availability of data and blocks directory and parse bitcoin.conf
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
|
|
||||||
|
#include <interface/node.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -186,7 +187,7 @@ QString Intro::getDefaultDataDirectory()
|
||||||
return GUIUtil::boostPathToQString(GetDefaultDataDir());
|
return GUIUtil::boostPathToQString(GetDefaultDataDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Intro::pickDataDirectory()
|
bool Intro::pickDataDirectory(interface::Node& node)
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
/* If data directory provided on command line, no need to look at 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
|
* override -datadir in the bitcoin.conf file in the default data directory
|
||||||
* (to be consistent with bitcoind behavior)
|
* (to be consistent with bitcoind behavior)
|
||||||
*/
|
*/
|
||||||
if(dataDir != getDefaultDataDirectory())
|
if(dataDir != getDefaultDataDirectory()) {
|
||||||
gArgs.SoftSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
|
node.softSetArg("-datadir", GUIUtil::qstringToBoostPath(dataDir).string()); // use OS locale for path setting
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ static const bool DEFAULT_CHOOSE_DATADIR = false;
|
||||||
|
|
||||||
class FreespaceChecker;
|
class FreespaceChecker;
|
||||||
|
|
||||||
|
namespace interface {
|
||||||
|
class Node;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Intro;
|
class Intro;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +45,7 @@ public:
|
||||||
* @note do NOT call global GetDataDir() before calling this function, this
|
* @note do NOT call global GetDataDir() before calling this function, this
|
||||||
* will cause the wrong path to be cached.
|
* will cause the wrong path to be cached.
|
||||||
*/
|
*/
|
||||||
static bool pickDataDirectory();
|
static bool pickDataDirectory(interface::Node& node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine default data directory for operating system.
|
* Determine default data directory for operating system.
|
||||||
|
|
Loading…
Reference in a new issue