mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #9834: qt: clean up initialize/shutdown signals
5b528d7
qt: clean up initialize/shutdown signals (Marko Bencun)
Tree-SHA512: 4a8326ba05a1cc037203a7abe01d4e77b6ff83e62ec14f09834ada4b35a23ffb1f28b5587aa2e02601f0f6c7d62c5647a7f10320239b4bac132791be29930ddb
This commit is contained in:
commit
b00ba6251f
@ -178,8 +178,8 @@ public Q_SLOTS:
|
||||
void shutdown();
|
||||
|
||||
Q_SIGNALS:
|
||||
void initializeResult(int retval);
|
||||
void shutdownResult(int retval);
|
||||
void initializeResult(bool success);
|
||||
void shutdownResult();
|
||||
void runawayException(const QString &message);
|
||||
|
||||
private:
|
||||
@ -223,8 +223,8 @@ public:
|
||||
WId getMainWinId() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void initializeResult(int retval);
|
||||
void shutdownResult(int retval);
|
||||
void initializeResult(bool success);
|
||||
void shutdownResult();
|
||||
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
|
||||
void handleRunawayException(const QString &message);
|
||||
|
||||
@ -284,7 +284,7 @@ void BitcoinCore::initialize()
|
||||
Q_EMIT initializeResult(false);
|
||||
return;
|
||||
}
|
||||
int rv = AppInitMain(threadGroup, scheduler);
|
||||
bool rv = AppInitMain(threadGroup, scheduler);
|
||||
Q_EMIT initializeResult(rv);
|
||||
} catch (const std::exception& e) {
|
||||
handleRunawayException(&e);
|
||||
@ -302,7 +302,7 @@ void BitcoinCore::shutdown()
|
||||
threadGroup.join_all();
|
||||
Shutdown();
|
||||
qDebug() << __func__ << ": Shutdown finished";
|
||||
Q_EMIT shutdownResult(1);
|
||||
Q_EMIT shutdownResult();
|
||||
} catch (const std::exception& e) {
|
||||
handleRunawayException(&e);
|
||||
} catch (...) {
|
||||
@ -398,8 +398,8 @@ void BitcoinApplication::startThread()
|
||||
executor->moveToThread(coreThread);
|
||||
|
||||
/* communication to and from thread */
|
||||
connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
|
||||
connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
|
||||
connect(executor, SIGNAL(initializeResult(bool)), this, SLOT(initializeResult(bool)));
|
||||
connect(executor, SIGNAL(shutdownResult()), this, SLOT(shutdownResult()));
|
||||
connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
|
||||
connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
|
||||
connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
|
||||
@ -450,12 +450,12 @@ void BitcoinApplication::requestShutdown()
|
||||
Q_EMIT requestedShutdown();
|
||||
}
|
||||
|
||||
void BitcoinApplication::initializeResult(int retval)
|
||||
void BitcoinApplication::initializeResult(bool success)
|
||||
{
|
||||
qDebug() << __func__ << ": Initialization result: " << retval;
|
||||
// Set exit result: 0 if successful, 1 if failure
|
||||
returnValue = retval ? 0 : 1;
|
||||
if(retval)
|
||||
qDebug() << __func__ << ": Initialization result: " << success;
|
||||
// Set exit result.
|
||||
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
if(success)
|
||||
{
|
||||
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
|
||||
qWarning() << "Platform customization:" << platformStyle->getName();
|
||||
@ -507,9 +507,8 @@ void BitcoinApplication::initializeResult(int retval)
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinApplication::shutdownResult(int retval)
|
||||
void BitcoinApplication::shutdownResult()
|
||||
{
|
||||
qDebug() << __func__ << ": Shutdown result: " << retval;
|
||||
quit(); // Exit main loop after shutdown finished
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user