Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
void resultsReady(const QHostInfo &info);
};
-// needs to be QObject because fromName calls tr()
-class QHostInfoAgent : public QObject
+class QHostInfoAgent
{
- Q_OBJECT
+ Q_DECLARE_TR_FUNCTIONS(QHostInfoAgent)
public:
static QHostInfo fromName(const QString &hostName);
};
results.setHostName(hostName);
if (aceHostname.isEmpty()) {
results.setError(QHostInfo::HostNotFound);
- results.setErrorString(hostName.isEmpty() ?
- QCoreApplication::translate("QHostInfoAgent", "No host name given") :
- QCoreApplication::translate("QHostInfoAgent", "Invalid hostname"));
+ if (hostName.isEmpty()) {
+ results.setErrorString(tr("No host name given"));
+ } else {
+ results.setErrorString(tr("Invalid hostname"));
+ }
return results;
}