8000 cabana: dispaly current FPS & cached minitues on statusbar by deanlee · Pull Request #27430 · commaai/openpilot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cabana: dispaly current FPS & cached minitues on statusbar #27430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading 8000
Diff view
Diff view
17 changes: 17 additions & 0 deletions tools/cabana/mainwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ MainWindow::MainWindow() : QMainWindow() {
QObject::connect(messages_widget, &MessagesWidget::msgSelectionChanged, center_widget, &CenterWidget::setMessage);
QObject::connect(charts_widget, &ChartsWidget::dock, this, &MainWindow::dockCharts);
QObject::connect(can, &AbstractStream::streamStarted, this, &MainWindow::loadDBCFromFingerprint);
QObject::connect(can, &AbstractStream::eventsMerged, this, &MainWindow::updateStatus);
QObject::connect(dbc(), &DBCManager::DBCFileChanged, this, &MainWindow::DBCFileChanged);
QObject::connect(UndoStack::instance(), &QUndoStack::cleanChanged, this, &MainWindow::undoStackCleanChanged);
QObject::connect(UndoStack::instance(), &QUndoStack::indexChanged, this, &MainWindow::undoStackIndexChanged);
QObject::connect(&settings, &Settings::changed, this, &MainWindow::updateStatus);
}

void MainWindow::createActions() {
Expand Down Expand Up @@ -179,6 +181,9 @@ void MainWindow::createStatusBar() {
progress_bar->setVisible(false);
statusBar()->addWidget(new QLabel(tr("For Help, Press F1")));
statusBar()->addPermanentWidget(progress_bar);

statusBar()->addPermanentWidget(status_label = new QLabel(this));
updateStatus();
}

void MainWindow::createShortcuts() {
Expand Down Expand Up @@ -403,6 +408,18 @@ void MainWindow::updateDownloadProgress(uint64_t cur, uint64_t total, bool succe
}
}

void MainWindow::updateStatus() {
float cached_minutes = 0;
if (!can->liveStreaming()) {
if (auto events = can->events(); !events->empty()) {
cached_minutes = (events->back()->mono_time - events->front()->mono_time) / (1e9 * 60);
}
} else {
settings.max_cached_minutes = settings.max_cached_minutes;
}
status_label->setText(tr("Cached Minutes:%1 FPS:%2").arg(cached_minutes, 0, 'f', 1).arg(settings.fps));
}

void MainWindow::dockCharts(bool dock) {
if (dock && floating_window) {
floating_window->removeEventFilter(charts_widget);
Expand Down
2 changes: 2 additions & 0 deletions tools/cabana/mainwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public slots:
void undoStackCleanChanged(bool clean);
void undoStackIndexChanged(int index);
void onlineHelp();
void updateStatus();

VideoWidget *video_widget = nullptr;
QDockWidget *video_dock;
Expand All @@ -65,6 +66,7 @@ public slots:
QWidget *floating_window = nullptr;
QVBoxLayout *charts_layout;
QProgressBar *progress_bar;
QLabel *status_label;
QJsonDocument fingerprint_to_dbc;
QSplitter *video_splitter;;
QString current_file = "";
Expand Down
0