diff --git a/config.h b/config.h index a7ebdb6..a9d8673 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG #define CONFIG -#define VERSION 181 +#define VERSION 182 //try to keep this in sync. //SavvyCAN will complain if you connect a GVRET board with a revision diff --git a/dbc/dbcloadsavewindow.cpp b/dbc/dbcloadsavewindow.cpp index df3eb9e..d43d658 100644 --- a/dbc/dbcloadsavewindow.cpp +++ b/dbc/dbcloadsavewindow.cpp @@ -1,6 +1,7 @@ #include "dbcloadsavewindow.h" #include "ui_dbcloadsavewindow.h" #include +#include "helpwindow.h" DBCLoadSaveWindow::DBCLoadSaveWindow(const QVector *frames, QWidget *parent) : QDialog(parent), @@ -32,13 +33,34 @@ DBCLoadSaveWindow::DBCLoadSaveWindow(const QVector *frames, QWidget *p connect(ui->tableFiles, &QTableWidget::cellDoubleClicked, this, &DBCLoadSaveWindow::cellDoubleClicked); editorWindow = new DBCMainEditor(frames); + + installEventFilter(this); } DBCLoadSaveWindow::~DBCLoadSaveWindow() { + removeEventFilter(this); delete ui; } +bool DBCLoadSaveWindow::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(event); + switch (keyEvent->key()) + { + case Qt::Key_F1: + HelpWindow::getRef()->showHelp("dbc_manager.html"); + break; + } + return true; + } else { + // standard event processing + return QObject::eventFilter(obj, event); + } + return false; +} + void DBCLoadSaveWindow::newFile() { int idx = dbcHandler->createBlankFile(); diff --git a/dbc/dbcloadsavewindow.h b/dbc/dbcloadsavewindow.h index 5bbc3ff..6e41e0c 100644 --- a/dbc/dbcloadsavewindow.h +++ b/dbc/dbcloadsavewindow.h @@ -38,6 +38,7 @@ private: void swapTableRows(bool up); QList takeRow(int row); void setRow(int row, const QList& rowItems); + bool eventFilter(QObject *obj, QEvent *event); }; #endif // DBCLOADSAVEWINDOW_H diff --git a/dbc/dbcmaineditor.cpp b/dbc/dbcmaineditor.cpp index 1b041b6..2afe9cc 100644 --- a/dbc/dbcmaineditor.cpp +++ b/dbc/dbcmaineditor.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "helpwindow.h" DBCMainEditor::DBCMainEditor( const QVector *frames, QWidget *parent) : QDialog(parent), @@ -49,6 +50,8 @@ DBCMainEditor::DBCMainEditor( const QVector *frames, QWidget *parent) ui->MessagesTable->setContextMenuPolicy(Qt::CustomContextMenu); sigEditor = new DBCSignalEditor(); + + installEventFilter(this); } void DBCMainEditor::showEvent(QShowEvent* event) @@ -66,10 +69,29 @@ void DBCMainEditor::showEvent(QShowEvent* event) DBCMainEditor::~DBCMainEditor() { + removeEventFilter(this); delete ui; delete sigEditor; } +bool DBCMainEditor::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(event); + switch (keyEvent->key()) + { + case Qt::Key_F1: + HelpWindow::getRef()->showHelp("dbc_editor.html"); + break; + } + return true; + } else { + // standard event processing + return QObject::eventFilter(obj, event); + } + return false; +} + void DBCMainEditor::setFileIdx(int idx) { if (idx < 0 || idx > dbcHandler->getFileCount() - 1) return; @@ -374,6 +396,7 @@ void DBCMainEditor::onCellClickedMessage(int row, int col) DBC_MESSAGE *message = dbcFile->messageHandler->findMsgByID(Utility::ParseStringToNum(idString)); sigEditor->setMessageRef(message); sigEditor->setFileIdx(fileIdx); + sigEditor->setWindowModality(Qt::WindowModal); sigEditor->exec(); //blocks this window from being active until we're done //now update the displayed # of signals inhibitCellChanged = true; diff --git a/dbc/dbcmaineditor.h b/dbc/dbcmaineditor.h index 055d512..b92815d 100644 --- a/dbc/dbcmaineditor.h +++ b/dbc/dbcmaineditor.h @@ -44,6 +44,7 @@ private: void refreshMessagesTable(const DBC_NODE *node); void showEvent(QShowEvent* event); void closeEvent(QCloseEvent *event); + bool eventFilter(QObject *obj, QEvent *event); void readSettings(); void writeSettings(); void insertBlankRow(); diff --git a/dbc/dbcsignaleditor.cpp b/dbc/dbcsignaleditor.cpp index b8c660d..1eb4977 100644 --- a/dbc/dbcsignaleditor.cpp +++ b/dbc/dbcsignaleditor.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "helpwindow.h" DBCSignalEditor::DBCSignalEditor(QWidget *parent) : QDialog(parent), @@ -205,10 +206,13 @@ DBCSignalEditor::DBCSignalEditor(QWidget *parent) : if (dbcMessage->multiplexorSignal == currentSignal) dbcMessage->multiplexorSignal = NULL; } }); + + installEventFilter(this); } DBCSignalEditor::~DBCSignalEditor() { + removeEventFilter(this); delete ui; } @@ -218,6 +222,24 @@ void DBCSignalEditor::closeEvent(QCloseEvent *event) writeSettings(); } +bool DBCSignalEditor::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(event); + switch (keyEvent->key()) + { + case Qt::Key_F1: + HelpWindow::getRef()->showHelp("signaleditor.html"); + break; + } + return true; + } else { + // standard event processing + return QObject::eventFilter(obj, event); + } + return false; +} + void DBCSignalEditor::setFileIdx(int idx) { if (idx < 0 || idx > dbcHandler->getFileCount() - 1) return; diff --git a/dbc/dbcsignaleditor.h b/dbc/dbcsignaleditor.h index a3b47cd..97b883f 100644 --- a/dbc/dbcsignaleditor.h +++ b/dbc/dbcsignaleditor.h @@ -44,6 +44,7 @@ private: void generateUsedBits(); void closeEvent(QCloseEvent *event); + bool eventFilter(QObject *obj, QEvent *event); void readSettings(); void writeSettings(); };