mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 04:35:41 +03: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:
parent
ccaa423372
commit
391beef707
Notes:
sideshowbarker
2024-07-17 08:59:18 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/391beef707 Pull-request: https://github.com/SerenityOS/serenity/pull/20384 Reviewed-by: https://github.com/awesomekling ✅
@ -81,22 +81,23 @@ set(SOURCES
|
|||||||
${BROWSER_SOURCE_DIR}/CookieJar.cpp
|
${BROWSER_SOURCE_DIR}/CookieJar.cpp
|
||||||
${BROWSER_SOURCE_DIR}/Database.cpp
|
${BROWSER_SOURCE_DIR}/Database.cpp
|
||||||
${BROWSER_SOURCE_DIR}/History.cpp
|
${BROWSER_SOURCE_DIR}/History.cpp
|
||||||
BrowserWindow.cpp
|
|
||||||
ConsoleWidget.cpp
|
|
||||||
EventLoopImplementationQt.cpp
|
|
||||||
EventLoopImplementationQtEventTarget.cpp
|
|
||||||
HelperProcess.cpp
|
HelperProcess.cpp
|
||||||
InspectorWidget.cpp
|
|
||||||
LocationEdit.cpp
|
|
||||||
ModelTranslator.cpp
|
|
||||||
Settings.cpp
|
|
||||||
SettingsDialog.cpp
|
|
||||||
Tab.cpp
|
|
||||||
TVGIconEngine.cpp
|
|
||||||
Utilities.cpp
|
Utilities.cpp
|
||||||
WebContentView.cpp
|
Qt/BrowserWindow.cpp
|
||||||
ladybird.qrc
|
Qt/ConsoleWidget.cpp
|
||||||
main.cpp
|
Qt/EventLoopImplementationQt.cpp
|
||||||
|
Qt/EventLoopImplementationQtEventTarget.cpp
|
||||||
|
Qt/InspectorWidget.cpp
|
||||||
|
Qt/LocationEdit.cpp
|
||||||
|
Qt/ModelTranslator.cpp
|
||||||
|
Qt/Settings.cpp
|
||||||
|
Qt/SettingsDialog.cpp
|
||||||
|
Qt/Tab.cpp
|
||||||
|
Qt/TVGIconEngine.cpp
|
||||||
|
Qt/StringUtils.cpp
|
||||||
|
Qt/WebContentView.cpp
|
||||||
|
Qt/ladybird.qrc
|
||||||
|
Qt/main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_executable(ladybird ${SOURCES})
|
qt_add_executable(ladybird ${SOURCES})
|
||||||
@ -107,14 +108,14 @@ target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/)
|
|||||||
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Applications/)
|
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Applications/)
|
||||||
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
|
target_include_directories(ladybird PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services/)
|
||||||
|
|
||||||
qt_add_executable(headless-browser
|
add_executable(headless-browser
|
||||||
${SERENITY_SOURCE_DIR}/Userland/Utilities/headless-browser.cpp
|
${SERENITY_SOURCE_DIR}/Userland/Utilities/headless-browser.cpp
|
||||||
${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/WebDriverConnection.cpp
|
${SERENITY_SOURCE_DIR}/Userland/Services/WebContent/WebDriverConnection.cpp
|
||||||
HelperProcess.cpp
|
HelperProcess.cpp
|
||||||
Utilities.cpp)
|
Utilities.cpp)
|
||||||
|
|
||||||
target_include_directories(headless-browser PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(headless-browser PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_link_libraries(headless-browser PRIVATE Qt::Core LibWeb LibWebView LibWebSocket LibCrypto LibFileSystem LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibDiff LibProtocol)
|
target_link_libraries(headless-browser PRIVATE LibWeb LibWebView LibWebSocket LibCrypto LibFileSystem LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibDiff LibProtocol)
|
||||||
|
|
||||||
set_target_properties(ladybird PROPERTIES
|
set_target_properties(ladybird PROPERTIES
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER org.SerenityOS.Ladybird
|
MACOSX_BUNDLE_GUI_IDENTIFIER org.SerenityOS.Ladybird
|
||||||
|
@ -11,10 +11,11 @@
|
|||||||
#include "ConsoleWidget.h"
|
#include "ConsoleWidget.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "SettingsDialog.h"
|
#include "SettingsDialog.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include "WebContentView.h"
|
#include "WebContentView.h"
|
||||||
#include <AK/TypeCasts.h>
|
#include <AK/TypeCasts.h>
|
||||||
#include <Browser/CookieJar.h>
|
#include <Browser/CookieJar.h>
|
||||||
|
#include <Ladybird/Utilities.h>
|
||||||
#include <LibWeb/CSS/PreferredColorScheme.h>
|
#include <LibWeb/CSS/PreferredColorScheme.h>
|
||||||
#include <LibWeb/Loader/ResourceLoader.h>
|
#include <LibWeb/Loader/ResourceLoader.h>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@ -25,8 +26,6 @@
|
|||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
extern Settings* s_settings;
|
extern Settings* s_settings;
|
||||||
|
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ConsoleWidget.h"
|
#include "ConsoleWidget.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include "WebContentView.h"
|
#include "WebContentView.h"
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibJS/MarkupGenerator.h>
|
#include <LibJS/MarkupGenerator.h>
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LocationEdit.h"
|
#include "LocationEdit.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ModelTranslator.h"
|
#include "ModelTranslator.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
@ -5,9 +5,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <BrowserSettings/Defaults.h>
|
#include <BrowserSettings/Defaults.h>
|
||||||
|
#include <Ladybird/Utilities.h>
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
28
Ladybird/Qt/StringUtils.cpp
Normal file
28
Ladybird/Qt/StringUtils.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StringUtils.h"
|
||||||
|
|
||||||
|
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const& qstring)
|
||||||
|
{
|
||||||
|
return AK::DeprecatedString(qstring.toUtf8().data());
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorOr<String> ak_string_from_qstring(QString const& qstring)
|
||||||
|
{
|
||||||
|
return String::from_utf8(StringView(qstring.toUtf8().data(), qstring.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const& ak_deprecated_string)
|
||||||
|
{
|
||||||
|
return QString::fromUtf8(ak_deprecated_string.characters(), ak_deprecated_string.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString qstring_from_ak_string(String const& ak_string)
|
||||||
|
{
|
||||||
|
auto view = ak_string.bytes_as_string_view();
|
||||||
|
return QString::fromUtf8(view.characters_without_null_termination(), view.length());
|
||||||
|
}
|
17
Ladybird/Qt/StringUtils.h
Normal file
17
Ladybird/Qt/StringUtils.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/DeprecatedString.h>
|
||||||
|
#include <AK/Error.h>
|
||||||
|
#include <AK/String.h>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const&);
|
||||||
|
ErrorOr<String> ak_string_from_qstring(QString const&);
|
||||||
|
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const&);
|
||||||
|
QString qstring_from_ak_string(String const&);
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TVGIconEngine.h"
|
#include "TVGIconEngine.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/MemoryStream.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
@ -9,8 +9,8 @@
|
|||||||
#include "ConsoleWidget.h"
|
#include "ConsoleWidget.h"
|
||||||
#include "InspectorWidget.h"
|
#include "InspectorWidget.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "StringUtils.h"
|
||||||
#include "TVGIconEngine.h"
|
#include "TVGIconEngine.h"
|
||||||
#include "Utilities.h"
|
|
||||||
#include <Browser/History.h>
|
#include <Browser/History.h>
|
||||||
#include <LibGfx/ImageFormats/BMPWriter.h>
|
#include <LibGfx/ImageFormats/BMPWriter.h>
|
||||||
#include <LibGfx/Painter.h>
|
#include <LibGfx/Painter.h>
|
@ -6,8 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WebContentView.h"
|
#include "WebContentView.h"
|
||||||
#include "HelperProcess.h"
|
#include "StringUtils.h"
|
||||||
#include "Utilities.h"
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
@ -17,6 +16,8 @@
|
|||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/API/KeyCode.h>
|
#include <Kernel/API/KeyCode.h>
|
||||||
|
#include <Ladybird/HelperProcess.h>
|
||||||
|
#include <Ladybird/Utilities.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Types.h"
|
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
|
#include <Ladybird/Types.h>
|
||||||
#include <LibGfx/Forward.h>
|
#include <LibGfx/Forward.h>
|
||||||
#include <LibGfx/Rect.h>
|
#include <LibGfx/Rect.h>
|
||||||
#include <LibGfx/StandardCursor.h>
|
#include <LibGfx/StandardCursor.h>
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WebSocketImplQt.h"
|
#include "WebSocketImplQt.h"
|
||||||
#include "Utilities.h"
|
#include "StringUtils.h"
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <QSslSocket>
|
#include <QSslSocket>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
8
Ladybird/Qt/ladybird.qrc
Normal file
8
Ladybird/Qt/ladybird.qrc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>../Icons/ladybird.png</file>
|
||||||
|
<file>../Icons/back.tvg</file>
|
||||||
|
<file>../Icons/forward.tvg</file>
|
||||||
|
<file>../Icons/reload.tvg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
#include "BrowserWindow.h"
|
#include "BrowserWindow.h"
|
||||||
#include "EventLoopImplementationQt.h"
|
#include "EventLoopImplementationQt.h"
|
||||||
#include "HelperProcess.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "Utilities.h"
|
|
||||||
#include "WebContentView.h"
|
#include "WebContentView.h"
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <Browser/CookieJar.h>
|
#include <Browser/CookieJar.h>
|
||||||
#include <Browser/Database.h>
|
#include <Browser/Database.h>
|
||||||
|
#include <Ladybird/HelperProcess.h>
|
||||||
|
#include <Ladybird/Utilities.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <LibCore/Process.h>
|
#include <LibCore/Process.h>
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
@ -7,30 +8,16 @@
|
|||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/Platform.h>
|
#include <AK/Platform.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibFileSystem/FileSystem.h>
|
#include <LibFileSystem/FileSystem.h>
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
DeprecatedString s_serenity_resource_root;
|
DeprecatedString s_serenity_resource_root;
|
||||||
|
|
||||||
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const& qstring)
|
ErrorOr<String> application_directory()
|
||||||
{
|
{
|
||||||
return AK::DeprecatedString(qstring.toUtf8().data());
|
auto current_executable_path = TRY(Core::System::current_executable_path());
|
||||||
}
|
auto dirname = LexicalPath::dirname(current_executable_path.to_deprecated_string());
|
||||||
|
return String::from_deprecated_string(dirname);
|
||||||
ErrorOr<String> ak_string_from_qstring(QString const& qstring)
|
|
||||||
{
|
|
||||||
return String::from_utf8(StringView(qstring.toUtf8().data(), qstring.size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const& ak_deprecated_string)
|
|
||||||
{
|
|
||||||
return QString::fromUtf8(ak_deprecated_string.characters(), ak_deprecated_string.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString qstring_from_ak_string(String const& ak_string)
|
|
||||||
{
|
|
||||||
auto view = ak_string.bytes_as_string_view();
|
|
||||||
return QString::fromUtf8(view.characters_without_null_termination(), view.length());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_init()
|
void platform_init()
|
||||||
@ -49,7 +36,7 @@ void platform_init()
|
|||||||
auto home_lagom = DeprecatedString::formatted("{}/.lagom", home);
|
auto home_lagom = DeprecatedString::formatted("{}/.lagom", home);
|
||||||
if (FileSystem::is_directory(home_lagom))
|
if (FileSystem::is_directory(home_lagom))
|
||||||
return home_lagom;
|
return home_lagom;
|
||||||
auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath());
|
auto app_dir = application_directory().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
||||||
# ifdef AK_OS_MACOS
|
# ifdef AK_OS_MACOS
|
||||||
return LexicalPath(app_dir).parent().append("Resources"sv).string();
|
return LexicalPath(app_dir).parent().append("Resources"sv).string();
|
||||||
# else
|
# else
|
||||||
@ -61,11 +48,9 @@ void platform_init()
|
|||||||
|
|
||||||
ErrorOr<Vector<String>> get_paths_for_helper_process(StringView process_name)
|
ErrorOr<Vector<String>> get_paths_for_helper_process(StringView process_name)
|
||||||
{
|
{
|
||||||
auto application_path = TRY(ak_string_from_qstring(QCoreApplication::applicationDirPath()));
|
auto application_path = TRY(application_directory());
|
||||||
Vector<String> paths;
|
Vector<String> paths;
|
||||||
|
|
||||||
TRY(paths.try_append(TRY(String::formatted("./{}/{}", process_name, process_name))));
|
|
||||||
TRY(paths.try_append(TRY(String::formatted("{}/{}/{}", application_path, process_name, process_name))));
|
|
||||||
TRY(paths.try_append(TRY(String::formatted("{}/{}", application_path, process_name))));
|
TRY(paths.try_append(TRY(String::formatted("{}/{}", application_path, process_name))));
|
||||||
TRY(paths.try_append(TRY(String::formatted("./{}", process_name))));
|
TRY(paths.try_append(TRY(String::formatted("./{}", process_name))));
|
||||||
// NOTE: Add platform-specific paths here
|
// NOTE: Add platform-specific paths here
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
@ -10,13 +11,9 @@
|
|||||||
#include <AK/Error.h>
|
#include <AK/Error.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const&);
|
|
||||||
ErrorOr<String> ak_string_from_qstring(QString const&);
|
|
||||||
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const&);
|
|
||||||
QString qstring_from_ak_string(String const&);
|
|
||||||
void platform_init();
|
void platform_init();
|
||||||
|
ErrorOr<String> application_directory();
|
||||||
ErrorOr<Vector<String>> get_paths_for_helper_process(StringView process_name);
|
ErrorOr<Vector<String>> get_paths_for_helper_process(StringView process_name);
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
extern DeprecatedString s_serenity_resource_root;
|
||||||
|
@ -6,18 +6,19 @@ set(WEBCONTENT_SOURCES
|
|||||||
${WEBCONTENT_SOURCE_DIR}/PageHost.cpp
|
${WEBCONTENT_SOURCE_DIR}/PageHost.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
|
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.cpp
|
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.cpp
|
||||||
../AudioCodecPluginQt.cpp
|
|
||||||
../AudioThread.cpp
|
|
||||||
../EventLoopImplementationQt.cpp
|
|
||||||
../EventLoopImplementationQtEventTarget.cpp
|
|
||||||
../FontPlugin.cpp
|
../FontPlugin.cpp
|
||||||
../HelperProcess.cpp
|
../HelperProcess.cpp
|
||||||
../ImageCodecPlugin.cpp
|
../ImageCodecPlugin.cpp
|
||||||
../RequestManagerQt.cpp
|
|
||||||
../Utilities.cpp
|
../Utilities.cpp
|
||||||
../WebSocketClientManagerQt.cpp
|
../Qt/AudioCodecPluginQt.cpp
|
||||||
../WebSocketQt.cpp
|
../Qt/AudioThread.cpp
|
||||||
../WebSocketImplQt.cpp
|
../Qt/EventLoopImplementationQt.cpp
|
||||||
|
../Qt/EventLoopImplementationQtEventTarget.cpp
|
||||||
|
../Qt/RequestManagerQt.cpp
|
||||||
|
../Qt/StringUtils.cpp
|
||||||
|
../Qt/WebSocketClientManagerQt.cpp
|
||||||
|
../Qt/WebSocketQt.cpp
|
||||||
|
../Qt/WebSocketImplQt.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../AudioCodecPluginQt.h"
|
|
||||||
#include "../EventLoopImplementationQt.h"
|
|
||||||
#include "../FontPlugin.h"
|
|
||||||
#include "../HelperProcess.h"
|
|
||||||
#include "../ImageCodecPlugin.h"
|
|
||||||
#include "../RequestManagerQt.h"
|
|
||||||
#include "../Utilities.h"
|
|
||||||
#include "../WebSocketClientManagerQt.h"
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
|
#include <Ladybird/FontPlugin.h>
|
||||||
|
#include <Ladybird/HelperProcess.h>
|
||||||
|
#include <Ladybird/ImageCodecPlugin.h>
|
||||||
|
#include <Ladybird/Qt/AudioCodecPluginQt.h>
|
||||||
|
#include <Ladybird/Qt/EventLoopImplementationQt.h>
|
||||||
|
#include <Ladybird/Qt/RequestManagerQt.h>
|
||||||
|
#include <Ladybird/Qt/WebSocketClientManagerQt.h>
|
||||||
|
#include <Ladybird/Utilities.h>
|
||||||
#include <LibAudio/Loader.h>
|
#include <LibAudio/Loader.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
@ -41,8 +41,6 @@
|
|||||||
static ErrorOr<void> load_content_filters();
|
static ErrorOr<void> load_content_filters();
|
||||||
static ErrorOr<void> load_autoplay_allowlist();
|
static ErrorOr<void> load_autoplay_allowlist();
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
|
||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
QCoreApplication app(arguments.argc, arguments.argv);
|
QCoreApplication app(arguments.argc, arguments.argv);
|
||||||
|
@ -8,13 +8,13 @@ set(SOURCES
|
|||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_executable(WebDriver ${SOURCES})
|
add_executable(WebDriver ${SOURCES})
|
||||||
|
|
||||||
target_include_directories(WebDriver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
target_include_directories(WebDriver PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||||
target_include_directories(WebDriver PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
|
target_include_directories(WebDriver PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||||
target_include_directories(WebDriver PRIVATE ${SERENITY_SOURCE_DIR}/Userland)
|
target_include_directories(WebDriver PRIVATE ${SERENITY_SOURCE_DIR}/Userland)
|
||||||
target_include_directories(WebDriver PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services)
|
target_include_directories(WebDriver PRIVATE ${SERENITY_SOURCE_DIR}/Userland/Services)
|
||||||
target_link_libraries(WebDriver PRIVATE Qt::Core Qt::Network LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket)
|
target_link_libraries(WebDriver PRIVATE LibCore LibFileSystem LibGfx LibIPC LibJS LibMain LibWeb LibWebSocket)
|
||||||
add_dependencies(WebDriver headless-browser)
|
add_dependencies(WebDriver headless-browser)
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
link_android_libs(WebDriver)
|
link_android_libs(WebDriver)
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../Utilities.h"
|
|
||||||
#include <AK/Platform.h>
|
#include <AK/Platform.h>
|
||||||
|
#include <Ladybird/Utilities.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/Directory.h>
|
#include <LibCore/Directory.h>
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
@ -14,11 +14,8 @@
|
|||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibCore/TCPServer.h>
|
#include <LibCore/TCPServer.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <WebDriver/Client.h>
|
#include <WebDriver/Client.h>
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
|
||||||
|
|
||||||
static ErrorOr<pid_t> launch_process(StringView application, ReadonlySpan<char const*> arguments)
|
static ErrorOr<pid_t> launch_process(StringView application, ReadonlySpan<char const*> arguments)
|
||||||
{
|
{
|
||||||
auto paths = TRY(get_paths_for_helper_process(application));
|
auto paths = TRY(get_paths_for_helper_process(application));
|
||||||
@ -57,9 +54,6 @@ static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_pat
|
|||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
// Note: only creating this to get access to its static methods in Utilities
|
|
||||||
QCoreApplication application(arguments.argc, arguments.argv);
|
|
||||||
|
|
||||||
auto listen_address = "0.0.0.0"sv;
|
auto listen_address = "0.0.0.0"sv;
|
||||||
int port = 8000;
|
int port = 8000;
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
|
||||||
<qresource>
|
|
||||||
<file>Icons/ladybird.png</file>
|
|
||||||
<file>Icons/back.tvg</file>
|
|
||||||
<file>Icons/forward.tvg</file>
|
|
||||||
<file>Icons/reload.tvg</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
@ -12,20 +12,20 @@ group("ladybird") {
|
|||||||
|
|
||||||
moc_qt_objects("generate_moc") {
|
moc_qt_objects("generate_moc") {
|
||||||
sources = [
|
sources = [
|
||||||
"BrowserWindow.h",
|
"Qt/BrowserWindow.h",
|
||||||
"ConsoleWidget.h",
|
"Qt/ConsoleWidget.h",
|
||||||
"EventLoopImplementationQtEventTarget.h",
|
"Qt/EventLoopImplementationQtEventTarget.h",
|
||||||
"InspectorWidget.h",
|
"Qt/InspectorWidget.h",
|
||||||
"LocationEdit.h",
|
"Qt/LocationEdit.h",
|
||||||
"ModelTranslator.h",
|
"Qt/ModelTranslator.h",
|
||||||
"SettingsDialog.h",
|
"Qt/SettingsDialog.h",
|
||||||
"Tab.h",
|
"Qt/Tab.h",
|
||||||
"WebContentView.h",
|
"Qt/WebContentView.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
compile_qt_resource_file("compile_resource_file") {
|
compile_qt_resource_file("compile_resource_file") {
|
||||||
sources = [ "ladybird.qrc" ]
|
sources = [ "Qt/ladybird.qrc" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
link_qt("ladybird_qt_components") {
|
link_qt("ladybird_qt_components") {
|
||||||
@ -79,21 +79,22 @@ executable("ladybird_executable") {
|
|||||||
"//Userland/Applications/Browser/CookieJar.cpp",
|
"//Userland/Applications/Browser/CookieJar.cpp",
|
||||||
"//Userland/Applications/Browser/Database.cpp",
|
"//Userland/Applications/Browser/Database.cpp",
|
||||||
"//Userland/Applications/Browser/History.cpp",
|
"//Userland/Applications/Browser/History.cpp",
|
||||||
"BrowserWindow.cpp",
|
|
||||||
"ConsoleWidget.cpp",
|
|
||||||
"EventLoopImplementationQt.cpp",
|
|
||||||
"EventLoopImplementationQtEventTarget.cpp",
|
|
||||||
"HelperProcess.cpp",
|
"HelperProcess.cpp",
|
||||||
"InspectorWidget.cpp",
|
"Qt/BrowserWindow.cpp",
|
||||||
"LocationEdit.cpp",
|
"Qt/ConsoleWidget.cpp",
|
||||||
"ModelTranslator.cpp",
|
"Qt/EventLoopImplementationQt.cpp",
|
||||||
"Settings.cpp",
|
"Qt/EventLoopImplementationQtEventTarget.cpp",
|
||||||
"SettingsDialog.cpp",
|
"Qt/InspectorWidget.cpp",
|
||||||
"TVGIconEngine.cpp",
|
"Qt/LocationEdit.cpp",
|
||||||
"Tab.cpp",
|
"Qt/ModelTranslator.cpp",
|
||||||
|
"Qt/Settings.cpp",
|
||||||
|
"Qt/SettingsDialog.cpp",
|
||||||
|
"Qt/StringUtils.cpp",
|
||||||
|
"Qt/TVGIconEngine.cpp",
|
||||||
|
"Qt/Tab.cpp",
|
||||||
|
"Qt/WebContentView.cpp",
|
||||||
|
"Qt/main.cpp",
|
||||||
"Utilities.cpp",
|
"Utilities.cpp",
|
||||||
"WebContentView.cpp",
|
|
||||||
"main.cpp",
|
|
||||||
]
|
]
|
||||||
sources += get_target_outputs(":generate_moc") +
|
sources += get_target_outputs(":generate_moc") +
|
||||||
get_target_outputs(":compile_resource_file")
|
get_target_outputs(":compile_resource_file")
|
||||||
@ -103,16 +104,9 @@ executable("ladybird_executable") {
|
|||||||
output_name = "ladybird"
|
output_name = "ladybird"
|
||||||
}
|
}
|
||||||
|
|
||||||
link_qt("headless_browser_qt") {
|
|
||||||
qt_components = [ "Core" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
executable("headless-browser") {
|
executable("headless-browser") {
|
||||||
include_dirs = [ "//Userland/Services" ]
|
include_dirs = [ "//Userland/Services" ]
|
||||||
configs += [
|
configs += [ ":ladybird_config" ]
|
||||||
":ladybird_config",
|
|
||||||
":headless_browser_qt",
|
|
||||||
]
|
|
||||||
deps = [
|
deps = [
|
||||||
"//Userland/Libraries/LibCore",
|
"//Userland/Libraries/LibCore",
|
||||||
"//Userland/Libraries/LibCrypto",
|
"//Userland/Libraries/LibCrypto",
|
||||||
|
@ -4,10 +4,10 @@ import("//Meta/gn/build/libs/pulse/enable.gni")
|
|||||||
|
|
||||||
moc_qt_objects("generate_moc") {
|
moc_qt_objects("generate_moc") {
|
||||||
sources = [
|
sources = [
|
||||||
"//Ladybird/AudioCodecPluginQt.h",
|
"//Ladybird/Qt/AudioCodecPluginQt.h",
|
||||||
"//Ladybird/AudioThread.h",
|
"//Ladybird/Qt/AudioThread.h",
|
||||||
"//Ladybird/EventLoopImplementationQtEventTarget.h",
|
"//Ladybird/Qt/EventLoopImplementationQtEventTarget.h",
|
||||||
"//Ladybird/RequestManagerQt.h",
|
"//Ladybird/Qt/RequestManagerQt.h",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,18 +48,19 @@ executable("WebContent") {
|
|||||||
"//Userland/Libraries/LibWebView:WebDriverServerEndpoint",
|
"//Userland/Libraries/LibWebView:WebDriverServerEndpoint",
|
||||||
]
|
]
|
||||||
sources = [
|
sources = [
|
||||||
"../AudioCodecPluginQt.cpp",
|
"//Ladybird/FontPlugin.cpp",
|
||||||
"../AudioThread.cpp",
|
"//Ladybird/HelperProcess.cpp",
|
||||||
"../EventLoopImplementationQt.cpp",
|
"//Ladybird/ImageCodecPlugin.cpp",
|
||||||
"../EventLoopImplementationQtEventTarget.cpp",
|
"//Ladybird/Qt/AudioCodecPluginQt.cpp",
|
||||||
"../FontPlugin.cpp",
|
"//Ladybird/Qt/AudioThread.cpp",
|
||||||
"../HelperProcess.cpp",
|
"//Ladybird/Qt/EventLoopImplementationQt.cpp",
|
||||||
"../ImageCodecPlugin.cpp",
|
"//Ladybird/Qt/EventLoopImplementationQtEventTarget.cpp",
|
||||||
"../RequestManagerQt.cpp",
|
"//Ladybird/Qt/RequestManagerQt.cpp",
|
||||||
"../Utilities.cpp",
|
"//Ladybird/Qt/StringUtils.cpp",
|
||||||
"../WebSocketClientManagerQt.cpp",
|
"//Ladybird/Qt/WebSocketClientManagerQt.cpp",
|
||||||
"../WebSocketImplQt.cpp",
|
"//Ladybird/Qt/WebSocketImplQt.cpp",
|
||||||
"../WebSocketQt.cpp",
|
"//Ladybird/Qt/WebSocketQt.cpp",
|
||||||
|
"//Ladybird/Utilities.cpp",
|
||||||
"//Userland/Services/WebContent/ConnectionFromClient.cpp",
|
"//Userland/Services/WebContent/ConnectionFromClient.cpp",
|
||||||
"//Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp",
|
"//Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp",
|
||||||
"//Userland/Services/WebContent/PageHost.cpp",
|
"//Userland/Services/WebContent/PageHost.cpp",
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
import("//Ladybird/link_qt.gni")
|
import("//Ladybird/link_qt.gni")
|
||||||
|
|
||||||
link_qt("WebDriver_qt") {
|
|
||||||
qt_components = [
|
|
||||||
"Core",
|
|
||||||
"Network",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
executable("WebDriver") {
|
executable("WebDriver") {
|
||||||
configs += [
|
configs += [ "//Ladybird:ladybird_config" ]
|
||||||
"//Ladybird:ladybird_config",
|
|
||||||
":WebDriver_qt",
|
|
||||||
]
|
|
||||||
include_dirs = [
|
include_dirs = [
|
||||||
"//Userland/Services",
|
"//Userland/Services",
|
||||||
"//Ladybird",
|
"//Ladybird",
|
||||||
@ -31,7 +21,7 @@ executable("WebDriver") {
|
|||||||
"//Userland/Libraries/LibWebView:WebDriverServerEndpoint",
|
"//Userland/Libraries/LibWebView:WebDriverServerEndpoint",
|
||||||
]
|
]
|
||||||
sources = [
|
sources = [
|
||||||
"../Utilities.cpp",
|
"//Ladybird/Utilities.cpp",
|
||||||
"//Userland/Services/WebDriver/Client.cpp",
|
"//Userland/Services/WebDriver/Client.cpp",
|
||||||
"//Userland/Services/WebDriver/Session.cpp",
|
"//Userland/Services/WebDriver/Session.cpp",
|
||||||
"//Userland/Services/WebDriver/WebContentConnection.cpp",
|
"//Userland/Services/WebDriver/WebContentConnection.cpp",
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#if !defined(AK_OS_SERENITY)
|
#if !defined(AK_OS_SERENITY)
|
||||||
# include <Ladybird/HelperProcess.h>
|
# include <Ladybird/HelperProcess.h>
|
||||||
# include <Ladybird/Utilities.h>
|
# include <Ladybird/Utilities.h>
|
||||||
# include <QCoreApplication>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class HeadlessWebContentView final : public WebView::ViewImplementation {
|
class HeadlessWebContentView final : public WebView::ViewImplementation {
|
||||||
@ -374,9 +373,6 @@ static ErrorOr<int> run_tests(HeadlessWebContentView& view, StringView test_root
|
|||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
#if !defined(AK_OS_SERENITY)
|
|
||||||
QCoreApplication app(arguments.argc, arguments.argv);
|
|
||||||
#endif
|
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
|
|
||||||
int screenshot_timeout = 1;
|
int screenshot_timeout = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user