Skip to content

Commit e3245b4

Browse files
committed
[Qt] add out-of-sync modal info layer
1 parent e47052f commit e3245b4

File tree

6 files changed

+602
-1
lines changed

6 files changed

+602
-1
lines changed

src/Makefile.qt.include

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ QT_FORMS_UI = \
9696
qt/forms/editaddressdialog.ui \
9797
qt/forms/helpmessagedialog.ui \
9898
qt/forms/intro.ui \
99+
qt/forms/modaloverlay.ui \
99100
qt/forms/openuridialog.ui \
100101
qt/forms/optionsdialog.ui \
101102
qt/forms/overviewpage.ui \
@@ -125,6 +126,7 @@ QT_MOC_CPP = \
125126
qt/moc_intro.cpp \
126127
qt/moc_macdockiconhandler.cpp \
127128
qt/moc_macnotificationhandler.cpp \
129+
qt/moc_modaloverlay.cpp \
128130
qt/moc_notificator.cpp \
129131
qt/moc_openuridialog.cpp \
130132
qt/moc_optionsdialog.cpp \
@@ -192,6 +194,7 @@ BITCOIN_QT_H = \
192194
qt/intro.h \
193195
qt/macdockiconhandler.h \
194196
qt/macnotificationhandler.h \
197+
qt/modaloverlay.h \
195198
qt/networkstyle.h \
196199
qt/notificator.h \
197200
qt/openuridialog.h \
@@ -292,6 +295,7 @@ BITCOIN_QT_CPP = \
292295
qt/csvmodelwriter.cpp \
293296
qt/guiutil.cpp \
294297
qt/intro.cpp \
298+
qt/modaloverlay.cpp \
295299
qt/networkstyle.cpp \
296300
qt/notificator.cpp \
297301
qt/optionsdialog.cpp \

src/qt/bitcoingui.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "clientmodel.h"
1313
#include "guiconstants.h"
1414
#include "guiutil.h"
15+
#include "modaloverlay.h"
1516
#include "networkstyle.h"
1617
#include "notificator.h"
1718
#include "openuridialog.h"
@@ -114,6 +115,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
114115
notificator(0),
115116
rpcConsole(0),
116117
helpMessageDialog(0),
118+
modalOverlay(0),
117119
prevBlocks(0),
118120
spinnerFrame(0),
119121
platformStyle(platformStyle)
@@ -241,6 +243,12 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
241243

242244
// Subscribe to notifications from core
243245
subscribeToCoreSignals();
246+
247+
modalOverlay = new ModalOverlay(this->centralWidget());
248+
#ifdef ENABLE_WALLET
249+
if(enableWallet)
250+
connect(walletFrame, SIGNAL(requestedOfSyncWarningInfo()), this, SLOT(showModalOverlay()));
251+
#endif
244252
}
245253

246254
BitcoinGUI::~BitcoinGUI()
@@ -491,6 +499,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
491499
// initialize the disable state of the tray icon with the current value in the model.
492500
setTrayIconVisible(optionsModel->getHideTrayIcon());
493501
}
502+
503+
modalOverlay->setKnownBestHeight(clientModel->getHeaderHeight());
494504
} else {
495505
// Disable possibility to show main window via action
496506
toggleHideAction->setEnabled(false);
@@ -705,7 +715,14 @@ void BitcoinGUI::setNumConnections(int count)
705715

706716
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header)
707717
{
708-
if(!clientModel)
718+
if (modalOverlay)
719+
{
720+
if (header)
721+
modalOverlay->setKnownBestHeight(count);
722+
else
723+
modalOverlay->tipUpdate(count, blockDate, nVerificationProgress);
724+
}
725+
if (!clientModel)
709726
return;
710727

711728
// Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
@@ -754,7 +771,10 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
754771

755772
#ifdef ENABLE_WALLET
756773
if(walletFrame)
774+
{
757775
walletFrame->showOutOfSyncWarning(false);
776+
modalOverlay->showHide(true, true);
777+
}
758778
#endif // ENABLE_WALLET
759779

760780
progressBarLabel->setVisible(false);
@@ -782,7 +802,10 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
782802

783803
#ifdef ENABLE_WALLET
784804
if(walletFrame)
805+
{
785806
walletFrame->showOutOfSyncWarning(true);
807+
modalOverlay->showHide();
808+
}
786809
#endif // ENABLE_WALLET
787810

788811
tooltip += QString("<br>");
@@ -1078,6 +1101,12 @@ void BitcoinGUI::setTrayIconVisible(bool fHideTrayIcon)
10781101
}
10791102
}
10801103

1104+
void BitcoinGUI::showModalOverlay()
1105+
{
1106+
if (modalOverlay)
1107+
modalOverlay->showHide(false, true);
1108+
}
1109+
10811110
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)
10821111
{
10831112
bool modal = (style & CClientUIInterface::MODAL);

src/qt/bitcoingui.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class UnitDisplayStatusBarControl;
2929
class WalletFrame;
3030
class WalletModel;
3131
class HelpMessageDialog;
32+
class ModalOverlay;
3233

3334
class CWallet;
3435

@@ -118,6 +119,7 @@ class BitcoinGUI : public QMainWindow
118119
Notificator *notificator;
119120
RPCConsole *rpcConsole;
120121
HelpMessageDialog *helpMessageDialog;
122+
ModalOverlay *modalOverlay;
121123

122124
/** Keep track of previous number of blocks, to detect progress */
123125
int prevBlocks;
@@ -229,6 +231,8 @@ private Q_SLOTS:
229231

230232
/** When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly. */
231233
void setTrayIconVisible(bool);
234+
235+
void showModalOverlay();
232236
};
233237

234238
class UnitDisplayStatusBarControl : public QLabel

0 commit comments

Comments
 (0)