|
@@ -22,7 +22,24 @@
|
|
|
#include <LibSQL/SQLClient.h>
|
|
|
#include <QApplication>
|
|
|
|
|
|
-AK::OwnPtr<Browser::Settings> s_settings;
|
|
|
+namespace Ladybird {
|
|
|
+
|
|
|
+OwnPtr<Ladybird::Settings> s_settings;
|
|
|
+
|
|
|
+bool is_using_dark_system_theme(QWidget& widget)
|
|
|
+{
|
|
|
+ // FIXME: Qt does not provide any method to query if the system is using a dark theme. We will have to implement
|
|
|
+ // platform-specific methods if we wish to have better detection. For now, this inspects if Qt is using a
|
|
|
+ // dark color for widget backgrounds using Rec. 709 luma coefficients.
|
|
|
+ // https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients
|
|
|
+
|
|
|
+ auto color = widget.palette().color(widget.backgroundRole());
|
|
|
+ auto luma = 0.2126f * color.redF() + 0.7152f * color.greenF() + 0.0722f * color.blueF();
|
|
|
+
|
|
|
+ return luma <= 0.5f;
|
|
|
+}
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
static ErrorOr<void> handle_attached_debugger()
|
|
|
{
|
|
@@ -102,8 +119,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
|
|
|
auto cookie_jar = database ? TRY(Browser::CookieJar::create(*database)) : Browser::CookieJar::create();
|
|
|
|
|
|
- s_settings = adopt_own_if_nonnull(new Browser::Settings());
|
|
|
- BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_ast_interpreter ? WebView::UseJavaScriptBytecode::No : WebView::UseJavaScriptBytecode::Yes, use_lagom_networking ? UseLagomNetworking::Yes : UseLagomNetworking::No);
|
|
|
+ Ladybird::s_settings = adopt_own_if_nonnull(new Ladybird::Settings());
|
|
|
+ Ladybird::BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_ast_interpreter ? WebView::UseJavaScriptBytecode::No : WebView::UseJavaScriptBytecode::Yes, use_lagom_networking ? Ladybird::UseLagomNetworking::Yes : Ladybird::UseLagomNetworking::No);
|
|
|
window.setWindowTitle("Ladybird");
|
|
|
window.resize(800, 600);
|
|
|
window.show();
|
|
@@ -116,16 +133,3 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
|
|
|
return event_loop.exec();
|
|
|
}
|
|
|
-
|
|
|
-bool is_using_dark_system_theme(QWidget& widget)
|
|
|
-{
|
|
|
- // FIXME: Qt does not provide any method to query if the system is using a dark theme. We will have to implement
|
|
|
- // platform-specific methods if we wish to have better detection. For now, this inspects if Qt is using a
|
|
|
- // dark color for widget backgrounds using Rec. 709 luma coefficients.
|
|
|
- // https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients
|
|
|
-
|
|
|
- auto color = widget.palette().color(widget.backgroundRole());
|
|
|
- auto luma = 0.2126f * color.redF() + 0.7152f * color.greenF() + 0.0722f * color.blueF();
|
|
|
-
|
|
|
- return luma <= 0.5f;
|
|
|
-}
|