aboutsummaryrefslogtreecommitdiff
path: root/src/qmmpui/commandlinehandler.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-12-27 21:19:42 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-12-27 21:19:42 +0000
commita13a898395740f6663dcba0ba24ff4e46d42d29c (patch)
treee65801d3962746788458f3bef59efbc4de57ed97 /src/qmmpui/commandlinehandler.cpp
parent5905c1acda34d0c7a26c8ba34ae8a280431ece7e (diff)
downloadqmmp-a13a898395740f6663dcba0ba24ff4e46d42d29c.tar.gz
qmmp-a13a898395740f6663dcba0ba24ff4e46d42d29c.tar.bz2
qmmp-a13a898395740f6663dcba0ba24ff4e46d42d29c.zip
added flags for command line options
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8534 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/commandlinehandler.cpp')
-rw-r--r--src/qmmpui/commandlinehandler.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/qmmpui/commandlinehandler.cpp b/src/qmmpui/commandlinehandler.cpp
index 7bf98f069..e8a5e81da 100644
--- a/src/qmmpui/commandlinehandler.cpp
+++ b/src/qmmpui/commandlinehandler.cpp
@@ -25,7 +25,9 @@ QStringList CommandLineHandler::helpString() const
QStringList out;
foreach (const CommandLineOption &opt, m_options.values())
{
- if(opt.values.isEmpty())
+ if(opt.flags & HIDDEN_FROM_HELP)
+ continue;
+ else if(opt.values.isEmpty())
out << opt.names.join(", ") + "||" + opt.helpString;
else
out << opt.names.join(", ") + " <" + opt.values.join("> <") + ">||" + opt.helpString;
@@ -33,6 +35,14 @@ QStringList CommandLineHandler::helpString() const
return out;
}
+QString CommandLineHandler::helpString(int id) const
+{
+ if(m_options[id].values.isEmpty())
+ return m_options[id].names.join(", ") + "||" + m_options[id].helpString;
+ else
+ return m_options[id].names.join(", ") + " <" + m_options[id].values.join("> <") + ">||" + m_options[id].helpString;
+}
+
int CommandLineHandler::identify(const QString &name) const
{
foreach (const CommandLineOption &opt, m_options.values())
@@ -43,6 +53,11 @@ int CommandLineHandler::identify(const QString &name) const
return -1;
}
+CommandLineHandler::OptionFlags CommandLineHandler::flags(int id) const
+{
+ return m_options.value(id).flags;
+}
+
void CommandLineHandler::registerOption(int id, const QString &name, const QString &helpString, const QStringList &values)
{
registerOption(id, QStringList() << name, helpString, values);
@@ -56,3 +71,8 @@ void CommandLineHandler::registerOption(int id, const QStringList &names, const
opt.helpString = helpString;
m_options.insert(id, opt);
}
+
+void CommandLineHandler::setOptionFlags(int id, OptionFlags flags)
+{
+ m_options[id].flags = flags;
+}