Fix WebUI Setting Saving.

This commit is contained in:
Phenom 2017-07-30 18:29:03 +02:00
parent a2f8b5e6e9
commit c2a3e46700
3 changed files with 31 additions and 23 deletions

View File

@ -4,6 +4,7 @@
#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>
#include <QSpinBox>
#include "util/misc.h"
#include "api/ApiServer.h"
@ -26,6 +27,8 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
{
ui.setupUi(this);
connect(ui.enableWebUI_CB, SIGNAL(clicked(bool)), this, SLOT(onEnableCBClicked(bool)));
connect(ui.port_SB, SIGNAL(valueChanged(int)), this, SLOT(onPortValueChanged(int)));
connect(ui.allIp_CB, SIGNAL(clicked(bool)), this, SLOT(onAllIPCBClicked(bool)));
connect(ui.applyStartBrowser_PB, SIGNAL(clicked()), this, SLOT(onApplyClicked()));
}
@ -63,11 +66,11 @@ bool WebuiPage::updateParams(QString &errmsg)
void WebuiPage::load()
{
std::cerr << "WebuiPage::load()" << std::endl;
whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled());
onEnableCBClicked(Settings->getWebinterfaceEnabled());
whileBlocking(ui.port_SB)->setValue(Settings->getWebinterfacePort());
whileBlocking(ui.allIp_CB)->setChecked(Settings->getWebinterfaceAllowAllIps());
std::cerr << "WebuiPage::load()" << std::endl;
whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled());
whileBlocking(ui.port_SB)->setValue(Settings->getWebinterfacePort());
whileBlocking(ui.allIp_CB)->setChecked(Settings->getWebinterfaceAllowAllIps());
onEnableCBClicked(Settings->getWebinterfaceEnabled());
}
QString WebuiPage::helpText() const
@ -139,19 +142,22 @@ QString WebuiPage::helpText() const
void WebuiPage::onEnableCBClicked(bool checked)
{
if(checked)
{
ui.params_GB->setEnabled(true);
ui.applyStartBrowser_PB->setEnabled(true);
}
else
{
ui.params_GB->setEnabled(false);
ui.applyStartBrowser_PB->setEnabled(false);
}
ui.params_GB->setEnabled(checked);
ui.applyStartBrowser_PB->setEnabled(checked);
QString S;
updateParams(S);
}
QString S;
updateParams(S);
void WebuiPage::onPortValueChanged(int /*value*/)
{
QString S;
updateParams(S);
}
void WebuiPage::onAllIPCBClicked(bool /*checked*/)
{
QString S;
updateParams(S);
}
void WebuiPage::onApplyClicked()

View File

@ -39,6 +39,8 @@ public:
public slots:
void onEnableCBClicked(bool checked);
void onPortValueChanged(int value);
void onAllIPCBClicked(bool checked);
void onApplyClicked();
private:

View File

@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>442</width>
<width>497</width>
<height>404</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="WebuiPageVLayout">
<item>
<widget class="QCheckBox" name="enableWebUI_CB">
<property name="text">
@ -29,7 +29,7 @@
<property name="title">
<string>Web parameters</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="params_GBGLayout">
<item row="0" column="1">
<widget class="QSpinBox" name="port_SB">
<property name="minimum">
@ -41,7 +41,7 @@
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="port_Label">
<property name="text">
<string>Port:</string>
</property>
@ -65,7 +65,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="noteLabel">
<property name="text">
<string>Note: these settings do not affect retroshare-nogui. Retroshare-nogui has a command line switch to activate the web interface.</string>
</property>
@ -75,7 +75,7 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="mainVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>