mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:15:10 +00:00
UI: Don't use QHostInfo.
This commit is contained in:
parent
44a1625ead
commit
89d3a7a58d
@ -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);
|
||||
//}
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define HOSTINFO_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QHostInfo>
|
||||
#include <QHash>
|
||||
|
||||
typedef QHash<int, QString> lookupids_map_t;
|
||||
@ -10,14 +9,14 @@ typedef QHash<int, QString> 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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user