Use unmodified QtSingleApplication on Windows.

Get running application instance PID without QtSingleApplication
modification.
This commit is contained in:
Vladimir Golovnev (Glassez) 2015-01-20 18:00:37 +03:00
parent e52a8fb0b0
commit 2dd473eb28
7 changed files with 47 additions and 89 deletions

View file

@ -90,10 +90,6 @@ public:
#include "main.moc"
#if defined(Q_OS_WIN) && !defined(QBT_HAS_GETCURRENTPID)
#error You seem to have updated QtSingleApplication without porting our custom QtSingleApplication::getRunningPid() function. Please see previous version to understate how it works.
#endif
// Signal handlers
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
void sigintHandler(int);
@ -217,14 +213,8 @@ int main(int argc, char *argv[])
#else
qDebug("qBittorrent is already running for this user.");
#endif
misc::msleep(300);
#ifdef Q_OS_WIN
DWORD pid = (DWORD)app->getRunningPid();
if (pid > 0) {
BOOL b = AllowSetForegroundWindow(pid);
qDebug("AllowSetForegroundWindow() returns %s", b ? "TRUE" : "FALSE");
}
#endif
if (!params.torrents.isEmpty()) {
QString message = params.torrents.join("|");
qDebug("Passing program parameters to running instance...");