diff --git a/selfdrive/ui/qt/spinner b/selfdrive/ui/qt/spinner new file mode 100755 index 0000000..645bc44 Binary files /dev/null and b/selfdrive/ui/qt/spinner differ diff --git a/system/clearpilot/tools/RotationModule.egg-info/PKG-INFO b/system/clearpilot/tools/RotationModule.egg-info/PKG-INFO new file mode 100644 index 0000000..8d80e20 --- /dev/null +++ b/system/clearpilot/tools/RotationModule.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: RotationModule +Version: 1.0 +Summary: Module for rotating display via native interface +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: UNKNOWN +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN diff --git a/system/clearpilot/tools/RotationModule.egg-info/SOURCES.txt b/system/clearpilot/tools/RotationModule.egg-info/SOURCES.txt new file mode 100644 index 0000000..ebac1c3 --- /dev/null +++ b/system/clearpilot/tools/RotationModule.egg-info/SOURCES.txt @@ -0,0 +1,6 @@ +rotation_module.cc +rotation_module_build.py +RotationModule.egg-info/PKG-INFO +RotationModule.egg-info/SOURCES.txt +RotationModule.egg-info/dependency_links.txt +RotationModule.egg-info/top_level.txt \ No newline at end of file diff --git a/system/clearpilot/tools/RotationModule.egg-info/dependency_links.txt b/system/clearpilot/tools/RotationModule.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/system/clearpilot/tools/RotationModule.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/system/clearpilot/tools/RotationModule.egg-info/top_level.txt b/system/clearpilot/tools/RotationModule.egg-info/top_level.txt new file mode 100644 index 0000000..ddccd9e --- /dev/null +++ b/system/clearpilot/tools/RotationModule.egg-info/top_level.txt @@ -0,0 +1 @@ +rotation diff --git a/system/clearpilot/tools/qt_shell b/system/clearpilot/tools/qt_shell index 1b3f882..d7c5e98 100755 Binary files a/system/clearpilot/tools/qt_shell and b/system/clearpilot/tools/qt_shell differ diff --git a/system/clearpilot/tools/qt_shell.cc b/system/clearpilot/tools/qt_shell.cc index 6c79f83..84475cd 100644 --- a/system/clearpilot/tools/qt_shell.cc +++ b/system/clearpilot/tools/qt_shell.cc @@ -1,6 +1,8 @@ +#include #include #include #include +#include #include #include #include @@ -15,8 +17,16 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); - if (argc < 2) { - printf("Usage: %s ''\n", argv[0]); + QCommandLineParser parser; + parser.addHelpOption(); + parser.addPositionalArgument("command", "The shell command to execute."); + QCommandLineOption titleOption("title", "Set the title displayed at the top of the window.", "title"); + parser.addOption(titleOption); + parser.process(app); + + QStringList args = parser.positionalArguments(); + if (args.isEmpty()) { + fprintf(stderr, "Usage: %s ''\n", argv[0]); return 1; } @@ -43,14 +53,28 @@ int main(int argc, char *argv[]) { window.setFixedSize(2160, 1080); + QVBoxLayout *layout = new QVBoxLayout(&window); + layout->setSpacing(0); + layout->setContentsMargins(0, 0, 0, 0); + + QString title = parser.value(titleOption); + QLabel *titleLabel = nullptr; + if (!title.isEmpty()) { + titleLabel = new QLabel(title); + titleLabel->setFont(QFont("Arial", 48)); + titleLabel->setAlignment(Qt::AlignCenter); + titleLabel->setFixedSize(window.width(), 150); + titleLabel->setStyleSheet("color: white; background-color: black;"); + layout->addWidget(titleLabel); + } + QTextEdit *outputDisplay = new QTextEdit; outputDisplay->setFont(QFont("Consolas", 32)); outputDisplay->setReadOnly(true); - outputDisplay->setFixedSize(2160, 1080); + outputDisplay->setFixedSize(window.width(), window.height() - (titleLabel ? 150 : 0)); outputDisplay->setStyleSheet("color: white; background-color: black;"); outputDisplay->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Hide the vertical scrollbar - layout->addWidget(outputDisplay); QProcess process; @@ -69,8 +93,8 @@ int main(int argc, char *argv[]) { app.quit(); }); - QString command = argv[1]; + QString command = args.first(); process.start(QString("bash -c \"%1\"").arg(command)); return app.exec(); -} \ No newline at end of file +} diff --git a/system/clearpilot/tools/qt_shell.cc.save b/system/clearpilot/tools/qt_shell.cc.save new file mode 100644 index 0000000..65628c1 --- /dev/null +++ b/system/clearpilot/tools/qt_shell.cc.save @@ -0,0 +1,100 @@ +#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 shell command to execute."); + QCommandLineOption titleOption("title", "Set the title displayed at the top of the window.", "title"); + parser.addOption(titleOption); + parser.process(app); + + QStringList args = parser.positionalArguments(); + if (args.isEmpty()) { + fprintf(stderr, "Usage: %s ''\n", argv[0]); + return 1; + } + + QWidget window; + window.setWindowTitle("Shell Command Output Viewer"); + 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 title = parser.value(titleOption); + QLabel *titleLabel = nullptr; + if (!title.isEmpty()) { + titleLabel = new QLabel(title); + titleLabel->setFont(QFont("Arial", 48)); + titleLabel->setAlignment(Qt::AlignCenter); + titleLabel->setFixedSize(window.width(), 150); + titleLabel->setStyleSheet("color: white; background-color: black;"); + layout->addWidget(titleLabel); + } + + QTextEdit *outputDisplay = new QTextEdit; + outputDisplay->setFont(QFont("Consolas", 32)); + outputDisplay->setReadOnly(true); + outputDisplay->setFixedSize(window.width(), window.height() - (titleLabel ? 300 : 0)); + outputDisplay->setStyleSheet("color: white; background-color: black;"); + outputDisplay->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Hide the vertical scrollbar + layout->addWidget(outputDisplay); + + QProcess process; + QObject::connect(&process, &QProcess::readyReadStandardOutput, [&]() { + static QStringList lines; + QString output = process.readAllStandardOutput(); + lines += output.split("\n", QString::SkipEmptyParts); + while (lines.size() > 100) { + lines.removeFirst(); + } + outputDisplay->setPlainText(lines.join("\n")); + outputDisplay->verticalScrollBar()->setValue(outputDisplay->verticalScrollBar()->maximum()); + }); + + QObject::connect(&process, QOverload::of(&QProcess::finished), [&]() { + app.quit(); + }); + + QString command = args.first(); + process.start(QString("bash -c \"%1\"").arg(command)); + + return app.exec(); +} diff --git a/system/clearpilot/tools/qt_shell_test.sh b/system/clearpilot/tools/qt_shell_test.sh new file mode 100644 index 0000000..b463fd9 --- /dev/null +++ b/system/clearpilot/tools/qt_shell_test.sh @@ -0,0 +1,2 @@ +../../../selfdrive/manager/build.py +./qt_shell "cat qt_shell.cc; sleep 5" --title="Hello"