Commit e14269ab authored by Urs Fleisch's avatar Urs Fleisch

Fix build with Qt 5.5.

parent 90721580
......@@ -184,8 +184,13 @@ void JsonCliFormatter::writeError(CliError errorCode)
{
QString msg;
if (errorCode == CliError::MethodNotFound) {
#if QT_VERSION >= 0x050600
msg = tr("Unknown command '%1'")
.arg(m_args.isEmpty() ? QLatin1String("") : m_args.constFirst());
#else
msg = tr("Unknown command '%1'")
.arg(m_args.isEmpty() ? QLatin1String("") : m_args.first());
#endif
}
writeErrorMessage(msg, jsonRpcErrorCode(errorCode));
}
......
......@@ -180,7 +180,11 @@ Kid3Cli::Kid3Cli(Kid3Application* app,
{
m_formatters << new JsonCliFormatter(io)
<< new TextCliFormatter(io);
#if QT_VERSION >= 0x050600
m_formatter = m_formatters.constLast();
#else
m_formatter = m_formatters.last();
#endif
m_cmds << new HelpCommand(this)
<< new TimeoutCommand(this)
......@@ -244,7 +248,11 @@ CliCommand* Kid3Cli::commandForArgs(const QString& line)
return nullptr;
// Default to the last formatter
#if QT_VERSION >= 0x050600
m_formatter = m_formatters.constLast();
#else
m_formatter = m_formatters.last();
#endif
QStringList args;
for (auto fmt : m_formatters) {
......
......@@ -177,8 +177,13 @@ void TextCliFormatter::writeError(CliError errorCode)
QString errorMsg;
switch (errorCode) {
case CliError::MethodNotFound:
#if QT_VERSION >= 0x050600
errorMsg = tr("Unknown command '%1'. Type 'help' for help.")
.arg(m_args.isEmpty() ? QLatin1String("") : m_args.constFirst());
#else
errorMsg = tr("Unknown command '%1'. Type 'help' for help.")
.arg(m_args.isEmpty() ? QLatin1String("") : m_args.first());
#endif
break;
default:
;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment