|
|
@ -11,6 +11,7 @@ |
|
|
|
#include <QMenu> |
|
|
|
#include <QMenu> |
|
|
|
#include <QMenuBar> |
|
|
|
#include <QMenuBar> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
|
|
|
|
|
#include <QShortcut> |
|
|
|
#include <QScreen> |
|
|
|
#include <QScreen> |
|
|
|
#include <QToolBar> |
|
|
|
#include <QToolBar> |
|
|
|
#include <QUndoView> |
|
|
|
#include <QUndoView> |
|
|
@ -82,6 +83,7 @@ MainWindow::MainWindow() : QMainWindow() { |
|
|
|
setCentralWidget(central_widget); |
|
|
|
setCentralWidget(central_widget); |
|
|
|
createActions(); |
|
|
|
createActions(); |
|
|
|
createStatusBar(); |
|
|
|
createStatusBar(); |
|
|
|
|
|
|
|
createShortcuts(); |
|
|
|
|
|
|
|
|
|
|
|
qRegisterMetaType<uint64_t>("uint64_t"); |
|
|
|
qRegisterMetaType<uint64_t>("uint64_t"); |
|
|
|
qRegisterMetaType<ReplyMsgType>("ReplyMsgType"); |
|
|
|
qRegisterMetaType<ReplyMsgType>("ReplyMsgType"); |
|
|
@ -156,6 +158,12 @@ void MainWindow::createStatusBar() { |
|
|
|
statusBar()->addPermanentWidget(progress_bar); |
|
|
|
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) { |
|
|
|
void MainWindow::loadDBCFromName(const QString &name) { |
|
|
|
if (name != dbc()->name()) |
|
|
|
if (name != dbc()->name()) |
|
|
|
dbc()->open(name); |
|
|
|
dbc()->open(name); |
|
|
@ -225,7 +233,8 @@ void MainWindow::dockCharts(bool dock) { |
|
|
|
floating_window->deleteLater(); |
|
|
|
floating_window->deleteLater(); |
|
|
|
floating_window = nullptr; |
|
|
|
floating_window = nullptr; |
|
|
|
} else if (!dock && !floating_window) { |
|
|
|
} 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->setWindowTitle("Charts - Cabana"); |
|
|
|
floating_window->setLayout(new QVBoxLayout()); |
|
|
|
floating_window->setLayout(new QVBoxLayout()); |
|
|
|
floating_window->layout()->addWidget(charts_widget); |
|
|
|
floating_window->layout()->addWidget(charts_widget); |
|
|
|