LibWebView: Add language settings to about:settings

This implements a setting to change the languages provided to websites
from `navigator.language(s)` and the `Accept-Language` header. Whereas
the existing Qt settings dialog allows users to type their language of
choice, this setting allows users to select from a predefined list of
languages. They may choose any number of languages and their preferred
order.

This patch only implements the persisted settings and their UI. It does
not integrate the choses languages into the WebContent process.
This commit is contained in:
Timothy Flynn 2025-04-03 13:42:39 -04:00 committed by Jelle Raaijmakers
commit f242920cc9
Notes: github-actions[bot] 2025-04-04 08:17:38 +00:00
8 changed files with 466 additions and 13 deletions

View file

@ -35,6 +35,7 @@ public:
virtual ~SettingsObserver();
virtual void new_tab_page_url_changed() { }
virtual void languages_changed() { }
virtual void search_engine_changed() { }
virtual void autocomplete_engine_changed() { }
virtual void autoplay_settings_changed() { }
@ -52,6 +53,10 @@ public:
URL::URL const& new_tab_page_url() const { return m_new_tab_page_url; }
void set_new_tab_page_url(URL::URL);
static Vector<String> parse_json_languages(JsonValue const&);
Vector<String> const& languages() const { return m_languages; }
void set_languages(Vector<String>);
Optional<SearchEngine> const& search_engine() const { return m_search_engine; }
void set_search_engine(Optional<StringView> search_engine_name);
@ -78,6 +83,7 @@ private:
ByteString m_settings_path;
URL::URL m_new_tab_page_url;
Vector<String> m_languages;
Optional<SearchEngine> m_search_engine;
Optional<AutocompleteEngine> m_autocomplete_engine;
SiteSetting m_autoplay;