fixed changing ports and restarting

This commit is contained in:
csoler 2019-11-10 22:05:55 +01:00
parent 3446f0b677
commit 9dc78d66c1
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
3 changed files with 23 additions and 9 deletions

View file

@ -86,16 +86,17 @@ bool WebuiPage::updateParams(QString &errmsg)
Settings->setWebinterfacePort(ui.port_SB->value());
Settings->setWebinterfaceAllowAllIps(ui.allIp_CB->isChecked());
Settings->setWebinterfaceFilesDirectory(ui.webInterfaceFiles_LE->text());
// apply config
checkShutdownWebui();
ok = checkStartWebui();
}
if(!ok)
errmsg = "Could not start webinterface.";
return ok;
}
bool WebuiPage::restart()
{
// apply config
checkShutdownWebui();
return checkStartWebui();
}
void WebuiPage::load()
{
std::cerr << "WebuiPage::load()" << std::endl;
@ -166,8 +167,8 @@ void WebuiPage::onAllIPCBClicked(bool /*checked*/)
void WebuiPage::onApplyClicked()
{
QString errmsg;
bool ok = updateParams(errmsg);
if(!ok)
if(!restart())
{
QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface.");
return;

View file

@ -68,6 +68,7 @@ private:
/** Qt Designer generated object */
Ui::WebuiPage ui;
bool restart();
bool updateParams(QString &errmsg);
static resource_api::ApiServer* apiServer;