Skip to content

Commit

Permalink
enable kind-of-fullscreen when media HTML5 element requests it
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrotter committed Feb 7, 2025
1 parent 2e0288d commit 79a4e7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/librssguard/gui/webbrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class RSSGUARD_DLLSPEC WebBrowser : public TabContent {

signals:
void windowCloseRequested();

void iconChanged(int index, const QIcon& icon);
void titleChanged(int index, const QString& title);

Expand Down
14 changes: 10 additions & 4 deletions src/librssguard/gui/webviewers/webengine/webengineviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ WebEngineViewer::WebEngineViewer(QWidget* parent) : QWebEngineView(parent), m_br
WebEnginePage* page = new WebEnginePage(this);

setPage(page);

connect(page, &WebEnginePage::fullScreenRequested, this, &WebEngineViewer::onFullScreenRequested);
}

bool WebEngineViewer::event(QEvent* event) {
Expand All @@ -48,6 +50,10 @@ bool WebEngineViewer::event(QEvent* event) {
return QWebEngineView::event(event);
}

void WebEngineViewer::onFullScreenRequested(QWebEngineFullScreenRequest request) {
request.accept();
}

WebEnginePage* WebEngineViewer::page() const {
return qobject_cast<WebEnginePage*>(QWebEngineView::page());
}
Expand Down Expand Up @@ -178,10 +184,10 @@ void WebEngineViewer::setVerticalScrollBarPosition(double pos) {
void WebEngineViewer::applyFont(const QFont& fon) {
auto pixel_size = QFontMetrics(fon).ascent();

qApp->web()->engineProfile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::StandardFont, fon.family());
qApp->web()->engineProfile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::SerifFont, fon.family());
qApp->web()->engineProfile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::SansSerifFont, fon.family());
qApp->web()->engineProfile()->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, pixel_size);
page()->profile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::StandardFont, fon.family());
page()->profile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::SerifFont, fon.family());
page()->profile()->settings()->setFontFamily(QWebEngineSettings::FontFamily::SansSerifFont, fon.family());
page()->profile()->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, pixel_size);
}

qreal WebEngineViewer::zoomFactor() const {
Expand Down
2 changes: 2 additions & 0 deletions src/librssguard/gui/webviewers/webengine/webengineviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "miscellaneous/externaltool.h"
#include "network-web/webengine/webenginepage.h"

#include <QWebEngineFullScreenRequest>
#include <QWebEngineView>

class RootItem;
Expand Down Expand Up @@ -57,6 +58,7 @@ class RSSGUARD_DLLSPEC WebEngineViewer : public QWebEngineView, public WebViewer
virtual bool event(QEvent* event);

private slots:
void onFullScreenRequested(QWebEngineFullScreenRequest request);
void openUrlWithExternalTool(ExternalTool tool, const QString& target_url);

private:
Expand Down

0 comments on commit 79a4e7c

Please sign in to comment.