refactor: Remove need for NetworkMonitor::getSuggestedIpAddress. Its always first if there is data
This commit is contained in:
committed by
Chris Rizzitello
parent
ae9ca35448
commit
844ebf5216
@ -431,7 +431,7 @@ void MainWindow::startCore()
|
||||
// Save current IP state when server starts
|
||||
if (m_coreProcess.mode() == CoreMode::Server) {
|
||||
m_serverStartIPs = m_networkMonitor->getAvailableIPv4Addresses();
|
||||
m_serverStartSuggestedIP = m_networkMonitor->getSuggestedIPv4Address();
|
||||
m_serverStartSuggestedIP = m_serverStartIPs.isEmpty() ? "" : m_serverStartIPs.first();
|
||||
}
|
||||
|
||||
m_coreProcess.start();
|
||||
@ -1304,8 +1304,8 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
|
||||
}
|
||||
} else {
|
||||
// Server is not running - update normally
|
||||
m_currentIpAddress = m_networkMonitor->getSuggestedIPv4Address();
|
||||
labelText.append(m_currentIpAddress.isEmpty() ? m_currentIpAddress : ipList.first());
|
||||
m_currentIpAddress = ipList.first();
|
||||
labelText.append(m_currentIpAddress);
|
||||
}
|
||||
|
||||
if (ipList.count() < 2) {
|
||||
|
||||
@ -117,14 +117,6 @@ QStringList NetworkMonitor::getAvailableIPv4Addresses() const
|
||||
return ipList;
|
||||
}
|
||||
|
||||
QString NetworkMonitor::getSuggestedIPv4Address() const
|
||||
{
|
||||
const auto addresses = getAvailableIPv4Addresses();
|
||||
if (addresses.isEmpty())
|
||||
return {};
|
||||
return addresses.first();
|
||||
}
|
||||
|
||||
void NetworkMonitor::setIpAddresses(const QStringList &newAddresses)
|
||||
{
|
||||
if (newAddresses == m_lastAddresses)
|
||||
|
||||
@ -52,12 +52,6 @@ public:
|
||||
*/
|
||||
QStringList getAvailableIPv4Addresses() const;
|
||||
|
||||
/**
|
||||
* @brief Get recommended IP address (RFC-1918 addresses preferred)
|
||||
* @return Recommended IP address, returns null if none available
|
||||
*/
|
||||
QString getSuggestedIPv4Address() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* @brief Emitted when IP addresses change
|
||||
|
||||
Reference in New Issue
Block a user