aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-06-28 10:11:55 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-06-28 10:12:01 +0200
commitff03c50c004844fff71b940c7ac67123a0c5934c (patch)
tree9316e68f2cd0bbefa511d3198212a3b5709c4a5b /src
parent5a06ebbf2d5f6ff57966c9ea9956cc1b666b3028 (diff)
parent1acf1db76fc3e07deb8f0f837934ea90383fedb5 (diff)
Merge #8257: Do not ask a UI question from bitcoind
1acf1db Do not ask a UI question from bitcoind (Pieter Wuille)
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp3
-rw-r--r--src/noui.cpp6
-rw-r--r--src/qt/bitcoingui.cpp2
-rw-r--r--src/ui_interface.h3
4 files changed, 13 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5d29f14eb8..ea4ccaddfc 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1326,8 +1326,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!fLoaded) {
// first suggest a reindex
if (!fReset) {
- bool fRet = uiInterface.ThreadSafeMessageBox(
+ bool fRet = uiInterface.ThreadSafeQuestion(
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
+ strLoadError + ".\nPlease restart with -reindex or -reindex-chainstate to recover.",
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
if (fRet) {
fReindex = true;
diff --git a/src/noui.cpp b/src/noui.cpp
index 3a77361919..0d9207c11a 100644
--- a/src/noui.cpp
+++ b/src/noui.cpp
@@ -39,6 +39,11 @@ static bool noui_ThreadSafeMessageBox(const std::string& message, const std::str
return false;
}
+static bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
+{
+ return noui_ThreadSafeMessageBox(message, caption, style);
+}
+
static void noui_InitMessage(const std::string& message)
{
LogPrintf("init message: %s\n", message);
@@ -48,5 +53,6 @@ void noui_connect()
{
// Connect bitcoind signal handlers
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
+ uiInterface.ThreadSafeQuestion.connect(noui_ThreadSafeQuestion);
uiInterface.InitMessage.connect(noui_InitMessage);
}
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 50c19c3848..9042e3b56a 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -1105,12 +1105,14 @@ void BitcoinGUI::subscribeToCoreSignals()
{
// Connect signals to client
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
+ uiInterface.ThreadSafeQuestion.connect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
}
void BitcoinGUI::unsubscribeFromCoreSignals()
{
// Disconnect signals from client
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
+ uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
}
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
diff --git a/src/ui_interface.h b/src/ui_interface.h
index 7ebfc17e5d..7e6557f8e2 100644
--- a/src/ui_interface.h
+++ b/src/ui_interface.h
@@ -76,6 +76,9 @@ public:
/** Show message box. */
boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
+ /** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */
+ boost::signals2::signal<bool (const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeQuestion;
+
/** Progress message during initialization. */
boost::signals2::signal<void (const std::string &message)> InitMessage;