Fixed sub dialog.
This commit is contained in:
parent
b544ad8a4c
commit
d34767d1c4
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#define ARGUMENTS_LIST_SEPARATOR "\n"
|
#define ARGUMENTS_LIST_SEPARATOR "\n"
|
||||||
|
|
||||||
|
#define ADBLOCK_EASYLIST_URL "https://easylist-downloads.adblockplus.org/easylist.txt"
|
||||||
#define DEFAULT_SQL_MESSAGES_FILTER "0 > 1"
|
#define DEFAULT_SQL_MESSAGES_FILTER "0 > 1"
|
||||||
#define MAX_MULTICOLUMN_SORT_STATES 3
|
#define MAX_MULTICOLUMN_SORT_STATES 3
|
||||||
#define ENCLOSURES_OUTER_SEPARATOR '#'
|
#define ENCLOSURES_OUTER_SEPARATOR '#'
|
||||||
|
@ -16,77 +16,73 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "adblockaddsubscriptiondialog.h"
|
#include "network-web/adblock/adblockaddsubscriptiondialog.h"
|
||||||
#include "ui_adblockaddsubscriptiondialog.h"
|
|
||||||
|
#include "definitions/definitions.h"
|
||||||
|
|
||||||
|
|
||||||
AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
|
AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent), m_ui(new Ui::AdBlockAddSubscriptionDialog) {
|
||||||
, ui(new Ui::AdBlockAddSubscriptionDialog)
|
m_ui->setupUi(this);
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
m_knownSubscriptions << Subscription("EasyList (English)", ADBLOCK_EASYLIST_URL)
|
m_knownSubscriptions << Subscription(QSL("EasyList (English)"), ADBLOCK_EASYLIST_URL)
|
||||||
<< Subscription("BSI Lista Polska (Polish)", "http://www.bsi.info.pl/filtrABP.txt")
|
<< Subscription(QSL("BSI Lista Polska (Polish)"), QSL("http://www.bsi.info.pl/filtrABP.txt"))
|
||||||
<< Subscription("Czech List (Czech)", "http://adblock.dajbych.net/adblock.txt")
|
<< Subscription(QSL("Czech List (Czech)"), QSL("http://adblock.dajbych.net/adblock.txt"))
|
||||||
<< Subscription("dutchblock (Dutch)", "http://groenewoudt.net/dutchblock/list.txt")
|
<< Subscription(QSL("dutchblock (Dutch)"), QSL("http://groenewoudt.net/dutchblock/list.txt"))
|
||||||
<< Subscription("Filtros Nauscopicos (Spanish)", "http://abp.mozilla-hispano.org/nauscopio/filtros.txt")
|
<< Subscription(QSL("Filtros Nauscopicos (Spanish)"), QSL("http://abp.mozilla-hispano.org/nauscopio/filtros.txt"))
|
||||||
<< Subscription("IsraelList (Hebrew)", "http://secure.fanboy.co.nz/israelilist/IsraelList.txt")
|
<< Subscription(QSL("IsraelList (Hebrew)"), QSL("http://secure.fanboy.co.nz/israelilist/IsraelList.txt"))
|
||||||
<< Subscription("NLBlock (Dutch)", "http://www.verzijlbergh.com/adblock/nlblock.txt")
|
<< Subscription(QSL("NLBlock (Dutch)"), QSL("http://www.verzijlbergh.com/adblock/nlblock.txt"))
|
||||||
<< Subscription("Peter Lowe's list (English)", "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext")
|
<< Subscription(QSL("Peter Lowe's list (English)"), QSL("http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext"))
|
||||||
<< Subscription("PLgeneral (Polish)", "http://www.niecko.pl/adblock/adblock.txt")
|
<< Subscription(QSL("PLgeneral (Polish))", QSL("http://www.niecko.pl/adblock/adblock.txt"))
|
||||||
<< Subscription("Schacks Adblock Plus liste (Danish)", "http://adblock.schack.dk/block.txt")
|
<< Subscription(QSL("Schacks Adblock Plus liste (Danish)"), QSL("http://adblock.schack.dk/block.txt"))
|
||||||
<< Subscription("Xfiles (Italian)", "http://mozilla.gfsolone.com/filtri.txt")
|
<< Subscription(QSL("Xfiles (Italian)"), QSL("http://mozilla.gfsolone.com/filtri.txt"))
|
||||||
<< Subscription("EasyPrivacy (English)", "http://easylist-downloads.adblockplus.org/easyprivacy.txt")
|
<< Subscription(QSL("EasyPrivacy (English)"), QSL("http://easylist-downloads.adblockplus.org/easyprivacy.txt"))
|
||||||
<< Subscription("RU Adlist (Russian)", "https://easylist-downloads.adblockplus.org/advblock.txt")
|
<< Subscription(QSL("RU Adlist (Russian)"), QSL("https://easylist-downloads.adblockplus.org/advblock.txt"))
|
||||||
<< Subscription("ABPindo (Indonesian)", "https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt")
|
<< Subscription(QSL("ABPindo (Indonesian)"), QSL("https://raw.githubusercontent.com/heradhis/indonesianadblockrules/master/subscriptions/abpindo.txt"))
|
||||||
<< Subscription("Easylist China (Chinese)", "https://easylist-downloads.adblockplus.org/easylistchina.txt")
|
<< Subscription(QSL("Easylist China (Chinese)"), QSL("https://easylist-downloads.adblockplus.org/easylistchina.txt"))
|
||||||
<< Subscription("Anti-Adblock Killer", "https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt")
|
<< Subscription(QSL("Anti-Adblock Killer"), QSL("https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt"))
|
||||||
<< Subscription(tr("Other..."), QString());
|
<< Subscription(tr("Other..."), QString());
|
||||||
|
|
||||||
foreach (const Subscription &subscription, m_knownSubscriptions) {
|
foreach (const Subscription &subscription, m_knownSubscriptions) {
|
||||||
ui->comboBox->addItem(subscription.title);
|
m_ui->comboBox->addItem(subscription.m_title);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)));
|
connect(m_ui->comboBox, &QComboBox::currentIndexChanged, this, &AdBlockAddSubscriptionDialog::indexChanged);
|
||||||
indexChanged(0);
|
indexChanged(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AdBlockAddSubscriptionDialog::title() const
|
QString AdBlockAddSubscriptionDialog::title() const {
|
||||||
{
|
return m_ui->title->text();
|
||||||
return ui->title->text();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AdBlockAddSubscriptionDialog::url() const
|
QString AdBlockAddSubscriptionDialog::url() const {
|
||||||
{
|
return m_ui->url->text();
|
||||||
return ui->url->text();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdBlockAddSubscriptionDialog::indexChanged(int index)
|
void AdBlockAddSubscriptionDialog::indexChanged(int index) {
|
||||||
{
|
|
||||||
const Subscription subscription = m_knownSubscriptions.at(index);
|
const Subscription subscription = m_knownSubscriptions.at(index);
|
||||||
|
|
||||||
// "Other..." entry
|
// "Other..." entry
|
||||||
if (subscription.url.isEmpty()) {
|
if (subscription.m_url.isEmpty()) {
|
||||||
ui->title->clear();
|
m_ui->title->clear();
|
||||||
ui->url->clear();
|
m_ui->url->clear();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int pos = subscription.title.indexOf(QLatin1Char('('));
|
int pos = subscription.m_title.indexOf(QLatin1Char('('));
|
||||||
QString title = subscription.title;
|
QString title = subscription.m_title;
|
||||||
|
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
title = title.left(pos).trimmed();
|
title = title.left(pos).trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->title->setText(title);
|
m_ui->title->setText(title);
|
||||||
ui->title->setCursorPosition(0);
|
m_ui->title->setCursorPosition(0);
|
||||||
|
|
||||||
ui->url->setText(subscription.url);
|
m_ui->url->setText(subscription.m_url);
|
||||||
ui->url->setCursorPosition(0);
|
m_ui->url->setCursorPosition(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog()
|
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog() {
|
||||||
{
|
delete m_ui;
|
||||||
delete ui;
|
|
||||||
}
|
}
|
||||||
|
@ -22,39 +22,38 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "ui_adblockaddsubscriptiondialog.h"
|
||||||
|
|
||||||
namespace Ui
|
|
||||||
{
|
namespace Ui {
|
||||||
class AdBlockAddSubscriptionDialog;
|
class AdBlockAddSubscriptionDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QUPZILLA_EXPORT AdBlockAddSubscriptionDialog : public QDialog
|
class AdBlockAddSubscriptionDialog : public QDialog {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AdBlockAddSubscriptionDialog(QWidget* parent = 0);
|
explicit AdBlockAddSubscriptionDialog(QWidget* parent = 0);
|
||||||
~AdBlockAddSubscriptionDialog();
|
virtual ~AdBlockAddSubscriptionDialog();
|
||||||
|
|
||||||
QString title() const;
|
QString title() const;
|
||||||
QString url() const;
|
QString url() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void indexChanged(int index);
|
void indexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AdBlockAddSubscriptionDialog* ui;
|
Ui::AdBlockAddSubscriptionDialog* m_ui;
|
||||||
|
|
||||||
struct Subscription {
|
struct Subscription {
|
||||||
QString title;
|
QString m_title;
|
||||||
QString url;
|
QString m_url;
|
||||||
|
|
||||||
Subscription() {}
|
Subscription() {}
|
||||||
|
|
||||||
Subscription(const QString &t, const QString &u) {
|
Subscription(const QString &t, const QString &u) {
|
||||||
title = t;
|
m_title = t;
|
||||||
url = u;
|
m_url = u;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user