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:
Adeeb Shihadeh
2022-07-18 21:18:10 -07:00
committed by GitHub
parent 89a11b1ca5
commit 95df2c9b48
6 changed files with 38 additions and 10 deletions
+17 -1
View File
@@ -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);
}
+1
View File
@@ -71,6 +71,7 @@ private:
LabelControl *versionLbl;
LabelControl *lastUpdateLbl;
ButtonControl *updateBtn;
ButtonControl *branchSwitcherBtn;
Params params;
QFileSystemWatcher *fs_watch;
+2 -2
View File
@@ -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_;