Remove letter case constraint on URI Handler (BYE==bye==Bye etc.)

This commit is contained in:
Julien Wadel 2021-01-13 17:27:40 +01:00
parent aa11d879ef
commit cdaf53f2aa

View file

@ -395,7 +395,7 @@ QString Cli::Command::getFunctionSyntax () const {
// FIXME: Do not accept args without value like: cmd toto.
// In the future `toto` could be a boolean argument.
QRegExp Cli::mRegExpArgs("(?:(?:([\\w-]+)\\s*)=\\s*(?:\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"|([^\\s]+)\\s*))");
QRegExp Cli::mRegExpFunctionName("^\\s*([a-z-]+)\\s*");
QRegExp Cli::mRegExpFunctionName("^\\s*([A-Z-]+)\\s*");
QMap<QString, Cli::Command> Cli::mCommands = {
createCommand("show", QT_TR_NOOP("showFunctionDescription"), cliShow, QHash<QString, Argument>(), true),
@ -503,13 +503,13 @@ pair<QString, Cli::Command> Cli::createCommand (
const QHash<QString, Argument> &argsScheme,
const bool &genericArguments
) {
return { functionName, Cli::Command(functionName, functionDescription, function, argsScheme, genericArguments) };
return { functionName.toUpper(), Cli::Command(functionName.toUpper(), functionDescription, function, argsScheme, genericArguments) };
}
// -----------------------------------------------------------------------------
QString Cli::parseFunctionName (const QString &command) {
mRegExpFunctionName.indexIn(command);
mRegExpFunctionName.indexIn(command.toUpper());
if (mRegExpFunctionName.pos(1) == -1) {
qWarning() << QStringLiteral("Unable to parse function name of command: `%1`.").arg(command);
return QString("");
@ -530,7 +530,7 @@ QHash<QString, QString> Cli::parseArgs (const QString &command) {
QHash<QString, QString> args;
int pos = 0;
while ((pos = mRegExpArgs.indexIn(command, pos)) != -1) {
while ((pos = mRegExpArgs.indexIn(command.toUpper(), pos)) != -1) {
pos += mRegExpArgs.matchedLength();
args[mRegExpArgs.cap(1)] = (mRegExpArgs.cap(2).isEmpty() ? mRegExpArgs.cap(3) : mRegExpArgs.cap(2));
}