QObject::tr
Puts the translation in the wrong context.
Gratuitous storing of a string literal, for no gain at all
// header
private:
QList<StatusItem> m_protocolItems;
std::shared_ptr<ICommsStatusProvider> m_protocol;
static constexpr const char *NOT_CONNECTED_STRING = "Not Connected";
static constexpr const char *CONNECTED_STRING = "Connected";
static constexpr const char *CONNECTED_VERSION_STRING = "Connected (version %1.%2)";
// source
if (reinterpret_cast<ICommsStatusProvider*>(m_protocol.get())->HasTimedOut())
m_protocolItems[0]._value = tr(NOT_CONNECTED_STRING);
else
{
uint32_t version = m_protocol->GetVersion();
if (version)
{
m_protocolItems[0]._value = tr(CONNECTED_VERSION_STRING).arg(version/100).arg(version%100, 2, 10, QChar('0'));
}
else
{
m_protocolItems[0]._value = tr(CONNECTED_STRING);
}
}