mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
SettingsDialog: Server port had no logic for some reason. Also restart server if settings are changed
This commit is contained in:
parent
a70e18a2bf
commit
c91b924f0e
@ -50,6 +50,7 @@ void SettingsDialog::showEvent(QShowEvent *event)
|
|||||||
ui->enableAuthenticationCheckBox->setChecked(conf->AuthRequired);
|
ui->enableAuthenticationCheckBox->setChecked(conf->AuthRequired);
|
||||||
ui->serverPasswordLineEdit->setText(conf->ServerPassword);
|
ui->serverPasswordLineEdit->setText(conf->ServerPassword);
|
||||||
ui->serverPasswordLineEdit->setEnabled(conf->AuthRequired);
|
ui->serverPasswordLineEdit->setEnabled(conf->AuthRequired);
|
||||||
|
ui->serverPortSpinBox->setValue(conf->ServerPort);
|
||||||
|
|
||||||
FillSessionTable();
|
FillSessionTable();
|
||||||
|
|
||||||
@ -121,13 +122,34 @@ void SettingsDialog::FormAccepted()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool needsRestart = false;
|
||||||
|
|
||||||
|
if (conf->ServerEnabled != ui->enableWebSocketServerCheckBox->isChecked()) {
|
||||||
|
needsRestart = true;
|
||||||
|
} else if (conf->AuthRequired != ui->enableAuthenticationCheckBox->isChecked()) {
|
||||||
|
needsRestart = true;
|
||||||
|
} else if (conf->ServerPassword != ui->serverPasswordLineEdit->text()) {
|
||||||
|
needsRestart = true;
|
||||||
|
} else if (conf->ServerPort != ui->serverPortSpinBox->value()) {
|
||||||
|
needsRestart = true;
|
||||||
|
}
|
||||||
|
|
||||||
conf->ServerEnabled = ui->enableWebSocketServerCheckBox->isChecked();
|
conf->ServerEnabled = ui->enableWebSocketServerCheckBox->isChecked();
|
||||||
conf->AlertsEnabled = ui->enableSystemTrayAlertsCheckBox->isChecked();
|
conf->AlertsEnabled = ui->enableSystemTrayAlertsCheckBox->isChecked();
|
||||||
conf->DebugEnabled = ui->enableDebugLoggingCheckBox->isChecked();
|
conf->DebugEnabled = ui->enableDebugLoggingCheckBox->isChecked();
|
||||||
conf->AuthRequired = ui->enableAuthenticationCheckBox->isChecked();
|
conf->AuthRequired = ui->enableAuthenticationCheckBox->isChecked();
|
||||||
conf->ServerPassword = ui->serverPasswordLineEdit->text();
|
conf->ServerPassword = ui->serverPasswordLineEdit->text();
|
||||||
|
conf->ServerPort = ui->serverPortSpinBox->value();
|
||||||
|
|
||||||
conf->Save();
|
conf->Save();
|
||||||
|
|
||||||
|
if (needsRestart) {
|
||||||
|
auto server = GetWebSocketServer();
|
||||||
|
server->Stop();
|
||||||
|
if (conf->ServerEnabled) {
|
||||||
|
server->Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::EnableAuthenticationCheckBoxChanged()
|
void SettingsDialog::EnableAuthenticationCheckBoxChanged()
|
||||||
|
Loading…
Reference in New Issue
Block a user