removed unneeded deps from adblock.js, simplified greader dialog, fixed some errors

This commit is contained in:
Martin Rotter 2021-09-06 13:06:40 +02:00
parent 041b578d96
commit 852319d6ab
7 changed files with 41 additions and 57 deletions

View file

@ -1,10 +1,8 @@
// Simple local HTTP server providing ad-blocking functionality via https://github.com/cliqz-oss/adblocker
//
// How to install:
// npm i -g @cliqz/adblocker
// npm i -g concat-stream
// npm i -g tldts-experimental
// npm i -g node-fetch
// npm i -g @cliqz/adblocker
//
// How to run:
// NODE_PATH="C:\Users\<user>\AppData\Roaming\npm\node_modules" node ./adblock-server.js "<port>" "<filters-file-path>"
@ -23,9 +21,6 @@ const fs = require('fs');
const tldts = require('tldts-experimental');
const adblock = require('@cliqz/adblocker')
const http = require('http');
const concat = require('concat-stream');
const constants = require('node:http2');
const fetch = require("node-fetch");
const cluster = require('cluster');
const numCPUs = require('os').cpus().length;

View file

@ -18,6 +18,8 @@ LabelWithStatus::LabelWithStatus(QWidget* parent)
// Compose the layout.
m_layout->addWidget(m_wdgInput);
m_layout->addWidget(m_btnStatus);
setLayoutDirection(Qt::LayoutDirection::RightToLeft);
}
void LabelWithStatus::setStatus(WidgetWithStatus::StatusType status,

View file

@ -17,6 +17,7 @@ WidgetWithStatus::WidgetWithStatus(QWidget* parent)
m_iconWarning = qApp->icons()->fromTheme(QSL("dialog-warning"));
m_iconError = qApp->icons()->fromTheme(QSL("dialog-error"));
m_iconOk = qApp->icons()->fromTheme(QSL("dialog-yes"));
m_iconQuestion = qApp->icons()->fromTheme(QSL("dialog-question"));
// Set layout properties.
m_layout->setContentsMargins({});
@ -49,6 +50,10 @@ void WidgetWithStatus::setStatus(WidgetWithStatus::StatusType status, const QStr
m_btnStatus->setIcon(m_iconOk);
break;
case StatusType::Question:
m_btnStatus->setIcon(m_iconQuestion);
break;
default:
break;
}

View file

@ -18,7 +18,8 @@ class WidgetWithStatus : public QWidget {
Warning,
Error,
Ok,
Progress
Progress,
Question
};
explicit WidgetWithStatus(QWidget* parent);
@ -36,6 +37,7 @@ class WidgetWithStatus : public QWidget {
QIcon m_iconWarning;
QIcon m_iconError;
QIcon m_iconOk;
QIcon m_iconQuestion;
};
inline WidgetWithStatus::StatusType WidgetWithStatus::status() const {

View file

@ -64,6 +64,7 @@ HEADERS += core/feeddownloader.h \
gui/notifications/notificationseditor.h \
gui/notifications/singlenotificationeditor.h \
gui/reusable/baselineedit.h \
gui/reusable/helpspoiler.h \
gui/reusable/progressbarwithtext.h \
gui/reusable/resizablestackedwidget.h \
gui/settings/settingsnotifications.h \
@ -245,6 +246,7 @@ SOURCES += core/feeddownloader.cpp \
gui/notifications/notificationseditor.cpp \
gui/notifications/singlenotificationeditor.cpp \
gui/reusable/baselineedit.cpp \
gui/reusable/helpspoiler.cpp \
gui/reusable/progressbarwithtext.cpp \
gui/reusable/resizablestackedwidget.cpp \
gui/settings/settingsnotifications.cpp \

View file

@ -29,8 +29,6 @@ GreaderAccountDetails::GreaderAccountDetails(QWidget* parent) : QWidget(parent),
m_ui.m_dateNewerThan->setMinimumDate(QDate(2000, 1, 1));
m_ui.m_dateNewerThan->setMaximumDate(QDate::currentDate());
//m_ui.m_dateNewerThan->setDate(QDate::currentDate().addYears(-1));
m_ui.m_dateNewerThan->setDisplayFormat(qApp->localization()->loadedLocale().dateFormat());
m_ui.m_lblTestResult->label()->setWordWrap(true);
@ -42,33 +40,31 @@ GreaderAccountDetails::GreaderAccountDetails(QWidget* parent) : QWidget(parent),
tr("No test done yet."),
tr("Here, results of connection test are shown."));
m_ui.m_lblLimitMessages->setText(tr("Some feeds might contain tens of thousands of articles "
m_ui.m_lblLimitMessages->setHelpText(tr("Some feeds might contain tens of thousands of articles "
"and downloading all of them could take great amount of time, "
"so sometimes it is good to download "
"only certain amount of newest messages."));
"only certain amount of newest messages."),
true);
GuiUtilities::setLabelAsNotice(*m_ui.m_lblLimitMessages, true);
m_ui.m_lblNewAlgorithm->setText(tr("If you select intelligent synchronization, then only not-yet-fetched "
m_ui.m_lblNewAlgorithm->setHelpText(tr("If you select intelligent synchronization, then only not-yet-fetched "
"or updated articles are downloaded. Network usage is greatly reduced and "
"overall synchronization speed is greatly improved, but "
"first feed fetching could be slow anyway if your feed contains "
"huge number of articles."));
GuiUtilities::setLabelAsNotice(*m_ui.m_lblNewAlgorithm, false);
"huge number of articles."),
false);
#if defined(INOREADER_OFFICIAL_SUPPORT)
m_ui.m_lblInfo->setText(tr("There are some preconfigured OAuth tokens so you do not have to fill in your "
m_ui.m_lblInfo->setHelpText(tr("There are some preconfigured OAuth tokens so you do not have to fill in your "
"client ID/secret, but it is strongly recommended to obtain your "
"own as preconfigured tokens have limited global usage quota. If you wish "
"to use preconfigured tokens, simply leave all above fields to their default values even "
"if they are empty."));
"if they are empty."),
true);
#else
m_ui.m_lblInfo->setText(tr("You have to fill in your client ID/secret and also fill in correct redirect URL."));
m_ui.m_lblInfo->setHelpText(tr("You have to fill in your client ID/secret and also fill in correct redirect URL."),
true);
#endif
GuiUtilities::setLabelAsNotice(*m_ui.m_lblInfo, true);
connect(m_ui.m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onPasswordChanged);
connect(m_ui.m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUsernameChanged);
connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUrlChanged);

View file

@ -250,20 +250,7 @@
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="m_lblInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblInfo" native="true"/>
</item>
</layout>
</widget>
@ -292,9 +279,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
</widget>
</item>
</layout>
@ -313,18 +297,10 @@
</spacer>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="m_lblLimitMessages">
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblLimitMessages" native="true"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="m_lblNewAlgorithm">
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="HelpSpoiler" name="m_lblNewAlgorithm" native="true"/>
</item>
</layout>
</widget>
@ -352,6 +328,12 @@
<header>resizablestackedwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>HelpSpoiler</class>
<extends>QWidget</extends>
<header>helpspoiler.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_cmbService</tabstop>