2012-05-19 09:35:26 +02:00
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
2014-02-08 22:50:24 +01:00
|
|
|
// Copyright (c) 2009-2014 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
|
|
|
|
2013-04-13 07:13:08 +02:00
|
|
|
#include "noui.h"
|
|
|
|
|
2012-05-19 09:35:26 +02:00
|
|
|
#include "ui_interface.h"
|
2013-04-13 07:13:08 +02:00
|
|
|
#include "util.h"
|
2012-05-19 09:35:26 +02:00
|
|
|
|
2013-04-13 07:13:08 +02:00
|
|
|
#include <stdint.h>
|
2012-05-19 09:35:26 +02:00
|
|
|
#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
|
|
|
}
|
|
|
|
|
2014-01-16 16:15:27 +01:00
|
|
|
LogPrintf("%s: %s\n", strCaption, message);
|
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
|
|
|
}
|
|
|
|
|
2013-01-11 22:57:22 +01:00
|
|
|
static void noui_InitMessage(const std::string &message)
|
|
|
|
{
|
2014-01-16 16:15:27 +01:00
|
|
|
LogPrintf("init message: %s\n", message);
|
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);
|
2013-01-11 22:57:22 +01:00
|
|
|
uiInterface.InitMessage.connect(noui_InitMessage);
|
2012-05-19 09:35:26 +02:00
|
|
|
}
|