cabana: fix missing opendbc files (#30555)

* fix missing dbc files

* remove suffix
pull/30109/head
Dean Lee 1 year ago committed by GitHub
parent e687be939e
commit d87191c1c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      tools/cabana/mainwin.cc
  2. 2
      tools/cabana/mainwin.h

@ -77,9 +77,10 @@ void MainWindow::loadFingerprints() {
QFile json_file(QApplication::applicationDirPath() + "/dbc/car_fingerprint_to_dbc.json"); QFile json_file(QApplication::applicationDirPath() + "/dbc/car_fingerprint_to_dbc.json");
if (json_file.open(QIODevice::ReadOnly)) { if (json_file.open(QIODevice::ReadOnly)) {
fingerprint_to_dbc = QJsonDocument::fromJson(json_file.readAll()); fingerprint_to_dbc = QJsonDocument::fromJson(json_file.readAll());
auto dbc_names = fingerprint_to_dbc.object().toVariantMap().values(); }
std::transform(dbc_names.begin(), dbc_names.end(), std::inserter(opendbc_names, opendbc_names.begin()), // get opendbc names
[](const auto &name) { return name.toString(); }); for (auto fn : QDir(OPENDBC_FILE_PATH).entryList({"*.dbc"}, QDir::Files, QDir::Name)) {
opendbc_names << QFileInfo(fn).baseName();
} }
} }

@ -86,7 +86,7 @@ protected:
QProgressBar *progress_bar; QProgressBar *progress_bar;
QLabel *status_label; QLabel *status_label;
QJsonDocument fingerprint_to_dbc; QJsonDocument fingerprint_to_dbc;
std::set<QString> opendbc_names; QStringList opendbc_names;
QSplitter *video_splitter = nullptr; QSplitter *video_splitter = nullptr;
enum { MAX_RECENT_FILES = 15 }; enum { MAX_RECENT_FILES = 15 };
QAction *recent_files_acts[MAX_RECENT_FILES] = {}; QAction *recent_files_acts[MAX_RECENT_FILES] = {};

Loading…
Cancel
Save