2012-05-19 09:35:26 +02:00
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
2013-10-20 21:25:06 +02:00
|
|
|
// Copyright (c) 2009-2013 The Bitcoin developers
|
2012-05-19 09:35:26 +02:00
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
2012-05-18 16:02:28 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2012-11-05 08:04:21 +01:00
|
|
|
|
2012-05-19 09:35:26 +02:00
|
|
|
#include "ui_interface.h"
|
|
|
|
#include "init.h"
|
|
|
|
#include "bitcoinrpc.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2013-02-16 17:58:45 +01:00
|
|
|
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
2012-05-19 09:35:26 +02:00
|
|
|
{
|
2012-11-05 08:04:21 +01:00
|
|
|
std::string strCaption;
|
|
|
|
// Check for usage of predefined caption
|
|
|
|
switch (style) {
|
|
|
|
case CClientUIInterface::MSG_ERROR:
|
|
|
|
strCaption += _("Error");
|
|
|
|
break;
|
|
|
|
case CClientUIInterface::MSG_WARNING:
|
|
|
|
strCaption += _("Warning");
|
|
|
|
break;
|
|
|
|
case CClientUIInterface::MSG_INFORMATION:
|
|
|
|
strCaption += _("Information");
|
|
|
|
break;
|
|
|
|
default:
|
2013-01-02 15:09:24 +01:00
|
|
|
strCaption += caption; // Use supplied caption (can be empty)
|
2012-11-05 08:04:21 +01:00
|
|
|
}
|
|
|
|
|
2013-09-18 12:38:08 +02:00
|
|
|
LogPrintf("%s: %s\n", strCaption.c_str(), message.c_str());
|
2012-11-05 08:04:21 +01:00
|
|
|
fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str());
|
2013-02-16 17:58:45 +01:00
|
|
|
return false;
|
2012-05-19 09:35:26 +02:00
|
|
|
}
|
|
|
|
|
2012-12-03 13:51:58 +01:00
|
|
|
static bool noui_ThreadSafeAskFee(int64 /*nFeeRequired*/)
|
2012-05-19 09:35:26 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-01-11 22:57:22 +01:00
|
|
|
static void noui_InitMessage(const std::string &message)
|
|
|
|
{
|
2013-09-18 12:38:08 +02:00
|
|
|
LogPrintf("init message: %s\n", message.c_str());
|
2013-01-11 22:57:22 +01:00
|
|
|
}
|
|
|
|
|
2012-05-19 09:35:26 +02:00
|
|
|
void noui_connect()
|
|
|
|
{
|
|
|
|
// Connect bitcoind signal handlers
|
|
|
|
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
|
|
|
|
uiInterface.ThreadSafeAskFee.connect(noui_ThreadSafeAskFee);
|
2013-01-11 22:57:22 +01:00
|
|
|
uiInterface.InitMessage.connect(noui_InitMessage);
|
2012-05-19 09:35:26 +02:00
|
|
|
}
|