Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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 }
Do not print contents of message to debug log.
Definition: ui_interface.h:67
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
Signals for UI communication.
Definition: ui_interface.h:28
#define LogPrintf(...)
Definition: util.h:203
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
If possible, ask the user a question.
Definition: ui_interface.h:79
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
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Show message box.
Definition: ui_interface.h:76
CClientUIInterface uiInterface
Definition: ui_interface.cpp:8
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result...
Definition: util.h:92
boost::signals2::signal< void(const std::string &message)> InitMessage
Progress message during initialization.
Definition: ui_interface.h:82
Predefined combinations for certain default usage cases.
Definition: ui_interface.h:70
Released under the MIT license