Bitcoin Core
32.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
node
interface_ui.cpp
Go to the documentation of this file.
1
// Copyright (c) 2010-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include <
node/interface_ui.h
>
6
7
#include <
util/btcsignals.h
>
8
#include <
util/string.h
>
9
#include <
util/translation.h
>
10
11
using
util::MakeUnorderedList
;
12
13
CClientUIInterface
uiInterface
;
14
15
bool
InitError
(
const
bilingual_str
& str)
16
{
17
uiInterface
.
ThreadSafeMessageBox
(str,
CClientUIInterface::MSG_ERROR
);
18
return
false
;
19
}
20
21
bool
InitError
(
const
bilingual_str
& str,
const
std::vector<std::string>& details)
22
{
23
// For now just flatten the list of error details into a string to pass to
24
// the base InitError overload. In the future, if more init code provides
25
// error details, the details could be passed separately from the main
26
// message for rich display in the GUI. But currently the only init
27
// functions which provide error details are ones that run during early init
28
// before the GUI uiInterface is registered, so there's no point passing
29
// main messages and details separately to uiInterface yet.
30
return
InitError
(details.empty() ? str : str +
Untranslated
(
strprintf
(
":\n%s"
,
MakeUnorderedList
(details))));
31
}
32
33
void
InitWarning
(
const
bilingual_str
& str)
34
{
35
uiInterface
.
ThreadSafeMessageBox
(str,
CClientUIInterface::MSG_WARNING
);
36
}
btcsignals.h
CClientUIInterface
Signals for UI communication.
Definition
interface_ui.h:22
CClientUIInterface::ThreadSafeMessageBox
btcsignals::signal< void(const bilingual_str &message, unsigned int style)> ThreadSafeMessageBox
Show message box.
Definition
interface_ui.h:68
CClientUIInterface::MSG_ERROR
@ MSG_ERROR
Definition
interface_ui.h:64
CClientUIInterface::MSG_WARNING
@ MSG_WARNING
Definition
interface_ui.h:63
MakeUnorderedList
std::string MakeUnorderedList(const std::vector< std::string > &items)
Create an unordered multi-line list of items.
Definition
string.h:230
uiInterface
CClientUIInterface uiInterface
Definition
interface_ui.cpp:13
InitWarning
void InitWarning(const bilingual_str &str)
Show warning message.
Definition
interface_ui.cpp:33
InitError
bool InitError(const bilingual_str &str)
Show error message.
Definition
interface_ui.cpp:15
interface_ui.h
util::MakeUnorderedList
std::string MakeUnorderedList(const std::vector< std::string > &items)
Create an unordered multi-line list of items.
Definition
string.h:230
string.h
bilingual_str
Bilingual messages:
Definition
translation.h:24
strprintf
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition
tinyformat.h:1172
translation.h
Untranslated
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition
translation.h:82
Generated on
for Bitcoin Core by
1.18.0