From 5251427cbf4483a6e15f8bfad1967fd26a52091e Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 12 Sep 2023 22:28:54 +0200 Subject: [PATCH] improved webui and jsonapi config pages --- .../src/gui/settings/JsonApiPage.ui | 64 +++++++++---------- retroshare-gui/src/gui/settings/WebuiPage.cpp | 37 +++++++---- 2 files changed, 55 insertions(+), 46 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.ui b/retroshare-gui/src/gui/settings/JsonApiPage.ui index 9227a3251..f8d31e38f 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.ui +++ b/retroshare-gui/src/gui/settings/JsonApiPage.ui @@ -67,38 +67,6 @@ - - - - - - Token: - - - - - - - <html><head/><body><p>Tokens should spell as &quot;user:password&quot; where both user and password are alphanumeric strings.</p></body></html> - - - - - - - Add - - - - - - - Remove - - - - - @@ -141,6 +109,38 @@ + + + + + + Token: + + + + + + + <html><head/><body><p>Tokens should spell as &quot;user:password&quot; where both user and password are alphanumeric strings.</p></body></html> + + + + + + + Add + + + + + + + Remove + + + + + diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index cccf54369..893fd87e2 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -122,7 +122,10 @@ bool WebuiPage::restart() rsWebUi->setUserPassword(ui.password_LE->text().toStdString()); rsWebUi->setHtmlFilesDirectory(ui.webInterfaceFiles_LE->text().toStdString()); + + setCursor(Qt::WaitCursor) ; rsWebUi->restart(); + setCursor(Qt::ArrowCursor) ; return true; } @@ -140,7 +143,7 @@ void WebuiPage::loadParams() if(it != smap.end()) whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second)); - if(rsWebUi->isRunning() && rsJsonApi->isRunning()) + if(rsWebUi->isRunning()) ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ; else ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ; @@ -190,9 +193,23 @@ QString WebuiPage::helpText() const void WebuiPage::onEnableCBClicked(bool checked) { - ui.params_GB->setEnabled(checked); - ui.startWebBrowser_PB->setEnabled(checked); - QString S; + QString errmsg; + updateParams(errmsg); + + ui.params_GB->setEnabled(checked); + ui.startWebBrowser_PB->setEnabled(checked); + ui.apply_PB->setEnabled(checked); + + if(checked) + { + if(!restart()) + { + QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface."); + return; + } + } + else + checkShutdownWebui(); } void WebuiPage::onPortValueChanged(int /*value*/) @@ -211,16 +228,8 @@ void WebuiPage::onApplyClicked() QString errmsg; updateParams(errmsg); - if(ui.enableWebUI_CB->isChecked()) - { - if(!restart()) - { - QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface."); - return; - } - else - checkShutdownWebui(); - } + restart(); + load(); }