Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show First 20 Lines • Show All 1,453 Lines • ▼ Show 20 Lines | static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string &message, | ||||
unsigned int style) { | unsigned int style) { | ||||
bool modal = (style & CClientUIInterface::MODAL); | bool modal = (style & CClientUIInterface::MODAL); | ||||
// The SECURE flag has no effect in the Qt GUI. | // The SECURE flag has no effect in the Qt GUI. | ||||
// bool secure = (style & CClientUIInterface::SECURE); | // bool secure = (style & CClientUIInterface::SECURE); | ||||
style &= ~CClientUIInterface::SECURE; | style &= ~CClientUIInterface::SECURE; | ||||
bool ret = false; | bool ret = false; | ||||
// In case of modal message, use blocking connection to wait for user to | // In case of modal message, use blocking connection to wait for user to | ||||
// click a button | // click a button | ||||
QMetaObject::invokeMethod(gui, "message", | bool invoked = QMetaObject::invokeMethod( | ||||
modal ? GUIUtil::blockingGUIThreadConnection() | gui, "message", | ||||
: Qt::QueuedConnection, | modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection, | ||||
Q_ARG(QString, QString::fromStdString(caption)), | Q_ARG(QString, QString::fromStdString(caption)), | ||||
Q_ARG(QString, QString::fromStdString(message)), | Q_ARG(QString, QString::fromStdString(message)), | ||||
Q_ARG(unsigned int, style), Q_ARG(bool *, &ret)); | Q_ARG(unsigned int, style), Q_ARG(bool *, &ret)); | ||||
assert(invoked); | |||||
return ret; | return ret; | ||||
} | } | ||||
void BitcoinGUI::subscribeToCoreSignals() { | void BitcoinGUI::subscribeToCoreSignals() { | ||||
// Connect signals to client | // Connect signals to client | ||||
m_handler_message_box = m_node.handleMessageBox( | m_handler_message_box = m_node.handleMessageBox( | ||||
std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, | std::bind(ThreadSafeMessageBox, this, std::placeholders::_1, | ||||
std::placeholders::_2, std::placeholders::_3)); | std::placeholders::_2, std::placeholders::_3)); | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |