|
|
@ -114,6 +114,7 @@ struct QBtCommandLineParameters |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
int webUiPort; |
|
|
|
int webUiPort; |
|
|
|
QStringList torrents; |
|
|
|
QStringList torrents; |
|
|
|
|
|
|
|
QString uknownParameter; |
|
|
|
|
|
|
|
|
|
|
|
QBtCommandLineParameters() |
|
|
|
QBtCommandLineParameters() |
|
|
|
: showHelp(false) |
|
|
|
: showHelp(false) |
|
|
@ -154,6 +155,12 @@ int main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
const QBtCommandLineParameters params = parseCommandLine(); |
|
|
|
const QBtCommandLineParameters params = parseCommandLine(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!params.uknownParameter.isEmpty()) { |
|
|
|
|
|
|
|
displayBadArgMessage(QObject::tr("%1 is an uknown command line parameter.", "--random-parameter is an uknown command line parameter.") |
|
|
|
|
|
|
|
.arg(params.uknownParameter)); |
|
|
|
|
|
|
|
return EXIT_FAILURE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifndef Q_OS_WIN |
|
|
|
#ifndef Q_OS_WIN |
|
|
|
if (params.showVersion) { |
|
|
|
if (params.showVersion) { |
|
|
|
if (isOneArg) { |
|
|
|
if (isOneArg) { |
|
|
@ -292,6 +299,9 @@ QBtCommandLineParameters parseCommandLine() |
|
|
|
for (int i = 1; i < appArguments.size(); ++i) { |
|
|
|
for (int i = 1; i < appArguments.size(); ++i) { |
|
|
|
const QString& arg = appArguments[i]; |
|
|
|
const QString& arg = appArguments[i]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((arg.startsWith("--") && !arg.endsWith(".torrent")) || |
|
|
|
|
|
|
|
(arg.startsWith("-") && arg.size() == 2)) { |
|
|
|
|
|
|
|
//Parse known parameters
|
|
|
|
if ((arg == QLatin1String("-h")) || (arg == QLatin1String("--help"))) { |
|
|
|
if ((arg == QLatin1String("-h")) || (arg == QLatin1String("--help"))) { |
|
|
|
result.showHelp = true; |
|
|
|
result.showHelp = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -314,6 +324,12 @@ QBtCommandLineParameters parseCommandLine() |
|
|
|
result.shouldDaemonize = true; |
|
|
|
result.shouldDaemonize = true; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
//Uknown argument
|
|
|
|
|
|
|
|
result.uknownParameter = arg; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
QFileInfo torrentPath; |
|
|
|
QFileInfo torrentPath; |
|
|
|
torrentPath.setFile(arg); |
|
|
|
torrentPath.setFile(arg); |
|
|
|