feat: display client IP info when manual IP is configured
This commit is contained in:
parent
5035dc843d
commit
3d52de0478
1 changed files with 20 additions and 6 deletions
|
|
@ -524,14 +524,20 @@ void MainWindow::updateModeControls()
|
|||
const auto mode = m_coreProcess.mode();
|
||||
const bool isServer = mode == Settings::CoreMode::Server;
|
||||
const bool isClient = mode == Settings::CoreMode::Client;
|
||||
|
||||
ui->serverOptions->setVisible(isServer);
|
||||
ui->lblIpAddresses->setVisible(isServer);
|
||||
ui->clientOptions->setVisible(isClient);
|
||||
ui->lblNoMode->setVisible(!isServer && !isClient);
|
||||
toggleCanRunCore(canRunCore());
|
||||
|
||||
if (isServer) {
|
||||
ui->lblIpAddresses->setVisible(
|
||||
(isClient && !Settings::value(Settings::Core::Interface).toString().isEmpty()) || isServer
|
||||
);
|
||||
|
||||
if (ui->lblIpAddresses->isVisible())
|
||||
updateNetworkInfo();
|
||||
|
||||
if (isServer) {
|
||||
m_networkMonitor->startMonitoring();
|
||||
} else {
|
||||
m_networkMonitor->stopMonitoring();
|
||||
|
|
@ -587,7 +593,15 @@ void MainWindow::updateSecurityIcon(bool visible)
|
|||
|
||||
void MainWindow::updateNetworkInfo()
|
||||
{
|
||||
const auto mode = m_coreProcess.mode();
|
||||
if (mode == CoreMode::None) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == CoreMode::Server)
|
||||
updateIpLabel(NetworkMonitor::validAddresses());
|
||||
else
|
||||
updateIpLabel({Settings::value(Settings::Core::Interface).toString()});
|
||||
}
|
||||
|
||||
void MainWindow::serverConnectionConfigureClient(const QString &clientName)
|
||||
|
|
@ -1215,7 +1229,8 @@ void MainWindow::remoteHostChanged(const QString &newRemoteHost)
|
|||
|
||||
void MainWindow::updateIpLabel(const QStringList &addresses)
|
||||
{
|
||||
if (m_coreProcess.mode() != CoreMode::Server) {
|
||||
const auto mode = m_coreProcess.mode();
|
||||
if (mode == CoreMode::None) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1232,7 +1247,6 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
|
|||
QString labelText = fixedIP ? tr("Using IP: ") : tr("Suggested IP: ");
|
||||
QString toolTipText = tr("<p>If connecting via the hostname fails, try %1</p>");
|
||||
|
||||
// Get all available IPs for tooltip
|
||||
const bool filterIpList = (serverStarted || fixedIP);
|
||||
const QRegularExpression ipListFilter(filterIpList ? QStringLiteral("(%1)").arg(m_serverStartIPs.join("|")) : "");
|
||||
const QStringList ipList = addresses.filter(ipListFilter);
|
||||
|
|
@ -1257,7 +1271,7 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
|
|||
}
|
||||
|
||||
ui->lblIpAddresses->setText(labelText);
|
||||
ui->lblIpAddresses->setToolTip(toolTipText);
|
||||
ui->lblIpAddresses->setToolTip(mode == CoreMode::Server ? toolTipText : QString());
|
||||
}
|
||||
|
||||
void MainWindow::updateTimeoutDelay(int newDelay)
|
||||
|
|
|
|||
Loading…
Reference in a new issue