mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 16:53:08 -07:00
Allow single app instance per configuration
This commit is contained in:
parent
73ee901c45
commit
38e54206d5
4 changed files with 24 additions and 14 deletions
|
@ -78,7 +78,6 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
|||
|
||||
#include "base/preferences.h"
|
||||
#include "base/profile.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "application.h"
|
||||
#include "cmdoptions.h"
|
||||
#include "upgrade.h"
|
||||
|
@ -135,11 +134,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
try {
|
||||
// Create Application
|
||||
const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
|
||||
auto app = std::make_unique<Application>(appId, argc, argv);
|
||||
auto app = std::make_unique<Application>(argc, argv);
|
||||
|
||||
const QBtCommandLineParameters params = app->commandLineArgs();
|
||||
|
||||
if (!params.unknownParameter.isEmpty()) {
|
||||
throw CommandLineParameterError(QObject::tr("%1 is an unknown command line parameter.",
|
||||
"--random-parameter is an unknown command line parameter.")
|
||||
|
@ -258,7 +255,7 @@ int main(int argc, char *argv[])
|
|||
if (params.shouldDaemonize) {
|
||||
app.reset(); // Destroy current application
|
||||
if (daemon(1, 0) == 0) {
|
||||
app = std::make_unique<Application>(appId, argc, argv);
|
||||
app = std::make_unique<Application>(argc, argv);
|
||||
if (app->isRunning()) {
|
||||
// Another instance had time to start.
|
||||
return EXIT_FAILURE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue