Files
thehub/libs/server/noui.cpp
T

65 lines
2.0 KiB
C++
Raw Permalink Normal View History

2017-11-09 19:34:51 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2010 Satoshi Nakamoto
* Copyright (C) 2009-2014 The Bitcoin Core developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2013-04-13 00:13:08 -05:00
#include "noui.h"
2018-02-10 22:48:07 +01:00
#include "UiInterface.h"
2013-04-13 00:13:08 -05:00
#include "util.h"
2014-08-21 16:11:09 +02:00
#include <cstdio>
2013-02-16 17:58:45 +01:00
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
{
bool fSecure = style & CClientUIInterface::SECURE;
style &= ~CClientUIInterface::SECURE;
std::string strCaption;
// Check for usage of predefined caption
switch (style) {
case CClientUIInterface::MSG_ERROR:
strCaption += _("Error");
break;
case CClientUIInterface::MSG_WARNING:
strCaption += _("Warning");
break;
case CClientUIInterface::MSG_INFORMATION:
strCaption += _("Information");
break;
default:
strCaption += caption; // Use supplied caption (can be empty)
}
if (!fSecure)
2020-10-27 14:28:07 +01:00
logCritical(Log::Bitcoin).nospace() << strCaption << ": " << message;
fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str());
2013-02-16 17:58:45 +01:00
return false;
}
static void noui_InitMessage(const std::string& message)
{
2017-08-29 11:42:11 +02:00
logCritical(Log::Bitcoin) << "init message:" << message;
}
void noui_connect()
{
// Connect bitcoind signal handlers
uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox);
uiInterface.InitMessage.connect(noui_InitMessage);
}