Added more command areas for extra hacking

This commit is contained in:
Jon ESA
2026-04-01 20:18:23 +01:00
parent 699a0ae8e3
commit 693e1d8e37

View File

@@ -1,5 +1,7 @@
#include <QApplication>
#include <QButtonGroup>
#include <QFont>
#include <QGridLayout>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QHash>
@@ -242,30 +244,43 @@ static QWidget *makeSettingsTab(WebSocketController *ctrl, QWidget *parent)
static QWidget *makeManualTab(WebSocketController *ctrl, QWidget *parent)
{
auto *page = new QWidget(parent);
auto *layout = new QVBoxLayout(page);
auto *row = new QHBoxLayout();
auto *cmdEdit = new QLineEdit(page);
cmdEdit->setPlaceholderText("Enter command to send...");
auto *sendBtn = new QPushButton("Send", page);
auto *clearBtn = new QPushButton("Clear", page);
row->addWidget(new QLabel("Command:", page));
row->addWidget(cmdEdit, 1);
row->addWidget(sendBtn);
row->addWidget(clearBtn);
auto *page = new QWidget(parent);
auto *layout = new QVBoxLayout(page);
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(4);
// 4 independent command input boxes (Enter to send, no Send button)
const QStringList placeholders = {
"Command 1...",
"Command 2...",
"Command 3...",
"Command 4...",
};
auto *inputGrid = new QGridLayout();
inputGrid->setSpacing(4);
for (int i = 0; i < 4; ++i) {
auto *edit = new QLineEdit(page);
edit->setPlaceholderText(placeholders[i]);
edit->setFont(QFont("Courier", 10));
inputGrid->addWidget(edit, i / 2, i % 2);
QObject::connect(edit, &QLineEdit::returnPressed, page, [edit, ctrl]() {
const QString cmd = edit->text().trimmed();
if (!cmd.isEmpty()) { ctrl->sendCommand(cmd); edit->clear(); }
});
}
layout->addLayout(inputGrid);
// Log view + clear button
auto *clearBtn = new QPushButton("Clear Log", page);
clearBtn->setMaximumWidth(100);
auto *log = new QTextEdit(page);
log->setReadOnly(true);
layout->addLayout(row);
log->setFont(QFont("Courier", 9));
layout->addWidget(log, 1);
layout->addWidget(clearBtn);
ctrl->addLogView(log);
auto send = [cmdEdit, ctrl]() {
const QString cmd = cmdEdit->text().trimmed();
if (!cmd.isEmpty()) { ctrl->sendCommand(cmd); cmdEdit->clear(); }
};
QObject::connect(sendBtn, &QPushButton::clicked, page, send);
QObject::connect(cmdEdit, &QLineEdit::returnPressed, page, send);
QObject::connect(clearBtn, &QPushButton::clicked, log, &QTextEdit::clear);
QObject::connect(clearBtn, &QPushButton::clicked, log, &QTextEdit::clear);
return page;
}