add automatic downscaling to prevent horizontal scrollbar for no-web-engine article viewer
This commit is contained in:
parent
58b567e82d
commit
6fc0bdd988
@ -17,7 +17,7 @@ RSS Guard is a simple RSS/ATOM feed reader for Windows, Linux, BSD, OS/2 or macO
|
|||||||
* [Nextcloud News](https://apps.nextcloud.com/apps/news)
|
* [Nextcloud News](https://apps.nextcloud.com/apps/news)
|
||||||
* [Tiny Tiny RSS](https://tt-rss.org)
|
* [Tiny Tiny RSS](https://tt-rss.org)
|
||||||
|
|
||||||
RSS Guard is also podcast player as it can play everything via its built-in `mpv-based` media player.
|
RSS Guard is also podcast player as it can play everything via its built-in `mpv`-based (or `ffmpeg`-based) media player.
|
||||||
|
|
||||||
![RSS Guard](resources/graphics/official_pictures/main-window-linux.png)
|
![RSS Guard](resources/graphics/official_pictures/main-window-linux.png)
|
||||||
|
|
||||||
|
@ -85,11 +85,14 @@ LibMpvBackend::LibMpvBackend(Application* app, QWidget* parent)
|
|||||||
mpv_set_option_string(m_mpvHandle, "save-position-on-quit", "no");
|
mpv_set_option_string(m_mpvHandle, "save-position-on-quit", "no");
|
||||||
mpv_set_option_string(m_mpvHandle, "no-resume-playback", "yes");
|
mpv_set_option_string(m_mpvHandle, "no-resume-playback", "yes");
|
||||||
|
|
||||||
|
#if !defined(NDEBUG)
|
||||||
|
mpv_set_option_string(m_mpvHandle, "terminal", "yes");
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// NOTE: Just random options for testing here.
|
// NOTE: Just random options for testing here.
|
||||||
//
|
//
|
||||||
// mpv_set_option_string(m_mpvHandle, "keep-open", "no");
|
// mpv_set_option_string(m_mpvHandle, "keep-open", "no");
|
||||||
// mpv_set_option_string(m_mpvHandle, "terminal", "yes");
|
|
||||||
// mpv_set_option_string(m_mpvHandle, "osd-italic", "yes");
|
// mpv_set_option_string(m_mpvHandle, "osd-italic", "yes");
|
||||||
// mpv_set_option_string(m_mpvHandle, "osd-color", "1.0/0.0/0.0");
|
// mpv_set_option_string(m_mpvHandle, "osd-color", "1.0/0.0/0.0");
|
||||||
// mpv_set_option_string(m_mpvHandle, "watch-later-dir", "mpv");
|
// mpv_set_option_string(m_mpvHandle, "watch-later-dir", "mpv");
|
||||||
|
@ -35,8 +35,10 @@ void SettingsMediaPlayer::loadSettings() {
|
|||||||
|
|
||||||
m_ui.m_gbMpvCustomConfigFolder
|
m_ui.m_gbMpvCustomConfigFolder
|
||||||
->setChecked(settings()->value(GROUP(VideoPlayer), SETTING(VideoPlayer::MpvUseCustomConfigFolder)).toBool());
|
->setChecked(settings()->value(GROUP(VideoPlayer), SETTING(VideoPlayer::MpvUseCustomConfigFolder)).toBool());
|
||||||
m_ui.m_txtMpvConfigFolder
|
m_ui.m_txtMpvConfigFolder->setText(QDir::toNativeSeparators(settings()
|
||||||
->setText(settings()->value(GROUP(VideoPlayer), SETTING(VideoPlayer::MpvCustomConfigFolder)).toString());
|
->value(GROUP(VideoPlayer),
|
||||||
|
SETTING(VideoPlayer::MpvCustomConfigFolder))
|
||||||
|
.toString()));
|
||||||
#elif defined(ENABLE_MEDIAPLAYER_QTMULTIMEDIA)
|
#elif defined(ENABLE_MEDIAPLAYER_QTMULTIMEDIA)
|
||||||
m_ui.m_txtBackend->setText(QSL("QtMultimedia"));
|
m_ui.m_txtBackend->setText(QSL("QtMultimedia"));
|
||||||
m_ui.m_helpInfo->setHelpText(tr("You use lightweight QtMultimedia-based media player backend. If some videos do not "
|
m_ui.m_helpInfo->setHelpText(tr("You use lightweight QtMultimedia-based media player backend. If some videos do not "
|
||||||
|
@ -69,13 +69,25 @@ QVariant TextBrowserViewer::loadOneResource(int type, const QUrl& name) {
|
|||||||
|
|
||||||
// Resources are enabled and we already have the resource.
|
// Resources are enabled and we already have the resource.
|
||||||
QByteArray resource_data = m_loadedResources.value(resolved_name);
|
QByteArray resource_data = m_loadedResources.value(resolved_name);
|
||||||
|
QImage img;
|
||||||
|
|
||||||
if (resource_data.isEmpty()) {
|
if (resource_data.isEmpty()) {
|
||||||
return m_placeholderImageError;
|
img = m_placeholderImageError.toImage();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return QImage::fromData(m_loadedResources.value(resolved_name));
|
img = QImage::fromData(m_loadedResources.value(resolved_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int acceptable_width = int(width() * 0.9);
|
||||||
|
|
||||||
|
if (img.width() > acceptable_width) {
|
||||||
|
qWarningNN << LOGSEC_GUI << "Picture" << QUOTE_W_SPACE(name)
|
||||||
|
<< "is too wide, down-scaling to prevent horizontal scrollbars.";
|
||||||
|
|
||||||
|
img = img.scaledToWidth(acceptable_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBrowserViewer::bindToBrowser(WebBrowser* browser) {
|
void TextBrowserViewer::bindToBrowser(WebBrowser* browser) {
|
||||||
@ -202,6 +214,9 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r
|
|||||||
int found_width = exp_match.captured(1).toInt();
|
int found_width = exp_match.captured(1).toInt();
|
||||||
|
|
||||||
if (found_width > acceptable_width) {
|
if (found_width > acceptable_width) {
|
||||||
|
qWarningNN << LOGSEC_GUI << "Element" << QUOTE_W_SPACE(exp_match.captured())
|
||||||
|
<< "is too wide, setting smaller value to prevent horizontal scrollbars.";
|
||||||
|
|
||||||
html_messages.m_html = html_messages.m_html.replace(exp_match.capturedStart(1),
|
html_messages.m_html = html_messages.m_html.replace(exp_match.capturedStart(1),
|
||||||
exp_match.capturedLength(1),
|
exp_match.capturedLength(1),
|
||||||
QString::number(acceptable_width));
|
QString::number(acceptable_width));
|
||||||
@ -215,11 +230,9 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r
|
|||||||
|
|
||||||
html_messages.m_html = html_messages.m_html.replace(exp_symbols, QString());
|
html_messages.m_html = html_messages.m_html.replace(exp_symbols, QString());
|
||||||
|
|
||||||
/*
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
IOFactory::writeFile("aaa.html", html_messages.m_html.toUtf8());
|
// IOFactory::writeFile("aaa.html", html_messages.m_html.toUtf8());
|
||||||
#endif
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
setHtml(html_messages.m_html, html_messages.m_baseUrl);
|
setHtml(html_messages.m_html, html_messages.m_baseUrl);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user