mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-15 03:53:58 +08:00
updated: add branch switching (#25200)
* switch param * add to ui * fix that * fetch for new branch Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: cc3857eb62cd169be05a4cb22c844a8b2ec94139
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "selfdrive/ui/ui.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "selfdrive/ui/qt/qt_window.h"
|
||||
#include "selfdrive/ui/qt/widgets/input.h"
|
||||
|
||||
TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
// param, title, desc, icon
|
||||
@@ -253,7 +254,19 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
}
|
||||
std::system("pkill -1 -f selfdrive.updated");
|
||||
});
|
||||
connect(uiState(), &UIState::offroadTransition, updateBtn, &QPushButton::setEnabled);
|
||||
|
||||
branchSwitcherBtn = new ButtonControl(tr("Switch Branch"), tr("ENTER"));
|
||||
connect(branchSwitcherBtn, &ButtonControl::clicked, [=]() {
|
||||
QString branch = InputDialog::getText(tr("Enter name of new branch"), this);
|
||||
if (branch.isEmpty()) {
|
||||
params.remove("SwitchToBranch");
|
||||
} else {
|
||||
params.put("SwitchToBranch", branch.toStdString());
|
||||
}
|
||||
std::system("pkill -1 -f selfdrive.updated");
|
||||
});
|
||||
connect(uiState(), &UIState::offroadTransition, branchSwitcherBtn, &QPushButton::setEnabled);
|
||||
|
||||
auto uninstallBtn = new ButtonControl(tr("Uninstall %1").arg(getBrand()), tr("UNINSTALL"));
|
||||
connect(uninstallBtn, &ButtonControl::clicked, [&]() {
|
||||
@@ -263,8 +276,11 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
|
||||
});
|
||||
connect(uiState(), &UIState::offroadTransition, uninstallBtn, &QPushButton::setEnabled);
|
||||
|
||||
QWidget *widgets[] = {versionLbl, lastUpdateLbl, updateBtn, gitBranchLbl, gitCommitLbl, osVersionLbl, uninstallBtn};
|
||||
QWidget *widgets[] = {versionLbl, lastUpdateLbl, updateBtn, branchSwitcherBtn, gitBranchLbl, gitCommitLbl, osVersionLbl, uninstallBtn};
|
||||
for (QWidget* w : widgets) {
|
||||
if (w == branchSwitcherBtn && params.getBool("IsTestedBranch")) {
|
||||
continue;
|
||||
}
|
||||
addItem(w);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ private:
|
||||
LabelControl *versionLbl;
|
||||
LabelControl *lastUpdateLbl;
|
||||
ButtonControl *updateBtn;
|
||||
ButtonControl *branchSwitcherBtn;
|
||||
|
||||
Params params;
|
||||
QFileSystemWatcher *fs_watch;
|
||||
|
||||
@@ -24,9 +24,9 @@ signals:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override {
|
||||
void mouseReleaseEvent(QMouseEvent *event) override {
|
||||
if (rect().contains(event->pos())) {
|
||||
emit clicked();
|
||||
emit clicked();
|
||||
}
|
||||
}
|
||||
QString lastText_, elidedText_;
|
||||
|
||||
Reference in New Issue
Block a user