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 }
37