mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-20 13:19:07 -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/FeedReaderFeedItem.cpp \
|
||||
gui/FeedTreeWidget.cpp \
|
||||
gui/ProxyWidget.cpp \
|
||||
util/CURLWrapper.cpp \
|
||||
util/XMLWrapper.cpp \
|
||||
util/HTMLWrapper.cpp \
|
||||
|
@ -66,6 +67,7 @@ HEADERS = FeedReaderPlugin.h \
|
|||
gui/FeedReaderUserNotify.h \
|
||||
gui/FeedReaderFeedItem.h \
|
||||
gui/FeedTreeWidget.h \
|
||||
gui/ProxyWidget.h \
|
||||
util/CURLWrapper.h \
|
||||
util/XMLWrapper.h \
|
||||
util/HTMLWrapper.h \
|
||||
|
@ -76,7 +78,8 @@ FORMS = gui/FeedReaderDialog.ui \
|
|||
gui/AddFeedDialog.ui \
|
||||
gui/PreviewFeedDialog.ui \
|
||||
gui/FeedReaderConfig.ui \
|
||||
gui/FeedReaderFeedItem.ui
|
||||
gui/FeedReaderFeedItem.ui \
|
||||
gui/ProxyWidget.ui
|
||||
|
||||
TARGET = FeedReader
|
||||
|
||||
|
|
|
@ -180,8 +180,7 @@ void AddFeedDialog::useStandardUpdateIntervalToggled()
|
|||
void AddFeedDialog::useStandardProxyToggled()
|
||||
{
|
||||
bool checked = ui->useStandardProxyCheckBox->isChecked();
|
||||
ui->proxyAddressLineEdit->setEnabled(!checked);
|
||||
ui->proxyPortSpinBox->setEnabled(!checked);
|
||||
ui->proxyWidget->setEnabled(!checked);
|
||||
}
|
||||
|
||||
void AddFeedDialog::typeForumToggled()
|
||||
|
@ -335,8 +334,8 @@ bool AddFeedDialog::fillFeed(uint32_t feedId)
|
|||
ui->passwordLineEdit->setText(QString::fromUtf8(feedInfo.password.c_str()));
|
||||
|
||||
ui->useStandardProxyCheckBox->setChecked(feedInfo.flag.standardProxy);
|
||||
ui->proxyAddressLineEdit->setText(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
|
||||
ui->proxyPortSpinBox->setValue(feedInfo.proxyPort);
|
||||
ui->proxyWidget->setAddress(QString::fromUtf8(feedInfo.proxyAddress.c_str()));
|
||||
ui->proxyWidget->setPort(feedInfo.proxyPort);
|
||||
|
||||
ui->useStandardUpdateInterval->setChecked(feedInfo.flag.standardUpdateInterval);
|
||||
ui->updateIntervalSpinBox->setValue(feedInfo.updateInterval / 60);
|
||||
|
@ -425,8 +424,8 @@ void AddFeedDialog::getFeedInfo(FeedInfo &feedInfo)
|
|||
feedInfo.password = ui->passwordLineEdit->text().toUtf8().constData();
|
||||
|
||||
feedInfo.flag.standardProxy = ui->useStandardProxyCheckBox->isChecked();
|
||||
feedInfo.proxyAddress = ui->proxyAddressLineEdit->text().toUtf8().constData();
|
||||
feedInfo.proxyPort = ui->proxyPortSpinBox->value();
|
||||
feedInfo.proxyAddress = ui->proxyWidget->address().toUtf8().constData();
|
||||
feedInfo.proxyPort = ui->proxyWidget->port();
|
||||
|
||||
feedInfo.flag.standardUpdateInterval = ui->useStandardUpdateInterval->isChecked();
|
||||
feedInfo.updateInterval = ui->updateIntervalSpinBox->value() * 60;
|
||||
|
|
|
@ -133,37 +133,16 @@
|
|||
<property name="title">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useStandardProxyCheckBox">
|
||||
<property name="text">
|
||||
<string>Use standard proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="serverLabel">
|
||||
<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>
|
||||
<widget class="ProxyWidget" name="proxyWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -465,6 +444,12 @@
|
|||
<extends>QComboBox</extends>
|
||||
<header>gui/common/RSComboBox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ProxyWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/ProxyWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>urlLineEdit</tabstop>
|
||||
|
@ -494,8 +479,7 @@
|
|||
<tabstop>useStandardUpdateInterval</tabstop>
|
||||
<tabstop>updateIntervalSpinBox</tabstop>
|
||||
<tabstop>useStandardProxyCheckBox</tabstop>
|
||||
<tabstop>proxyAddressLineEdit</tabstop>
|
||||
<tabstop>proxyPortSpinBox</tabstop>
|
||||
<tabstop>proxyWidget</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -31,8 +31,7 @@ FeedReaderConfig::FeedReaderConfig(QWidget *parent, Qt::WindowFlags flags)
|
|||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->proxyAddressLineEdit->setEnabled(false);
|
||||
ui->proxyPortSpinBox->setEnabled(false);
|
||||
ui->proxyWidget->setEnabled(false);
|
||||
|
||||
/* Connect signals */
|
||||
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());
|
||||
});
|
||||
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->proxyWidget, &ProxyWidget::changed, this, &FeedReaderConfig::updateProxy);
|
||||
|
||||
connect(ui->useProxyCheckBox, SIGNAL(toggled(bool)), this, SLOT(useProxyToggled()));
|
||||
}
|
||||
|
@ -75,8 +73,8 @@ void FeedReaderConfig::load()
|
|||
std::string proxyAddress;
|
||||
uint16_t proxyPort;
|
||||
whileBlocking(ui->useProxyCheckBox)->setChecked(rsFeedReader->getStandardProxy(proxyAddress, proxyPort));
|
||||
whileBlocking(ui->proxyAddressLineEdit)->setText(QString::fromUtf8(proxyAddress.c_str()));
|
||||
whileBlocking(ui->proxyPortSpinBox)->setValue(proxyPort);
|
||||
whileBlocking(ui->proxyWidget)->setAddress(QString::fromUtf8(proxyAddress.c_str()));
|
||||
whileBlocking(ui->proxyWidget)->setPort(proxyPort);
|
||||
|
||||
loaded = true;
|
||||
|
||||
|
@ -87,11 +85,10 @@ void FeedReaderConfig::useProxyToggled()
|
|||
{
|
||||
bool enabled = ui->useProxyCheckBox->isChecked();
|
||||
|
||||
ui->proxyAddressLineEdit->setEnabled(enabled);
|
||||
ui->proxyPortSpinBox->setEnabled(enabled);
|
||||
ui->proxyWidget->setEnabled(enabled);
|
||||
}
|
||||
|
||||
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">
|
||||
<string>Proxy</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useProxyCheckBox">
|
||||
<property name="text">
|
||||
<string>Use proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="serverLabel">
|
||||
<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>
|
||||
<widget class="ProxyWidget" name="proxyWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -157,12 +136,19 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ProxyWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/ProxyWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>updateIntervalSpinBox</tabstop>
|
||||
<tabstop>storageTimeSpinBox</tabstop>
|
||||
<tabstop>useProxyCheckBox</tabstop>
|
||||
<tabstop>proxyAddressLineEdit</tabstop>
|
||||
<tabstop>proxyPortSpinBox</tabstop>
|
||||
<tabstop>proxyWidget</tabstop>
|
||||
<tabstop>saveInBackgroundCheckBox</tabstop>
|
||||
<tabstop>setMsgToReadOnActivate</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