[Qt] add out-of-sync modal info layer
This commit is contained in:
committed by
lateminer
parent
c106e9fc69
commit
98df73acd1
@@ -12,6 +12,7 @@
|
||||
#include "clientmodel.h"
|
||||
#include "guiconstants.h"
|
||||
#include "guiutil.h"
|
||||
#include "modaloverlay.h"
|
||||
#include "networkstyle.h"
|
||||
#include "notificator.h"
|
||||
#include "openuridialog.h"
|
||||
@@ -120,6 +121,7 @@ BitcoinGUI::BitcoinGUI(const Config *cfg, const PlatformStyle *platformStyle, co
|
||||
notificator(0),
|
||||
rpcConsole(0),
|
||||
helpMessageDialog(0),
|
||||
modalOverlay(0),
|
||||
prevBlocks(0),
|
||||
spinnerFrame(0),
|
||||
platformStyle(platformStyle),
|
||||
@@ -261,6 +263,12 @@ BitcoinGUI::BitcoinGUI(const Config *cfg, const PlatformStyle *platformStyle, co
|
||||
|
||||
// Subscribe to notifications from core
|
||||
subscribeToCoreSignals();
|
||||
|
||||
modalOverlay = new ModalOverlay(this->centralWidget());
|
||||
#ifdef ENABLE_WALLET
|
||||
if(enableWallet)
|
||||
connect(walletFrame, SIGNAL(requestedOfSyncWarningInfo()), this, SLOT(showModalOverlay()));
|
||||
#endif
|
||||
}
|
||||
|
||||
BitcoinGUI::~BitcoinGUI()
|
||||
@@ -519,6 +527,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
|
||||
// initialize the disable state of the tray icon with the current value in the model.
|
||||
setTrayIconVisible(optionsModel->getHideTrayIcon());
|
||||
}
|
||||
|
||||
modalOverlay->setKnownBestHeight(clientModel->getHeaderHeight());
|
||||
} else {
|
||||
// Disable possibility to show main window via action
|
||||
toggleHideAction->setEnabled(false);
|
||||
@@ -743,7 +753,14 @@ void BitcoinGUI::setNumConnections(int count)
|
||||
|
||||
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header)
|
||||
{
|
||||
if(!clientModel)
|
||||
if (modalOverlay)
|
||||
{
|
||||
if (header)
|
||||
modalOverlay->setKnownBestHeight(count);
|
||||
else
|
||||
modalOverlay->tipUpdate(count, blockDate, nVerificationProgress);
|
||||
}
|
||||
if (!clientModel)
|
||||
return;
|
||||
|
||||
// Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
|
||||
@@ -792,7 +809,10 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
if(walletFrame)
|
||||
{
|
||||
walletFrame->showOutOfSyncWarning(false);
|
||||
modalOverlay->showHide(true, true);
|
||||
}
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
progressBarLabel->setVisible(false);
|
||||
@@ -820,7 +840,10 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
if(walletFrame)
|
||||
{
|
||||
walletFrame->showOutOfSyncWarning(true);
|
||||
modalOverlay->showHide();
|
||||
}
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
tooltip += QString("<br>");
|
||||
@@ -1191,6 +1214,12 @@ void BitcoinGUI::setTrayIconVisible(bool fHideTrayIcon)
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinGUI::showModalOverlay()
|
||||
{
|
||||
if (modalOverlay)
|
||||
modalOverlay->showHide(false, true);
|
||||
}
|
||||
|
||||
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)
|
||||
{
|
||||
bool modal = (style & CClientUIInterface::MODAL);
|
||||
|
||||
Reference in New Issue
Block a user