mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
LibWebView+WebContent+UI: Migrate to the new autoplay settings
This removes the old autoplay allowlist file in favor of the new site setting. We still support the command-line flag to enable autoplay globally, as this is needed for WPT.
This commit is contained in:
parent
223b04f087
commit
ed265b568d
Notes:
github-actions[bot]
2025-03-30 15:20:08 +00:00
Author: https://github.com/trflynn89
Commit: ed265b568d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4146
Reviewed-by: https://github.com/tcl3 ✅
20 changed files with 17 additions and 137 deletions
|
@ -104,12 +104,6 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, IsPopupWindow
|
|||
});
|
||||
});
|
||||
|
||||
QObject::connect(Settings::the(), &Settings::enable_autoplay_changed, this, [this](bool enable) {
|
||||
for_each_tab([enable](auto& tab) {
|
||||
tab.set_enable_autoplay(enable);
|
||||
});
|
||||
});
|
||||
|
||||
QObject::connect(Settings::the(), &Settings::preferred_languages_changed, this, [this](QStringList languages) {
|
||||
Vector<String> preferred_languages;
|
||||
preferred_languages.ensure_capacity(languages.length());
|
||||
|
@ -881,7 +875,6 @@ void BrowserWindow::initialize_tab(Tab* tab)
|
|||
tab->set_preferred_languages(preferred_languages);
|
||||
tab->set_navigator_compatibility_mode(navigator_compatibility_mode());
|
||||
tab->set_enable_do_not_track(Settings::the()->enable_do_not_track());
|
||||
tab->set_enable_autoplay(WebView::Application::web_content_options().enable_autoplay == WebView::EnableAutoplay::Yes || Settings::the()->enable_autoplay());
|
||||
tab->view().set_preferred_color_scheme(m_preferred_color_scheme);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,17 +100,6 @@ void Settings::set_enable_do_not_track(bool enable)
|
|||
emit enable_do_not_track_changed(enable);
|
||||
}
|
||||
|
||||
bool Settings::enable_autoplay()
|
||||
{
|
||||
return m_qsettings->value("enable_autoplay", false).toBool();
|
||||
}
|
||||
|
||||
void Settings::set_enable_autoplay(bool enable)
|
||||
{
|
||||
m_qsettings->setValue("enable_autoplay", enable);
|
||||
emit enable_autoplay_changed(enable);
|
||||
}
|
||||
|
||||
bool Settings::show_menubar()
|
||||
{
|
||||
return m_qsettings->value("show_menubar", false).toBool();
|
||||
|
|
|
@ -57,9 +57,6 @@ public:
|
|||
bool enable_do_not_track();
|
||||
void set_enable_do_not_track(bool enable);
|
||||
|
||||
bool enable_autoplay();
|
||||
void set_enable_autoplay(bool enable);
|
||||
|
||||
bool show_menubar();
|
||||
void set_show_menubar(bool show_menubar);
|
||||
|
||||
|
@ -67,7 +64,6 @@ signals:
|
|||
void show_menubar_changed(bool show_menubar);
|
||||
void preferred_languages_changed(QStringList const& languages);
|
||||
void enable_do_not_track_changed(bool enable);
|
||||
void enable_autoplay_changed(bool enable);
|
||||
|
||||
protected:
|
||||
Settings();
|
||||
|
|
|
@ -49,28 +49,12 @@ SettingsDialog::SettingsDialog(QMainWindow* window)
|
|||
Settings::the()->set_enable_do_not_track(state == Qt::Checked);
|
||||
});
|
||||
|
||||
m_enable_autoplay = new QCheckBox(this);
|
||||
if (WebView::Application::web_content_options().enable_autoplay == WebView::EnableAutoplay::Yes) {
|
||||
m_enable_autoplay->setChecked(true);
|
||||
} else {
|
||||
m_enable_autoplay->setChecked(Settings::the()->enable_autoplay());
|
||||
}
|
||||
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(6, 7, 0))
|
||||
QObject::connect(m_enable_autoplay, &QCheckBox::checkStateChanged, this, [&](int state) {
|
||||
#else
|
||||
QObject::connect(m_enable_autoplay, &QCheckBox::stateChanged, this, [&](int state) {
|
||||
#endif
|
||||
Settings::the()->set_enable_autoplay(state == Qt::Checked);
|
||||
});
|
||||
|
||||
setup_autocomplete_engine();
|
||||
|
||||
m_layout->addRow(new QLabel("Preferred Language(s)", this), m_preferred_languages);
|
||||
m_layout->addRow(new QLabel("Enable Autocomplete", this), m_enable_autocomplete);
|
||||
m_layout->addRow(new QLabel("Autocomplete Engine", this), m_autocomplete_engine_dropdown);
|
||||
m_layout->addRow(new QLabel("Send web sites a \"Do Not Track\" request", this), m_enable_do_not_track);
|
||||
m_layout->addRow(new QLabel("Enable autoplay on all websites", this), m_enable_autoplay);
|
||||
|
||||
setWindowTitle("Settings");
|
||||
setLayout(m_layout);
|
||||
|
|
|
@ -31,7 +31,6 @@ private:
|
|||
QCheckBox* m_enable_autocomplete { nullptr };
|
||||
QPushButton* m_autocomplete_engine_dropdown { nullptr };
|
||||
QCheckBox* m_enable_do_not_track { nullptr };
|
||||
QCheckBox* m_enable_autoplay { nullptr };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -948,9 +948,4 @@ void Tab::set_enable_do_not_track(bool enable)
|
|||
m_view->set_enable_do_not_track(enable);
|
||||
}
|
||||
|
||||
void Tab::set_enable_autoplay(bool enable)
|
||||
{
|
||||
m_view->set_enable_autoplay(enable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,8 +92,6 @@ public:
|
|||
|
||||
void set_enable_do_not_track(bool);
|
||||
|
||||
void set_enable_autoplay(bool);
|
||||
|
||||
bool url_is_hidden() const { return m_location_edit->url_is_hidden(); }
|
||||
void set_url_is_hidden(bool url_is_hidden) { m_location_edit->set_url_is_hidden(url_is_hidden); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue