Dash Core  0.12.2.1
P2P Digital Currency
noui.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin Core developers
3 // Copyright (c) 2014-2017 The Dash Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #include "noui.h"
8 
9 #include "ui_interface.h"
10 #include "util.h"
11 
12 #include <cstdio>
13 #include <stdint.h>
14 #include <string>
15 
16 static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
17 {
18  bool fSecure = style & CClientUIInterface::SECURE;
19  style &= ~CClientUIInterface::SECURE;
20 
21  std::string strCaption;
22  // Check for usage of predefined caption
23  switch (style) {
25  strCaption += _("Error");
26  break;
28  strCaption += _("Warning");
29  break;
31  strCaption += _("Information");
32  break;
33  default:
34  strCaption += caption; // Use supplied caption (can be empty)
35  }
36 
37  if (!fSecure)
38  LogPrintf("%s: %s\n", strCaption, message);
39  fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str());
40  return false;
41 }
42 
43 static bool noui_ThreadSafeQuestion(const std::string& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
44 {
45  return noui_ThreadSafeMessageBox(message, caption, style);
46 }
47 
48 static void noui_InitMessage(const std::string& message)
49 {
50  LogPrintf("init message: %s\n", message);
51 }
52 
54 {
55  // Connect dashd signal handlers
59 }
boost::signals2::signal< void(const std::string &message)> InitMessage
Definition: ui_interface.h:83
static bool noui_ThreadSafeMessageBox(const std::string &message, const std::string &caption, unsigned int style)
Definition: noui.cpp:16
void noui_connect()
Definition: noui.cpp:53
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Definition: ui_interface.h:77
boost::signals2::signal< bool(const std::string &message, const std::string &noninteractive_message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeQuestion
Definition: ui_interface.h:80
#define LogPrintf(...)
Definition: util.h:98
CClientUIInterface uiInterface
Definition: init.cpp:130
static bool noui_ThreadSafeQuestion(const std::string &, const std::string &message, const std::string &caption, unsigned int style)
Definition: noui.cpp:43
static void noui_InitMessage(const std::string &message)
Definition: noui.cpp:48
std::string _(const char *psz)
Definition: util.h:84