From 4e3e069a6517c49932877c6eb6c12c5664b1c871 Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Sat, 7 Jun 2025 10:48:30 +0200 Subject: [PATCH] Revert "ui: model fuzzy search" (#990) Revert "ui: model fuzzy search (#958)" This reverts commit 489d9164f8c8aba20b898c55e29e1c98f4598d09. --- .../qt/offroad/settings/models_panel.cc | 33 +++---------------- .../qt/offroad/settings/models_panel.h | 3 +- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.cc index 2d7367de1c..44a6bd3b48 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.cc @@ -24,17 +24,7 @@ ModelsPanel::ModelsPanel(QWidget *parent) : QWidget(parent) { currentModelLblBtn = new ButtonControlSP(tr("Current Model"), tr("SELECT"), current_model); currentModelLblBtn->setValue(current_model); - connect(currentModelLblBtn, &ButtonControlSP::clicked, [=]() { - - InputDialog d(tr("Search Model"), this, tr("Enter search keywords, or leave blank to list all models."), false); - d.setMinLength(0); - const int ret = d.exec(); - if (ret) { - handleCurrentModelLblBtnClicked(d.text()); - } - - }); - + connect(currentModelLblBtn, &ButtonControlSP::clicked, this, &ModelsPanel::handleCurrentModelLblBtnClicked); connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { is_onroad = !offroad; updateLabels(); @@ -144,7 +134,7 @@ void ModelsPanel::updateModelManagerState() { * @brief Handles the model bundle selection button click * Displays available bundles, allows selection, and initiates download */ -void ModelsPanel::handleCurrentModelLblBtnClicked(const QString &query) { +void ModelsPanel::handleCurrentModelLblBtnClicked() { currentModelLblBtn->setEnabled(false); currentModelLblBtn->setValue(tr("Fetching models...")); @@ -152,8 +142,7 @@ void ModelsPanel::handleCurrentModelLblBtnClicked(const QString &query) { QMap index_to_bundle; const auto bundles = model_manager.getAvailableBundles(); for (const auto &bundle: bundles) { - std::string bundleStr = std::string(bundle.getDisplayName()) + " $SNAME$ " + std::string(bundle.getInternalName()); - index_to_bundle.insert(bundle.getIndex(), QString::fromStdString(bundleStr)); + index_to_bundle.insert(bundle.getIndex(), QString::fromStdString(bundle.getDisplayName())); } // Sort bundles by index in descending order @@ -167,24 +156,10 @@ void ModelsPanel::handleCurrentModelLblBtnClicked(const QString &query) { bundleNames.append(index_to_bundle[index]); } - QStringList filteredBundleNames = searchFromList(query, bundleNames); - currentModelLblBtn->setValue(GetActiveModelName()); - if (filteredBundleNames.isEmpty()) { - ConfirmationDialog::alert(tr("No model found for keywords: %1").arg(query), this); - return; - } - - for (const QString &bundleName: filteredBundleNames) { - int index = bundleName.indexOf("$SNAME$"); - if (index != -1) { - filteredBundleNames.replace(filteredBundleNames.indexOf(bundleName), bundleName.left(index).trimmed()); - } - } - const QString selectedBundleName = MultiOptionDialog::getSelection( - tr("Select a Model"), filteredBundleNames, GetActiveModelName(), this); + tr("Select a Model"), bundleNames, GetActiveModelName(), this); if (selectedBundleName.isEmpty() || !canContinueOnMeteredDialog()) { return; diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.h index ee6a74a666..4ba526651e 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.h @@ -7,7 +7,6 @@ #pragma once -#include "selfdrive/ui/sunnypilot/qt/util.h" #include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" class ModelsPanel : public QWidget { @@ -31,7 +30,7 @@ private: // UI update related methods void updateLabels(); - void handleCurrentModelLblBtnClicked(const QString &query); + void handleCurrentModelLblBtnClicked(); void handleBundleDownloadProgress(); void showResetParamsDialog(); cereal::ModelManagerSP::Reader model_manager;