mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-27 07:46:17 +01:00
simple article layout in litehtml persistent
This commit is contained in:
parent
e3096aee4f
commit
c4bf8f24b5
@ -24,7 +24,8 @@
|
|||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
|
||||||
LiteHtmlViewer::LiteHtmlViewer(QWidget* parent) : QLiteHtmlWidget(parent), m_downloader(new Downloader(this)),
|
LiteHtmlViewer::LiteHtmlViewer(QWidget* parent) : QLiteHtmlWidget(parent), m_downloader(new Downloader(this)),
|
||||||
m_reloadingWithImages(false), m_useSimpleArticleLayout(false) {
|
m_reloadingWithImages(false),
|
||||||
|
m_useSimpleArticleLayout(qApp->settings()->value(GROUP(Messages), SETTING(Messages::SimpleArticleLayout)).toBool()) {
|
||||||
setResourceHandler([this](const QUrl& url) {
|
setResourceHandler([this](const QUrl& url) {
|
||||||
emit loadProgress(-1);
|
emit loadProgress(-1);
|
||||||
return m_reloadingWithImages ? handleResource(url) : QByteArray{};
|
return m_reloadingWithImages ? handleResource(url) : QByteArray{};
|
||||||
@ -155,12 +156,13 @@ QPair<QString, QUrl> LiteHtmlViewer::prepareHtmlForMessage(const QList<Message>&
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::DisplayImagePlaceholders)).toBool()) {
|
/*if (qApp->settings()->value(GROUP(Messages), SETTING(Messages::DisplayImagePlaceholders)).toBool()) {
|
||||||
html += message.m_contents;
|
html += message.m_contents;
|
||||||
}
|
}
|
||||||
else {*/
|
else {*/
|
||||||
QString cnts = message.m_contents;
|
QString cnts = message.m_contents;
|
||||||
|
|
||||||
|
html += cnts.replace(imgTagRegex, QString());
|
||||||
|
|
||||||
html += cnts.replace(imgTagRegex, QString());
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
html += pictures_html;
|
html += pictures_html;
|
||||||
@ -216,6 +218,8 @@ void LiteHtmlViewer::setZoomFactor(qreal zoom_factor) {
|
|||||||
|
|
||||||
void LiteHtmlViewer::simpleLayoutChanged(bool activated) {
|
void LiteHtmlViewer::simpleLayoutChanged(bool activated) {
|
||||||
m_useSimpleArticleLayout = activated;
|
m_useSimpleArticleLayout = activated;
|
||||||
|
|
||||||
|
qApp->settings()->setValue(GROUP(Messages), Messages::SimpleArticleLayout, activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiteHtmlViewer::selectedTextChanged(bool available) {
|
void LiteHtmlViewer::selectedTextChanged(bool available) {
|
||||||
@ -295,6 +299,7 @@ void LiteHtmlViewer::showContextMenu(const QPoint& pos, const QUrl& url) {
|
|||||||
tr("Use simple article layout"),
|
tr("Use simple article layout"),
|
||||||
this));
|
this));
|
||||||
m_actionSimpleLayout->setCheckable(true);
|
m_actionSimpleLayout->setCheckable(true);
|
||||||
|
m_actionSimpleLayout->setChecked(m_useSimpleArticleLayout);
|
||||||
|
|
||||||
m_actionReloadWithImages.reset(new QAction(qApp->icons()->fromTheme(QSL("viewimage"), QSL("view-refresh")),
|
m_actionReloadWithImages.reset(new QAction(qApp->icons()->fromTheme(QSL("viewimage"), QSL("view-refresh")),
|
||||||
tr("Reload with images"),
|
tr("Reload with images"),
|
||||||
|
@ -120,6 +120,9 @@ DVALUE(bool) Messages::EnableMessagePreviewDef = true;
|
|||||||
DKEY Messages::Zoom = "zoom";
|
DKEY Messages::Zoom = "zoom";
|
||||||
DVALUE(qreal) Messages::ZoomDef = double(1.0);
|
DVALUE(qreal) Messages::ZoomDef = double(1.0);
|
||||||
|
|
||||||
|
DKEY Messages::SimpleArticleLayout = "simple_article_layout";
|
||||||
|
DVALUE(bool) Messages::SimpleArticleLayoutDef = false;
|
||||||
|
|
||||||
DKEY Messages::FixupFutureArticleDateTimes = "fixup_future_datetimes";
|
DKEY Messages::FixupFutureArticleDateTimes = "fixup_future_datetimes";
|
||||||
DVALUE(bool) Messages::FixupFutureArticleDateTimesDef = false;
|
DVALUE(bool) Messages::FixupFutureArticleDateTimesDef = false;
|
||||||
|
|
||||||
|
@ -127,6 +127,9 @@ namespace Messages {
|
|||||||
KEY Zoom;
|
KEY Zoom;
|
||||||
VALUE(qreal) ZoomDef;
|
VALUE(qreal) ZoomDef;
|
||||||
|
|
||||||
|
KEY SimpleArticleLayout;
|
||||||
|
VALUE(bool) SimpleArticleLayoutDef;
|
||||||
|
|
||||||
KEY FixupFutureArticleDateTimes;
|
KEY FixupFutureArticleDateTimes;
|
||||||
VALUE(bool) FixupFutureArticleDateTimesDef;
|
VALUE(bool) FixupFutureArticleDateTimesDef;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user