Skip to content
Snippets Groups Projects

QDS-13458 Show ip addresses on the home page

Merged Burak Hançerli requested to merge QDS-13458/show-ip-addresses into master
3 files
+ 37
106
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 19
0
@@ -26,6 +26,7 @@
@@ -26,6 +26,7 @@
#include "backend.h"
#include "backend.h"
#include <QDesktopServices>
#include <QDesktopServices>
 
#include <QNetworkInterface>
#include "logger.h"
#include "logger.h"
@@ -253,3 +254,21 @@ QString Backend::lastDesignStudioIp() const
@@ -253,3 +254,21 @@ QString Backend::lastDesignStudioIp() const
{
{
return m_dsManager ? m_dsManager->getDesignStudioIp({}) : QString();
return m_dsManager ? m_dsManager->getDesignStudioIp({}) : QString();
}
}
 
 
QJsonArray Backend::getIpAddresses() const
 
{
 
QNetworkInterface networkInterface;
 
QJsonArray ipAddresses;
 
 
for (const auto &interface : networkInterface.allInterfaces()) {
 
for (const auto &entry : interface.addressEntries()) {
 
if (entry.ip().protocol() == QAbstractSocket::IPv4Protocol && !entry.ip().isLoopback()) {
 
qDebug() << "Interface:" << interface.name() << "IP:" << entry.ip().toString();
 
ipAddresses.append(
 
QJsonObject{{"interface", interface.name()}, {"ip", entry.ip().toString()}});
 
}
 
}
 
}
 
 
return ipAddresses;
 
}
Loading