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

Loading…
Cancel
Save