refactor: MainWindow add canRunCore method

This commit is contained in:
sithlord48
2026-02-23 20:34:41 -05:00
committed by Nick Bolton
parent c37c7e2354
commit 3db4c60155
2 changed files with 10 additions and 1 deletions

View File

@ -525,7 +525,7 @@ void MainWindow::updateModeControls()
ui->lblIpAddresses->setVisible(isServer);
ui->clientOptions->setVisible(isClient);
ui->lblNoMode->setVisible(!isServer && !isClient);
toggleCanRunCore((isServer || isClient) && (isClient && !ui->lineHostname->text().isEmpty()) || isServer);
toggleCanRunCore(canRunCore());
if (isServer) {
updateNetworkInfo();
@ -1207,3 +1207,11 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
ui->lblIpAddresses->setText(labelText);
ui->lblIpAddresses->setToolTip(toolTipText);
}
bool MainWindow::canRunCore() const
{
const auto mode = m_coreProcess.mode();
const bool isServer = mode == Settings::CoreMode::Server;
const bool isClient = mode == Settings::CoreMode::Client;
return ((isServer || isClient) && (isClient && !ui->lineHostname->text().isEmpty()) || isServer);
}

View File

@ -161,6 +161,7 @@ private:
void handleNewClientPromptRequest(const QString &clientName, bool usePeerAuth);
void updateIpLabel(const QStringList &addresses);
bool canRunCore() const;
/**
* @brief showClientError
* @param error Error Type