2022-07-14 03:41:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
2023-05-31 01:44:16 +00:00
|
|
|
* Copyright (c) 2023, Cameron Youell <cameronyouell@gmail.com>
|
2024-07-02 19:31:14 +00:00
|
|
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
2022-07-14 03:41:13 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
#include <AK/ByteString.h>
|
2023-05-29 09:05:30 +00:00
|
|
|
#include <AK/OwnPtr.h>
|
2023-10-19 20:08:31 +00:00
|
|
|
#include <LibWebView/SearchEngine.h>
|
2023-08-09 10:23:32 +00:00
|
|
|
#include <QPoint>
|
2022-07-14 03:41:13 +00:00
|
|
|
#include <QSettings>
|
2023-08-09 10:23:32 +00:00
|
|
|
#include <QSize>
|
2022-07-14 03:41:13 +00:00
|
|
|
|
2023-08-02 17:52:59 +00:00
|
|
|
namespace Ladybird {
|
2022-07-14 03:41:13 +00:00
|
|
|
|
2023-01-20 23:30:05 +00:00
|
|
|
class Settings : public QObject {
|
2024-05-05 15:11:51 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2022-07-14 03:41:13 +00:00
|
|
|
public:
|
2023-05-29 09:05:30 +00:00
|
|
|
Settings(Settings const&) = delete;
|
|
|
|
Settings& operator=(Settings const&) = delete;
|
|
|
|
|
|
|
|
static Settings* the()
|
|
|
|
{
|
|
|
|
static Settings instance;
|
|
|
|
return &instance;
|
|
|
|
}
|
2022-07-14 03:41:13 +00:00
|
|
|
|
2024-07-15 19:50:51 +00:00
|
|
|
ByteString directory();
|
|
|
|
|
2023-08-09 10:23:32 +00:00
|
|
|
Optional<QPoint> last_position();
|
|
|
|
void set_last_position(QPoint const& last_position);
|
|
|
|
|
|
|
|
QSize last_size();
|
|
|
|
void set_last_size(QSize const& last_size);
|
|
|
|
|
|
|
|
bool is_maximized();
|
|
|
|
void set_is_maximized(bool is_maximized);
|
|
|
|
|
2023-01-20 23:30:05 +00:00
|
|
|
QString new_tab_page();
|
|
|
|
void set_new_tab_page(QString const& page);
|
|
|
|
|
2023-10-19 20:08:31 +00:00
|
|
|
WebView::SearchEngine search_engine() const { return m_search_engine; }
|
|
|
|
void set_search_engine(WebView::SearchEngine engine);
|
|
|
|
|
2024-07-23 20:11:47 +00:00
|
|
|
QStringList preferred_languages();
|
|
|
|
void set_preferred_languages(QStringList const& languages);
|
|
|
|
|
2023-05-31 01:44:16 +00:00
|
|
|
struct EngineProvider {
|
|
|
|
QString name;
|
|
|
|
QString url;
|
|
|
|
};
|
|
|
|
|
|
|
|
EngineProvider autocomplete_engine();
|
|
|
|
void set_autocomplete_engine(EngineProvider const& engine);
|
|
|
|
|
|
|
|
bool enable_autocomplete();
|
|
|
|
void set_enable_autocomplete(bool enable);
|
|
|
|
|
|
|
|
bool enable_search();
|
|
|
|
void set_enable_search(bool enable);
|
|
|
|
|
2024-07-02 19:31:14 +00:00
|
|
|
bool enable_do_not_track();
|
|
|
|
void set_enable_do_not_track(bool enable);
|
|
|
|
|
2024-09-22 22:12:36 +00:00
|
|
|
bool enable_autoplay();
|
|
|
|
void set_enable_autoplay(bool enable);
|
|
|
|
|
2024-05-05 15:11:51 +00:00
|
|
|
bool show_menubar();
|
|
|
|
void set_show_menubar(bool show_menubar);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void show_menubar_changed(bool show_menubar);
|
2024-06-12 02:24:39 +00:00
|
|
|
void enable_search_changed(bool enable);
|
|
|
|
void search_engine_changed(WebView::SearchEngine engine);
|
2024-07-23 20:11:47 +00:00
|
|
|
void preferred_languages_changed(QStringList const& languages);
|
2024-07-02 19:31:14 +00:00
|
|
|
void enable_do_not_track_changed(bool enable);
|
2024-09-22 22:12:36 +00:00
|
|
|
void enable_autoplay_changed(bool enable);
|
2024-05-05 15:11:51 +00:00
|
|
|
|
2023-05-29 09:05:30 +00:00
|
|
|
protected:
|
|
|
|
Settings();
|
|
|
|
|
2022-07-14 03:41:13 +00:00
|
|
|
private:
|
2023-05-29 09:05:30 +00:00
|
|
|
OwnPtr<QSettings> m_qsettings;
|
2023-10-19 20:08:31 +00:00
|
|
|
WebView::SearchEngine m_search_engine;
|
2022-07-14 03:41:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|