From 8ffd55813f427ac6a6be5da19994177086f1c1f2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 10 May 2024 00:36:49 -0500 Subject: [PATCH] wip --- selfdrive/ui/SConscript | 4 +- selfdrive/ui/qt/home.cc | 10 --- .../RotationModule.egg-info/PKG-INFO | 0 .../RotationModule.egg-info/SOURCES.txt | 0 .../dependency_links.txt | 0 .../RotationModule.egg-info/top_level.txt | 0 .../tools/{ => archive}/qt_shell.cc.save | 0 .../clearpilot/tools/{ => archive}/shell.py | 0 .../clearpilot/tools/{ => archive}/shell.sh | 0 .../clearpilot/tools/{ => archive}/webview.py | 0 .../clearpilot/tools/{ => archive}/webview.sh | 0 system/clearpilot/tools/webview.cc | 66 +++++++++++++++++++ 12 files changed, 69 insertions(+), 11 deletions(-) rename system/clearpilot/tools/{ => archive}/RotationModule.egg-info/PKG-INFO (100%) rename system/clearpilot/tools/{ => archive}/RotationModule.egg-info/SOURCES.txt (100%) rename system/clearpilot/tools/{ => archive}/RotationModule.egg-info/dependency_links.txt (100%) rename system/clearpilot/tools/{ => archive}/RotationModule.egg-info/top_level.txt (100%) rename system/clearpilot/tools/{ => archive}/qt_shell.cc.save (100%) rename system/clearpilot/tools/{ => archive}/shell.py (100%) rename system/clearpilot/tools/{ => archive}/shell.sh (100%) rename system/clearpilot/tools/{ => archive}/webview.py (100%) rename system/clearpilot/tools/{ => archive}/webview.sh (100%) create mode 100644 system/clearpilot/tools/webview.cc diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index 51eb6b8..4842a40 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -3,7 +3,7 @@ import json Import('qt_env', 'arch', 'common', 'messaging', 'visionipc', 'cereal', 'transformations') -base_libs = [common, messaging, cereal, visionipc, transformations, 'zmq', 'Qt5WebEngineWidgets', +base_libs = [common, messaging, cereal, visionipc, transformations, 'zmq', 'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread', 'OmxCore', 'avformat', 'avcodec', 'avutil', 'yuv'] + qt_env["LIBS"] if arch == 'larch64': @@ -18,10 +18,12 @@ if arch == "Darwin": # FIXME: remove this once we're on 5.15 (24.04) qt_env['CXXFLAGS'] += ["-Wno-deprecated-declarations"] +# Clearpilot qt_env['CXXFLAGS'] += ["-I/usr/include/aarch64-linux-gnu/qt5/QtWebEngine"] qt_env['CXXFLAGS'] += ["-I/usr/include/aarch64-linux-gnu/qt5/QtWebEngineCore"] qt_env['CXXFLAGS'] += ["-I/usr/include/aarch64-linux-gnu/qt5/QtWebEngineWidgets"] qt_env['CXXFLAGS'] += ["-I/usr/include/aarch64-linux-gnu/qt5/QtWebChannel"] +base_libs += ['Qt5WebEngineWidgets'] qt_util = qt_env.Library("qt_util", ["#selfdrive/ui/qt/api.cc", "#selfdrive/ui/qt/util.cc"], LIBS=base_libs) widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/drive_stats.cc", "qt/widgets/wifi.cc", diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index c661168..b752622 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -11,8 +11,6 @@ #include "selfdrive/ui/qt/widgets/prime.h" #include "system/hardware/hw.h" -#include - #ifdef ENABLE_MAPS #include "selfdrive/ui/qt/maps/map_settings.h" #endif @@ -191,17 +189,9 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) { QHBoxLayout *home_layout = new QHBoxLayout(home_widget); home_layout->setContentsMargins(0, 0, 0, 0); home_layout->setSpacing(30); - } center_layout->addWidget(home_widget); - // Create a QWebEngineView - QWebEngineView *web_view = new QWebEngineView(); - web_view->load(QUrl("http://fark.com")); - - // Add the QWebEngineView to the layout - center_layout->addWidget(web_view); - // add update & alerts widgets update_widget = new UpdateAlert(); QObject::connect(update_widget, &UpdateAlert::dismiss, [=]() { center_layout->setCurrentIndex(0); }); diff --git a/system/clearpilot/tools/RotationModule.egg-info/PKG-INFO b/system/clearpilot/tools/archive/RotationModule.egg-info/PKG-INFO similarity index 100% rename from system/clearpilot/tools/RotationModule.egg-info/PKG-INFO rename to system/clearpilot/tools/archive/RotationModule.egg-info/PKG-INFO diff --git a/system/clearpilot/tools/RotationModule.egg-info/SOURCES.txt b/system/clearpilot/tools/archive/RotationModule.egg-info/SOURCES.txt similarity index 100% rename from system/clearpilot/tools/RotationModule.egg-info/SOURCES.txt rename to system/clearpilot/tools/archive/RotationModule.egg-info/SOURCES.txt diff --git a/system/clearpilot/tools/RotationModule.egg-info/dependency_links.txt b/system/clearpilot/tools/archive/RotationModule.egg-info/dependency_links.txt similarity index 100% rename from system/clearpilot/tools/RotationModule.egg-info/dependency_links.txt rename to system/clearpilot/tools/archive/RotationModule.egg-info/dependency_links.txt diff --git a/system/clearpilot/tools/RotationModule.egg-info/top_level.txt b/system/clearpilot/tools/archive/RotationModule.egg-info/top_level.txt similarity index 100% rename from system/clearpilot/tools/RotationModule.egg-info/top_level.txt rename to system/clearpilot/tools/archive/RotationModule.egg-info/top_level.txt diff --git a/system/clearpilot/tools/qt_shell.cc.save b/system/clearpilot/tools/archive/qt_shell.cc.save similarity index 100% rename from system/clearpilot/tools/qt_shell.cc.save rename to system/clearpilot/tools/archive/qt_shell.cc.save diff --git a/system/clearpilot/tools/shell.py b/system/clearpilot/tools/archive/shell.py similarity index 100% rename from system/clearpilot/tools/shell.py rename to system/clearpilot/tools/archive/shell.py diff --git a/system/clearpilot/tools/shell.sh b/system/clearpilot/tools/archive/shell.sh similarity index 100% rename from system/clearpilot/tools/shell.sh rename to system/clearpilot/tools/archive/shell.sh diff --git a/system/clearpilot/tools/webview.py b/system/clearpilot/tools/archive/webview.py similarity index 100% rename from system/clearpilot/tools/webview.py rename to system/clearpilot/tools/archive/webview.py diff --git a/system/clearpilot/tools/webview.sh b/system/clearpilot/tools/archive/webview.sh similarity index 100% rename from system/clearpilot/tools/webview.sh rename to system/clearpilot/tools/archive/webview.sh diff --git a/system/clearpilot/tools/webview.cc b/system/clearpilot/tools/webview.cc new file mode 100644 index 0000000..e0dfa0b --- /dev/null +++ b/system/clearpilot/tools/webview.cc @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QCommandLineParser parser; + parser.addHelpOption(); + parser.addPositionalArgument("command", "The URL to open."); + parser.process(app); + + QStringList args = parser.positionalArguments(); + if (args.isEmpty()) { + fprintf(stderr, "Usage: %s ''\n", argv[0]); + return 1; + } + + // Common init + QWidget window; + window.setWindowTitle("Webview"); + window.setStyleSheet("background-color: black;"); + window.showFullScreen(); + + auto windowHandle = window.windowHandle(); + if (!windowHandle) { + fprintf(stderr, "Error: Unable to obtain window handle.\n"); + return 1; + } + + QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface(); + auto *s = static_cast(native->nativeResourceForWindow("surface", windowHandle)); + if (!s) { + fprintf(stderr, "Error: Unable to obtain native Wayland surface.\n"); + return 1; + } + + wl_surface_set_buffer_transform(s, WL_OUTPUT_TRANSFORM_270); + wl_surface_commit(s); + + window.setFixedSize(2160, 1080); + + QVBoxLayout *layout = new QVBoxLayout(&window); + layout->setSpacing(0); + layout->setContentsMargins(0, 0, 0, 0); + + QString url = args.first(); + QWebEngineView *web_view = new QWebEngineView(); + web_view->load(QUrl(url)); + center_layout->addWidget(web_view); + + return app.exec(); +}