mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-14 19:02:43 +02:00
Drop MSG_NOPREFIX flag
Since bilingual_str type is fully supported, the MSG_NOPREFIX flag is no longer needed.
This commit is contained in:
parent
083daf7fba
commit
d924f2a596
28
src/noui.cpp
28
src/noui.cpp
@ -23,24 +23,20 @@ bool noui_ThreadSafeMessageBox(const bilingual_str& message, const std::string&
|
|||||||
{
|
{
|
||||||
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;
|
||||||
if (prefix) {
|
switch (style) {
|
||||||
switch (style) {
|
case CClientUIInterface::MSG_ERROR:
|
||||||
case CClientUIInterface::MSG_ERROR:
|
strCaption = "Error: ";
|
||||||
strCaption = "Error: ";
|
break;
|
||||||
break;
|
case CClientUIInterface::MSG_WARNING:
|
||||||
case CClientUIInterface::MSG_WARNING:
|
strCaption = "Warning: ";
|
||||||
strCaption = "Warning: ";
|
break;
|
||||||
break;
|
case CClientUIInterface::MSG_INFORMATION:
|
||||||
case CClientUIInterface::MSG_INFORMATION:
|
strCaption = "Information: ";
|
||||||
strCaption = "Information: ";
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
strCaption = caption + ": "; // Use supplied caption (can be empty)
|
||||||
strCaption = caption + ": "; // Use supplied caption (can be empty)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fSecure) {
|
if (!fSecure) {
|
||||||
|
@ -1062,9 +1062,6 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
|
|||||||
int nMBoxIcon = QMessageBox::Information;
|
int nMBoxIcon = QMessageBox::Information;
|
||||||
int nNotifyIcon = Notificator::Information;
|
int nNotifyIcon = Notificator::Information;
|
||||||
|
|
||||||
bool prefix = !(style & CClientUIInterface::MSG_NOPREFIX);
|
|
||||||
style &= ~CClientUIInterface::MSG_NOPREFIX;
|
|
||||||
|
|
||||||
QString msgType;
|
QString msgType;
|
||||||
if (!title.isEmpty()) {
|
if (!title.isEmpty()) {
|
||||||
msgType = title;
|
msgType = title;
|
||||||
@ -1072,11 +1069,11 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
|
|||||||
switch (style) {
|
switch (style) {
|
||||||
case CClientUIInterface::MSG_ERROR:
|
case CClientUIInterface::MSG_ERROR:
|
||||||
msgType = tr("Error");
|
msgType = tr("Error");
|
||||||
if (prefix) message = tr("Error: %1").arg(message);
|
message = tr("Error: %1").arg(message);
|
||||||
break;
|
break;
|
||||||
case CClientUIInterface::MSG_WARNING:
|
case CClientUIInterface::MSG_WARNING:
|
||||||
msgType = tr("Warning");
|
msgType = tr("Warning");
|
||||||
if (prefix) message = tr("Warning: %1").arg(message);
|
message = tr("Warning: %1").arg(message);
|
||||||
break;
|
break;
|
||||||
case CClientUIInterface::MSG_INFORMATION:
|
case CClientUIInterface::MSG_INFORMATION:
|
||||||
msgType = tr("Information");
|
msgType = tr("Information");
|
||||||
|
@ -67,9 +67,6 @@ public:
|
|||||||
/** Force blocking, modal message box dialog (not just OS notification) */
|
/** Force blocking, modal message box dialog (not just OS notification) */
|
||||||
MODAL = 0x10000000U,
|
MODAL = 0x10000000U,
|
||||||
|
|
||||||
/** Do not prepend error/warning prefix */
|
|
||||||
MSG_NOPREFIX = 0x20000000U,
|
|
||||||
|
|
||||||
/** Do not print contents of message to debug log */
|
/** Do not print contents of message to debug log */
|
||||||
SECURE = 0x40000000U,
|
SECURE = 0x40000000U,
|
||||||
|
|
||||||
|
@ -1655,22 +1655,22 @@ bool UndoReadFromDisk(CBlockUndo& blockundo, const CBlockIndex* pindex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Abort with a message */
|
/** Abort with a message */
|
||||||
static bool AbortNode(const std::string& strMessage, const bilingual_str& userMessage = bilingual_str(), unsigned int prefix = 0)
|
static bool AbortNode(const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
|
||||||
{
|
{
|
||||||
SetMiscWarning(strMessage);
|
SetMiscWarning(strMessage);
|
||||||
LogPrintf("*** %s\n", strMessage);
|
LogPrintf("*** %s\n", strMessage);
|
||||||
if (!userMessage.empty()) {
|
if (!userMessage.empty()) {
|
||||||
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR | prefix);
|
uiInterface.ThreadSafeMessageBox(userMessage, "", CClientUIInterface::MSG_ERROR);
|
||||||
} else {
|
} else {
|
||||||
uiInterface.ThreadSafeMessageBox(_("Error: A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MSG_NOPREFIX);
|
uiInterface.ThreadSafeMessageBox(_("A fatal internal error occurred, see debug.log for details"), "", CClientUIInterface::MSG_ERROR);
|
||||||
}
|
}
|
||||||
StartShutdown();
|
StartShutdown();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str(), unsigned int prefix = 0)
|
static bool AbortNode(BlockValidationState& state, const std::string& strMessage, const bilingual_str& userMessage = bilingual_str())
|
||||||
{
|
{
|
||||||
AbortNode(strMessage, userMessage, prefix);
|
AbortNode(strMessage, userMessage);
|
||||||
return state.Error(strMessage);
|
return state.Error(strMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2335,7 +2335,7 @@ bool CChainState::FlushStateToDisk(
|
|||||||
if (fDoFullFlush || fPeriodicWrite) {
|
if (fDoFullFlush || fPeriodicWrite) {
|
||||||
// Depend on nMinDiskSpace to ensure we can write block index
|
// Depend on nMinDiskSpace to ensure we can write block index
|
||||||
if (!CheckDiskSpace(GetBlocksDir())) {
|
if (!CheckDiskSpace(GetBlocksDir())) {
|
||||||
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
LOG_TIME_MILLIS_WITH_CATEGORY("write block and undo data to disk", BCLog::BENCH);
|
LOG_TIME_MILLIS_WITH_CATEGORY("write block and undo data to disk", BCLog::BENCH);
|
||||||
@ -2383,7 +2383,7 @@ bool CChainState::FlushStateToDisk(
|
|||||||
// an overestimation, as most will delete an existing entry or
|
// an overestimation, as most will delete an existing entry or
|
||||||
// overwrite one. Still, use a conservative safety factor of 2.
|
// overwrite one. Still, use a conservative safety factor of 2.
|
||||||
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
|
if (!CheckDiskSpace(GetDataDir(), 48 * 2 * 2 * CoinsTip().GetCacheSize())) {
|
||||||
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
|
||||||
}
|
}
|
||||||
// Flush the chainstate (which may refer to block index entries).
|
// Flush the chainstate (which may refer to block index entries).
|
||||||
if (!CoinsTip().Flush())
|
if (!CoinsTip().Flush())
|
||||||
@ -3290,7 +3290,7 @@ static bool FindBlockPos(FlatFilePos &pos, unsigned int nAddSize, unsigned int n
|
|||||||
bool out_of_space;
|
bool out_of_space;
|
||||||
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
|
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
|
||||||
if (out_of_space) {
|
if (out_of_space) {
|
||||||
return AbortNode("Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
return AbortNode("Disk space is too low!", _("Disk space is too low!"));
|
||||||
}
|
}
|
||||||
if (bytes_allocated != 0 && fPruneMode) {
|
if (bytes_allocated != 0 && fPruneMode) {
|
||||||
fCheckForPruning = true;
|
fCheckForPruning = true;
|
||||||
@ -3314,7 +3314,7 @@ static bool FindUndoPos(BlockValidationState &state, int nFile, FlatFilePos &pos
|
|||||||
bool out_of_space;
|
bool out_of_space;
|
||||||
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
|
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
|
||||||
if (out_of_space) {
|
if (out_of_space) {
|
||||||
return AbortNode(state, "Disk space is too low!", _("Error: Disk space is too low!"), CClientUIInterface::MSG_NOPREFIX);
|
return AbortNode(state, "Disk space is too low!", _("Disk space is too low!"));
|
||||||
}
|
}
|
||||||
if (bytes_allocated != 0 && fPruneMode) {
|
if (bytes_allocated != 0 && fPruneMode) {
|
||||||
fCheckForPruning = true;
|
fCheckForPruning = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user