mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-22 14:10:54 -04:00
FeedReader: Moved proxy setting to own widget
This commit is contained in:
parent
8c26fa879d
commit
1094e3e651
8 changed files with 165 additions and 70 deletions
|
@ -45,6 +45,7 @@ SOURCES = FeedReaderPlugin.cpp \
|
||||||
gui/FeedReaderUserNotify.cpp \
|
gui/FeedReaderUserNotify.cpp \
|
||||||
gui/FeedReaderFeedItem.cpp \
|
gui/FeedReaderFeedItem.cpp \
|
||||||
gui/FeedTreeWidget.cpp \
|
gui/FeedTreeWidget.cpp \
|
||||||
|
gui/ProxyWidget.cpp \
|
||||||
util/CURLWrapper.cpp \
|
util/CURLWrapper.cpp \
|
||||||
util/XMLWrapper.cpp \
|
util/XMLWrapper.cpp \
|
||||||
util/HTMLWrapper.cpp \
|
util/HTMLWrapper.cpp \
|
||||||
|
@ -66,6 +67,7 @@ HEADERS = FeedReaderPlugin.h \
|
||||||
gui/FeedReaderUserNotify.h \
|
gui/FeedReaderUserNotify.h \
|
||||||
gui/FeedReaderFeedItem.h \
|
gui/FeedReaderFeedItem.h \
|
||||||
gui/FeedTreeWidget.h \
|
gui/FeedTreeWidget.h \
|
||||||
|
gui/ProxyWidget.h \
|
||||||
util/CURLWrapper.h \
|
util/CURLWrapper.h \
|
||||||
util/XMLWrapper.h \
|
util/XMLWrapper.h \
|
||||||
util/HTMLWrapper.h \
|
util/HTMLWrapper.h \
|
||||||
|
@ -76,7 +78,8 @@ FORMS = gui/FeedReaderDialog.ui \
|
||||||
gui/AddFeedDialog.ui \
|
gui/AddFeedDialog.ui \
|
||||||
gui/PreviewFeedDialog.ui \
|
gui/PreviewFeedDialog.ui \
|
||||||
gui/FeedReaderConfig.ui \
|
gui/FeedReaderConfig.ui \
|
||||||
gui/FeedReaderFeedItem.ui
|
gui/FeedReaderFeedItem.ui \
|
||||||
|
gui/ProxyWidget.ui
|
||||||
|
|
||||||
TARGET = FeedReader
|
TARGET = FeedReader
|
||||||
|
|
||||||
|
|
|
@ -180,8 +180,7 @@ void AddFeedDialog::useStandardUpdateIntervalToggled()
|
||||||
void AddFeedDialog::useStandardProxyToggled()
|
void AddFeedDialog::useStandardProxyToggled()
|
||||||
{
|
{
|
||||||
bool checked = ui->useStandardProxyCheckBox->isChecked();
|
bool checked = ui->useStandardProxyCheckBox->isChecked();
|
||||||
ui->proxyAddressLineEdit->setEnabled(!checked);
|
ui->proxyWidget->setEnabled(!checked);
|
||||||
ui->proxyPortSpinBox->setEnabled(!checked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFeedDialog::typeForumToggled()
|
void AddFeedDialog::typeForumToggled()
|
||||||
|
@ -335,8 +334,8 @@ bool AddFeedDialog::fillFeed(uint32_t feedId)
|
||||||
ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str()));
|
ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str()));
|
||||||
|
|
||||||
ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy);
|
ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy);
|
||||||
ui->proxyAddressLineEdit->setText(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
|
ui->proxyWidget->setAddress(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
|
||||||
ui->proxyPortSpinBox->setValue(feedInfo.proxyPort);
|
ui->proxyWidget->setPort(feedInfo.proxyPort);
|
||||||
|
|
||||||
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
|
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
|
||||||
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
|
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
|
||||||
|
@ -425,8 +424,8 @@ void AddFeedDialog::getFeedInfo(FeedInfo &feedInfo)
|
||||||
feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData();
|
feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData();
|
||||||
|
|
||||||
feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked();
|
feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked();
|
||||||
feedInfo.proxyAddress = ui->proxyAddressLineEdit->text().toUtf8().constData();
|
feedInfo.proxyAddress = ui->proxyWidget->address().toUtf8().constData();
|
||||||
feedInfo.proxyPort = ui->proxyPortSpinBox->value();
|
feedInfo.proxyPort = ui->proxyWidget->port();
|
||||||
|
|
||||||
feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked();
|
feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked();
|
||||||
feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60;
|
feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60;
|
||||||
|
|
|
@ -133,37 +133,16 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Proxy</string>
|
<string>Proxy</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item row="0" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="useStandardProxyCheckBox">
|
<widget class="QCheckBox" name="useStandardProxyCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use standard proxy</string>
|
<string>Use standard proxy</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="serverLabel">
|
<widget class="ProxyWidget" name="proxyWidget" native="true"/>
|
||||||
<property name="text">
|
|
||||||
<string>Server</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="portLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QSpinBox" name="proxyPortSpinBox">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>65535</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -465,6 +444,12 @@
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
<header>gui/common/RSComboBox.h</header>
|
<header>gui/common/RSComboBox.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ProxyWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/ProxyWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>urlLineEdit</tabstop>
|
<tabstop>urlLineEdit</tabstop>
|
||||||
|
@ -494,8 +479,7 @@
|
||||||
<tabstop>useStandardUpdateInterval</tabstop>
|
<tabstop>useStandardUpdateInterval</tabstop>
|
||||||
<tabstop>updateIntervalSpinBox</tabstop>
|
<tabstop>updateIntervalSpinBox</tabstop>
|
||||||
<tabstop>useStandardProxyCheckBox</tabstop>
|
<tabstop>useStandardProxyCheckBox</tabstop>
|
||||||
<tabstop>proxyAddressLineEdit</tabstop>
|
<tabstop>proxyWidget</tabstop>
|
||||||
<tabstop>proxyPortSpinBox</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -31,8 +31,7 @@ FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->proxyAddressLineEdit->setEnabled(false);
|
ui->proxyWidget->setEnabled(false);
|
||||||
ui->proxyPortSpinBox->setEnabled(false);
|
|
||||||
|
|
||||||
/* Connect signals */
|
/* Connect signals */
|
||||||
connect(ui->updateIntervalSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this]() {
|
connect(ui->updateIntervalSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this]() {
|
||||||
|
@ -51,8 +50,7 @@ FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
|
||||||
Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked());
|
Settings->setValueToGroup("FeedReaderDialog", "OpenAllInNewTab", ui->openAllInNewTabCheckBox->isChecked());
|
||||||
});
|
});
|
||||||
connect(ui->useProxyCheckBox, &QCheckBox::toggled, this, &FeedReaderConfig::updateProxy);
|
connect(ui->useProxyCheckBox, &QCheckBox::toggled, this, &FeedReaderConfig::updateProxy);
|
||||||
connect(ui->proxyAddressLineEdit, &QLineEdit::textChanged, this, &FeedReaderConfig::updateProxy);
|
connect(ui->proxyWidget, &ProxyWidget::changed, this, &FeedReaderConfig::updateProxy);
|
||||||
connect(ui->proxyPortSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, &FeedReaderConfig::updateProxy);
|
|
||||||
|
|
||||||
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
|
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
|
||||||
}
|
}
|
||||||
|
@ -75,8 +73,8 @@ void FeedReaderConfig::load()
|
||||||
std::string proxyAddress;
|
std::string proxyAddress;
|
||||||
uint16_t proxyPort;
|
uint16_t proxyPort;
|
||||||
whileBlocking(ui->useProxyCheckBox)->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
|
whileBlocking(ui->useProxyCheckBox)->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
|
||||||
whileBlocking(ui->proxyAddressLineEdit)->setText(QString::fromUtf8(proxyAddress.c_str()));
|
whileBlocking(ui->proxyWidget)->setAddress(QString::fromUtf8(proxyAddress.c_str()));
|
||||||
whileBlocking(ui->proxyPortSpinBox)->setValue(proxyPort);
|
whileBlocking(ui->proxyWidget)->setPort(proxyPort);
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
|
||||||
|
@ -87,11 +85,10 @@ void FeedReaderConfig::useProxyToggled()
|
||||||
{
|
{
|
||||||
bool enabled = ui->useProxyCheckBox->isChecked();
|
bool enabled = ui->useProxyCheckBox->isChecked();
|
||||||
|
|
||||||
ui->proxyAddressLineEdit->setEnabled(enabled);
|
ui->proxyWidget->setEnabled(enabled);
|
||||||
ui->proxyPortSpinBox->setEnabled(enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedReaderConfig::updateProxy()
|
void FeedReaderConfig::updateProxy()
|
||||||
{
|
{
|
||||||
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyAddressLineEdit->text().toUtf8().constData(), ui->proxyPortSpinBox->value());
|
rsFeedReader->setStandardProxy(ui->useProxyCheckBox->isChecked(), ui->proxyWidget->address().toUtf8().constData(), ui->proxyWidget->port());
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,37 +77,16 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Proxy</string>
|
<string>Proxy</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item row="0" column="0" colspan="4">
|
<item>
|
||||||
<widget class="QCheckBox" name="useProxyCheckBox">
|
<widget class="QCheckBox" name="useProxyCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use proxy</string>
|
<string>Use proxy</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="serverLabel">
|
<widget class="ProxyWidget" name="proxyWidget" native="true"/>
|
||||||
<property name="text">
|
|
||||||
<string>Server</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="proxyAddressLineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QSpinBox" name="proxyPortSpinBox">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>65535</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="potLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -157,12 +136,19 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>ProxyWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/ProxyWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>updateIntervalSpinBox</tabstop>
|
<tabstop>updateIntervalSpinBox</tabstop>
|
||||||
<tabstop>storageTimeSpinBox</tabstop>
|
<tabstop>storageTimeSpinBox</tabstop>
|
||||||
<tabstop>useProxyCheckBox</tabstop>
|
<tabstop>useProxyCheckBox</tabstop>
|
||||||
<tabstop>proxyAddressLineEdit</tabstop>
|
<tabstop>proxyWidget</tabstop>
|
||||||
<tabstop>proxyPortSpinBox</tabstop>
|
|
||||||
<tabstop>saveInBackgroundCheckBox</tabstop>
|
<tabstop>saveInBackgroundCheckBox</tabstop>
|
||||||
<tabstop>setMsgToReadOnActivate</tabstop>
|
<tabstop>setMsgToReadOnActivate</tabstop>
|
||||||
<tabstop>openAllInNewTabCheckBox</tabstop>
|
<tabstop>openAllInNewTabCheckBox</tabstop>
|
||||||
|
|
38
plugins/FeedReader/gui/ProxyWidget.cpp
Normal file
38
plugins/FeedReader/gui/ProxyWidget.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include "ProxyWidget.h"
|
||||||
|
#include "ui_ProxyWidget.h"
|
||||||
|
|
||||||
|
ProxyWidget::ProxyWidget(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
, ui(new Ui::ProxyWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
/* Connect signals */
|
||||||
|
connect(ui->addressLineEdit, &QLineEdit::textChanged, this, &ProxyWidget::changed);
|
||||||
|
connect(ui->portSpinBox, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, &ProxyWidget::changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProxyWidget::~ProxyWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProxyWidget::address()
|
||||||
|
{
|
||||||
|
return ui->addressLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProxyWidget::setAddress(const QString &value)
|
||||||
|
{
|
||||||
|
ui->addressLineEdit->setText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ProxyWidget::port()
|
||||||
|
{
|
||||||
|
return ui->portSpinBox->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProxyWidget::setPort(int value)
|
||||||
|
{
|
||||||
|
ui->portSpinBox->setValue(value);
|
||||||
|
}
|
31
plugins/FeedReader/gui/ProxyWidget.h
Normal file
31
plugins/FeedReader/gui/ProxyWidget.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef PROXYWIDGET_H
|
||||||
|
#define PROXYWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ProxyWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProxyWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ProxyWidget(QWidget *parent = nullptr);
|
||||||
|
~ProxyWidget();
|
||||||
|
|
||||||
|
QString address();
|
||||||
|
void setAddress(const QString &value);
|
||||||
|
|
||||||
|
int port();
|
||||||
|
void setPort(int value);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void changed();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ProxyWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PROXYWIDGET_H
|
57
plugins/FeedReader/gui/ProxyWidget.ui
Normal file
57
plugins/FeedReader/gui/ProxyWidget.ui
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ProxyWidget</class>
|
||||||
|
<widget class="QWidget" name="ProxyWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="serverLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Server</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="addressLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="portLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="portSpinBox">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Add table
Add a link
Reference in a new issue