mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #14162: gui: Also log and print messages or questions like bitcoind
fa7e9694e1ed5406036620d4bf0b72a2aa984578 qt: Also log and print messages or questions like bitcoind (MarcoFalke) dd031e383975ae42b4cddd9a5bf6080ef5b46afa noui: Move handlers to header file (MarcoFalke) Pull request description: Testing and debugging after shutdown are harder if the node was run through the gui, because errors and warnings would not be logged to the debug.log or written to the stderr (as is the case for bitcoind). Tree-SHA512: 1154e2bf02e3c2616c8d28609569d6c3c7344c5877ad5c1303245044cc7aced9eaec9627f1e1258ed087b49c2a2e6f99bc6c1ad0abe0a855b61e737bdf2059bc # Conflicts: # src/noui.cpp
This commit is contained in:
parent
637a8a28fe
commit
337de3c6f9
@ -15,7 +15,7 @@
|
||||
|
||||
#include <boost/signals2/connection.hpp>
|
||||
|
||||
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
||||
bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
||||
{
|
||||
bool fSecure = style & CClientUIInterface::SECURE;
|
||||
style &= ~CClientUIInterface::SECURE;
|
||||
@ -42,19 +42,18 @@ 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)
|
||||
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)
|
||||
void noui_InitMessage(const std::string& message)
|
||||
{
|
||||
LogPrintf("init message: %s\n", message);
|
||||
}
|
||||
|
||||
void noui_connect()
|
||||
{
|
||||
// Connect dashd signal handlers
|
||||
uiInterface.ThreadSafeMessageBox_connect(noui_ThreadSafeMessageBox);
|
||||
uiInterface.ThreadSafeQuestion_connect(noui_ThreadSafeQuestion);
|
||||
uiInterface.InitMessage_connect(noui_InitMessage);
|
||||
|
12
src/noui.h
12
src/noui.h
@ -5,6 +5,16 @@
|
||||
#ifndef BITCOIN_NOUI_H
|
||||
#define BITCOIN_NOUI_H
|
||||
|
||||
extern void noui_connect();
|
||||
#include <string>
|
||||
|
||||
/** Non-GUI handler, which logs and prints messages. */
|
||||
bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style);
|
||||
/** Non-GUI handler, which logs and prints questions. */
|
||||
bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style);
|
||||
/** Non-GUI handler, which only logs a message. */
|
||||
void noui_InitMessage(const std::string& message);
|
||||
|
||||
/** Connect all bitcoind signal handlers */
|
||||
void noui_connect();
|
||||
|
||||
#endif // BITCOIN_NOUI_H
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <chainparams.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <noui.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/system.h>
|
||||
#include <qt/masternodelist.h>
|
||||
@ -1792,6 +1793,9 @@ void BitcoinGUI::showModalOverlay()
|
||||
|
||||
static bool ThreadSafeMessageBox(BitcoinGUI* gui, const std::string& message, const std::string& caption, unsigned int style)
|
||||
{
|
||||
// Redundantly log and print message in non-gui fashion
|
||||
noui_ThreadSafeMessageBox(message, caption, style);
|
||||
|
||||
bool modal = (style & CClientUIInterface::MODAL);
|
||||
// The SECURE flag has no effect in the Qt GUI.
|
||||
// bool secure = (style & CClientUIInterface::SECURE);
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <noui.h>
|
||||
#include <rpc/server.h>
|
||||
#include <stacktraces.h>
|
||||
#include <ui_interface.h>
|
||||
@ -72,7 +73,7 @@ Q_DECLARE_METATYPE(uint256)
|
||||
|
||||
static void InitMessage(const std::string& message)
|
||||
{
|
||||
LogPrintf("init message: %s\n", message);
|
||||
noui_InitMessage(message);
|
||||
}
|
||||
|
||||
/** Translate string to current locale using Qt. */
|
||||
|
Loading…
Reference in New Issue
Block a user