qt: Prevent non-functional GUI from popping up during Init
When a InitError or InitWarning happens, the GUI pops up but is unusable (until Init finishes). This is caused by showNormalIfMinimized. Add a message flag to skip this call for Init errors or warnings.
This commit is contained in:
parent
93a7861d71
commit
1ad26362c9
3 changed files with 9 additions and 4 deletions
|
@ -164,13 +164,13 @@ void HandleSIGHUP(int)
|
|||
|
||||
bool static InitError(const std::string &str)
|
||||
{
|
||||
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR);
|
||||
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_ERROR | CClientUIInterface::NOSHOWGUI);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool static InitWarning(const std::string &str)
|
||||
{
|
||||
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING);
|
||||
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING | CClientUIInterface::NOSHOWGUI);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -681,7 +681,10 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned
|
|||
if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK)))
|
||||
buttons = QMessageBox::Ok;
|
||||
|
||||
// Ensure we get users attention
|
||||
// Ensure we get users attention, but only if main window is visible
|
||||
// as we don't want to pop up the main window for messages that happen before
|
||||
// initialization is finished.
|
||||
if(!(style & CClientUIInterface::NOSHOWGUI))
|
||||
showNormalIfMinimized();
|
||||
QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this);
|
||||
int r = mBox.exec();
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
|
||||
/** Force blocking, modal message box dialog (not just OS notification) */
|
||||
MODAL = 0x10000000U,
|
||||
/** Don't bring GUI to foreground. Use for messages during initialization */
|
||||
NOSHOWGUI = 0x20000000U,
|
||||
|
||||
/** Predefined combinations for certain default usage cases */
|
||||
MSG_INFORMATION = ICON_INFORMATION,
|
||||
|
|
Loading…
Reference in a new issue