summaryrefslogtreecommitdiff
path: root/resourceqt-client/commandlineparser.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-11-18 08:18:10 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-11-18 08:18:10 +0200
commit6a47ede3a71e22b09a09169818705351c00abf9d (patch)
tree83a4c008606ed5de7db8a227fa75f26164f6a308 /resourceqt-client/commandlineparser.cpp
parente205f049b23a16eca17cc66b70e0c285db538c2b (diff)
parent2db176e028c54684e2fe6adf58ab0c5807d298c9 (diff)
Merge branch 'master' into meego
Diffstat (limited to 'resourceqt-client/commandlineparser.cpp')
-rw-r--r--resourceqt-client/commandlineparser.cpp29
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;
+}