1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

Ladybird: Move Qt-specific classes and functions to a Qt subdirectory

This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
This commit is contained in:
Andrew Kaster 2023-08-05 10:42:26 -06:00 committed by Andrew Kaster
parent ccaa423372
commit 391beef707
53 changed files with 160 additions and 157 deletions

47
Ladybird/Qt/Settings.cpp Normal file
View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "Settings.h"
#include "StringUtils.h"
#include <AK/URL.h>
#include <BrowserSettings/Defaults.h>
#include <Ladybird/Utilities.h>
namespace Ladybird {
static QString rebase_default_url_on_serenity_resource_root(StringView default_url)
{
URL url { default_url };
Vector<DeprecatedString> paths;
for (auto segment : s_serenity_resource_root.split('/'))
paths.append(move(segment));
for (size_t i = 0; i < url.path_segment_count(); ++i)
paths.append(url.path_segment_at_index(i));
url.set_paths(move(paths));
return qstring_from_ak_deprecated_string(url.to_deprecated_string());
}
Settings::Settings()
{
m_qsettings = new QSettings("Serenity", "Ladybird", this);
}
QString Settings::new_tab_page()
{
static auto const default_new_tab_url = rebase_default_url_on_serenity_resource_root(Browser::default_new_tab_url);
return m_qsettings->value("new_tab_page", default_new_tab_url).toString();
}
void Settings::set_new_tab_page(QString const& page)
{
m_qsettings->setValue("new_tab_page", page);
}
}