mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-27 07:46:17 +01:00
bit of refactoring
This commit is contained in:
parent
0bb4d62545
commit
82bde2d087
@ -26,7 +26,7 @@
|
|||||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
<release version="4.2.1" date="2022-04-01"/>
|
<release version="4.2.1" date="2022-04-04"/>
|
||||||
</releases>
|
</releases>
|
||||||
<content_rating type="oars-1.0">
|
<content_rating type="oars-1.0">
|
||||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||||
|
@ -91,13 +91,7 @@ void WebBrowser::setHtml(const QString& html, const QUrl& base_url) {
|
|||||||
m_webView->setHtml(html, base_url);
|
m_webView->setHtml(html, base_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebBrowser::~WebBrowser() {
|
WebBrowser::~WebBrowser() {}
|
||||||
//m_toolBar->removeAction(m_txtLocationAction);
|
|
||||||
//m_toolBar->removeAction(m_btnDiscoverFeedsAction);
|
|
||||||
|
|
||||||
// Delete members. Do not use scoped pointers here.
|
|
||||||
//delete m_layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
double WebBrowser::verticalScrollBarPosition() const {
|
double WebBrowser::verticalScrollBarPosition() const {
|
||||||
return m_webView->verticalScrollBarPosition();
|
return m_webView->verticalScrollBarPosition();
|
||||||
@ -284,9 +278,9 @@ void WebBrowser::initializeLayout() {
|
|||||||
m_actionOpenInSystemBrowser->setEnabled(false);
|
m_actionOpenInSystemBrowser->setEnabled(false);
|
||||||
m_actionReadabilePage->setEnabled(false);
|
m_actionReadabilePage->setEnabled(false);
|
||||||
|
|
||||||
m_btnDiscoverFeedsAction->setDefaultWidget(new QWidget(this));
|
//m_btnDiscoverFeedsAction->setDefaultWidget(new QWidget(this));
|
||||||
|
|
||||||
//m_btnDiscoverFeedsAction->setDefaultWidget(m_btnDiscoverFeeds);
|
m_btnDiscoverFeedsAction->setDefaultWidget(m_btnDiscoverFeeds);
|
||||||
|
|
||||||
// Add needed actions into toolbar.
|
// Add needed actions into toolbar.
|
||||||
m_toolBar->addAction(m_actionBack);
|
m_toolBar->addAction(m_actionBack);
|
||||||
@ -296,8 +290,8 @@ void WebBrowser::initializeLayout() {
|
|||||||
m_toolBar->addAction(m_actionOpenInSystemBrowser);
|
m_toolBar->addAction(m_actionOpenInSystemBrowser);
|
||||||
m_toolBar->addAction(m_actionReadabilePage);
|
m_toolBar->addAction(m_actionReadabilePage);
|
||||||
|
|
||||||
//m_toolBar->addAction(m_btnDiscoverFeedsAction);
|
m_toolBar->addAction(m_btnDiscoverFeedsAction);
|
||||||
//m_txtLocationAction = m_toolBar->addWidget(m_txtLocation);
|
m_txtLocationAction = m_toolBar->addWidget(m_txtLocation);
|
||||||
|
|
||||||
m_loadingProgress = new QProgressBar(this);
|
m_loadingProgress = new QProgressBar(this);
|
||||||
m_loadingProgress->setFixedHeight(10);
|
m_loadingProgress->setFixedHeight(10);
|
||||||
|
@ -150,29 +150,13 @@ void LiteHtmlViewer::applyFont(const QFont& fon) {
|
|||||||
QLiteHtmlWidget::setDefaultFont(fon);
|
QLiteHtmlWidget::setDefaultFont(fon);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LiteHtmlViewer::canZoomIn() const {
|
|
||||||
return zoomFactor() <= double(MAX_ZOOM_FACTOR) - double(ZOOM_FACTOR_STEP);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LiteHtmlViewer::canZoomOut() const {
|
|
||||||
return zoomFactor() >= double(MIN_ZOOM_FACTOR) + double(ZOOM_FACTOR_STEP);
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal LiteHtmlViewer::zoomFactor() const {
|
qreal LiteHtmlViewer::zoomFactor() const {
|
||||||
return QLiteHtmlWidget::zoomFactor();
|
return QLiteHtmlWidget::zoomFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiteHtmlViewer::zoomIn() {
|
|
||||||
setZoomFactor(zoomFactor() + double(ZOOM_FACTOR_STEP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void LiteHtmlViewer::zoomOut() {
|
|
||||||
setZoomFactor(zoomFactor() - double(ZOOM_FACTOR_STEP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void LiteHtmlViewer::setZoomFactor(qreal zoom_factor) {
|
void LiteHtmlViewer::setZoomFactor(qreal zoom_factor) {
|
||||||
if (zoom_factor == 0.0) {
|
if (zoom_factor == 0.0) {
|
||||||
QLiteHtmlWidget::setZoomFactor(0.1);
|
QLiteHtmlWidget::setZoomFactor(MIN_ZOOM_FACTOR);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QLiteHtmlWidget::setZoomFactor(zoom_factor);
|
QLiteHtmlWidget::setZoomFactor(zoom_factor);
|
||||||
|
@ -30,11 +30,7 @@ class LiteHtmlViewer : public QLiteHtmlWidget, public WebViewer {
|
|||||||
virtual double verticalScrollBarPosition() const;
|
virtual double verticalScrollBarPosition() const;
|
||||||
virtual void setVerticalScrollBarPosition(double pos);
|
virtual void setVerticalScrollBarPosition(double pos);
|
||||||
virtual void applyFont(const QFont& fon);
|
virtual void applyFont(const QFont& fon);
|
||||||
virtual bool canZoomIn() const;
|
|
||||||
virtual bool canZoomOut() const;
|
|
||||||
virtual qreal zoomFactor() const;
|
virtual qreal zoomFactor() const;
|
||||||
virtual void zoomIn();
|
|
||||||
virtual void zoomOut();
|
|
||||||
virtual void setZoomFactor(qreal zoom_factor);
|
virtual void setZoomFactor(qreal zoom_factor);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -221,26 +221,10 @@ void WebEngineViewer::applyFont(const QFont& fon) {
|
|||||||
QWebEngineProfile::defaultProfile()->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, pixel_size);
|
QWebEngineProfile::defaultProfile()->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, pixel_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebEngineViewer::canZoomIn() const {
|
|
||||||
return zoomFactor() <= double(MAX_ZOOM_FACTOR) - double(ZOOM_FACTOR_STEP);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WebEngineViewer::canZoomOut() const {
|
|
||||||
return zoomFactor() >= double(MIN_ZOOM_FACTOR) + double(ZOOM_FACTOR_STEP);
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal WebEngineViewer::zoomFactor() const {
|
qreal WebEngineViewer::zoomFactor() const {
|
||||||
return QWebEngineView::zoomFactor();
|
return QWebEngineView::zoomFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebEngineViewer::zoomIn() {
|
|
||||||
setZoomFactor(zoomFactor() + double(ZOOM_FACTOR_STEP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebEngineViewer::zoomOut() {
|
|
||||||
setZoomFactor(zoomFactor() - double(ZOOM_FACTOR_STEP));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebEngineViewer::setZoomFactor(qreal zoom_factor) {
|
void WebEngineViewer::setZoomFactor(qreal zoom_factor) {
|
||||||
QWebEngineView::setZoomFactor(zoom_factor);
|
QWebEngineView::setZoomFactor(zoom_factor);
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,7 @@ class WebEngineViewer : public QWebEngineView, public WebViewer {
|
|||||||
virtual double verticalScrollBarPosition() const;
|
virtual double verticalScrollBarPosition() const;
|
||||||
virtual void setVerticalScrollBarPosition(double pos);
|
virtual void setVerticalScrollBarPosition(double pos);
|
||||||
virtual void applyFont(const QFont& fon);
|
virtual void applyFont(const QFont& fon);
|
||||||
virtual bool canZoomIn() const;
|
|
||||||
virtual bool canZoomOut() const;
|
|
||||||
virtual qreal zoomFactor() const;
|
virtual qreal zoomFactor() const;
|
||||||
virtual void zoomIn();
|
|
||||||
virtual void zoomOut();
|
|
||||||
virtual void setZoomFactor(qreal zoom_factor);
|
virtual void setZoomFactor(qreal zoom_factor);
|
||||||
virtual QString html() const;
|
virtual QString html() const;
|
||||||
virtual QUrl url() const;
|
virtual QUrl url() const;
|
||||||
|
@ -51,14 +51,30 @@ class WebViewer {
|
|||||||
virtual void applyFont(const QFont& fon) = 0;
|
virtual void applyFont(const QFont& fon) = 0;
|
||||||
|
|
||||||
// Zooming.
|
// Zooming.
|
||||||
virtual bool canZoomIn() const = 0;
|
virtual bool canZoomIn() const;
|
||||||
virtual bool canZoomOut() const = 0;
|
virtual bool canZoomOut() const;
|
||||||
virtual void zoomIn() = 0;
|
virtual void zoomIn();
|
||||||
virtual void zoomOut() = 0;
|
virtual void zoomOut();
|
||||||
virtual qreal zoomFactor() const = 0;
|
virtual qreal zoomFactor() const = 0;
|
||||||
virtual void setZoomFactor(qreal zoom_factor) = 0;
|
virtual void setZoomFactor(qreal zoom_factor) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline WebViewer::~WebViewer() {}
|
inline WebViewer::~WebViewer() {}
|
||||||
|
|
||||||
|
inline void WebViewer::zoomIn() {
|
||||||
|
setZoomFactor(zoomFactor() + double(ZOOM_FACTOR_STEP));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void WebViewer::zoomOut() {
|
||||||
|
setZoomFactor(zoomFactor() - double(ZOOM_FACTOR_STEP));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool WebViewer::canZoomIn() const {
|
||||||
|
return zoomFactor() <= double(MAX_ZOOM_FACTOR) - double(ZOOM_FACTOR_STEP);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool WebViewer::canZoomOut() const {
|
||||||
|
return zoomFactor() >= double(MIN_ZOOM_FACTOR) + double(ZOOM_FACTOR_STEP);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // WEBVIEWER_H
|
#endif // WEBVIEWER_H
|
||||||
|
@ -26,9 +26,9 @@ GmailServiceRoot::GmailServiceRoot(RootItem* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GmailServiceRoot::~GmailServiceRoot() {
|
GmailServiceRoot::~GmailServiceRoot() {
|
||||||
/*if (!m_emailPreview.isNull()) {
|
if (!m_emailPreview.isNull()) {
|
||||||
m_emailPreview->deleteLater();
|
m_emailPreview->deleteLater();
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GmailServiceRoot::updateTitle() {
|
void GmailServiceRoot::updateTitle() {
|
||||||
@ -106,7 +106,7 @@ bool GmailServiceRoot::wantsBaggedIdsOfExistingMessages() const {
|
|||||||
|
|
||||||
CustomMessagePreviewer* GmailServiceRoot::customMessagePreviewer() {
|
CustomMessagePreviewer* GmailServiceRoot::customMessagePreviewer() {
|
||||||
if (m_emailPreview.isNull()) {
|
if (m_emailPreview.isNull()) {
|
||||||
m_emailPreview.reset(new EmailPreviewer());
|
m_emailPreview = new EmailPreviewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_emailPreview.data();
|
return m_emailPreview.data();
|
||||||
|
@ -50,7 +50,7 @@ class GmailServiceRoot : public ServiceRoot, public CacheForServiceRoot {
|
|||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<EmailPreviewer> m_emailPreview;
|
QPointer<EmailPreviewer> m_emailPreview;
|
||||||
GmailNetworkFactory* m_network;
|
GmailNetworkFactory* m_network;
|
||||||
QAction* m_actionReply;
|
QAction* m_actionReply;
|
||||||
Message m_replyToMessage;
|
Message m_replyToMessage;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user