Changeset View
Changeset View
Standalone View
Standalone View
src/noui.cpp
Show All 15 Lines | |||||
boost::signals2::connection noui_ThreadSafeMessageBoxConn; | boost::signals2::connection noui_ThreadSafeMessageBoxConn; | ||||
boost::signals2::connection noui_ThreadSafeQuestionConn; | boost::signals2::connection noui_ThreadSafeQuestionConn; | ||||
boost::signals2::connection noui_InitMessageConn; | boost::signals2::connection noui_InitMessageConn; | ||||
bool noui_ThreadSafeMessageBox(const std::string &message, | bool noui_ThreadSafeMessageBox(const std::string &message, | ||||
const std::string &caption, unsigned int style) { | const std::string &caption, unsigned int style) { | ||||
bool fSecure = style & CClientUIInterface::SECURE; | bool fSecure = style & CClientUIInterface::SECURE; | ||||
style &= ~CClientUIInterface::SECURE; | style &= ~CClientUIInterface::SECURE; | ||||
bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX); | |||||
style &= ~CClientUIInterface::MSG_NOPREFIX; | |||||
std::string strCaption; | std::string strCaption; | ||||
// Check for usage of predefined caption | if (prefix) { | ||||
switch (style) { | switch (style) { | ||||
case CClientUIInterface::MSG_ERROR: | case CClientUIInterface::MSG_ERROR: | ||||
strCaption += _("Error").translated; | strCaption = "Error: "; | ||||
break; | break; | ||||
case CClientUIInterface::MSG_WARNING: | case CClientUIInterface::MSG_WARNING: | ||||
strCaption += _("Warning").translated; | strCaption = "Warning: "; | ||||
break; | break; | ||||
case CClientUIInterface::MSG_INFORMATION: | case CClientUIInterface::MSG_INFORMATION: | ||||
strCaption += _("Information").translated; | strCaption = "Information: "; | ||||
break; | break; | ||||
default: | default: | ||||
// Use supplied caption (can be empty) | // Use supplied caption (can be empty) | ||||
strCaption += caption; | strCaption = caption + ": "; | ||||
} | |||||
} | } | ||||
if (!fSecure) { | if (!fSecure) { | ||||
LogPrintf("%s: %s\n", strCaption, message); | LogPrintf("%s%s\n", strCaption, message); | ||||
} | } | ||||
tfm::format(std::cerr, "%s: %s\n", strCaption, message); | tfm::format(std::cerr, "%s%s\n", strCaption.c_str(), message.c_str()); | ||||
return false; | return false; | ||||
} | } | ||||
bool noui_ThreadSafeQuestion( | bool noui_ThreadSafeQuestion( | ||||
const std::string & /* ignored interactive message */, | const std::string & /* ignored interactive message */, | ||||
const std::string &message, const std::string &caption, | const std::string &message, const std::string &caption, | ||||
unsigned int style) { | unsigned int style) { | ||||
return noui_ThreadSafeMessageBox(message, caption, style); | return noui_ThreadSafeMessageBox(message, caption, style); | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |