Browse Source

Perform settings upgrade for existing user only

adaptive-webui-19844
Vladimir Golovnev (Glassez) 5 years ago
parent
commit
86c95db91d
  1. 8
      src/app/main.cpp

8
src/app/main.cpp

@ -168,6 +168,8 @@ int main(int argc, char *argv[])
if (!qputenv("QBITTORRENT", QBT_VERSION)) if (!qputenv("QBITTORRENT", QBT_VERSION))
fprintf(stderr, "Couldn't set environment variable...\n"); fprintf(stderr, "Couldn't set environment variable...\n");
const bool firstTimeUser = !Preferences::instance()->getAcceptedLegal();
if (firstTimeUser) {
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
if (!userAgreesWithLegalNotice()) if (!userAgreesWithLegalNotice())
return EXIT_SUCCESS; return EXIT_SUCCESS;
@ -184,6 +186,7 @@ int main(int argc, char *argv[])
&& !userAgreesWithLegalNotice()) && !userAgreesWithLegalNotice())
return EXIT_SUCCESS; return EXIT_SUCCESS;
#endif #endif
}
// Check if qBittorrent is already running for this user // Check if qBittorrent is already running for this user
if (app->isRunning()) { if (app->isRunning()) {
@ -233,6 +236,7 @@ int main(int argc, char *argv[])
app->setAttribute(Qt::AA_DontShowIconsInMenus); app->setAttribute(Qt::AA_DontShowIconsInMenus);
#endif #endif
if (!firstTimeUser) {
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
if (!upgrade()) return EXIT_FAILURE; if (!upgrade()) return EXIT_FAILURE;
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
@ -243,6 +247,7 @@ int main(int argc, char *argv[])
&& isatty(fileno(stdin)) && isatty(fileno(stdin))
&& isatty(fileno(stdout)))) return EXIT_FAILURE; && isatty(fileno(stdout)))) return EXIT_FAILURE;
#endif #endif
}
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN) #if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
if (params.shouldDaemonize) { if (params.shouldDaemonize) {
app.reset(); // Destroy current application app.reset(); // Destroy current application
@ -378,8 +383,7 @@ void displayBadArgMessage(const QString &message)
bool userAgreesWithLegalNotice() bool userAgreesWithLegalNotice()
{ {
Preferences *const pref = Preferences::instance(); Preferences *const pref = Preferences::instance();
if (pref->getAcceptedLegal()) // Already accepted once Q_ASSERT(!pref->getAcceptedLegal());
return true;
#ifdef DISABLE_GUI #ifdef DISABLE_GUI
const QString eula = QString("\n*** %1 ***\n").arg(QObject::tr("Legal Notice")) const QString eula = QString("\n*** %1 ***\n").arg(QObject::tr("Legal Notice"))

Loading…
Cancel
Save