From 89d3a7a58d9752e14fbfff691565dd17e46018a4 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Wed, 25 Oct 2017 17:51:02 +0500 Subject: [PATCH] UI: Don't use QHostInfo. --- src/ui/util/hostinfo.cpp | 25 +++++++++++++------------ src/ui/util/hostinfo.h | 11 +++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ui/util/hostinfo.cpp b/src/ui/util/hostinfo.cpp index 9a30cfc1..75f04f1d 100644 --- a/src/ui/util/hostinfo.cpp +++ b/src/ui/util/hostinfo.cpp @@ -12,8 +12,9 @@ HostInfo::~HostInfo() void HostInfo::lookupHost(const QString &name) { - const int lookupId = QHostInfo::lookupHost( - name, this, &HostInfo::handleLookedupHost); +// const int lookupId = QHostInfo::lookupHost( +// name, this, &HostInfo::handleLookedupHost); + const int lookupId = -1; m_lookupIds.insert(lookupId, name); } @@ -22,7 +23,7 @@ void HostInfo::abortHostLookup(int lookupId) { m_lookupIds.remove(lookupId); - QHostInfo::abortHostLookup(lookupId); +// QHostInfo::abortHostLookup(lookupId); } void HostInfo::abortHostLookups() @@ -32,15 +33,15 @@ void HostInfo::abortHostLookups() } } -void HostInfo::handleLookedupHost(const QHostInfo &info) -{ - const int lookupId = info.lookupId(); - const QString name = m_lookupIds.value(lookupId); - const bool success = (info.error() == QHostInfo::NoError); +//void HostInfo::handleLookedupHost(const QHostInfo &info) +//{ +// const int lookupId = info.lookupId(); +// const QString name = m_lookupIds.value(lookupId); +// const bool success = (info.error() == QHostInfo::NoError); - m_info = info; +// m_info = info; - m_lookupIds.remove(lookupId); +// m_lookupIds.remove(lookupId); - emit hostLookedup(name, success); -} +// emit hostLookedup(name, success); +//} diff --git a/src/ui/util/hostinfo.h b/src/ui/util/hostinfo.h index 6971b55e..55326a6a 100644 --- a/src/ui/util/hostinfo.h +++ b/src/ui/util/hostinfo.h @@ -2,7 +2,6 @@ #define HOSTINFO_H #include -#include #include typedef QHash lookupids_map_t; @@ -10,14 +9,14 @@ typedef QHash lookupids_map_t; class HostInfo : public QObject { Q_OBJECT - Q_PROPERTY(QString hostName READ hostName CONSTANT) +// Q_PROPERTY(QString hostName READ hostName CONSTANT) public: explicit HostInfo(QObject *parent = nullptr); virtual ~HostInfo(); - QString hostName() const { return m_info.hostName(); } - QString errorString() const { return m_info.errorString(); } +// QString hostName() const { return m_info.hostName(); } +// QString errorString() const { return m_info.errorString(); } signals: void hostLookedup(const QString &name, bool success); @@ -28,13 +27,13 @@ public slots: void abortHostLookups(); private slots: - void handleLookedupHost(const QHostInfo &info); +// void handleLookedupHost(const QHostInfo &info); private: void abortHostLookup(int lookupId); private: - QHostInfo m_info; +// QHostInfo m_info; lookupids_map_t m_lookupIds; };