MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ThreadSafeMessageBox

Function ThreadSafeMessageBox

src/qt/bitcoingui.cpp:1592–1618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1590}
1591
1592[[nodiscard]] static bool ThreadSafeMessageBox(BitcoinGUI* gui, const bilingual_str& message, unsigned int style)
1593{
1594 bool modal = (style & CClientUIInterface::MODAL);
1595 // The SECURE flag has no effect in the Qt GUI.
1596 // bool secure = (style & CClientUIInterface::SECURE);
1597 style &= ~CClientUIInterface::SECURE;
1598 bool ret = false;
1599
1600 QString detailed_message; // This is original message, in English, for googling and referencing.
1601 if (message.original != message.translated) {
1602 detailed_message = BitcoinGUI::tr("Original message:") + "\n" + QString::fromStdString(message.original);
1603 }
1604 // The title is empty for node messages. The fallback title is usually set
1605 // by `style`.
1606 const QString title{};
1607
1608 // In case of modal message, use blocking connection to wait for user to click a button
1609 bool invoked = QMetaObject::invokeMethod(gui, "message",
1610 modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection,
1611 Q_ARG(QString, title),
1612 Q_ARG(QString, QString::fromStdString(message.translated)),
1613 Q_ARG(unsigned int, style),
1614 Q_ARG(bool*, &ret),
1615 Q_ARG(QString, detailed_message));
1616 assert(invoked);
1617 return ret;
1618}
1619
1620void BitcoinGUI::subscribeToCoreSignals()
1621{

Callers 1

Calls 1

Tested by

no test coverage detected