mirror of https://github.com/commaai/openpilot.git
Cabana: add shortcuts (#26528)
add shortcuts
old-commit-hash: daea877c07
This commit is contained in:
parent
46f70592ae
commit
9e61dbfeba
|
@ -85,9 +85,9 @@ DetailWidget::DetailWidget(ChartsWidget *charts, QWidget *parent) : charts(chart
|
|||
|
||||
tab_widget = new QTabWidget(this);
|
||||
tab_widget->setTabPosition(QTabWidget::South);
|
||||
tab_widget->addTab(scroll, "Msg");
|
||||
tab_widget->addTab(scroll, "&Msg");
|
||||
history_log = new HistoryLog(this);
|
||||
tab_widget->addTab(history_log, "Logs");
|
||||
tab_widget->addTab(history_log, "&Logs");
|
||||
main_layout->addWidget(tab_widget);
|
||||
|
||||
QObject::connect(binary_view, &BinaryView::signalClicked, this, &DetailWidget::showForm);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QShortcut>
|
||||
#include <QScreen>
|
||||
#include <QToolBar>
|
||||
#include <QUndoView>
|
||||
|
@ -82,6 +83,7 @@ MainWindow::MainWindow() : QMainWindow() {
|
|||
setCentralWidget(central_widget);
|
||||
createActions();
|
||||
createStatusBar();
|
||||
createShortcuts();
|
||||
|
||||
qRegisterMetaType<uint64_t>("uint64_t");
|
||||
qRegisterMetaType<ReplyMsgType>("ReplyMsgType");
|
||||
|
@ -156,6 +158,12 @@ void MainWindow::createStatusBar() {
|
|||
statusBar()->addPermanentWidget(progress_bar);
|
||||
}
|
||||
|
||||
void MainWindow::createShortcuts() {
|
||||
auto shortcut = new QShortcut(QKeySequence(Qt::Key_Space), this, nullptr, nullptr, Qt::ApplicationShortcut);
|
||||
QObject::connect(shortcut, &QShortcut::activated, []() { can->pause(!can->isPaused()); });
|
||||
// TODO: add more shortcuts here.
|
||||
}
|
||||
|
||||
void MainWindow::loadDBCFromName(const QString &name) {
|
||||
if (name != dbc()->name())
|
||||
dbc()->open(name);
|
||||
|
@ -225,7 +233,8 @@ void MainWindow::dockCharts(bool dock) {
|
|||
floating_window->deleteLater();
|
||||
floating_window = nullptr;
|
||||
} else if (!dock && !floating_window) {
|
||||
floating_window = new QWidget(nullptr);
|
||||
floating_window = new QWidget(this);
|
||||
floating_window->setWindowFlags(Qt::Window);
|
||||
floating_window->setWindowTitle("Charts - Cabana");
|
||||
floating_window->setLayout(new QVBoxLayout());
|
||||
floating_window->layout()->addWidget(charts_widget);
|
||||
|
|
|
@ -35,6 +35,7 @@ signals:
|
|||
protected:
|
||||
void createActions();
|
||||
void createStatusBar();
|
||||
void createShortcuts();
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void updateDownloadProgress(uint64_t cur, uint64_t total, bool success);
|
||||
void setOption();
|
||||
|
|
Loading…
Reference in New Issue