mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
Fixed save of settings in plugin FeedReader
This commit is contained in:
parent
26c5ce4ed2
commit
efe454c937
@ -22,6 +22,7 @@
|
||||
#include "ui_FeedReaderConfig.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "interface/rsFeedReader.h"
|
||||
#include <util/misc.h>
|
||||
|
||||
/** Constructor */
|
||||
FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
|
||||
@ -30,12 +31,30 @@ FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
|
||||
|
||||
ui->proxyAddressLineEdit->setEnabled(false);
|
||||
ui->proxyPortSpinBox->setEnabled(false);
|
||||
|
||||
loaded = false;
|
||||
/* Connect signals */
|
||||
connect(ui->updateIntervalSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this]() {
|
||||
rsFeedReader->setStandardUpdateInterval(ui->updateIntervalSpinBox->value() * 60);
|
||||
});
|
||||
connect(ui->storageTimeSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this]() {
|
||||
rsFeedReader->setStandardStorageTime(ui->storageTimeSpinBox->value() * 60 *60 * 24);
|
||||
});
|
||||
connect(ui->saveInBackgroundCheckBox, QCheckBox::toggled, this, [this]() {
|
||||
rsFeedReader->setSaveInBackground(ui->saveInBackgroundCheckBox->isChecked());
|
||||
});
|
||||
connect(ui->setMsgToReadOnActivate, QCheckBox::toggled, this, [this]() {
|
||||
Settings->setValueToGroup("FeedReaderDialog", "SetMsgToReadOnActivate", ui->setMsgToReadOnActivate->isChecked());
|
||||
});
|
||||
connect(ui->openAllInNewTabCheckBox, QCheckBox::toggled, this, [this]() {
|
||||
Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked());
|
||||
});
|
||||
connect(ui->useProxyCheckBox, QCheckBox::toggled, this, &FeedReaderConfig::updateProxy);
|
||||
connect(ui->proxyAddressLineEdit, QLineEdit::textChanged, this, &FeedReaderConfig::updateProxy);
|
||||
connect(ui->proxyPortSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, &FeedReaderConfig::updateProxy);
|
||||
|
||||
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
|
||||
}
|
||||
|
||||
/** Destructor */
|
||||
@ -47,31 +66,21 @@ FeedReaderConfig::~FeedReaderConfig()
|
||||
/** Loads the settings for this page */
|
||||
void FeedReaderConfig::load()
|
||||
{
|
||||
ui->updateIntervalSpinBox->setValue(rsFeedReader->getStandardUpdateInterval() / 60);
|
||||
ui->storageTimeSpinBox->setValue(rsFeedReader->getStandardStorageTime() / (60 * 60 *24));
|
||||
ui->saveInBackgroundCheckBox->setChecked(rsFeedReader->getSaveInBackground());
|
||||
ui->setMsgToReadOnActivate->setChecked(FeedReaderSetting_SetMsgToReadOnActivate());
|
||||
ui->openAllInNewTabCheckBox->setChecked(FeedReaderSetting_OpenAllInNewTab());
|
||||
whileBlocking(ui->updateIntervalSpinBox)->setValue(rsFeedReader->getStandardUpdateInterval() / 60);
|
||||
whileBlocking(ui->storageTimeSpinBox)->setValue(rsFeedReader->getStandardStorageTime() / (60 * 60 *24));
|
||||
whileBlocking(ui->saveInBackgroundCheckBox)->setChecked(rsFeedReader->getSaveInBackground());
|
||||
whileBlocking(ui->setMsgToReadOnActivate)->setChecked(FeedReaderSetting_SetMsgToReadOnActivate());
|
||||
whileBlocking(ui->openAllInNewTabCheckBox)->setChecked(FeedReaderSetting_OpenAllInNewTab());
|
||||
|
||||
std::string proxyAddress;
|
||||
uint16_t proxyPort;
|
||||
ui->useProxyCheckBox->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
|
||||
ui->proxyAddressLineEdit->setText(QString::fromUtf8(proxyAddress.c_str()));
|
||||
ui->proxyPortSpinBox->setValue(proxyPort);
|
||||
whileBlocking(ui->useProxyCheckBox)->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
|
||||
whileBlocking(ui->proxyAddressLineEdit)->setText(QString::fromUtf8(proxyAddress.c_str()));
|
||||
whileBlocking(ui->proxyPortSpinBox)->setValue(proxyPort);
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
bool FeedReaderConfig::save(QString &/*errmsg*/)
|
||||
{
|
||||
rsFeedReader->setStandardUpdateInterval(ui->updateIntervalSpinBox->value() * 60);
|
||||
rsFeedReader->setStandardStorageTime(ui->storageTimeSpinBox->value() * 60 *60 * 24);
|
||||
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyAddressLineEdit->text().toUtf8().constData(), ui->proxyPortSpinBox->value());
|
||||
rsFeedReader->setSaveInBackground(ui->saveInBackgroundCheckBox->isChecked());
|
||||
Settings->setValueToGroup("FeedReaderDialog", "SetMsgToReadOnActivate", ui->setMsgToReadOnActivate->isChecked());
|
||||
Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked());
|
||||
|
||||
return true;
|
||||
useProxyToggled();
|
||||
}
|
||||
|
||||
void FeedReaderConfig::useProxyToggled()
|
||||
@ -81,3 +90,8 @@ void FeedReaderConfig::useProxyToggled()
|
||||
ui->proxyAddressLineEdit->setEnabled(enabled);
|
||||
ui->proxyPortSpinBox->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void FeedReaderConfig::updateProxy()
|
||||
{
|
||||
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyAddressLineEdit->text().toUtf8().constData(), ui->proxyPortSpinBox->value());
|
||||
}
|
||||
|
@ -40,8 +40,6 @@ public:
|
||||
/** Default Destructor */
|
||||
virtual ~FeedReaderConfig();
|
||||
|
||||
/** Saves the changes on this page */
|
||||
virtual bool save(QString &errmsg);
|
||||
/** Loads the settings for this page */
|
||||
virtual void load();
|
||||
|
||||
@ -51,10 +49,10 @@ public:
|
||||
|
||||
private slots:
|
||||
void useProxyToggled();
|
||||
void updateProxy();
|
||||
|
||||
private:
|
||||
Ui::FeedReaderConfig *ui;
|
||||
bool loaded;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user