Line data Source code
1 : // Copyright (c) 2010 Satoshi Nakamoto
2 : // Copyright (c) 2009-2014 The Bitcoin Core developers
3 : // Distributed under the MIT software license, see the accompanying
4 : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 :
6 : #include "noui.h"
7 :
8 : #include "ui_interface.h"
9 : #include "util.h"
10 :
11 : #include <cstdio>
12 : #include <stdint.h>
13 : #include <string>
14 :
15 0 : static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
16 : {
17 0 : bool fSecure = style & CClientUIInterface::SECURE;
18 0 : style &= ~CClientUIInterface::SECURE;
19 :
20 : std::string strCaption;
21 : // Check for usage of predefined caption
22 0 : switch (style) {
23 : case CClientUIInterface::MSG_ERROR:
24 0 : strCaption += _("Error");
25 0 : break;
26 : case CClientUIInterface::MSG_WARNING:
27 0 : strCaption += _("Warning");
28 0 : break;
29 : case CClientUIInterface::MSG_INFORMATION:
30 0 : strCaption += _("Information");
31 0 : break;
32 : default:
33 : strCaption += caption; // Use supplied caption (can be empty)
34 : }
35 :
36 0 : if (!fSecure)
37 0 : LogPrintf("%s: %s\n", strCaption, message);
38 0 : fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str());
39 0 : return false;
40 : }
41 :
42 709 : static void noui_InitMessage(const std::string& message)
43 : {
44 709 : LogPrintf("init message: %s\n", message);
45 709 : }
46 :
47 269 : void noui_connect()
48 : {
49 : // Connect bitcoind signal handlers
50 538 : uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
51 538 : uiInterface.InitMessage.connect(noui_InitMessage);
52 554 : }
|