aboutsummaryrefslogtreecommitdiff
path: root/src/qt/splashscreen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/splashscreen.cpp')
-rw-r--r--src/qt/splashscreen.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp
index 1b7cc69231..a1fbba963c 100644
--- a/src/qt/splashscreen.cpp
+++ b/src/qt/splashscreen.cpp
@@ -142,8 +142,8 @@ SplashScreen::~SplashScreen()
bool SplashScreen::eventFilter(QObject * obj, QEvent * ev) {
if (ev->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
- if(keyEvent->text()[0] == 'q' && breakAction != nullptr) {
- breakAction();
+ if(keyEvent->text()[0] == 'q') {
+ StartShutdown();
}
}
return QObject::eventFilter(obj, ev);
@@ -170,27 +170,18 @@ static void InitMessage(SplashScreen *splash, const std::string &message)
Q_ARG(QColor, QColor(55,55,55)));
}
-static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress)
+static void ShowProgress(SplashScreen *splash, const std::string &title, int nProgress, bool resume_possible)
{
- InitMessage(splash, title + strprintf("%d", nProgress) + "%");
-}
-
-void SplashScreen::setBreakAction(const std::function<void(void)> &action)
-{
- breakAction = action;
-}
-
-static void SetProgressBreakAction(SplashScreen *splash, const std::function<void(void)> &action)
-{
- QMetaObject::invokeMethod(splash, "setBreakAction",
- Qt::QueuedConnection,
- Q_ARG(std::function<void(void)>, action));
+ InitMessage(splash, title + std::string("\n") +
+ (resume_possible ? _("(press q to shutdown and continue later)")
+ : _("press q to shutdown")) +
+ strprintf("\n%d", nProgress) + "%");
}
#ifdef ENABLE_WALLET
void SplashScreen::ConnectWallet(CWallet* wallet)
{
- wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
+ wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2, false));
connectedWallets.push_back(wallet);
}
#endif
@@ -199,8 +190,7 @@ void SplashScreen::subscribeToCoreSignals()
{
// Connect signals to client
uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1));
- uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
- uiInterface.SetProgressBreakAction.connect(boost::bind(SetProgressBreakAction, this, _1));
+ uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2, _3));
#ifdef ENABLE_WALLET
uiInterface.LoadWallet.connect(boost::bind(&SplashScreen::ConnectWallet, this, _1));
#endif
@@ -210,10 +200,10 @@ void SplashScreen::unsubscribeFromCoreSignals()
{
// Disconnect signals from client
uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1));
- uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
+ uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2, _3));
#ifdef ENABLE_WALLET
for (CWallet* const & pwallet : connectedWallets) {
- pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
+ pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2, false));
}
#endif
}