diff options
Diffstat (limited to 'resourceqt-client/commandlineparser.cpp')
-rw-r--r-- | resourceqt-client/commandlineparser.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/resourceqt-client/commandlineparser.cpp b/resourceqt-client/commandlineparser.cpp index f169801..cb477fd 100644 --- a/resourceqt-client/commandlineparser.cpp +++ b/resourceqt-client/commandlineparser.cpp @@ -28,7 +28,8 @@ QHash<QString, ResourcePolicy::ResourceType> CommandLineParser::resourceValues; CommandLineParser::CommandLineParser(): allResources(), optResources(), autoRelease(false), alwaysReply(false), - verbose(false), allowUnkownResourceClass(false), output(stdout) + verbose(false), allowUnkownResourceClass(false), output(stdout), prefix(""), + timings(false) { resourceValues["AudioPlayback"] = ResourcePolicy::AudioPlaybackType; resourceValues["VideoPlayback"] = ResourcePolicy::VideoPlaybackType; @@ -63,6 +64,8 @@ bool CommandLineParser::parseArguments() case 'm': case 's': case 'i': + timings = true; + break; case 't': break; case 'f': @@ -82,6 +85,9 @@ bool CommandLineParser::parseArguments() case 'v': verbose = true; break; + case 'p': + parsePrefix(*(++ci)); + break; case 'h': default: usage(); @@ -139,6 +145,16 @@ bool CommandLineParser::parseClassString(const QString &str) return true; } +void CommandLineParser::parsePrefix(const QString &str) +{ + prefix = str + ": "; +} + +QString CommandLineParser::getPrefix() const +{ + return prefix; +} + bool CommandLineParser::parseResourceList(const QString &resourceListStr, QSet<ResourcePolicy::ResourceType> &resources) { @@ -182,11 +198,14 @@ bool CommandLineParser::parseModeValues(const QString &modeListStr) void CommandLineParser::usage() { - output << "usage: resourceqt-client [-h] [-m mode-values]" << - "[-o optional-resources] [-s shared-resources -m shared-mask] " << + output << "usage: resourceqt-client [-h] [-f mode-values]" << + "[-o optional-resources] [-i] [-v] [-p prefix] " << "class all-resources" << endl; output << "\toptions:" << endl; output << "\t h\tprint this help message and exit" << endl; + output << "\t i\tshow timings of requests" << endl; + output << "\t v\tshow debug of libresourceqt" << endl; + output << "\t p\tPrefix all output with the given prefix" << endl; output << "\t f\tmode values. See 'modes' below for the " "\n\t\tsyntax of <mode-values>" << endl; output << "\t o\toptional resources. See 'resources' below for the " @@ -247,3 +266,7 @@ bool CommandLineParser::shouldBeVerbose() const return verbose; } +bool CommandLineParser::showTimings() const +{ + return timings; +} |