|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
#include "networkinterface.h"
|
|
|
|
|
#include <QNetworkInterface>
|
|
|
|
|
|
|
|
|
|
NetworkInterface::NetworkInterface(int interfaceIndex, QObject *parent)
|
|
|
|
|
: QObject{parent}
|
|
|
|
|
: QObject{parent},
|
|
|
|
|
m_qni{QNetworkInterface::interfaceFromIndex(interfaceIndex)}
|
|
|
|
|
{
|
|
|
|
|
QNetworkInterface qni{QNetworkInterface::interfaceFromIndex(interfaceIndex)};
|
|
|
|
|
setName(qni.name());
|
|
|
|
|
setName(m_qni.name());
|
|
|
|
|
setAddress(m_qni.addressEntries().first().ip().toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString NetworkInterface::name() const
|
|
|
|
@ -20,3 +20,16 @@ void NetworkInterface::setName(const QString &newName)
|
|
|
|
|
m_name = newName;
|
|
|
|
|
emit nameChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString NetworkInterface::address() const
|
|
|
|
|
{
|
|
|
|
|
return m_address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NetworkInterface::setAddress(const QString &newAddress)
|
|
|
|
|
{
|
|
|
|
|
if (m_address == newAddress)
|
|
|
|
|
return;
|
|
|
|
|
m_address = newAddress;
|
|
|
|
|
emit addressChanged();
|
|
|
|
|
}
|
|
|
|
|