do not require path to UI_ files
This commit is contained in:
parent
df0f831c3c
commit
7d709dcc81
17 changed files with 223 additions and 179 deletions
|
@ -1,5 +1,8 @@
|
||||||
|
if(NOT DEFINED LIBRSSGUARD_BINARY_PATH)
|
||||||
set(LIBRSSGUARD_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../librssguard")
|
set(LIBRSSGUARD_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../librssguard")
|
||||||
set(LIBRSSGUARD_BINARY_PATH "${CMAKE_BINARY_DIR}/src/librssguard")
|
endif()
|
||||||
|
|
||||||
|
#set(LIBRSSGUARD_BINARY_PATH "${CMAKE_BINARY_DIR}/src/librssguard")
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/definitions.h
|
src/definitions.h
|
||||||
|
@ -48,17 +51,6 @@ set(UI_FILES
|
||||||
src/gui/standardfeeddetails.ui
|
src/gui/standardfeeddetails.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add mimesis.
|
|
||||||
list(APPEND SOURCES
|
|
||||||
${LIBRSSGUARD_SOURCE_PATH}/3rd-party/mimesis/mimesis.hpp
|
|
||||||
${LIBRSSGUARD_SOURCE_PATH}/3rd-party/mimesis/quoted-printable.hpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add boolinq.
|
|
||||||
list(APPEND SOURCES
|
|
||||||
${LIBRSSGUARD_SOURCE_PATH}/3rd-party/boolinq/boolinq.h
|
|
||||||
)
|
|
||||||
|
|
||||||
# Deal with .ui files.
|
# Deal with .ui files.
|
||||||
qt_wrap_ui(SOURCES ${UI_FILES})
|
qt_wrap_ui(SOURCES ${UI_FILES})
|
||||||
|
|
||||||
|
@ -81,7 +73,6 @@ target_include_directories(rssguard-standard
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${LIBRSSGUARD_SOURCE_PATH}
|
${LIBRSSGUARD_SOURCE_PATH}
|
||||||
${LIBRSSGUARD_BINARY_PATH}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Qt.
|
# Qt.
|
||||||
|
@ -103,18 +94,6 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(rssguard-standard PUBLIC
|
|
||||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#if(NO_LITE)
|
|
||||||
# target_link_libraries(rssguard-standard PUBLIC
|
|
||||||
# Qt${QT_VERSION_MAJOR}::WebEngineWidgets
|
|
||||||
# )
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
if(WIN32 OR OS2)
|
if(WIN32 OR OS2)
|
||||||
install(TARGETS rssguard-standard DESTINATION plugins)
|
install(TARGETS rssguard-standard DESTINATION plugins)
|
||||||
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
|
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||||
|
|
|
@ -14,6 +14,8 @@ FormEditStandardAccount::FormEditStandardAccount(QWidget* parent)
|
||||||
activateTab(0);
|
activateTab(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormEditStandardAccount::~FormEditStandardAccount() = default;
|
||||||
|
|
||||||
void FormEditStandardAccount::loadAccountData() {
|
void FormEditStandardAccount::loadAccountData() {
|
||||||
FormAccountDetails::loadAccountData();
|
FormAccountDetails::loadAccountData();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class FormEditStandardAccount : public FormAccountDetails {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FormEditStandardAccount(QWidget* parent = nullptr);
|
explicit FormEditStandardAccount(QWidget* parent = nullptr);
|
||||||
|
virtual ~FormEditStandardAccount();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void loadAccountData();
|
virtual void loadAccountData();
|
||||||
|
|
|
@ -13,7 +13,10 @@
|
||||||
#include "src/gui/standardfeeddetails.h"
|
#include "src/gui/standardfeeddetails.h"
|
||||||
#include "src/standardfeed.h"
|
#include "src/standardfeed.h"
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QGroupBox>
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
|
|
||||||
FormStandardFeedDetails::FormStandardFeedDetails(ServiceRoot* service_root,
|
FormStandardFeedDetails::FormStandardFeedDetails(ServiceRoot* service_root,
|
||||||
|
@ -44,8 +47,8 @@ void FormStandardFeedDetails::guessFeed() {
|
||||||
m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText(),
|
m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText(),
|
||||||
m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText(),
|
m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText(),
|
||||||
m_authDetails->authenticationType(),
|
m_authDetails->authenticationType(),
|
||||||
m_authDetails->m_txtUsername->lineEdit()->text(),
|
m_authDetails->username(),
|
||||||
m_authDetails->m_txtPassword->lineEdit()->text(),
|
m_authDetails->password(),
|
||||||
m_serviceRoot->networkProxy());
|
m_serviceRoot->networkProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,13 +57,13 @@ void FormStandardFeedDetails::guessIconOnly() {
|
||||||
m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText(),
|
m_standardFeedDetails->m_ui.m_txtSource->textEdit()->toPlainText(),
|
||||||
m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText(),
|
m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText(),
|
||||||
m_authDetails->authenticationType(),
|
m_authDetails->authenticationType(),
|
||||||
m_authDetails->m_txtUsername->lineEdit()->text(),
|
m_authDetails->username(),
|
||||||
m_authDetails->m_txtPassword->lineEdit()->text(),
|
m_authDetails->password(),
|
||||||
m_serviceRoot->networkProxy());
|
m_serviceRoot->networkProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardFeedDetails::onTitleChanged(const QString& title) {
|
void FormStandardFeedDetails::onTitleChanged(const QString& title) {
|
||||||
m_ui.m_buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(!title.simplified().isEmpty());
|
buttonBox()->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(!title.simplified().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormStandardFeedDetails::apply() {
|
void FormStandardFeedDetails::apply() {
|
||||||
|
@ -109,13 +112,13 @@ void FormStandardFeedDetails::apply() {
|
||||||
std_feed->setPostProcessScript(m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText());
|
std_feed->setPostProcessScript(m_standardFeedDetails->m_ui.m_txtPostProcessScript->textEdit()->toPlainText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChangeAllowed(m_authDetails->m_mcbAuthType)) {
|
if (isChangeAllowed(m_authDetails->findChild<MultiFeedEditCheckBox*>(QSL("m_mcbAuthType")))) {
|
||||||
std_feed->setProtection(m_authDetails->authenticationType());
|
std_feed->setProtection(m_authDetails->authenticationType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChangeAllowed(m_authDetails->m_mcbAuthentication)) {
|
if (isChangeAllowed(m_authDetails->findChild<MultiFeedEditCheckBox*>(QSL("m_mcbAuthentication")))) {
|
||||||
std_feed->setUsername(m_authDetails->m_txtUsername->lineEdit()->text());
|
std_feed->setUsername(m_authDetails->username());
|
||||||
std_feed->setPassword(m_authDetails->m_txtPassword->lineEdit()->text());
|
std_feed->setPassword(m_authDetails->password());
|
||||||
}
|
}
|
||||||
|
|
||||||
std_feed->setCreationDate(QDateTime::currentDateTime());
|
std_feed->setCreationDate(QDateTime::currentDateTime());
|
||||||
|
@ -161,8 +164,10 @@ void FormStandardFeedDetails::loadFeedData() {
|
||||||
m_standardFeedDetails->m_ui.m_mcbType->addActionWidget(m_standardFeedDetails->m_ui.m_cmbType);
|
m_standardFeedDetails->m_ui.m_mcbType->addActionWidget(m_standardFeedDetails->m_ui.m_cmbType);
|
||||||
m_standardFeedDetails->m_ui.m_mcbEncoding->addActionWidget(m_standardFeedDetails->m_ui.m_cmbEncoding);
|
m_standardFeedDetails->m_ui.m_mcbEncoding->addActionWidget(m_standardFeedDetails->m_ui.m_cmbEncoding);
|
||||||
|
|
||||||
m_authDetails->m_mcbAuthType->addActionWidget(m_authDetails->m_cbAuthType);
|
m_authDetails->findChild<MultiFeedEditCheckBox*>(QSL("m_mcbAuthType"))
|
||||||
m_authDetails->m_mcbAuthentication->addActionWidget(m_authDetails->m_gbAuthentication);
|
->addActionWidget(m_authDetails->findChild<QComboBox*>(QSL("m_cbAuthType")));
|
||||||
|
m_authDetails->findChild<MultiFeedEditCheckBox*>(QSL("m_mcbAuthentication"))
|
||||||
|
->addActionWidget(m_authDetails->findChild<QGroupBox*>(QSL("m_gbAuthentication")));
|
||||||
|
|
||||||
m_standardFeedDetails->m_ui.m_btnFetchMetadata->setEnabled(false);
|
m_standardFeedDetails->m_ui.m_btnFetchMetadata->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -179,8 +184,8 @@ void FormStandardFeedDetails::loadFeedData() {
|
||||||
m_standardFeedDetails->loadCategories(m_serviceRoot->getSubTreeCategories(), m_serviceRoot);
|
m_standardFeedDetails->loadCategories(m_serviceRoot->getSubTreeCategories(), m_serviceRoot);
|
||||||
|
|
||||||
m_authDetails->setAuthenticationType(std_feed->protection());
|
m_authDetails->setAuthenticationType(std_feed->protection());
|
||||||
m_authDetails->m_txtUsername->lineEdit()->setText(std_feed->username());
|
m_authDetails->setUsername(std_feed->username());
|
||||||
m_authDetails->m_txtPassword->lineEdit()->setText(std_feed->password());
|
m_authDetails->setPassword(std_feed->password());
|
||||||
|
|
||||||
if (m_creatingNew) {
|
if (m_creatingNew) {
|
||||||
// auto processed_url = qApp->web()->processFeedUriScheme(m_urlToProcess);
|
// auto processed_url = qApp->web()->processFeedUriScheme(m_urlToProcess);
|
||||||
|
|
|
@ -2,63 +2,67 @@
|
||||||
|
|
||||||
#include "gui/reusable/networkproxydetails.h"
|
#include "gui/reusable/networkproxydetails.h"
|
||||||
|
|
||||||
|
#include "ui_networkproxydetails.h"
|
||||||
|
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
NetworkProxyDetails::NetworkProxyDetails(QWidget* parent) : QWidget(parent) {
|
NetworkProxyDetails::NetworkProxyDetails(QWidget* parent) : QWidget(parent), m_ui(new Ui::NetworkProxyDetails()) {
|
||||||
m_ui.setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
m_ui.m_lblProxyInfo->setHelpText(tr("Note that these settings are applied only on newly established connections."),
|
m_ui->m_lblProxyInfo->setHelpText(tr("Note that these settings are applied only on newly established connections."),
|
||||||
false);
|
false);
|
||||||
m_ui.m_txtProxyPassword->setPasswordMode(true);
|
m_ui->m_txtProxyPassword->setPasswordMode(true);
|
||||||
|
|
||||||
connect(m_ui.m_cmbProxyType,
|
connect(m_ui->m_cmbProxyType,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this,
|
this,
|
||||||
&NetworkProxyDetails::onProxyTypeChanged);
|
&NetworkProxyDetails::onProxyTypeChanged);
|
||||||
|
|
||||||
m_ui.m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::ProxyType::NoProxy);
|
m_ui->m_cmbProxyType->addItem(tr("No proxy"), QNetworkProxy::ProxyType::NoProxy);
|
||||||
m_ui.m_cmbProxyType->addItem(tr("System proxy"), QNetworkProxy::ProxyType::DefaultProxy);
|
m_ui->m_cmbProxyType->addItem(tr("System proxy"), QNetworkProxy::ProxyType::DefaultProxy);
|
||||||
m_ui.m_cmbProxyType->addItem(QSL("Socks5"), QNetworkProxy::ProxyType::Socks5Proxy);
|
m_ui->m_cmbProxyType->addItem(QSL("Socks5"), QNetworkProxy::ProxyType::Socks5Proxy);
|
||||||
m_ui.m_cmbProxyType->addItem(QSL("Http"), QNetworkProxy::ProxyType::HttpProxy);
|
m_ui->m_cmbProxyType->addItem(QSL("Http"), QNetworkProxy::ProxyType::HttpProxy);
|
||||||
|
|
||||||
connect(m_ui.m_cmbProxyType,
|
connect(m_ui->m_cmbProxyType,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this,
|
this,
|
||||||
&NetworkProxyDetails::changed);
|
&NetworkProxyDetails::changed);
|
||||||
connect(m_ui.m_txtProxyHost, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
|
connect(m_ui->m_txtProxyHost, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
|
||||||
connect(m_ui.m_txtProxyPassword, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
|
connect(m_ui->m_txtProxyPassword, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
|
||||||
connect(m_ui.m_txtProxyUsername, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
|
connect(m_ui->m_txtProxyUsername, &QLineEdit::textChanged, this, &NetworkProxyDetails::changed);
|
||||||
connect(m_ui.m_spinProxyPort,
|
connect(m_ui->m_spinProxyPort,
|
||||||
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
this,
|
this,
|
||||||
&NetworkProxyDetails::changed);
|
&NetworkProxyDetails::changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NetworkProxyDetails::~NetworkProxyDetails() = default;
|
||||||
|
|
||||||
QNetworkProxy NetworkProxyDetails::proxy() const {
|
QNetworkProxy NetworkProxyDetails::proxy() const {
|
||||||
QNetworkProxy proxy(static_cast<QNetworkProxy::ProxyType>(m_ui.m_cmbProxyType->currentData().toInt()),
|
QNetworkProxy proxy(static_cast<QNetworkProxy::ProxyType>(m_ui->m_cmbProxyType->currentData().toInt()),
|
||||||
m_ui.m_txtProxyHost->text(),
|
m_ui->m_txtProxyHost->text(),
|
||||||
m_ui.m_spinProxyPort->value(),
|
m_ui->m_spinProxyPort->value(),
|
||||||
m_ui.m_txtProxyUsername->text(),
|
m_ui->m_txtProxyUsername->text(),
|
||||||
m_ui.m_txtProxyPassword->text());
|
m_ui->m_txtProxyPassword->text());
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkProxyDetails::setProxy(const QNetworkProxy& proxy) {
|
void NetworkProxyDetails::setProxy(const QNetworkProxy& proxy) {
|
||||||
m_ui.m_cmbProxyType->setCurrentIndex(m_ui.m_cmbProxyType->findData(proxy.type()));
|
m_ui->m_cmbProxyType->setCurrentIndex(m_ui->m_cmbProxyType->findData(proxy.type()));
|
||||||
m_ui.m_txtProxyHost->setText(proxy.hostName());
|
m_ui->m_txtProxyHost->setText(proxy.hostName());
|
||||||
m_ui.m_spinProxyPort->setValue(proxy.port());
|
m_ui->m_spinProxyPort->setValue(proxy.port());
|
||||||
m_ui.m_txtProxyUsername->setText(proxy.user());
|
m_ui->m_txtProxyUsername->setText(proxy.user());
|
||||||
m_ui.m_txtProxyPassword->setText(proxy.password());
|
m_ui->m_txtProxyPassword->setText(proxy.password());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkProxyDetails::onProxyTypeChanged(int index) {
|
void NetworkProxyDetails::onProxyTypeChanged(int index) {
|
||||||
const QNetworkProxy::ProxyType selected_type =
|
const QNetworkProxy::ProxyType selected_type =
|
||||||
static_cast<QNetworkProxy::ProxyType>(m_ui.m_cmbProxyType->itemData(index).toInt());
|
static_cast<QNetworkProxy::ProxyType>(m_ui->m_cmbProxyType->itemData(index).toInt());
|
||||||
const bool is_proxy_selected =
|
const bool is_proxy_selected =
|
||||||
selected_type != QNetworkProxy::ProxyType::NoProxy && selected_type != QNetworkProxy::ProxyType::DefaultProxy;
|
selected_type != QNetworkProxy::ProxyType::NoProxy && selected_type != QNetworkProxy::ProxyType::DefaultProxy;
|
||||||
|
|
||||||
m_ui.m_proxyDetails->setEnabled(is_proxy_selected);
|
m_ui->m_proxyDetails->setEnabled(is_proxy_selected);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,18 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui_networkproxydetails.h"
|
|
||||||
|
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class NetworkProxyDetails;
|
||||||
|
}
|
||||||
|
|
||||||
class NetworkProxyDetails : public QWidget {
|
class NetworkProxyDetails : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NetworkProxyDetails(QWidget* parent = nullptr);
|
explicit NetworkProxyDetails(QWidget* parent = nullptr);
|
||||||
|
virtual ~NetworkProxyDetails();
|
||||||
|
|
||||||
QNetworkProxy proxy() const;
|
QNetworkProxy proxy() const;
|
||||||
void setProxy(const QNetworkProxy& proxy);
|
void setProxy(const QNetworkProxy& proxy);
|
||||||
|
@ -25,7 +28,7 @@ class NetworkProxyDetails : public QWidget {
|
||||||
void onProxyTypeChanged(int index);
|
void onProxyTypeChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NetworkProxyDetails m_ui;
|
QScopedPointer<Ui::NetworkProxyDetails> m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETWORKPROXYDETAILS_H
|
#endif // NETWORKPROXYDETAILS_H
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
#include "services/abstract/gui/accountdetails.h"
|
#include "services/abstract/gui/accountdetails.h"
|
||||||
|
|
||||||
AccountDetails::AccountDetails(QWidget* parent) : QWidget(parent) {
|
#include "ui_accountdetails.h"
|
||||||
m_ui.setupUi(this);
|
|
||||||
|
AccountDetails::AccountDetails(QWidget* parent) : QWidget(parent), m_ui(new Ui::AccountDetails()) {
|
||||||
|
m_ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AccountDetails::~AccountDetails() = default;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui_accountdetails.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AccountDetails;
|
class AccountDetails;
|
||||||
}
|
}
|
||||||
|
@ -18,9 +16,10 @@ class RSSGUARD_DLLSPEC AccountDetails : public QWidget {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AccountDetails(QWidget* parent = nullptr);
|
explicit AccountDetails(QWidget* parent = nullptr);
|
||||||
|
virtual ~AccountDetails();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AccountDetails m_ui;
|
QScopedPointer<Ui::AccountDetails> m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ACCOUNTDETAILS_H
|
#endif // ACCOUNTDETAILS_H
|
||||||
|
|
|
@ -2,29 +2,32 @@
|
||||||
|
|
||||||
#include "services/abstract/gui/authenticationdetails.h"
|
#include "services/abstract/gui/authenticationdetails.h"
|
||||||
|
|
||||||
|
#include "ui_authenticationdetails.h"
|
||||||
|
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
AuthenticationDetails::AuthenticationDetails(bool only_basic, QWidget* parent) : QWidget(parent) {
|
AuthenticationDetails::AuthenticationDetails(bool only_basic, QWidget* parent)
|
||||||
setupUi(this);
|
: QWidget(parent), m_ui(new Ui::AuthenticationDetails()) {
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
// Set text boxes.
|
// Set text boxes.
|
||||||
m_txtPassword->lineEdit()->setPasswordMode(true);
|
m_ui->m_txtPassword->lineEdit()->setPasswordMode(true);
|
||||||
m_txtUsername->lineEdit()->setPlaceholderText(tr("Username"));
|
m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username"));
|
||||||
m_txtUsername->lineEdit()->setToolTip(tr("Set username to access the feed."));
|
m_ui->m_txtUsername->lineEdit()->setToolTip(tr("Set username to access the feed."));
|
||||||
m_txtPassword->lineEdit()->setPlaceholderText(tr("Password"));
|
m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password"));
|
||||||
m_txtPassword->lineEdit()->setToolTip(tr("Set password to access the feed."));
|
m_ui->m_txtPassword->lineEdit()->setToolTip(tr("Set password to access the feed."));
|
||||||
|
|
||||||
m_cbAuthType->addItem(tr("No authentication"),
|
m_ui->m_cbAuthType->addItem(tr("No authentication"),
|
||||||
QVariant::fromValue(NetworkFactory::NetworkAuthentication::NoAuthentication));
|
QVariant::fromValue(NetworkFactory::NetworkAuthentication::NoAuthentication));
|
||||||
m_cbAuthType->addItem(tr("HTTP Basic"), QVariant::fromValue(NetworkFactory::NetworkAuthentication::Basic));
|
m_ui->m_cbAuthType->addItem(tr("HTTP Basic"), QVariant::fromValue(NetworkFactory::NetworkAuthentication::Basic));
|
||||||
|
|
||||||
if (!only_basic) {
|
if (!only_basic) {
|
||||||
m_cbAuthType->addItem(tr("Token"), QVariant::fromValue(NetworkFactory::NetworkAuthentication::Token));
|
m_ui->m_cbAuthType->addItem(tr("Token"), QVariant::fromValue(NetworkFactory::NetworkAuthentication::Token));
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &AuthenticationDetails::onUsernameChanged);
|
connect(m_ui->m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &AuthenticationDetails::onUsernameChanged);
|
||||||
connect(m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &AuthenticationDetails::onPasswordChanged);
|
connect(m_ui->m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &AuthenticationDetails::onPasswordChanged);
|
||||||
connect(m_cbAuthType,
|
connect(m_ui->m_cbAuthType,
|
||||||
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||||
this,
|
this,
|
||||||
&AuthenticationDetails::onAuthenticationSwitched);
|
&AuthenticationDetails::onAuthenticationSwitched);
|
||||||
|
@ -32,23 +35,41 @@ AuthenticationDetails::AuthenticationDetails(bool only_basic, QWidget* parent) :
|
||||||
onAuthenticationSwitched();
|
onAuthenticationSwitched();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AuthenticationDetails::username() const {
|
||||||
|
return m_ui->m_txtUsername->lineEdit()->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthenticationDetails::setUsername(const QString& username) {
|
||||||
|
m_ui->m_txtUsername->lineEdit()->setText(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AuthenticationDetails::password() const {
|
||||||
|
return m_ui->m_txtPassword->lineEdit()->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AuthenticationDetails::setPassword(const QString& password) {
|
||||||
|
m_ui->m_txtPassword->lineEdit()->setText(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthenticationDetails::~AuthenticationDetails() = default;
|
||||||
|
|
||||||
void AuthenticationDetails::setAuthenticationType(NetworkFactory::NetworkAuthentication protect) {
|
void AuthenticationDetails::setAuthenticationType(NetworkFactory::NetworkAuthentication protect) {
|
||||||
auto fnd = m_cbAuthType->findData(QVariant::fromValue(protect));
|
auto fnd = m_ui->m_cbAuthType->findData(QVariant::fromValue(protect));
|
||||||
|
|
||||||
if (fnd >= 0) {
|
if (fnd >= 0) {
|
||||||
m_cbAuthType->setCurrentIndex(fnd);
|
m_ui->m_cbAuthType->setCurrentIndex(fnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkFactory::NetworkFactory::NetworkAuthentication AuthenticationDetails::authenticationType() const {
|
NetworkFactory::NetworkFactory::NetworkAuthentication AuthenticationDetails::authenticationType() const {
|
||||||
return m_cbAuthType->currentData().value<NetworkFactory::NetworkAuthentication>();
|
return m_ui->m_cbAuthType->currentData().value<NetworkFactory::NetworkAuthentication>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthenticationDetails::onUsernameChanged(const QString& new_username) {
|
void AuthenticationDetails::onUsernameChanged(const QString& new_username) {
|
||||||
bool is_username_ok = authenticationType() == NetworkFactory::NetworkAuthentication::NoAuthentication ||
|
bool is_username_ok = authenticationType() == NetworkFactory::NetworkAuthentication::NoAuthentication ||
|
||||||
!new_username.simplified().isEmpty();
|
!new_username.simplified().isEmpty();
|
||||||
|
|
||||||
m_txtUsername->setStatus(is_username_ok ? LineEditWithStatus::StatusType::Ok
|
m_ui->m_txtUsername->setStatus(is_username_ok ? LineEditWithStatus::StatusType::Ok
|
||||||
: LineEditWithStatus::StatusType::Warning,
|
: LineEditWithStatus::StatusType::Warning,
|
||||||
is_username_ok ? tr("Username/token is ok or it is not needed.")
|
is_username_ok ? tr("Username/token is ok or it is not needed.")
|
||||||
: tr("Username/token is empty."));
|
: tr("Username/token is empty."));
|
||||||
|
@ -58,26 +79,26 @@ void AuthenticationDetails::onPasswordChanged(const QString& new_password) {
|
||||||
bool is_password_ok = authenticationType() == NetworkFactory::NetworkAuthentication::NoAuthentication ||
|
bool is_password_ok = authenticationType() == NetworkFactory::NetworkAuthentication::NoAuthentication ||
|
||||||
!new_password.simplified().isEmpty();
|
!new_password.simplified().isEmpty();
|
||||||
|
|
||||||
m_txtPassword->setStatus(is_password_ok ? LineEditWithStatus::StatusType::Ok
|
m_ui->m_txtPassword->setStatus(is_password_ok ? LineEditWithStatus::StatusType::Ok
|
||||||
: LineEditWithStatus::StatusType::Warning,
|
: LineEditWithStatus::StatusType::Warning,
|
||||||
is_password_ok ? tr("Password is ok or it is not needed.") : tr("Password is empty."));
|
is_password_ok ? tr("Password is ok or it is not needed.") : tr("Password is empty."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthenticationDetails::onAuthenticationSwitched() {
|
void AuthenticationDetails::onAuthenticationSwitched() {
|
||||||
onUsernameChanged(m_txtUsername->lineEdit()->text());
|
onUsernameChanged(m_ui->m_txtUsername->lineEdit()->text());
|
||||||
onPasswordChanged(m_txtPassword->lineEdit()->text());
|
onPasswordChanged(m_ui->m_txtPassword->lineEdit()->text());
|
||||||
|
|
||||||
auto prot = authenticationType();
|
auto prot = authenticationType();
|
||||||
|
|
||||||
m_lblPassword->setVisible(prot != NetworkFactory::NetworkAuthentication::Token);
|
m_ui->m_lblPassword->setVisible(prot != NetworkFactory::NetworkAuthentication::Token);
|
||||||
m_txtPassword->setVisible(prot != NetworkFactory::NetworkAuthentication::Token);
|
m_ui->m_txtPassword->setVisible(prot != NetworkFactory::NetworkAuthentication::Token);
|
||||||
|
|
||||||
if (prot == NetworkFactory::NetworkAuthentication::Token) {
|
if (prot == NetworkFactory::NetworkAuthentication::Token) {
|
||||||
m_lblUsername->setText(tr("Access token"));
|
m_ui->m_lblUsername->setText(tr("Access token"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_lblUsername->setText(tr("Username"));
|
m_ui->m_lblUsername->setText(tr("Username"));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gbAuthentication->setEnabled(prot != NetworkFactory::NetworkAuthentication::NoAuthentication);
|
m_ui->m_gbAuthentication->setEnabled(prot != NetworkFactory::NetworkAuthentication::NoAuthentication);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,25 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "ui_authenticationdetails.h"
|
|
||||||
|
|
||||||
#include "network-web/networkfactory.h"
|
#include "network-web/networkfactory.h"
|
||||||
#include "services/abstract/feed.h"
|
#include "services/abstract/feed.h"
|
||||||
|
|
||||||
class RSSGUARD_DLLSPEC AuthenticationDetails : public QWidget, public Ui::AuthenticationDetails {
|
namespace Ui {
|
||||||
|
class AuthenticationDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RSSGUARD_DLLSPEC AuthenticationDetails : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AuthenticationDetails(bool only_basic, QWidget* parent = nullptr);
|
explicit AuthenticationDetails(bool only_basic, QWidget* parent = nullptr);
|
||||||
|
virtual ~AuthenticationDetails();
|
||||||
|
|
||||||
|
QString username() const;
|
||||||
|
void setUsername(const QString& username);
|
||||||
|
|
||||||
|
QString password() const;
|
||||||
|
void setPassword(const QString& password);
|
||||||
|
|
||||||
void setAuthenticationType(NetworkFactory::NetworkFactory::NetworkAuthentication protect);
|
void setAuthenticationType(NetworkFactory::NetworkFactory::NetworkAuthentication protect);
|
||||||
NetworkFactory::NetworkFactory::NetworkAuthentication authenticationType() const;
|
NetworkFactory::NetworkFactory::NetworkAuthentication authenticationType() const;
|
||||||
|
@ -23,6 +32,9 @@ class RSSGUARD_DLLSPEC AuthenticationDetails : public QWidget, public Ui::Authen
|
||||||
void onUsernameChanged(const QString& new_username);
|
void onUsernameChanged(const QString& new_username);
|
||||||
void onPasswordChanged(const QString& new_password);
|
void onPasswordChanged(const QString& new_password);
|
||||||
void onAuthenticationSwitched();
|
void onAuthenticationSwitched();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::AuthenticationDetails> m_ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUTHENTICATIONDETAILS_H
|
#endif // AUTHENTICATIONDETAILS_H
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "services/abstract/gui/formaccountdetails.h"
|
#include "services/abstract/gui/formaccountdetails.h"
|
||||||
|
|
||||||
|
#include "ui_accountdetails.h"
|
||||||
#include "ui_formaccountdetails.h"
|
#include "ui_formaccountdetails.h"
|
||||||
|
|
||||||
#include "gui/guiutilities.h"
|
#include "gui/guiutilities.h"
|
||||||
|
@ -15,8 +16,8 @@
|
||||||
|
|
||||||
FormAccountDetails::FormAccountDetails(const QIcon& icon, QWidget* parent)
|
FormAccountDetails::FormAccountDetails(const QIcon& icon, QWidget* parent)
|
||||||
: QDialog(parent), m_proxyDetails(new NetworkProxyDetails(this)), m_accountDetails(new AccountDetails(this)),
|
: QDialog(parent), m_proxyDetails(new NetworkProxyDetails(this)), m_accountDetails(new AccountDetails(this)),
|
||||||
m_account(nullptr), m_creatingNew(false) {
|
m_account(nullptr), m_creatingNew(false), m_ui(new Ui::FormAccountDetails()) {
|
||||||
m_ui.setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
insertCustomTab(m_accountDetails, tr("Miscellaneous"), 0);
|
insertCustomTab(m_accountDetails, tr("Miscellaneous"), 0);
|
||||||
insertCustomTab(m_proxyDetails, tr("Network proxy"), 1);
|
insertCustomTab(m_proxyDetails, tr("Network proxy"), 1);
|
||||||
|
@ -25,11 +26,13 @@ FormAccountDetails::FormAccountDetails(const QIcon& icon, QWidget* parent)
|
||||||
createConnections();
|
createConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormAccountDetails::~FormAccountDetails() = default;
|
||||||
|
|
||||||
void FormAccountDetails::apply() {
|
void FormAccountDetails::apply() {
|
||||||
m_account->setNodeShowImportant(m_accountDetails->m_ui.m_cbImportant->isChecked());
|
m_account->setNodeShowImportant(m_accountDetails->m_ui->m_cbImportant->isChecked());
|
||||||
m_account->setNodeShowLabels(m_accountDetails->m_ui.m_cbLabels->isChecked());
|
m_account->setNodeShowLabels(m_accountDetails->m_ui->m_cbLabels->isChecked());
|
||||||
m_account->setNodeShowProbes(m_accountDetails->m_ui.m_cbProbes->isChecked());
|
m_account->setNodeShowProbes(m_accountDetails->m_ui->m_cbProbes->isChecked());
|
||||||
m_account->setNodeShowUnread(m_accountDetails->m_ui.m_cbUnread->isChecked());
|
m_account->setNodeShowUnread(m_accountDetails->m_ui->m_cbUnread->isChecked());
|
||||||
|
|
||||||
m_account->setNetworkProxy(m_proxyDetails->proxy());
|
m_account->setNetworkProxy(m_proxyDetails->proxy());
|
||||||
|
|
||||||
|
@ -42,15 +45,15 @@ void FormAccountDetails::apply() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAccountDetails::insertCustomTab(QWidget* custom_tab, const QString& title, int index) {
|
void FormAccountDetails::insertCustomTab(QWidget* custom_tab, const QString& title, int index) {
|
||||||
m_ui.m_tabWidget->insertTab(index, custom_tab, title);
|
m_ui->m_tabWidget->insertTab(index, custom_tab, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAccountDetails::activateTab(int index) {
|
void FormAccountDetails::activateTab(int index) {
|
||||||
m_ui.m_tabWidget->setCurrentIndex(index);
|
m_ui->m_tabWidget->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAccountDetails::clearTabs() {
|
void FormAccountDetails::clearTabs() {
|
||||||
m_ui.m_tabWidget->clear();
|
m_ui->m_tabWidget->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAccountDetails::loadAccountData() {
|
void FormAccountDetails::loadAccountData() {
|
||||||
|
@ -69,14 +72,14 @@ void FormAccountDetails::loadAccountData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_accountDetails->m_ui.m_cbImportant->setChecked(m_account->nodeShowImportant());
|
m_accountDetails->m_ui->m_cbImportant->setChecked(m_account->nodeShowImportant());
|
||||||
m_accountDetails->m_ui.m_cbLabels->setChecked(m_account->nodeShowLabels());
|
m_accountDetails->m_ui->m_cbLabels->setChecked(m_account->nodeShowLabels());
|
||||||
m_accountDetails->m_ui.m_cbProbes->setChecked(m_account->nodeShowProbes());
|
m_accountDetails->m_ui->m_cbProbes->setChecked(m_account->nodeShowProbes());
|
||||||
m_accountDetails->m_ui.m_cbUnread->setChecked(m_account->nodeShowUnread());
|
m_accountDetails->m_ui->m_cbUnread->setChecked(m_account->nodeShowUnread());
|
||||||
|
|
||||||
m_proxyDetails->setProxy(m_account->networkProxy());
|
m_proxyDetails->setProxy(m_account->networkProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAccountDetails::createConnections() {
|
void FormAccountDetails::createConnections() {
|
||||||
connect(m_ui.m_buttonBox, &QDialogButtonBox::accepted, this, &FormAccountDetails::apply);
|
connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormAccountDetails::apply);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,16 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "ui_formaccountdetails.h"
|
|
||||||
|
|
||||||
#include "database/databasefactory.h"
|
#include "database/databasefactory.h"
|
||||||
#include "database/databasequeries.h"
|
#include "database/databasequeries.h"
|
||||||
#include "gui/reusable/networkproxydetails.h"
|
#include "gui/reusable/networkproxydetails.h"
|
||||||
#include "miscellaneous/application.h"
|
#include "miscellaneous/application.h"
|
||||||
#include "services/abstract/gui/accountdetails.h"
|
#include "services/abstract/gui/accountdetails.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class FormAccountDetails;
|
||||||
|
}
|
||||||
|
|
||||||
class ServiceRoot;
|
class ServiceRoot;
|
||||||
|
|
||||||
class RSSGUARD_DLLSPEC FormAccountDetails : public QDialog {
|
class RSSGUARD_DLLSPEC FormAccountDetails : public QDialog {
|
||||||
|
@ -20,6 +22,7 @@ class RSSGUARD_DLLSPEC FormAccountDetails : public QDialog {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FormAccountDetails(const QIcon& icon, QWidget* parent = nullptr);
|
explicit FormAccountDetails(const QIcon& icon, QWidget* parent = nullptr);
|
||||||
|
virtual ~FormAccountDetails();
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T* addEditAccount(T* account_to_edit = nullptr);
|
T* addEditAccount(T* account_to_edit = nullptr);
|
||||||
|
@ -48,7 +51,7 @@ class RSSGUARD_DLLSPEC FormAccountDetails : public QDialog {
|
||||||
void createConnections();
|
void createConnections();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ui::FormAccountDetails m_ui;
|
QScopedPointer<Ui::FormAccountDetails> m_ui;
|
||||||
NetworkProxyDetails* m_proxyDetails;
|
NetworkProxyDetails* m_proxyDetails;
|
||||||
AccountDetails* m_accountDetails;
|
AccountDetails* m_accountDetails;
|
||||||
ServiceRoot* m_account;
|
ServiceRoot* m_account;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include "services/abstract/gui/formcategorydetails.h"
|
#include "services/abstract/gui/formcategorydetails.h"
|
||||||
|
|
||||||
|
#include "ui_formcategorydetails.h"
|
||||||
|
|
||||||
#include "3rd-party/boolinq/boolinq.h"
|
#include "3rd-party/boolinq/boolinq.h"
|
||||||
#include "database/databasequeries.h"
|
#include "database/databasequeries.h"
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#ifndef FORMCATEGORYDETAILS_H
|
#ifndef FORMCATEGORYDETAILS_H
|
||||||
#define FORMCATEGORYDETAILS_H
|
#define FORMCATEGORYDETAILS_H
|
||||||
|
|
||||||
#include "ui_formcategorydetails.h"
|
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "3rd-party/boolinq/boolinq.h"
|
#include "3rd-party/boolinq/boolinq.h"
|
||||||
|
|
|
@ -20,21 +20,23 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
FormFeedDetails::FormFeedDetails(ServiceRoot* service_root, QWidget* parent)
|
FormFeedDetails::FormFeedDetails(ServiceRoot* service_root, QWidget* parent)
|
||||||
: QDialog(parent), m_serviceRoot(service_root) {
|
: QDialog(parent), m_ui(new Ui::FormFeedDetails()), m_serviceRoot(service_root) {
|
||||||
initialize();
|
initialize();
|
||||||
createConnections();
|
createConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormFeedDetails::~FormFeedDetails() = default;
|
||||||
|
|
||||||
void FormFeedDetails::activateTab(int index) {
|
void FormFeedDetails::activateTab(int index) {
|
||||||
m_ui.m_tabWidget->setCurrentIndex(index);
|
m_ui->m_tabWidget->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::clearTabs() {
|
void FormFeedDetails::clearTabs() {
|
||||||
m_ui.m_tabWidget->clear();
|
m_ui->m_tabWidget->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::insertCustomTab(QWidget* custom_tab, const QString& title, int index) {
|
void FormFeedDetails::insertCustomTab(QWidget* custom_tab, const QString& title, int index) {
|
||||||
m_ui.m_tabWidget->insertTab(index, custom_tab, title);
|
m_ui->m_tabWidget->insertTab(index, custom_tab, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::apply() {
|
void FormFeedDetails::apply() {
|
||||||
|
@ -42,29 +44,29 @@ void FormFeedDetails::apply() {
|
||||||
|
|
||||||
for (Feed* fd : fds) {
|
for (Feed* fd : fds) {
|
||||||
// Setup common data for the feed.
|
// Setup common data for the feed.
|
||||||
if (isChangeAllowed(m_ui.m_mcbAutoDownloading)) {
|
if (isChangeAllowed(m_ui->m_mcbAutoDownloading)) {
|
||||||
fd->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui.m_cmbAutoUpdateType
|
fd->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType
|
||||||
->itemData(m_ui.m_cmbAutoUpdateType->currentIndex())
|
->itemData(m_ui->m_cmbAutoUpdateType->currentIndex())
|
||||||
.toInt()));
|
.toInt()));
|
||||||
fd->setAutoUpdateInterval(int(m_ui.m_spinAutoUpdateInterval->value()));
|
fd->setAutoUpdateInterval(int(m_ui->m_spinAutoUpdateInterval->value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChangeAllowed(m_ui.m_mcbOpenArticlesAutomatically)) {
|
if (isChangeAllowed(m_ui->m_mcbOpenArticlesAutomatically)) {
|
||||||
fd->setOpenArticlesDirectly(m_ui.m_cbOpenArticlesAutomatically->isChecked());
|
fd->setOpenArticlesDirectly(m_ui->m_cbOpenArticlesAutomatically->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChangeAllowed(m_ui.m_mcbFeedRtl)) {
|
if (isChangeAllowed(m_ui->m_mcbFeedRtl)) {
|
||||||
fd->setIsRtl(m_ui.m_cbFeedRTL->isChecked());
|
fd->setIsRtl(m_ui->m_cbFeedRTL->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.m_wdgArticleLimiting->saveFeed(fd, m_isBatchEdit);
|
m_ui->m_wdgArticleLimiting->saveFeed(fd, m_isBatchEdit);
|
||||||
|
|
||||||
if (isChangeAllowed(m_ui.m_mcbDisableFeed)) {
|
if (isChangeAllowed(m_ui->m_mcbDisableFeed)) {
|
||||||
fd->setIsSwitchedOff(m_ui.m_cbDisableFeed->isChecked());
|
fd->setIsSwitchedOff(m_ui->m_cbDisableFeed->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChangeAllowed(m_ui.m_mcbSuppressFeed)) {
|
if (isChangeAllowed(m_ui->m_mcbSuppressFeed)) {
|
||||||
fd->setIsQuiet(m_ui.m_cbSuppressFeed->isChecked());
|
fd->setIsQuiet(m_ui->m_cbSuppressFeed->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_creatingNew) {
|
if (!m_creatingNew) {
|
||||||
|
@ -80,28 +82,32 @@ void FormFeedDetails::apply() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDialogButtonBox* FormFeedDetails::buttonBox() const {
|
||||||
|
return m_ui->m_buttonBox;
|
||||||
|
}
|
||||||
|
|
||||||
bool FormFeedDetails::isChangeAllowed(MultiFeedEditCheckBox* mcb) const {
|
bool FormFeedDetails::isChangeAllowed(MultiFeedEditCheckBox* mcb) const {
|
||||||
return !m_isBatchEdit || mcb->isChecked();
|
return !m_isBatchEdit || mcb->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) {
|
void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) {
|
||||||
Feed::AutoUpdateType auto_update_type =
|
Feed::AutoUpdateType auto_update_type =
|
||||||
static_cast<Feed::AutoUpdateType>(m_ui.m_cmbAutoUpdateType->itemData(new_index).toInt());
|
static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(new_index).toInt());
|
||||||
|
|
||||||
switch (auto_update_type) {
|
switch (auto_update_type) {
|
||||||
case Feed::AutoUpdateType::DontAutoUpdate:
|
case Feed::AutoUpdateType::DontAutoUpdate:
|
||||||
case Feed::AutoUpdateType::DefaultAutoUpdate:
|
case Feed::AutoUpdateType::DefaultAutoUpdate:
|
||||||
m_ui.m_spinAutoUpdateInterval->setEnabled(false);
|
m_ui->m_spinAutoUpdateInterval->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_ui.m_spinAutoUpdateInterval->setEnabled(true);
|
m_ui->m_spinAutoUpdateInterval->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::createConnections() {
|
void FormFeedDetails::createConnections() {
|
||||||
connect(m_ui.m_buttonBox, &QDialogButtonBox::accepted, this, &FormFeedDetails::acceptIfPossible);
|
connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormFeedDetails::acceptIfPossible);
|
||||||
connect(m_ui.m_cmbAutoUpdateType,
|
connect(m_ui->m_cmbAutoUpdateType,
|
||||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this,
|
this,
|
||||||
&FormFeedDetails::onAutoUpdateTypeChanged);
|
&FormFeedDetails::onAutoUpdateTypeChanged);
|
||||||
|
@ -112,11 +118,11 @@ void FormFeedDetails::loadFeedData() {
|
||||||
|
|
||||||
if (m_isBatchEdit) {
|
if (m_isBatchEdit) {
|
||||||
// We hook batch selectors.
|
// We hook batch selectors.
|
||||||
m_ui.m_mcbAutoDownloading->addActionWidget(m_ui.m_wdgAutoUpdate);
|
m_ui->m_mcbAutoDownloading->addActionWidget(m_ui->m_wdgAutoUpdate);
|
||||||
m_ui.m_mcbOpenArticlesAutomatically->addActionWidget(m_ui.m_cbOpenArticlesAutomatically);
|
m_ui->m_mcbOpenArticlesAutomatically->addActionWidget(m_ui->m_cbOpenArticlesAutomatically);
|
||||||
m_ui.m_mcbDisableFeed->addActionWidget(m_ui.m_cbDisableFeed);
|
m_ui->m_mcbDisableFeed->addActionWidget(m_ui->m_cbDisableFeed);
|
||||||
m_ui.m_mcbSuppressFeed->addActionWidget(m_ui.m_cbSuppressFeed);
|
m_ui->m_mcbSuppressFeed->addActionWidget(m_ui->m_cbSuppressFeed);
|
||||||
m_ui.m_mcbFeedRtl->addActionWidget(m_ui.m_cbFeedRTL);
|
m_ui->m_mcbFeedRtl->addActionWidget(m_ui->m_cbFeedRTL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// We hide batch selectors.
|
// We hide batch selectors.
|
||||||
|
@ -125,7 +131,7 @@ void FormFeedDetails::loadFeedData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.m_wdgArticleLimiting->setForAppWideFeatures(false, m_isBatchEdit);
|
m_ui->m_wdgArticleLimiting->setForAppWideFeatures(false, m_isBatchEdit);
|
||||||
|
|
||||||
if (m_creatingNew) {
|
if (m_creatingNew) {
|
||||||
GuiUtilities::applyDialogProperties(*this,
|
GuiUtilities::applyDialogProperties(*this,
|
||||||
|
@ -143,13 +149,13 @@ void FormFeedDetails::loadFeedData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.m_cmbAutoUpdateType
|
m_ui->m_cmbAutoUpdateType
|
||||||
->setCurrentIndex(m_ui.m_cmbAutoUpdateType->findData(QVariant::fromValue(int(fd->autoUpdateType()))));
|
->setCurrentIndex(m_ui->m_cmbAutoUpdateType->findData(QVariant::fromValue(int(fd->autoUpdateType()))));
|
||||||
m_ui.m_spinAutoUpdateInterval->setValue(fd->autoUpdateInterval());
|
m_ui->m_spinAutoUpdateInterval->setValue(fd->autoUpdateInterval());
|
||||||
m_ui.m_cbOpenArticlesAutomatically->setChecked(fd->openArticlesDirectly());
|
m_ui->m_cbOpenArticlesAutomatically->setChecked(fd->openArticlesDirectly());
|
||||||
m_ui.m_cbFeedRTL->setChecked(fd->isRtl());
|
m_ui->m_cbFeedRTL->setChecked(fd->isRtl());
|
||||||
m_ui.m_cbDisableFeed->setChecked(fd->isSwitchedOff());
|
m_ui->m_cbDisableFeed->setChecked(fd->isSwitchedOff());
|
||||||
m_ui.m_cbSuppressFeed->setChecked(fd->isQuiet());
|
m_ui->m_cbSuppressFeed->setChecked(fd->isQuiet());
|
||||||
|
|
||||||
Feed::ArticleIgnoreLimit art_limit = Feed::ArticleIgnoreLimit(fd->articleIgnoreLimit());
|
Feed::ArticleIgnoreLimit art_limit = Feed::ArticleIgnoreLimit(fd->articleIgnoreLimit());
|
||||||
|
|
||||||
|
@ -166,7 +172,7 @@ void FormFeedDetails::loadFeedData() {
|
||||||
art_limit.m_moveToBinDontPurge = false;
|
art_limit.m_moveToBinDontPurge = false;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
m_ui.m_wdgArticleLimiting->load(art_limit, true);
|
m_ui->m_wdgArticleLimiting->load(art_limit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::acceptIfPossible() {
|
void FormFeedDetails::acceptIfPossible() {
|
||||||
|
@ -186,15 +192,15 @@ void FormFeedDetails::acceptIfPossible() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::initialize() {
|
void FormFeedDetails::initialize() {
|
||||||
m_ui.setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
// Setup auto-update options.
|
// Setup auto-update options.
|
||||||
m_ui.m_spinAutoUpdateInterval->setMode(TimeSpinBox::Mode::MinutesSeconds);
|
m_ui->m_spinAutoUpdateInterval->setMode(TimeSpinBox::Mode::MinutesSeconds);
|
||||||
m_ui.m_spinAutoUpdateInterval->setValue(DEFAULT_AUTO_UPDATE_INTERVAL);
|
m_ui->m_spinAutoUpdateInterval->setValue(DEFAULT_AUTO_UPDATE_INTERVAL);
|
||||||
m_ui.m_cmbAutoUpdateType->addItem(tr("Fetch articles using global interval"),
|
m_ui->m_cmbAutoUpdateType->addItem(tr("Fetch articles using global interval"),
|
||||||
QVariant::fromValue(int(Feed::AutoUpdateType::DefaultAutoUpdate)));
|
QVariant::fromValue(int(Feed::AutoUpdateType::DefaultAutoUpdate)));
|
||||||
m_ui.m_cmbAutoUpdateType->addItem(tr("Fetch articles every"),
|
m_ui->m_cmbAutoUpdateType->addItem(tr("Fetch articles every"),
|
||||||
QVariant::fromValue(int(Feed::AutoUpdateType::SpecificAutoUpdate)));
|
QVariant::fromValue(int(Feed::AutoUpdateType::SpecificAutoUpdate)));
|
||||||
m_ui.m_cmbAutoUpdateType->addItem(tr("Disable auto-fetching of articles"),
|
m_ui->m_cmbAutoUpdateType->addItem(tr("Disable auto-fetching of articles"),
|
||||||
QVariant::fromValue(int(Feed::AutoUpdateType::DontAutoUpdate)));
|
QVariant::fromValue(int(Feed::AutoUpdateType::DontAutoUpdate)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "ui_formfeeddetails.h"
|
|
||||||
|
|
||||||
#include "3rd-party/boolinq/boolinq.h"
|
#include "3rd-party/boolinq/boolinq.h"
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
|
@ -18,13 +16,15 @@ class ServiceRoot;
|
||||||
class Feed;
|
class Feed;
|
||||||
class Category;
|
class Category;
|
||||||
class RootItem;
|
class RootItem;
|
||||||
|
class QDialogButtonBox;
|
||||||
|
class MultiFeedEditCheckBox;
|
||||||
|
|
||||||
class RSSGUARD_DLLSPEC FormFeedDetails : public QDialog {
|
class RSSGUARD_DLLSPEC FormFeedDetails : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FormFeedDetails(ServiceRoot* service_root, QWidget* parent = nullptr);
|
explicit FormFeedDetails(ServiceRoot* service_root, QWidget* parent = nullptr);
|
||||||
virtual ~FormFeedDetails() = default;
|
virtual ~FormFeedDetails();
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
QList<T*> addEditFeed(const QList<Feed*>& feeds_to_edit = {});
|
QList<T*> addEditFeed(const QList<Feed*>& feeds_to_edit = {});
|
||||||
|
@ -47,6 +47,8 @@ class RSSGUARD_DLLSPEC FormFeedDetails : public QDialog {
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
QDialogButtonBox* buttonBox() const;
|
||||||
|
|
||||||
bool isChangeAllowed(MultiFeedEditCheckBox* mcb) const;
|
bool isChangeAllowed(MultiFeedEditCheckBox* mcb) const;
|
||||||
void insertCustomTab(QWidget* custom_tab, const QString& title, int index);
|
void insertCustomTab(QWidget* custom_tab, const QString& title, int index);
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ class RSSGUARD_DLLSPEC FormFeedDetails : public QDialog {
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ui::FormFeedDetails m_ui;
|
QScopedPointer<Ui::FormFeedDetails> m_ui;
|
||||||
QList<Feed*> m_feeds;
|
QList<Feed*> m_feeds;
|
||||||
ServiceRoot* m_serviceRoot;
|
ServiceRoot* m_serviceRoot;
|
||||||
bool m_creatingNew;
|
bool m_creatingNew;
|
||||||
|
|
|
@ -36,8 +36,8 @@ void FormTtRssFeedDetails::apply() {
|
||||||
m_serviceRoot->networkProxy(),
|
m_serviceRoot->networkProxy(),
|
||||||
m_authDetails->authenticationType() ==
|
m_authDetails->authenticationType() ==
|
||||||
NetworkFactory::NetworkAuthentication::Basic,
|
NetworkFactory::NetworkAuthentication::Basic,
|
||||||
m_authDetails->m_txtUsername->lineEdit()->text(),
|
m_authDetails->username(),
|
||||||
m_authDetails->m_txtPassword->lineEdit()->text());
|
m_authDetails->password());
|
||||||
|
|
||||||
if (response.code() == STF_INSERTED) {
|
if (response.code() == STF_INSERTED) {
|
||||||
// Feed was added online.
|
// Feed was added online.
|
||||||
|
|
Loading…
Add table
Reference in a new issue