refactor: MainWindow add canRunCore method
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user