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