From 1811ec6cab02ec4dc1445cc6adb5f738a3fa6edc Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 18 Aug 2012 17:33:51 +0200 Subject: [PATCH] Optional daemon-mode for qbittorrent-nox --- doc/qbittorrent-nox.1 | 2 +- src/main.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/qbittorrent-nox.1 b/doc/qbittorrent-nox.1 index 2fcc644e0..531e49d79 100644 --- a/doc/qbittorrent-nox.1 +++ b/doc/qbittorrent-nox.1 @@ -8,7 +8,7 @@ qBittorrent\-nox \- a command line Bittorrent client written in C++ / Qt4 .SH "SYNOPSIS" -\fBqbittorrent\-nox\fR [\-\-webui-port=x] [TORRENT_FILE | URL]... +\fBqbittorrent\-nox\fR [\-\-d|\-\-daemon] [\-\-webui-port=x] [TORRENT_FILE | URL]... \fBqbittorrent\-nox\fR \-\-help diff --git a/src/main.cpp b/src/main.cpp index 8aef644d0..54ecab20e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,6 +74,8 @@ public: std::cout << '\t' << prg_name << " --version: " << qPrintable(tr("displays program version")) << std::endl; #ifndef DISABLE_GUI std::cout << '\t' << prg_name << " --no-splash: " << qPrintable(tr("disable splash screen")) << std::endl; +#else + std::cout << '\t' << prg_name << " -d | --daemon: " << qPrintable(tr("run in daemon-mode (background)")) << std::endl; #endif std::cout << '\t' << prg_name << " --help: " << qPrintable(tr("displays this help message")) << std::endl; std::cout << '\t' << prg_name << " --webui-port=x: " << qPrintable(tr("changes the webui port (current: %1)").arg(QString::number(Preferences().getWebUiPort()))) << std::endl; @@ -158,6 +160,20 @@ int main(int argc, char *argv[]) { // Create Application QString uid = misc::getUserIDString(); #ifdef DISABLE_GUI + bool becomedaemon = false; + for(int i=1; i