wip
This commit is contained in:
BIN
selfdrive/ui/qt/spinner
Executable file
BIN
selfdrive/ui/qt/spinner
Executable file
Binary file not shown.
10
system/clearpilot/tools/RotationModule.egg-info/PKG-INFO
Normal file
10
system/clearpilot/tools/RotationModule.egg-info/PKG-INFO
Normal file
@@ -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
|
||||||
@@ -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
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
rotation
|
||||||
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
|
#include <QCommandLineParser>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
#include <QLabel>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
@@ -15,8 +17,16 @@
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
if (argc < 2) {
|
QCommandLineParser parser;
|
||||||
printf("Usage: %s '<command>'\n", argv[0]);
|
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 '<command>'\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,14 +53,28 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
window.setFixedSize(2160, 1080);
|
window.setFixedSize(2160, 1080);
|
||||||
|
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(&window);
|
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;
|
QTextEdit *outputDisplay = new QTextEdit;
|
||||||
outputDisplay->setFont(QFont("Consolas", 32));
|
outputDisplay->setFont(QFont("Consolas", 32));
|
||||||
outputDisplay->setReadOnly(true);
|
outputDisplay->setReadOnly(true);
|
||||||
outputDisplay->setFixedSize(2160, 1080);
|
outputDisplay->setFixedSize(window.width(), window.height() - (titleLabel ? 150 : 0));
|
||||||
outputDisplay->setStyleSheet("color: white; background-color: black;");
|
outputDisplay->setStyleSheet("color: white; background-color: black;");
|
||||||
outputDisplay->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Hide the vertical scrollbar
|
outputDisplay->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Hide the vertical scrollbar
|
||||||
|
|
||||||
layout->addWidget(outputDisplay);
|
layout->addWidget(outputDisplay);
|
||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
@@ -69,8 +93,8 @@ int main(int argc, char *argv[]) {
|
|||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
|
|
||||||
QString command = argv[1];
|
QString command = args.first();
|
||||||
process.start(QString("bash -c \"%1\"").arg(command));
|
process.start(QString("bash -c \"%1\"").arg(command));
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
100
system/clearpilot/tools/qt_shell.cc.save
Normal file
100
system/clearpilot/tools/qt_shell.cc.save
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 '<command>'\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<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 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<int, QProcess::ExitStatus>::of(&QProcess::finished), [&]() {
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
|
||||||
|
QString command = args.first();
|
||||||
|
process.start(QString("bash -c \"%1\"").arg(command));
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
2
system/clearpilot/tools/qt_shell_test.sh
Normal file
2
system/clearpilot/tools/qt_shell_test.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
../../../selfdrive/manager/build.py
|
||||||
|
./qt_shell "cat qt_shell.cc; sleep 5" --title="Hello"
|
||||||
Reference in New Issue
Block a user