SyncEngine engine(account, options.source_dir, folder, &db);
engine.setIgnoreHiddenFiles(options.ignoreHiddenFiles);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ QObject::connect(&engine, &SyncEngine::finished,
+ [&app](bool result) { app.exit(result ? EXIT_SUCCESS : EXIT_FAILURE); });
+#else
QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit()));
+#endif
QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot()));
// Have to be done async, else, an error before exec() does not terminate the event loop.
QMetaObject::invokeMethod(&engine, "startSync", Qt::QueuedConnection);
- app.exec();
+ int resultCode = app.exec();
if (engine.isAnotherSyncNeeded() != NoFollowUpSync) {
if (restartCount < options.restartTimes) {
qWarning() << "Another sync is needed, but not done because restart count is exceeded" << restartCount;
}
- return 0;
+ return resultCode;
}