refactor: MainWindow add canRunCore method
This commit is contained in:
parent
c37c7e2354
commit
3db4c60155
2 changed files with 10 additions and 1 deletions
|
|
@ -525,7 +525,7 @@ void MainWindow::updateModeControls()
|
||||||
ui->lblIpAddresses->setVisible(isServer);
|
ui->lblIpAddresses->setVisible(isServer);
|
||||||
ui->clientOptions->setVisible(isClient);
|
ui->clientOptions->setVisible(isClient);
|
||||||
ui->lblNoMode->setVisible(!isServer && !isClient);
|
ui->lblNoMode->setVisible(!isServer && !isClient);
|
||||||
toggleCanRunCore((isServer || isClient) && (isClient && !ui->lineHostname->text().isEmpty()) || isServer);
|
toggleCanRunCore(canRunCore());
|
||||||
|
|
||||||
if (isServer) {
|
if (isServer) {
|
||||||
updateNetworkInfo();
|
updateNetworkInfo();
|
||||||
|
|
@ -1207,3 +1207,11 @@ void MainWindow::updateIpLabel(const QStringList &addresses)
|
||||||
ui->lblIpAddresses->setText(labelText);
|
ui->lblIpAddresses->setText(labelText);
|
||||||
ui->lblIpAddresses->setToolTip(toolTipText);
|
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 handleNewClientPromptRequest(const QString &clientName, bool usePeerAuth);
|
||||||
void updateIpLabel(const QStringList &addresses);
|
void updateIpLabel(const QStringList &addresses);
|
||||||
|
|
||||||
|
bool canRunCore() const;
|
||||||
/**
|
/**
|
||||||
* @brief showClientError
|
* @brief showClientError
|
||||||
* @param error Error Type
|
* @param error Error Type
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue