mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Fix main().
This commit is contained in:
parent
2dd473eb28
commit
8b95bb233d
1 changed files with 6 additions and 5 deletions
|
@ -146,7 +146,8 @@ int main(int argc, char *argv[])
|
||||||
bool isOneArg = (argc == 2);
|
bool isOneArg = (argc == 2);
|
||||||
|
|
||||||
// Create Application
|
// Create Application
|
||||||
QScopedPointer<Application> app(new Application("qBittorrent-" + misc::getUserIDString(), argc, argv));
|
QString appId = QLatin1String("qBittorrent-") + misc::getUserIDString();
|
||||||
|
QScopedPointer<Application> app(new Application(appId, argc, argv));
|
||||||
|
|
||||||
MessagesCollector* messagesCollector = new MessagesCollector();
|
MessagesCollector* messagesCollector = new MessagesCollector();
|
||||||
QObject::connect(app.data(), SIGNAL(messageReceived(const QString &)),
|
QObject::connect(app.data(), SIGNAL(messageReceived(const QString &)),
|
||||||
|
@ -210,9 +211,9 @@ int main(int argc, char *argv[])
|
||||||
.arg(QLatin1String("-d (or --daemon)")));
|
.arg(QLatin1String("-d (or --daemon)")));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
#else
|
else
|
||||||
qDebug("qBittorrent is already running for this user.");
|
|
||||||
#endif
|
#endif
|
||||||
|
qDebug("qBittorrent is already running for this user.");
|
||||||
|
|
||||||
misc::msleep(300);
|
misc::msleep(300);
|
||||||
if (!params.torrents.isEmpty()) {
|
if (!params.torrents.isEmpty()) {
|
||||||
|
@ -233,7 +234,7 @@ int main(int argc, char *argv[])
|
||||||
if (params.shouldDaemonize) {
|
if (params.shouldDaemonize) {
|
||||||
app.reset(); // Destroy current application
|
app.reset(); // Destroy current application
|
||||||
if ((daemon(1, 0) == 0)) {
|
if ((daemon(1, 0) == 0)) {
|
||||||
app.reset(new Application("qBittorrent-" + misc::getUserIDString(), argc, argv));
|
app.reset(new Application(appId, argc, argv));
|
||||||
if (app->isRunning()) {
|
if (app->isRunning()) {
|
||||||
// Another instance had time to start.
|
// Another instance had time to start.
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -266,7 +267,7 @@ int main(int argc, char *argv[])
|
||||||
delete messagesCollector;
|
delete messagesCollector;
|
||||||
app->setActivationWindow(&window);
|
app->setActivationWindow(&window);
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
static_cast<QMacApplication*>(app.data())->setReadyToProcessEvents();
|
app->setReadyToProcessEvents();
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
#else
|
#else
|
||||||
// Load Headless class
|
// Load Headless class
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue