You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
821 B

#include "networkinterface.h"
NetworkInterface::NetworkInterface(int interfaceIndex, QObject *parent)
: QObject{parent},
m_qni{QNetworkInterface::interfaceFromIndex(interfaceIndex)}
{
setName(m_qni.name());
setAddress(m_qni.addressEntries().first().ip().toString());
}
QString NetworkInterface::name() const
{
return m_name;
}
void NetworkInterface::setName(const QString &newName)
{
if (m_name == newName)
return;
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();
}
void NetworkInterface::shutdown()
{
qWarning() << "Shutting down interface";
}