@ -142,8 +142,8 @@ SplashScreen::~SplashScreen()
bool SplashScreen : : eventFilter ( QObject * obj , QEvent * ev ) {
bool SplashScreen : : eventFilter ( QObject * obj , QEvent * ev ) {
if ( ev - > type ( ) = = QEvent : : KeyPress ) {
if ( ev - > type ( ) = = QEvent : : KeyPress ) {
QKeyEvent * keyEvent = static_cast < QKeyEvent * > ( ev ) ;
QKeyEvent * keyEvent = static_cast < QKeyEvent * > ( ev ) ;
if ( keyEvent - > text ( ) [ 0 ] = = ' q ' & & breakAction ! = nullptr ) {
if ( keyEvent - > text ( ) [ 0 ] = = ' q ' ) {
breakActio n( ) ;
StartShutdow n( ) ;
}
}
}
}
return QObject : : eventFilter ( obj , ev ) ;
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 ) ) ) ;
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 ) + " % " ) ;
InitMessage ( splash , title + std : : string ( " \n " ) +
}
( resume_possible ? _ ( " (press q to shutdown and continue later) " )
: _ ( " press q to shutdown " ) ) +
void SplashScreen : : setBreakAction ( const std : : function < void ( void ) > & action )
strprintf ( " \n %d " , nProgress ) + " % " ) ;
{
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 ) ) ;
}
}
# ifdef ENABLE_WALLET
# ifdef ENABLE_WALLET
void SplashScreen : : ConnectWallet ( CWallet * 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 ) ;
connectedWallets . push_back ( wallet ) ;
}
}
# endif
# endif
@ -199,8 +190,7 @@ void SplashScreen::subscribeToCoreSignals()
{
{
// Connect signals to client
// Connect signals to client
uiInterface . InitMessage . connect ( boost : : bind ( InitMessage , this , _1 ) ) ;
uiInterface . InitMessage . connect ( boost : : bind ( InitMessage , this , _1 ) ) ;
uiInterface . ShowProgress . connect ( boost : : bind ( ShowProgress , this , _1 , _2 ) ) ;
uiInterface . ShowProgress . connect ( boost : : bind ( ShowProgress , this , _1 , _2 , _3 ) ) ;
uiInterface . SetProgressBreakAction . connect ( boost : : bind ( SetProgressBreakAction , this , _1 ) ) ;
# ifdef ENABLE_WALLET
# ifdef ENABLE_WALLET
uiInterface . LoadWallet . connect ( boost : : bind ( & SplashScreen : : ConnectWallet , this , _1 ) ) ;
uiInterface . LoadWallet . connect ( boost : : bind ( & SplashScreen : : ConnectWallet , this , _1 ) ) ;
# endif
# endif
@ -210,10 +200,10 @@ void SplashScreen::unsubscribeFromCoreSignals()
{
{
// Disconnect signals from client
// Disconnect signals from client
uiInterface . InitMessage . disconnect ( boost : : bind ( InitMessage , this , _1 ) ) ;
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
# ifdef ENABLE_WALLET
for ( CWallet * const & pwallet : connectedWallets ) {
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
# endif
}
}