This commit is contained in:
Your Name
2024-05-10 00:36:49 -05:00
parent 9b846f82d7
commit 8ffd55813f
12 changed files with 69 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ import json
Import('qt_env', 'arch', 'common', 'messaging', 'visionipc', Import('qt_env', 'arch', 'common', 'messaging', 'visionipc',
'cereal', 'transformations') '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"] 'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread', 'OmxCore', 'avformat', 'avcodec', 'avutil', 'yuv'] + qt_env["LIBS"]
if arch == 'larch64': if arch == 'larch64':
@@ -18,10 +18,12 @@ if arch == "Darwin":
# FIXME: remove this once we're on 5.15 (24.04) # FIXME: remove this once we're on 5.15 (24.04)
qt_env['CXXFLAGS'] += ["-Wno-deprecated-declarations"] 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/QtWebEngine"]
qt_env['CXXFLAGS'] += ["-I/usr/include/aarch64-linux-gnu/qt5/QtWebEngineCore"] 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/QtWebEngineWidgets"]
qt_env['CXXFLAGS'] += ["-I/usr/include/aarch64-linux-gnu/qt5/QtWebChannel"] 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) 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", widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/drive_stats.cc", "qt/widgets/wifi.cc",

View File

@@ -11,8 +11,6 @@
#include "selfdrive/ui/qt/widgets/prime.h" #include "selfdrive/ui/qt/widgets/prime.h"
#include "system/hardware/hw.h" #include "system/hardware/hw.h"
#include <QWebEngineView>
#ifdef ENABLE_MAPS #ifdef ENABLE_MAPS
#include "selfdrive/ui/qt/maps/map_settings.h" #include "selfdrive/ui/qt/maps/map_settings.h"
#endif #endif
@@ -191,17 +189,9 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
QHBoxLayout *home_layout = new QHBoxLayout(home_widget); QHBoxLayout *home_layout = new QHBoxLayout(home_widget);
home_layout->setContentsMargins(0, 0, 0, 0); home_layout->setContentsMargins(0, 0, 0, 0);
home_layout->setSpacing(30); home_layout->setSpacing(30);
} }
center_layout->addWidget(home_widget); 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 // add update & alerts widgets
update_widget = new UpdateAlert(); update_widget = new UpdateAlert();
QObject::connect(update_widget, &UpdateAlert::dismiss, [=]() { center_layout->setCurrentIndex(0); }); QObject::connect(update_widget, &UpdateAlert::dismiss, [=]() { center_layout->setCurrentIndex(0); });

View File

@@ -0,0 +1,66 @@
#include <QCommandLineParser>
#include <QApplication>
#include <QWidget>
#include <QTextEdit>
#include <QLabel>
#include <QProcess>
#include <QVBoxLayout>
#include <QFont>
#include <QScreen>
#include <QScrollBar>
#include <QGuiApplication>
#include <qpa/qplatformnativeinterface.h>
#include <wayland-client-protocol.h>
#include <QWebEngineView>
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 '<command>'\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<wl_surface*>(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();
}