1 |
// qsamplerOptions.cpp |
// qsamplerOptions.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2009, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
242 |
// |
// |
243 |
|
|
244 |
// Help about command line options. |
// Help about command line options. |
245 |
void Options::print_usage ( const char *arg0 ) |
void Options::print_usage ( const QString& arg0 ) |
246 |
{ |
{ |
247 |
QTextStream out(stderr); |
QTextStream out(stderr); |
248 |
out << QObject::tr("Usage: %1 [options] [session-file]\n\n" |
out << QObject::tr("Usage: %1 [options] [session-file]\n\n" |
258 |
|
|
259 |
|
|
260 |
// Parse command line arguments into m_settings. |
// Parse command line arguments into m_settings. |
261 |
bool Options::parse_args ( int argc, char **argv ) |
bool Options::parse_args ( const QStringList& args ) |
262 |
{ |
{ |
263 |
QTextStream out(stderr); |
QTextStream out(stderr); |
264 |
const QString sEol = "\n\n"; |
const QString sEol = "\n\n"; |
265 |
int iCmdArgs = 0; |
int iCmdArgs = 0; |
266 |
|
int argc = args.count(); |
267 |
|
|
268 |
for (int i = 1; i < argc; i++) { |
for (int i = 1; i < argc; i++) { |
269 |
|
|
270 |
if (iCmdArgs > 0) { |
if (iCmdArgs > 0) { |
271 |
sSessionFile += " "; |
sSessionFile += " "; |
272 |
sSessionFile += argv[i]; |
sSessionFile += args.at(i); |
273 |
iCmdArgs++; |
iCmdArgs++; |
274 |
continue; |
continue; |
275 |
} |
} |
276 |
|
|
277 |
QString sArg = argv[i]; |
QString sArg = args.at(i); |
278 |
QString sVal = QString::null; |
QString sVal = QString::null; |
279 |
int iEqual = sArg.indexOf("="); |
int iEqual = sArg.indexOf("="); |
280 |
if (iEqual >= 0) { |
if (iEqual >= 0) { |
281 |
sVal = sArg.right(sArg.length() - iEqual - 1); |
sVal = sArg.right(sArg.length() - iEqual - 1); |
282 |
sArg = sArg.left(iEqual); |
sArg = sArg.left(iEqual); |
283 |
} |
} |
284 |
else if (i < argc) |
else if (i < argc - 1) |
285 |
sVal = argv[i + 1]; |
sVal = args.at(i + 1); |
286 |
|
|
287 |
if (sArg == "-s" || sArg == "--start") { |
if (sArg == "-s" || sArg == "--start") { |
288 |
bServerStart = true; |
bServerStart = true; |
306 |
i++; |
i++; |
307 |
} |
} |
308 |
else if (sArg == "-?" || sArg == "--help") { |
else if (sArg == "-?" || sArg == "--help") { |
309 |
print_usage(argv[0]); |
print_usage(args.at(0)); |
310 |
return false; |
return false; |
311 |
} |
} |
312 |
else if (sArg == "-v" || sArg == "--version") { |
else if (sArg == "-v" || sArg == "--version") { |