Auto merge of #2130 - str4d:2095-metrics-reindex-msg, r=arcalinea
Do not ask a UI question on metrics screen Based on bitcoin/bitcoin#8257. Closes #2095.
This commit is contained in:
commit
c1cff6069f
|
@ -1341,8 +1341,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
if (!fLoaded) {
|
if (!fLoaded) {
|
||||||
// first suggest a reindex
|
// first suggest a reindex
|
||||||
if (!fReset) {
|
if (!fReset) {
|
||||||
bool fRet = uiInterface.ThreadSafeMessageBox(
|
bool fRet = uiInterface.ThreadSafeQuestion(
|
||||||
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
|
strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
|
||||||
|
strLoadError + ".\nPlease restart with -reindex to recover.",
|
||||||
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
|
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
|
||||||
if (fRet) {
|
if (fRet) {
|
||||||
fReindex = true;
|
fReindex = true;
|
||||||
|
|
|
@ -101,6 +101,11 @@ static bool metrics_ThreadSafeMessageBox(const std::string& message,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool metrics_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
|
||||||
|
{
|
||||||
|
return metrics_ThreadSafeMessageBox(message, caption, style);
|
||||||
|
}
|
||||||
|
|
||||||
static void metrics_InitMessage(const std::string& message)
|
static void metrics_InitMessage(const std::string& message)
|
||||||
{
|
{
|
||||||
*initMessage = message;
|
*initMessage = message;
|
||||||
|
@ -110,6 +115,8 @@ void ConnectMetricsScreen()
|
||||||
{
|
{
|
||||||
uiInterface.ThreadSafeMessageBox.disconnect_all_slots();
|
uiInterface.ThreadSafeMessageBox.disconnect_all_slots();
|
||||||
uiInterface.ThreadSafeMessageBox.connect(metrics_ThreadSafeMessageBox);
|
uiInterface.ThreadSafeMessageBox.connect(metrics_ThreadSafeMessageBox);
|
||||||
|
uiInterface.ThreadSafeQuestion.disconnect_all_slots();
|
||||||
|
uiInterface.ThreadSafeQuestion.connect(metrics_ThreadSafeQuestion);
|
||||||
uiInterface.InitMessage.disconnect_all_slots();
|
uiInterface.InitMessage.disconnect_all_slots();
|
||||||
uiInterface.InitMessage.connect(metrics_InitMessage);
|
uiInterface.InitMessage.connect(metrics_InitMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,11 @@ static bool noui_ThreadSafeMessageBox(const std::string& message, const std::str
|
||||||
return false;
|
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)
|
static void noui_InitMessage(const std::string& message)
|
||||||
{
|
{
|
||||||
LogPrintf("init message: %s\n", message);
|
LogPrintf("init message: %s\n", message);
|
||||||
|
@ -48,5 +53,6 @@ void noui_connect()
|
||||||
{
|
{
|
||||||
// Connect bitcoind signal handlers
|
// Connect bitcoind signal handlers
|
||||||
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
|
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
|
||||||
|
uiInterface.ThreadSafeQuestion.connect(noui_ThreadSafeQuestion);
|
||||||
uiInterface.InitMessage.connect(noui_InitMessage);
|
uiInterface.InitMessage.connect(noui_InitMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1040,12 +1040,14 @@ void BitcoinGUI::subscribeToCoreSignals()
|
||||||
{
|
{
|
||||||
// Connect signals to client
|
// Connect signals to client
|
||||||
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
|
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
|
||||||
|
uiInterface.ThreadSafeQuestion.connect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::unsubscribeFromCoreSignals()
|
void BitcoinGUI::unsubscribeFromCoreSignals()
|
||||||
{
|
{
|
||||||
// Disconnect signals from client
|
// Disconnect signals from client
|
||||||
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
|
uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3));
|
||||||
|
uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() :
|
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() :
|
||||||
|
|
|
@ -75,6 +75,9 @@ public:
|
||||||
/** Show message box. */
|
/** Show message box. */
|
||||||
boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
|
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. */
|
/** Progress message during initialization. */
|
||||||
boost::signals2::signal<void (const std::string &message)> InitMessage;
|
boost::signals2::signal<void (const std::string &message)> InitMessage;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue