From 265dabb3128c4c8f31b8afd35a29ba1bd5bd1fbc Mon Sep 17 00:00:00 2001 From: Ake Hedman Date: Fri, 2 Feb 2024 15:32:54 +0100 Subject: [PATCH] Renamed bit and value edit files and fialogs --- CMakeLists.txt | 71 +- ...{cdlgmdfregisterbit.cpp => cdlgmdfbit.cpp} | 46 +- src/{cdlgmdfregisterbit.h => cdlgmdfbit.h} | 14 +- src/{cdlgmdfregisterbit.ui => cdlgmdfbit.ui} | 8 +- ...registerbitlist.cpp => cdlgmdfbitlist.cpp} | 61 +- ...gmdfregisterbitlist.h => cdlgmdfbitlist.h} | 18 +- ...dfregisterbitlist.ui => cdlgmdfbitlist.ui} | 8 +- src/cdlgmdfdm.cpp | 354 +++++ src/cdlgmdfdm.h | 128 ++ src/cdlgmdfdm.ui | 225 +-- src/cdlgmdfdmaction.cpp | 325 +++++ src/cdlgmdfdmaction.h | 114 ++ src/cdlgmdfdmaction.ui | 231 +++ src/cdlgmdfdmactionparam.cpp | 231 +++ src/cdlgmdfdmactionparam.h | 110 ++ src/cdlgmdfdmactionparam.ui | 144 ++ src/cdlgmdfregistervaluelist.ui | 181 --- ...gmdfregistervalue.cpp => cdlgmdfvalue.cpp} | 28 +- ...{cdlgmdfregistervalue.h => cdlgmdfvalue.h} | 18 +- ...dlgmdfregistervalue.ui => cdlgmdfvalue.ui} | 8 +- ...stervaluelist.cpp => cdlgmdfvaluelist.cpp} | 42 +- ...registervaluelist.h => cdlgmdfvaluelist.h} | 14 +- src/cdlgmdfvaluelist.ui | 199 ++- src/cfrmmdf.cpp | 1271 ++++++++++++----- src/cfrmmdf.h | 95 +- 25 files changed, 3041 insertions(+), 903 deletions(-) rename src/{cdlgmdfregisterbit.cpp => cdlgmdfbit.cpp} (85%) rename src/{cdlgmdfregisterbit.h => cdlgmdfbit.h} (92%) rename src/{cdlgmdfregisterbit.ui => cdlgmdfbit.ui} (96%) rename src/{cdlgmdfregisterbitlist.cpp => cdlgmdfbitlist.cpp} (88%) rename src/{cdlgmdfregisterbitlist.h => cdlgmdfbitlist.h} (91%) rename src/{cdlgmdfregisterbitlist.ui => cdlgmdfbitlist.ui} (96%) create mode 100644 src/cdlgmdfdm.cpp create mode 100644 src/cdlgmdfdm.h create mode 100644 src/cdlgmdfdmaction.cpp create mode 100644 src/cdlgmdfdmaction.h create mode 100644 src/cdlgmdfdmaction.ui create mode 100644 src/cdlgmdfdmactionparam.cpp create mode 100644 src/cdlgmdfdmactionparam.h create mode 100644 src/cdlgmdfdmactionparam.ui delete mode 100644 src/cdlgmdfregistervaluelist.ui rename src/{cdlgmdfregistervalue.cpp => cdlgmdfvalue.cpp} (84%) rename src/{cdlgmdfregistervalue.h => cdlgmdfvalue.h} (88%) rename src/{cdlgmdfregistervalue.ui => cdlgmdfvalue.ui} (92%) rename src/{cdlgmdfregistervaluelist.cpp => cdlgmdfvaluelist.cpp} (90%) rename src/{cdlgmdfregistervaluelist.h => cdlgmdfvaluelist.h} (91%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c76da2a..ef110247 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,8 +237,7 @@ qt5_wrap_ui(UI src/mainwindow.ui src/cdlgactionparam.ui srd/cdlgdatepicker.ui src/cfrmmdf.ui - src/cdlgmdfmodule.ui - src/cdlgmdfdm.ui + src/cdlgmdfmodule.ui src/cdlgmdffilepicture.ui src/cdlgmdfmodule.ui src/cdlgmdfevent.ui @@ -261,19 +260,24 @@ qt5_wrap_ui(UI src/mainwindow.ui src/cdlgmdfregister.ui src/cdlgmdfregisterlist.ui - src/cdlgmdfregisterbit.ui - src/cdlgmdfregisterbitlist.ui - src/cdlgmdfregistervalue.ui - src/cdlgmdfregistervaluelist.ui + + src/cdlgmdfbit.ui + src/cdlgmdfbitlist.ui + src/cdlgmdfvalue.ui + src/cdlgmdfvaluelist.ui src/cdlgmdfregistermapping.ui src/cdlgmdfremotevar.ui src/cdlgmdfremotevarlist.ui - src/cdlgmdfremotevarbitlist.ui - src/cdlgmdfremotevarbit.ui - src/cdlgmdfremotevarvaluelist.ui - src/cdlgmdfremotevarvalue.ui + # src/cdlgmdfremotevarbitlist.ui + # src/cdlgmdfremotevarbit.ui + # src/cdlgmdfremotevarvaluelist.ui + # src/cdlgmdfremotevarvalue.ui + + src/cdlgmdfdm.ui + src/cdlgmdfdmaction.ui + str/cdlgmdfdmactionparam.ui ) add_executable(${PROJECT_NAME} @@ -584,25 +588,25 @@ add_executable(${PROJECT_NAME} src/cdlgmdfregisterlist.cpp src/cdlgmdfregisterlist.h - build/ui_cdlgmdfregisterbit.h - src/cdlgmdfregisterbit.ui - src/cdlgmdfregisterbit.cpp - src/cdlgmdfregisterbit.h + build/ui_cdlgmdfbit.h + src/cdlgmdfbit.ui + src/cdlgmdfbit.cpp + src/cdlgmdfbit.h - build/ui_cdlgmdfregisterbitlist.h - src/cdlgmdfregisterbitlist.ui - src/cdlgmdfregisterbitlist.cpp - src/cdlgmdfregisterbitlist.h + build/ui_cdlgmdfbitlist.h + src/cdlgmdfbitlist.ui + src/cdlgmdfbitlist.cpp + src/cdlgmdfbitlist.h - build/ui_cdlgmdfregistervalue.h - src/cdlgmdfregistervalue.ui - src/cdlgmdfregistervalue.cpp - src/cdlgmdfregistervalue.h + build/ui_cdlgmdfvalue.h + src/cdlgmdfvalue.ui + src/cdlgmdfvalue.cpp + src/cdlgmdfvalue.h - build/ui_cdlgmdfregistervaluelist.h - src/cdlgmdfregistervaluelist.ui - src/cdlgmdfregistervaluelist.cpp - src/cdlgmdfregistervaluelist.h + build/ui_cdlgmdfvaluelist.h + src/cdlgmdfvaluelist.ui + src/cdlgmdfvaluelist.cpp + src/cdlgmdfvaluelist.h build/ui_cdlgmdfremotevar.h src/cdlgmdfremotevar.ui @@ -614,6 +618,21 @@ add_executable(${PROJECT_NAME} src/cdlgmdfremotevarlist.cpp src/cdlgmdfremotevarlist.h + build/ui_cdlgmdfdm.h + src/cdlgmdfdm.ui + src/cdlgmdfdm.cpp + src/cdlgmdfdm.h + + build/ui_cdlgmdfdmaction.h + src/cdlgmdfdmaction.ui + src/cdlgmdfdmaction.cpp + src/cdlgmdfdmaction.h + + build/ui_cdlgmdfdmactionparam.h + src/cdlgmdfdmactionparam.ui + src/cdlgmdfdmactionparam.cpp + src/cdlgmdfdmactionparam.h + ${VSCP_PATH}/src/vscp/common/version.h ${VSCP_PATH}/src/vscp/common/vscp.h ${VSCP_PATH}/src/vscp/common/vscpremotetcpif.h diff --git a/src/cdlgmdfregisterbit.cpp b/src/cdlgmdfbit.cpp similarity index 85% rename from src/cdlgmdfregisterbit.cpp rename to src/cdlgmdfbit.cpp index f6a31945..0ea9344e 100644 --- a/src/cdlgmdfregisterbit.cpp +++ b/src/cdlgmdfbit.cpp @@ -35,8 +35,8 @@ #include -#include "cdlgmdfregisterbit.h" -#include "ui_cdlgmdfregisterbit.h" +#include "cdlgmdfbit.h" +#include "ui_cdlgmdfbit.h" #include #include @@ -49,15 +49,15 @@ #include #include -const char CDlgMdfRegisterBit::pre_str_registerbit[] = "Register bit: "; +const char CDlgMdfBit::pre_str_registerbit[] = "Register bit: "; /////////////////////////////////////////////////////////////////////////////// // CTor // -CDlgMdfRegisterBit::CDlgMdfRegisterBit(QWidget* parent) +CDlgMdfBit::CDlgMdfBit(QWidget* parent) : QDialog(parent) - , ui(new Ui::CDlgMdfRegisterBit) + , ui(new Ui::CDlgMdfBit) { ui->setupUi(this); @@ -75,7 +75,7 @@ CDlgMdfRegisterBit::CDlgMdfRegisterBit(QWidget* parent) // DTor // -CDlgMdfRegisterBit::~CDlgMdfRegisterBit() +CDlgMdfBit::~CDlgMdfBit() { delete ui; } @@ -85,7 +85,7 @@ CDlgMdfRegisterBit::~CDlgMdfRegisterBit() // void -CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index, mdf_record_type type) +CDlgMdfBit::initDialogData(CMDF_Bit* pbit, int index, mdf_record_type type) { QString str; @@ -167,7 +167,7 @@ CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index, mdf_record_type ty // void -CDlgMdfRegisterBit::setInitialFocus(void) +CDlgMdfBit::setInitialFocus(void) { // ui->editName->setFocus(); } @@ -177,13 +177,13 @@ CDlgMdfRegisterBit::setInitialFocus(void) // ---------------------------------------------------------------------------- QString -CDlgMdfRegisterBit::getName(void) +CDlgMdfBit::getName(void) { return ui->editName->text(); }; void -CDlgMdfRegisterBit::setName(const QString& name) +CDlgMdfBit::setName(const QString& name) { ui->editName->setText(name); }; @@ -191,13 +191,13 @@ CDlgMdfRegisterBit::setName(const QString& name) // ----------------------------------------------------------------------- uint8_t -CDlgMdfRegisterBit::getPos(void) +CDlgMdfBit::getPos(void) { return ui->spinPos->value(); } void -CDlgMdfRegisterBit::setPos(uint8_t span) +CDlgMdfBit::setPos(uint8_t span) { ui->spinPos->setValue(span); } @@ -206,13 +206,13 @@ CDlgMdfRegisterBit::setPos(uint8_t span) // ----------------------------------------------------------------------- uint8_t -CDlgMdfRegisterBit::getWidth(void) +CDlgMdfBit::getWidth(void) { return ui->spinWidth->value(); } void -CDlgMdfRegisterBit::setWidth(uint8_t span) +CDlgMdfBit::setWidth(uint8_t span) { ui->spinWidth->setValue(span); } @@ -220,13 +220,13 @@ CDlgMdfRegisterBit::setWidth(uint8_t span) // ----------------------------------------------------------------------- uint8_t -CDlgMdfRegisterBit::getDefault(void) +CDlgMdfBit::getDefault(void) { return ui->spinDefault->value(); } void -CDlgMdfRegisterBit::setDefault(uint8_t span) +CDlgMdfBit::setDefault(uint8_t span) { ui->spinDefault->setValue(span); } @@ -234,13 +234,13 @@ CDlgMdfRegisterBit::setDefault(uint8_t span) // ----------------------------------------------------------------------- uint8_t -CDlgMdfRegisterBit::getMin(void) +CDlgMdfBit::getMin(void) { return ui->spinMin->value(); } void -CDlgMdfRegisterBit::setMin(uint8_t min) +CDlgMdfBit::setMin(uint8_t min) { ui->spinMin->setValue(min); } @@ -248,13 +248,13 @@ CDlgMdfRegisterBit::setMin(uint8_t min) // ----------------------------------------------------------------------- uint8_t -CDlgMdfRegisterBit::getMax(void) +CDlgMdfBit::getMax(void) { return ui->spinMax->value(); } void -CDlgMdfRegisterBit::setMax(uint8_t span) +CDlgMdfBit::setMax(uint8_t span) { ui->spinMax->setValue(span); } @@ -262,13 +262,13 @@ CDlgMdfRegisterBit::setMax(uint8_t span) // ----------------------------------------------------------------------- mdf_access_mode -CDlgMdfRegisterBit::getAccess(void) +CDlgMdfBit::getAccess(void) { return static_cast(ui->comboAccess->currentIndex()); } void -CDlgMdfRegisterBit::setAccess(uint8_t access) +CDlgMdfBit::setAccess(uint8_t access) { if (access <= MDF_REG_ACCESS_READ_WRITE) { ui->comboAccess->setCurrentIndex(access); @@ -282,7 +282,7 @@ CDlgMdfRegisterBit::setAccess(uint8_t access) // void -CDlgMdfRegisterBit::accept() +CDlgMdfBit::accept() { std::string str; if (nullptr != m_pbit) { diff --git a/src/cdlgmdfregisterbit.h b/src/cdlgmdfbit.h similarity index 92% rename from src/cdlgmdfregisterbit.h rename to src/cdlgmdfbit.h index 2842da1d..0692f6ac 100644 --- a/src/cdlgmdfregisterbit.h +++ b/src/cdlgmdfbit.h @@ -26,8 +26,8 @@ // SOFTWARE. // -#ifndef CDLGMDFREGISTERBIT_H -#define CDLGMDFREGISTERBIT_H +#ifndef CDLGMDFBIT_H +#define CDLGMDFBIT_H #include #include @@ -35,16 +35,16 @@ #include namespace Ui { -class CDlgMdfRegisterBit; +class CDlgMdfBit; } -class CDlgMdfRegisterBit : public QDialog { +class CDlgMdfBit : public QDialog { Q_OBJECT public: public: - explicit CDlgMdfRegisterBit(QWidget* parent = nullptr); - ~CDlgMdfRegisterBit(); + explicit CDlgMdfBit(QWidget* parent = nullptr); + ~CDlgMdfBit(); static const int index_name = 0; static const int index_pos = 1; @@ -110,7 +110,7 @@ public slots: void accept(void); private: - Ui::CDlgMdfRegisterBit* ui; + Ui::CDlgMdfBit* ui; /// Pointer to MDF CMDF* m_pmdf; diff --git a/src/cdlgmdfregisterbit.ui b/src/cdlgmdfbit.ui similarity index 96% rename from src/cdlgmdfregisterbit.ui rename to src/cdlgmdfbit.ui index 9a541f79..f294d469 100644 --- a/src/cdlgmdfregisterbit.ui +++ b/src/cdlgmdfbit.ui @@ -1,7 +1,7 @@ - CDlgMdfRegisterBit - + CDlgMdfBit + 0 @@ -163,7 +163,7 @@ buttonBox accepted() - CDlgMdfRegisterBit + CDlgMdfBit accept() @@ -179,7 +179,7 @@ buttonBox rejected() - CDlgMdfRegisterBit + CDlgMdfBit reject() diff --git a/src/cdlgmdfregisterbitlist.cpp b/src/cdlgmdfbitlist.cpp similarity index 88% rename from src/cdlgmdfregisterbitlist.cpp rename to src/cdlgmdfbitlist.cpp index a89c5156..6000e658 100644 --- a/src/cdlgmdfregisterbitlist.cpp +++ b/src/cdlgmdfbitlist.cpp @@ -1,4 +1,4 @@ -// cdlgmdfregisterbitlist.cpp +// cdlgmdfbitlist.cpp // // This file is part of the VSCP (https://www.vscp.org) // @@ -35,9 +35,9 @@ #include -#include "cdlgmdfregisterbit.h" -#include "cdlgmdfregisterbitlist.h" -#include "ui_cdlgmdfregisterbitlist.h" +#include "cdlgmdfbit.h" +#include "cdlgmdfbitlist.h" +#include "ui_cdlgmdfbitlist.h" #include #include @@ -53,9 +53,9 @@ // CTor // -CDlgMdfRegisterBitList::CDlgMdfRegisterBitList(QWidget* parent) +CDlgMdfBitList::CDlgMdfBitList(QWidget* parent) : QDialog(parent) - , ui(new Ui::CDlgMdfRegisterBitList) + , ui(new Ui::CDlgMdfBitList) { m_pobj = nullptr; m_type = mdf_type_unknown; @@ -64,12 +64,12 @@ CDlgMdfRegisterBitList::CDlgMdfRegisterBitList(QWidget* parent) vscpworks* pworks = (vscpworks*)QCoreApplication::instance(); - connect(ui->btnAddRegisterBit, &QToolButton::clicked, this, &CDlgMdfRegisterBitList::addRegisterBit); - connect(ui->btnEditRegisterBit, &QToolButton::clicked, this, &CDlgMdfRegisterBitList::editRegisterBit); - connect(ui->btnDupRegisterBit, &QToolButton::clicked, this, &CDlgMdfRegisterBitList::dupRegisterBit); - connect(ui->btnDelRegisterBit, &QToolButton::clicked, this, &CDlgMdfRegisterBitList::deleteRegisterBit); + connect(ui->btnAddRegisterBit, &QToolButton::clicked, this, &CDlgMdfBitList::addRegisterBit); + connect(ui->btnEditRegisterBit, &QToolButton::clicked, this, &CDlgMdfBitList::editRegisterBit); + connect(ui->btnDupRegisterBit, &QToolButton::clicked, this, &CDlgMdfBitList::dupRegisterBit); + connect(ui->btnDelRegisterBit, &QToolButton::clicked, this, &CDlgMdfBitList::deleteRegisterBit); - connect(ui->listBits, &QListWidget::doubleClicked, this, &CDlgMdfRegisterBitList::editRegisterBit); + connect(ui->listBits, &QListWidget::doubleClicked, this, &CDlgMdfBitList::editRegisterBit); this->setFixedSize(this->size()); } @@ -78,7 +78,7 @@ CDlgMdfRegisterBitList::CDlgMdfRegisterBitList(QWidget* parent) // DTor // -CDlgMdfRegisterBitList::~CDlgMdfRegisterBitList() +CDlgMdfBitList::~CDlgMdfBitList() { delete ui; } @@ -88,7 +88,7 @@ CDlgMdfRegisterBitList::~CDlgMdfRegisterBitList() // void -CDlgMdfRegisterBitList::initDialogData(CMDF_Object* pobj, mdf_record_type type) +CDlgMdfBitList::initDialogData(CMDF_Object* pobj, mdf_record_type type) { QString str; @@ -112,6 +112,9 @@ CDlgMdfRegisterBitList::initDialogData(CMDF_Object* pobj, mdf_record_type type) else if (mdf_type_alarm == type) { setWindowTitle("Alarm bit definitions"); } + else if (mdf_type_action_param == type) { + setWindowTitle("Action parameter bit definitions"); + } // m_pmdf->getRegisterMap(m_page, pages); renderBitItems(); @@ -122,7 +125,7 @@ CDlgMdfRegisterBitList::initDialogData(CMDF_Object* pobj, mdf_record_type type) // std::deque* -CDlgMdfRegisterBitList::getBits(void) +CDlgMdfBitList::getBits(void) { if (mdf_type_register == m_type) { return ((CMDF_Register*)m_pobj)->getListBits(); @@ -142,7 +145,7 @@ CDlgMdfRegisterBitList::getBits(void) // void -CDlgMdfRegisterBitList::renderBitItems(void) +CDlgMdfBitList::renderBitItems(void) { std::deque* pbits = nullptr; std::map pages; @@ -161,6 +164,9 @@ CDlgMdfRegisterBitList::renderBitItems(void) else if (mdf_type_alarm == m_type) { pbits = ((CMDF*)m_pobj)->getAlarmListBits(); } + else if (mdf_type_action_param == m_type) { + pbits = ((CMDF_ActionParameter*)m_pobj)->getListBits(); + } else { return; } @@ -188,7 +194,7 @@ CDlgMdfRegisterBitList::renderBitItems(void) // void -CDlgMdfRegisterBitList::addRegisterBit(void) +CDlgMdfBitList::addRegisterBit(void) { bool ok; std::deque* pbits; @@ -203,7 +209,7 @@ CDlgMdfRegisterBitList::addRegisterBit(void) // Save the selected row int idx = ui->listBits->currentRow(); - CDlgMdfRegisterBit dlg(this); + CDlgMdfBit dlg(this); dlg.initDialogData(pbitnew); dlg.setWindowTitle(tr("Add register bit definition")); @@ -225,6 +231,9 @@ CDlgMdfRegisterBitList::addRegisterBit(void) else if (mdf_type_alarm == m_type) { pbits = ((CMDF*)m_pobj)->getAlarmListBits(); } + else if (mdf_type_action_param == m_type) { + pbits = ((CMDF_ActionParameter*)m_pobj)->getListBits(); + } else { return; } @@ -242,7 +251,7 @@ CDlgMdfRegisterBitList::addRegisterBit(void) // void -CDlgMdfRegisterBitList::editRegisterBit(void) +CDlgMdfBitList::editRegisterBit(void) { bool ok; CMDF_Bit* pbit = nullptr; @@ -264,11 +273,14 @@ CDlgMdfRegisterBitList::editRegisterBit(void) else if (mdf_type_alarm == m_type) { pbit = ((CMDF*)m_pobj)->getAlarmListBits()->at(pitem->data(Qt::UserRole).toUInt()); } + else if (mdf_type_action_param == m_type) { + pbit = ((CMDF_ActionParameter*)m_pobj)->getListBits()->at(pitem->data(Qt::UserRole).toUInt()); + } else { return; } - CDlgMdfRegisterBit dlg(this); + CDlgMdfBit dlg(this); dlg.initDialogData(pbit, 0, m_type); editbitdlg: @@ -294,7 +306,7 @@ CDlgMdfRegisterBitList::editRegisterBit(void) // void -CDlgMdfRegisterBitList::dupRegisterBit(void) +CDlgMdfBitList::dupRegisterBit(void) { if (-1 != ui->listBits->currentRow()) { @@ -310,7 +322,7 @@ CDlgMdfRegisterBitList::dupRegisterBit(void) // // Make copy // *pregnew = *preg; - // CDlgMdfRegisterBit dlg(this); + // CDlgMdfBit dlg(this); // dlg.initDialogData(m_pmdf, pregnew); // dupregdlg: // if (QDialog::Accepted == dlg.exec()) { @@ -351,7 +363,7 @@ CDlgMdfRegisterBitList::dupRegisterBit(void) // void -CDlgMdfRegisterBitList::deleteRegisterBit(void) +CDlgMdfBitList::deleteRegisterBit(void) { CMDF_Bit* pbit; std::deque::iterator it; @@ -366,6 +378,9 @@ CDlgMdfRegisterBitList::deleteRegisterBit(void) else if (mdf_type_alarm == m_type) { pbits = ((CMDF*)m_pobj)->getAlarmListBits(); } + else if (mdf_type_action_param == m_type) { + pbits = ((CMDF_ActionParameter*)m_pobj)->getListBits(); + } else { return; } @@ -407,7 +422,7 @@ CDlgMdfRegisterBitList::deleteRegisterBit(void) // void -CDlgMdfRegisterBitList::accept() +CDlgMdfBitList::accept() { std::string str; if (nullptr != m_pobj) { diff --git a/src/cdlgmdfregisterbitlist.h b/src/cdlgmdfbitlist.h similarity index 91% rename from src/cdlgmdfregisterbitlist.h rename to src/cdlgmdfbitlist.h index 05bdc170..37f06328 100644 --- a/src/cdlgmdfregisterbitlist.h +++ b/src/cdlgmdfbitlist.h @@ -26,8 +26,8 @@ // SOFTWARE. // -#ifndef CDLGMDFREGISTERBITLIST_H -#define CDLGMDFREGISTERBITLIST_H +#ifndef CDLGMDFBITLIST_H +#define CDLGMDFBITLIST_H #include #include @@ -37,15 +37,15 @@ #include namespace Ui { -class CDlgMdfRegisterBitList; +class CDlgMdfBitList; } -class CDlgMdfRegisterBitList : public QDialog { +class CDlgMdfBitList : public QDialog { Q_OBJECT public: - explicit CDlgMdfRegisterBitList(QWidget* parent = nullptr); - ~CDlgMdfRegisterBitList(); + explicit CDlgMdfBitList(QWidget* parent = nullptr); + ~CDlgMdfBitList(); /*! Set edit mode. @@ -91,6 +91,9 @@ class CDlgMdfRegisterBitList : public QDialog { else if (mdf_type_alarm == m_type) { pbits = ((CMDF*)m_pobj)->getAlarmListBits(); } + else if (mdf_type_action_param == m_type) { + pbits = ((CMDF_ActionParameter*)m_pobj)->getListBits(); + } else { return 0; } @@ -129,11 +132,10 @@ public slots: void deleteRegisterBit(void); private: - Ui::CDlgMdfRegisterBitList* ui; + Ui::CDlgMdfBitList* ui; // MDF CMDF_Object* m_pobj; - // CMDF_Register* m_preg; // Object type mdf_record_type m_type; diff --git a/src/cdlgmdfregisterbitlist.ui b/src/cdlgmdfbitlist.ui similarity index 96% rename from src/cdlgmdfregisterbitlist.ui rename to src/cdlgmdfbitlist.ui index 1ef8b87f..526df96e 100644 --- a/src/cdlgmdfregisterbitlist.ui +++ b/src/cdlgmdfbitlist.ui @@ -1,7 +1,7 @@ - CDlgMdfRegisterBitList - + CDlgMdfBitList + 0 @@ -148,7 +148,7 @@ buttonBox accepted() - CDlgMdfRegisterBitList + CDlgMdfBitList accept() @@ -164,7 +164,7 @@ buttonBox rejected() - CDlgMdfRegisterBitList + CDlgMdfBitList reject() diff --git a/src/cdlgmdfdm.cpp b/src/cdlgmdfdm.cpp new file mode 100644 index 00000000..172b53d9 --- /dev/null +++ b/src/cdlgmdfdm.cpp @@ -0,0 +1,354 @@ +// cdlgmdfdm.cpp +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2024 Ake Hedman, Grodans Paradis AB +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +#ifdef WIN32 +#include +#endif + +#include +#include + +#include + +#include "cdlgmdfdmaction.h" + +#include "cdlgmdfdm.h" +#include "ui_cdlgmdfdm.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +const char CDlgMdfDM::pre_str_dm[] = "Decision Matrix: "; + +/////////////////////////////////////////////////////////////////////////////// +// CTor +// + +CDlgMdfDM::CDlgMdfDM(QWidget* parent) + : QDialog(parent) + , ui(new Ui::CDlgMdfDM) +{ + ui->setupUi(this); + + // m_type = mdf_type_unknown; + m_pdm = nullptr; + + vscpworks* pworks = (vscpworks*)QCoreApplication::instance(); + + this->setFixedSize(this->size()); +} + +/////////////////////////////////////////////////////////////////////////////// +// DTor +// + +CDlgMdfDM::~CDlgMdfDM() +{ + delete ui; +} + +/////////////////////////////////////////////////////////////////////////////// +// initDialogData +// + +void +CDlgMdfDM::initDialogData(CMDF* pmdf, CMDF_DecisionMatrix* pdm, int index) +{ + QString str; + + if (nullptr == pmdf) { + spdlog::error("MDF register information - Invalid MDF object (initDialogData)"); + return; + } + + m_pmdf = pmdf; + + if (nullptr == pdm) { + spdlog::error("MDF decsion matrix information - Invalid MDF register object (initDialogData)"); + return; + } + + m_pdm = pdm; + + // Connect edit action + connect(ui->btnEditAction, + SIGNAL(clicked()), + this, + SLOT(editAction())); + + // Connect add action + connect(ui->btnAddAction, + SIGNAL(clicked()), + this, + SLOT(addAction())); + + // Connect dup action + connect(ui->btnDupAction, + SIGNAL(clicked()), + this, + SLOT(dupAction())); + + // Connect dup action + connect(ui->btnDelAction, + SIGNAL(clicked()), + this, + SLOT(delAction())); + + setLevel(pdm->getLevel()); + setPage(pdm->getStartPage()); + setOffset(pdm->getStartOffset()); + setRows(pdm->getRowCount()); + setSize(pdm->getRowSize()); + + // Render available actions + renderActions(); + + switch (index) { + case index_level: + ui->comboLevel->setFocus(); + break; + + case index_start_page: + ui->spinStartPage->setFocus(); + break; + + case index_start_offset: + ui->editStartOffset->setFocus(); + break; + + case index_rows: + ui->spinRowCnt->setFocus(); + break; + + case index_row_size: + ui->spinRowSize->setFocus(); + break; + + default: + ui->comboLevel->setFocus(); + break; + } + + this->setFixedSize(this->size()); +} + +// ---------------------------------------------------------------------------- +// Getters & Setters +// ---------------------------------------------------------------------------- + +int +CDlgMdfDM::getLevel(void) +{ + return ui->comboLevel->currentIndex() + 1; +}; + +void +CDlgMdfDM::setLevel(int level) +{ + level--; + if (level < 0) { + level = 0; + } + ui->comboLevel->setCurrentIndex(level); +}; + +// ----------------------------------------------------------------------- + +uint16_t +CDlgMdfDM::getPage(void) +{ + return ui->spinStartPage->value(); +} + +void +CDlgMdfDM::setPage(uint16_t page) +{ + ui->spinStartPage->setValue(page); +} + +// ----------------------------------------------------------------------- + +uint32_t +CDlgMdfDM::getOffset(void) +{ + return vscp_readStringValue(ui->editStartOffset->text().toStdString()); +} + +void +CDlgMdfDM::setOffset(uint32_t offset) +{ + ui->editStartOffset->setText(QString("%1").arg(offset)); +} + +// ----------------------------------------------------------------------- + +uint16_t +CDlgMdfDM::getRows(void) +{ + return ui->spinRowCnt->value(); +} + +void +CDlgMdfDM::setRows(uint16_t rows) +{ + ui->spinRowCnt->setValue(rows); +} + +// ----------------------------------------------------------------------- + +uint16_t +CDlgMdfDM::getSize(void) +{ + return ui->spinRowSize->value(); +} + +void +CDlgMdfDM::setSize(uint16_t cnt) +{ + ui->spinRowSize->setValue(cnt); +} + +// ----------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +// renderActions +// + +void +CDlgMdfDM::renderActions(void) +{ + if (nullptr == m_pdm) { + return; + } + + ui->listActions->clear(); + + std::deque* pActionList = m_pdm->getActionList(); + + if (nullptr != pActionList) { + for (int i = 0; i < pActionList->size(); i++) { + CMDF_Action* paction = (*pActionList)[i]; + if (nullptr != paction) { + QString str = QString("%1 %2").arg(paction->getCode()).arg(paction->getName().c_str()); + QListWidgetItem* pitem = new QListWidgetItem(str, ui->listActions, QListWidgetItem::UserType); + if (nullptr != pitem) { + pitem->setData(QListWidgetItem::UserType, paction->getCode()); + ui->listActions->addItem(pitem); + } + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// editAction +// + +void +CDlgMdfDM::editAction(void) +{ + bool ok; + + if (-1 != ui->listActions->currentRow()) { + + // Save the selected row + int idx = ui->listActions->currentRow(); + + QListWidgetItem* pitem = ui->listActions->currentItem(); + printf("data=%d\n",pitem->data(QListWidgetItem::UserType).toUInt()); + CMDF_Action* paction = m_pdm->getAction(pitem->data(QListWidgetItem::UserType).toUInt()); + + CDlgMdfDmAction dlg(this); + dlg.initDialogData(m_pmdf, paction); + if (QDialog::Accepted == dlg.exec()) { + ui->listActions->clear(); + renderActions(); + ui->listActions->setCurrentRow(idx); + } + } + else { + QMessageBox::warning(this, tr(APPNAME), tr("An item must be selected"), QMessageBox::Ok); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// addAction +// + +void +CDlgMdfDM::addAction(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// dupAction +// + +void +CDlgMdfDM::dupAction(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// deleteAction +// + +void +CDlgMdfDM::deleteAction(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// accept +// + +void +CDlgMdfDM::accept() +{ + std::string str; + if (nullptr != m_pdm) { + m_pdm->setLevel(getLevel()); + m_pdm->setStartPage(getPage()); + m_pdm->setStartOffset(getOffset()); + m_pdm->setRowCount(getRows()); + m_pdm->setRowSize(getSize()); + } + else { + spdlog::error("MDF module information - Invalid MDF object (accept)"); + } + + QDialog::accept(); +} diff --git a/src/cdlgmdfdm.h b/src/cdlgmdfdm.h new file mode 100644 index 00000000..4775c5d0 --- /dev/null +++ b/src/cdlgmdfdm.h @@ -0,0 +1,128 @@ +// cdlgmdfdm.h +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2024 Ake Hedman, Grodans Paradis AB +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +#ifndef CDLGMDFDM_H +#define CDLGMDFDM_H + +#include +#include + +#include + + + +namespace Ui { +class CDlgMdfDM; +} + +class CDlgMdfDM : public QDialog { + Q_OBJECT + +public: +public: + explicit CDlgMdfDM(QWidget* parent = nullptr); + ~CDlgMdfDM(); + + static const int index_level = 0; + static const int index_start_page = 1; + static const int index_start_offset = 2; + static const int index_rows = 3; + static const int index_row_size = 4; + static const int index_actions = 5; + + static const char pre_str_dm[]; + + /*! + Init dialog data + @param CMDF *pmdf Pointer to MDF + @param pmdfobject Pointer to MDF object + @param index Selected file item + + */ + void initDialogData(CMDF *pmdf, CMDF_DecisionMatrix* pdm, int index = 0); + + + + // ---------------------------------------------------------------------------- + // Getters & Setters + // ---------------------------------------------------------------------------- + + // level + int getLevel(void); + void setLevel(int level); + + // page + uint16_t getPage(void); + void setPage(uint16_t page); + + // offset + uint32_t getOffset(void); + void setOffset(uint32_t offset); + + // Number of DM rows + uint16_t getRows(void); + void setRows(uint16_t rows); + + // DM row size + uint16_t getSize(void); + void setSize(uint16_t size); + + // Render available actions + void renderActions(void); + +public slots: + + // Edit action item + void editAction(void); + + // Add action item + void addAction(void); + + // Duplicate action item + void dupAction(void); + + // Delete action item + void deleteAction(void); + + /*! + Accept dialog data and write to register + */ + void accept(void); + + +private: + Ui::CDlgMdfDM* ui; + + /// Pointer to MDF + CMDF *m_pmdf; + + CMDF_DecisionMatrix* m_pdm; + +}; + +#endif // CDLGMDFDM_H diff --git a/src/cdlgmdfdm.ui b/src/cdlgmdfdm.ui index 2a8c02ba..03c342cc 100644 --- a/src/cdlgmdfdm.ui +++ b/src/cdlgmdfdm.ui @@ -7,13 +7,13 @@ 0 0 754 - 407 + 406 - Dialog + Decision Matrix - + 10 @@ -38,7 +38,7 @@ 9 9 741 - 351 + 356 @@ -50,7 +50,7 @@ - + 0 @@ -59,12 +59,12 @@ - 1 + Level I - 2 + Level II @@ -77,9 +77,9 @@ - - - 0 + + + 65535 @@ -91,11 +91,7 @@ - - - 0 - - + @@ -105,9 +101,9 @@ - - - 1 + + + 255 @@ -119,118 +115,87 @@ - + + + + - 8 + Actions - - - - Code - - - - - Name - - - - - 0 - - - NOOP - - + + + + - - 1 - - - FIRST - - - - Description + + + Edit action item - EN + ... - - - - New Subitem + + + :/pencil.svg:/pencil.svg - - Info URL + + Ctrl+E - + - - 2 - - - SECOND - - - - Description + + + Add action item - EN + ... - - - - New Subitem + + + :/add.png:/add.png - - Info URL - - - - - - - - - - - Edit + + Ctrl+A - - - Add + + + Duplicate action item - - - - - Add Description + ... - - - - - - Remove + + + :/images/svg/copy.svg:/images/svg/copy.svg + + + Ctrl+D - + + + Delete action item + - Duplicate + ... + + + + :/remove.png:/remove.png + + + Ctrl+X @@ -251,16 +216,60 @@ - - - - Actions - - - - - + + + + + + buttonBox + accepted() + CDlgMdfDM + accept() + + + 380 + 385 + + + 376 + 203 + + + + + buttonBox + rejected() + CDlgMdfDM + reject() + + + 380 + 385 + + + 376 + 203 + + + + + listActions + itemDoubleClicked(QListWidgetItem*) + btnEditAction + click() + + + 406 + 265 + + + 734 + 181 + + + + diff --git a/src/cdlgmdfdmaction.cpp b/src/cdlgmdfdmaction.cpp new file mode 100644 index 00000000..4b1de93f --- /dev/null +++ b/src/cdlgmdfdmaction.cpp @@ -0,0 +1,325 @@ +// cdlgmdfaction.cpp +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2024 Ake Hedman, Grodans Paradis AB +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +#ifdef WIN32 +#include +#endif + +#include +#include + +#include + +#include "cdlgmdfdmactionparam.h" + +#include "cdlgmdfdmaction.h" +#include "ui_cdlgmdfdmaction.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +const char CDlgMdfDmAction::pre_str_dm_action[] = "Actions: "; + +/////////////////////////////////////////////////////////////////////////////// +// CTor +// + +CDlgMdfDmAction::CDlgMdfDmAction(QWidget* parent) + : QDialog(parent) + , ui(new Ui::CDlgMdfDmAction) +{ + ui->setupUi(this); + + // m_type = mdf_type_unknown; + m_paction = nullptr; + + // Connect edit action + connect(ui->btnEditActionParam, + SIGNAL(clicked()), + this, + SLOT(editActionParam())); + + // Connect add action + connect(ui->btnAddActionParam, + SIGNAL(clicked()), + this, + SLOT(addActionParam())); + + // Connect dup action + connect(ui->btnDupActionParam, + SIGNAL(clicked()), + this, + SLOT(dupActionParam())); + + // Connect dup action + connect(ui->btnDelActionParam, + SIGNAL(clicked()), + this, + SLOT(delActionParam())); + + vscpworks* pworks = (vscpworks*)QCoreApplication::instance(); + + this->setFixedSize(this->size()); +} + +/////////////////////////////////////////////////////////////////////////////// +// DTor +// + +CDlgMdfDmAction::~CDlgMdfDmAction() +{ + delete ui; +} + +/////////////////////////////////////////////////////////////////////////////// +// initDialogData +// + +void +CDlgMdfDmAction::initDialogData(CMDF* pmdf, CMDF_Action* paction, int index) +{ + QString str; + + if (nullptr == pmdf) { + spdlog::error("MDF register information - Invalid MDF object (initDialogData)"); + return; + } + + m_pmdf = pmdf; + + if (nullptr == paction) { + spdlog::error("MDF decsion matrix information - Invalid MDF register object (initDialogData)"); + return; + } + + m_paction = paction; + + // Connect edit action + connect(ui->btnEditActionParam, + SIGNAL(clicked()), + this, + SLOT(editAction())); + + // Connect add action + connect(ui->btnAddActionParam, + SIGNAL(clicked()), + this, + SLOT(addAction())); + + // Connect dup action + connect(ui->btnDupActionParam, + SIGNAL(clicked()), + this, + SLOT(dupAction())); + + // Connect dup action + connect(ui->btnDelActionParam, + SIGNAL(clicked()), + this, + SLOT(delAction())); + + setCode(paction->getCode()); + setName(paction->getName().c_str()); + + // Render available actions + renderActionParams(); + + switch (index) { + case index_code: + ui->spinCode->setFocus(); + break; + + case index_name: + ui->editName->setFocus(); + break; + + default: + ui->spinCode->setFocus(); + break; + } + + this->setFixedSize(this->size()); +} + +/////////////////////////////////////////////////////////////////////////////// +// setReadOnly +// + +void +CDlgMdfDmAction::setReadOnly(void) +{ + ui->spinCode->setEnabled(false); + ui->editName->setEnabled(false); +} + +// ---------------------------------------------------------------------------- +// Getters & Setters +// ---------------------------------------------------------------------------- + +uint8_t +CDlgMdfDmAction::getCode(void) +{ + return ui->spinCode->value(); +}; + +void +CDlgMdfDmAction::setCode(uint8_t code) +{ + ui->spinCode->setValue(code); +}; + +// ----------------------------------------------------------------------- + +QString +CDlgMdfDmAction::getName(void) +{ + return ui->editName->text(); +}; + +void +CDlgMdfDmAction::setName(const QString& name) +{ + ui->editName->setText(name); +}; + +// ----------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +// renderActions +// + +void +CDlgMdfDmAction::renderActionParams(void) +{ + if (nullptr == m_paction) { + return; + } + + ui->listActionParams->clear(); + + std::deque* pActionParamList = m_paction->getListActionParameter(); + + if (nullptr != pActionParamList) { + for (int i = 0; i < pActionParamList->size(); i++) { + CMDF_ActionParameter* pactionparam = (*pActionParamList)[i]; + if (nullptr != pactionparam) { + QString str = QString("Offset: %1 - %2").arg(pactionparam->getOffset()).arg(pactionparam->getName().c_str()); + QListWidgetItem* pitem = new QListWidgetItem(str, ui->listActionParams); + if (nullptr != pitem) { + pitem->setData(QListWidgetItem::UserType,pactionparam->getOffset()); + ui->listActionParams->addItem(pitem); + } + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// editActionParam +// + +void +CDlgMdfDmAction::editActionParam(void) +{ + bool ok; + + if (-1 != ui->listActionParams->currentRow()) { + + // Save the selected row + int idx = ui->listActionParams->currentRow(); + + QListWidgetItem* pitem = ui->listActionParams->currentItem(); + printf("data=%d\n",pitem->data(QListWidgetItem::UserType).toUInt()); + CMDF_ActionParameter* pactionparam = m_paction->getActionParam(pitem->data(QListWidgetItem::UserType).toUInt()); + + CDlgMdfDmActionParam dlg(this); + dlg.initDialogData(m_pmdf, pactionparam); + if (QDialog::Accepted == dlg.exec()) { + ui->listActionParams->clear(); + renderActionParams(); + ui->listActionParams->setCurrentRow(idx); + } + } + else { + QMessageBox::warning(this, tr(APPNAME), tr("An item must be selected"), QMessageBox::Ok); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// addActionParam +// + +void +CDlgMdfDmAction::addActionParam(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// dupActionParam +// + +void +CDlgMdfDmAction::dupActionParam(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// deleteActionParam +// + +void +CDlgMdfDmAction::deleteActionParam(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// accept +// + +void +CDlgMdfDmAction::accept() +{ + std::string str; + if (nullptr != m_paction) { + m_paction ->setCode(getCode()); + m_paction->setName(getName().toStdString()); + } + else { + spdlog::error("MDF module information - Invalid MDF object (accept)"); + } + + QDialog::accept(); +} diff --git a/src/cdlgmdfdmaction.h b/src/cdlgmdfdmaction.h new file mode 100644 index 00000000..0a01caac --- /dev/null +++ b/src/cdlgmdfdmaction.h @@ -0,0 +1,114 @@ +// cdlgmdfaction.h +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2024 Ake Hedman, Grodans Paradis AB +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +#ifndef CDLGMDFDM_ACTIONS_H +#define CDLGMDFDM_ACTIONS_H + +#include +#include + +#include + + + +namespace Ui { +class CDlgMdfDmAction; +} + +class CDlgMdfDmAction : public QDialog { + Q_OBJECT + +public: + explicit CDlgMdfDmAction(QWidget* parent = nullptr); + ~CDlgMdfDmAction(); + + static const int index_code = 0; + static const int index_name = 1; + + static const char pre_str_dm_action[]; + + /*! + Init dialog data + @param CMDF *pmdf Pointer to MDF + @param pmdfobject Pointer to MDF object + @param index Selected file item + + */ + void initDialogData(CMDF *pmdf, CMDF_Action* paction, int index = 0); + + /*! + Only enable parameter list + */ + void setReadOnly(void); + + // ---------------------------------------------------------------------------- + // Getters & Setters + // ---------------------------------------------------------------------------- + + // code + uint8_t getCode(void); + void setCode(uint8_t code); + + // name + QString getName(void); + void setName(const QString& name); + + // Render available actions + void renderActionParams(void); + +public slots: + + // Edit action item + void editActionParam(void); + + // Add action item + void addActionParam(void); + + // Duplicate action item + void dupActionParam(void); + + // Delete action item + void deleteActionParam(void); + + /*! + Accept dialog data and write to register + */ + void accept(void); + + +private: + Ui::CDlgMdfDmAction* ui; + + /// Pointer to MDF + CMDF *m_pmdf; + + CMDF_Action* m_paction; + +}; + +#endif // CDLGMDFDM_ACTIONS_H diff --git a/src/cdlgmdfdmaction.ui b/src/cdlgmdfdmaction.ui new file mode 100644 index 00000000..b8d8e805 --- /dev/null +++ b/src/cdlgmdfdmaction.ui @@ -0,0 +1,231 @@ + + + CDlgMdfDmAction + + + + 0 + 0 + 754 + 336 + + + + Decsion Matrix Action + + + + + 10 + 300 + 731 + 31 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok + + + false + + + + + + 10 + 10 + 731 + 281 + + + + + + + Code + + + + + + + 65535 + + + + + + + Name + + + + + + + + + + + + + + + + + Parameters + + + + + + + + + + + + + + Edit action parameter item + + + ... + + + + :/pencil.svg:/pencil.svg + + + Ctrl+E + + + + + + + Add action parameter item + + + ... + + + + :/add.png:/add.png + + + Ctrl+A + + + + + + + Duplicate action parameter item + + + ... + + + + :/images/svg/copy.svg:/images/svg/copy.svg + + + Ctrl+D + + + + + + + Delete action parameter item + + + ... + + + + :/remove.png:/remove.png + + + Ctrl+X + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + buttonBox + accepted() + CDlgMdfDmAction + accept() + + + 380 + 385 + + + 376 + 203 + + + + + buttonBox + rejected() + CDlgMdfDmAction + reject() + + + 380 + 385 + + + 376 + 203 + + + + + listActionParams + itemDoubleClicked(QListWidgetItem*) + btnEditActionParam + click() + + + 382 + 206 + + + 725 + 87 + + + + + diff --git a/src/cdlgmdfdmactionparam.cpp b/src/cdlgmdfdmactionparam.cpp new file mode 100644 index 00000000..338f1718 --- /dev/null +++ b/src/cdlgmdfdmactionparam.cpp @@ -0,0 +1,231 @@ +// cdlgmdfactionparam.cpp +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2024 Ake Hedman, Grodans Paradis AB +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +#ifdef WIN32 +#include +#endif + +#include +#include + +#include + +#include "cdlgmdfdmactionparam.h" +#include "ui_cdlgmdfdmactionparam.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +const char CDlgMdfDmActionParam::pre_str_actionparam[] = "Parameter: "; + +/////////////////////////////////////////////////////////////////////////////// +// CTor +// + +CDlgMdfDmActionParam::CDlgMdfDmActionParam(QWidget* parent) + : QDialog(parent) + , ui(new Ui::CDlgMdfDmActionParam) +{ + ui->setupUi(this); + + // m_type = mdf_type_unknown; + m_pactionparam = nullptr; + + vscpworks* pworks = (vscpworks*)QCoreApplication::instance(); + + this->setFixedSize(this->size()); +} + +/////////////////////////////////////////////////////////////////////////////// +// DTor +// + +CDlgMdfDmActionParam::~CDlgMdfDmActionParam() +{ + delete ui; +} + +/////////////////////////////////////////////////////////////////////////////// +// initDialogData +// + +void +CDlgMdfDmActionParam::initDialogData(CMDF* pmdf, CMDF_ActionParameter* pactionparam, int index) +{ + QString str; + + if (nullptr == pmdf) { + spdlog::error("MDF register information - Invalid MDF object (initDialogData)"); + return; + } + + m_pmdf = pmdf; + + if (nullptr == pactionparam) { + spdlog::error("MDF decsion matrix information - Invalid MDF register object (initDialogData)"); + return; + } + + m_pactionparam = pactionparam; + + setName(pactionparam->getName().c_str()); + setOffset(pactionparam->getOffset()); + setMin(pactionparam->getMin()); + setMax(pactionparam->getMax()); + + // // Render available actions + renderActionParams(); + + switch (index) { + case index_name: + ui->editName->setFocus(); + break; + + case index_offset: + ui->spinOffset->setFocus(); + break; + + case index_max: + ui->spinMax->setFocus(); + break; + + case index_min: + ui->spinMin->setFocus(); + break; + + default: + ui->editName->setFocus(); + break; + } + + this->setFixedSize(this->size()); +} + + + +// ---------------------------------------------------------------------------- +// Getters & Setters +// ---------------------------------------------------------------------------- + +QString +CDlgMdfDmActionParam::getName(void) +{ + return ui->editName->text(); +}; + +void +CDlgMdfDmActionParam::setName(const QString& name) +{ + ui->editName->setText(name); +}; + +// ----------------------------------------------------------------------- + + +uint32_t +CDlgMdfDmActionParam::getOffset(void) +{ + return ui->spinOffset->value(); +}; + +void +CDlgMdfDmActionParam::setOffset(uint32_t offset) +{ + ui->spinOffset->setValue(offset); +}; + +// ----------------------------------------------------------------------- + +uint8_t +CDlgMdfDmActionParam::getMin(void) +{ + return ui->spinMin->value(); +}; + +void +CDlgMdfDmActionParam::setMin(uint8_t min) +{ + ui->spinMin->setValue(min); +}; + +// ----------------------------------------------------------------------- + + +uint8_t +CDlgMdfDmActionParam::getMax(void) +{ + return ui->spinMax->value(); +}; + +void +CDlgMdfDmActionParam::setMax(uint8_t min) +{ + ui->spinMax->setValue(min); +}; + +// ----------------------------------------------------------------------- + + +//////////////////////////////////////////////////////////////////////////////// +// renderActionParams +// + +void CDlgMdfDmActionParam::renderActionParams(void) +{ + +} + + +/////////////////////////////////////////////////////////////////////////////// +// accept +// + +void +CDlgMdfDmActionParam::accept() +{ + std::string str; + if (nullptr != m_pactionparam) { + m_pactionparam->setName(getName().toStdString()); + m_pactionparam->setOffset(getOffset()); + m_pactionparam->setMin(getMin()); + m_pactionparam->setMax(getMax()); + } + else { + spdlog::error("MDF module information - Invalid MDF object (accept)"); + } + + QDialog::accept(); +} diff --git a/src/cdlgmdfdmactionparam.h b/src/cdlgmdfdmactionparam.h new file mode 100644 index 00000000..7f26553c --- /dev/null +++ b/src/cdlgmdfdmactionparam.h @@ -0,0 +1,110 @@ +// cdlgmdfactionparam.h +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2024 Ake Hedman, Grodans Paradis AB +// +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +#ifndef CDLGMDFDM_ACTION_PARAM_H +#define CDLGMDFDM_ACTION_PARAM_H + +#include +#include + +#include + + + +namespace Ui { +class CDlgMdfDmActionParam; +} + +class CDlgMdfDmActionParam : public QDialog { + Q_OBJECT + +public: +public: + explicit CDlgMdfDmActionParam(QWidget* parent = nullptr); + ~CDlgMdfDmActionParam(); + + static const int index_name = 0; + static const int index_offset = 1; + static const int index_min = 2; + static const int index_max = 3; + + static const char pre_str_actionparam[]; + + /*! + Init dialog data + @param CMDF *pmdf Pointer to MDF + @param pmdfobject Pointer to MDF object + @param index Selected file item + + */ + void initDialogData(CMDF *pmdf, CMDF_ActionParameter* pactionparam, int index = 0); + + /// @brief Rener action parameters + void renderActionParams(void); + + // ---------------------------------------------------------------------------- + // Getters & Setters + // ---------------------------------------------------------------------------- + + // name + QString getName(void); + void setName(const QString& name); + + // page + uint32_t getOffset(void); + void setOffset(uint32_t offset); + + // min + uint8_t getMin(void); + void setMin(uint8_t min); + + // max + uint8_t getMax(void); + void setMax(uint8_t max); + +public slots: + + + + /*! + Accept dialog data and write to register + */ + void accept(void); + + +private: + Ui::CDlgMdfDmActionParam* ui; + + /// Pointer to MDF + CMDF *m_pmdf; + + CMDF_ActionParameter* m_pactionparam; + +}; + +#endif // CDLGMDFDM_ACTION_PARAM_H diff --git a/src/cdlgmdfdmactionparam.ui b/src/cdlgmdfdmactionparam.ui new file mode 100644 index 00000000..571e0402 --- /dev/null +++ b/src/cdlgmdfdmactionparam.ui @@ -0,0 +1,144 @@ + + + CDlgMdfDmActionParam + + + + 0 + 0 + 754 + 206 + + + + Decsion Matrix Action Parameter + + + + + 10 + 170 + 741 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok + + + false + + + + + + 9 + 9 + 741 + 151 + + + + + + + Name + + + + + + + + + + Offset + + + + + + + 65535 + + + + + + + Min + + + + + + + 65535 + + + + + + + Max + + + + + + + 65535 + + + + + + + + + + + + + + + + + + + buttonBox + accepted() + CDlgMdfDmActionParam + accept() + + + 380 + 385 + + + 376 + 203 + + + + + buttonBox + rejected() + CDlgMdfDmActionParam + reject() + + + 380 + 385 + + + 376 + 203 + + + + + diff --git a/src/cdlgmdfregistervaluelist.ui b/src/cdlgmdfregistervaluelist.ui deleted file mode 100644 index ff9b456f..00000000 --- a/src/cdlgmdfregistervaluelist.ui +++ /dev/null @@ -1,181 +0,0 @@ - - - CDlgMdfRegisterValueList - - - - 0 - 0 - 661 - 445 - - - - Register values - - - - - 0 - 410 - 651 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok - - - false - - - - - - 9 - 19 - 641 - 381 - - - - - - - - - - - - - - - - Add description item - - - ... - - - - :/add.png:/add.png - - - Ctrl+A - - - - - - - Edit description item - - - ... - - - - :/pencil.svg:/pencil.svg - - - Ctrl+E - - - - - - - Duplicate description item - - - ... - - - - :/images/svg/copy.svg:/images/svg/copy.svg - - - Ctrl+D - - - - - - - Delete Description item - - - ... - - - - :/remove.png:/remove.png - - - Ctrl+X - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - - - buttonBox - accepted() - CDlgMdfRegisterValueList - accept() - - - 325 - 425 - - - 330 - 222 - - - - - buttonBox - rejected() - CDlgMdfRegisterValueList - reject() - - - 325 - 425 - - - 330 - 222 - - - - - diff --git a/src/cdlgmdfregistervalue.cpp b/src/cdlgmdfvalue.cpp similarity index 84% rename from src/cdlgmdfregistervalue.cpp rename to src/cdlgmdfvalue.cpp index 205aa746..fd3c8612 100644 --- a/src/cdlgmdfregistervalue.cpp +++ b/src/cdlgmdfvalue.cpp @@ -1,4 +1,4 @@ -// cdlgmdfregistervalue.cpp +// cdlgmdfvalue.cpp // // This file is part of the VSCP (https://www.vscp.org) // @@ -35,8 +35,8 @@ #include -#include "cdlgmdfregistervalue.h" -#include "ui_cdlgmdfregistervalue.h" +#include "cdlgmdfvalue.h" +#include "ui_cdlgmdfvalue.h" #include #include @@ -49,15 +49,15 @@ #include #include -const char CDlgMdfRegisterValue::pre_str_registerbit[] = "Register value: "; +const char CDlgMdfValue::pre_str_registerbit[] = "Register value: "; /////////////////////////////////////////////////////////////////////////////// // CTor // -CDlgMdfRegisterValue::CDlgMdfRegisterValue(QWidget* parent) +CDlgMdfValue::CDlgMdfValue(QWidget* parent) : QDialog(parent) - , ui(new Ui::CDlgMdfRegisterValue) + , ui(new Ui::CDlgMdfValue) { ui->setupUi(this); @@ -74,7 +74,7 @@ CDlgMdfRegisterValue::CDlgMdfRegisterValue(QWidget* parent) // DTor // -CDlgMdfRegisterValue::~CDlgMdfRegisterValue() +CDlgMdfValue::~CDlgMdfValue() { delete ui; } @@ -84,7 +84,7 @@ CDlgMdfRegisterValue::~CDlgMdfRegisterValue() // void -CDlgMdfRegisterValue::initDialogData(CMDF_Value* pvalue, int index) +CDlgMdfValue::initDialogData(CMDF_Value* pvalue, int index) { QString str; @@ -119,7 +119,7 @@ CDlgMdfRegisterValue::initDialogData(CMDF_Value* pvalue, int index) // void -CDlgMdfRegisterValue::setInitialFocus(void) +CDlgMdfValue::setInitialFocus(void) { // ui->editName->setFocus(); } @@ -129,13 +129,13 @@ CDlgMdfRegisterValue::setInitialFocus(void) // ---------------------------------------------------------------------------- QString -CDlgMdfRegisterValue::getName(void) +CDlgMdfValue::getName(void) { return ui->editName->text(); }; void -CDlgMdfRegisterValue::setName(const QString& name) +CDlgMdfValue::setName(const QString& name) { ui->editName->setText(name); }; @@ -143,13 +143,13 @@ CDlgMdfRegisterValue::setName(const QString& name) // ----------------------------------------------------------------------- QString -CDlgMdfRegisterValue::getValue(void) +CDlgMdfValue::getValue(void) { return ui->editValue->text(); }; void -CDlgMdfRegisterValue::setValue(const QString& name) +CDlgMdfValue::setValue(const QString& name) { ui->editValue->setText(name); }; @@ -160,7 +160,7 @@ CDlgMdfRegisterValue::setValue(const QString& name) // void -CDlgMdfRegisterValue::accept() +CDlgMdfValue::accept() { std::string str; if (nullptr != m_pvalue) { diff --git a/src/cdlgmdfregistervalue.h b/src/cdlgmdfvalue.h similarity index 88% rename from src/cdlgmdfregistervalue.h rename to src/cdlgmdfvalue.h index 3c1ee40d..e3bf73d3 100644 --- a/src/cdlgmdfregistervalue.h +++ b/src/cdlgmdfvalue.h @@ -1,4 +1,4 @@ -// cdlgmdfregistervalue.h +// cdlgmdfvalue.h // // This file is part of the VSCP (https://www.vscp.org) // @@ -26,8 +26,8 @@ // SOFTWARE. // -#ifndef CDLGMDFREGISTERVALUE_H -#define CDLGMDFREGISTERVALUE_H +#ifndef CDLGMDFVALUE_H +#define CDLGMDFVALUE_H #include #include @@ -35,16 +35,16 @@ #include namespace Ui { -class CDlgMdfRegisterValue; +class CDlgMdfValue; } -class CDlgMdfRegisterValue : public QDialog { +class CDlgMdfValue : public QDialog { Q_OBJECT public: public: - explicit CDlgMdfRegisterValue(QWidget* parent = nullptr); - ~CDlgMdfRegisterValue(); + explicit CDlgMdfValue(QWidget* parent = nullptr); + ~CDlgMdfValue(); static const int index_name = 0; static const int index_value = 1; @@ -86,7 +86,7 @@ public slots: void accept(void); private: - Ui::CDlgMdfRegisterValue* ui; + Ui::CDlgMdfValue* ui; /// Pointer to MDF CMDF* m_pmdf; @@ -95,4 +95,4 @@ public slots: CMDF_Value* m_pvalue; }; -#endif // CDlgMdfRegisterValue_H +#endif // CDlgMdfValue_H diff --git a/src/cdlgmdfregistervalue.ui b/src/cdlgmdfvalue.ui similarity index 92% rename from src/cdlgmdfregistervalue.ui rename to src/cdlgmdfvalue.ui index 5f6ddfae..311e6d3e 100644 --- a/src/cdlgmdfregistervalue.ui +++ b/src/cdlgmdfvalue.ui @@ -1,7 +1,7 @@ - CDlgMdfRegisterValue - + CDlgMdfValue + 0 @@ -74,7 +74,7 @@ buttonBox accepted() - CDlgMdfRegisterValue + CDlgMdfValue accept() @@ -90,7 +90,7 @@ buttonBox rejected() - CDlgMdfRegisterValue + CDlgMdfValue reject() diff --git a/src/cdlgmdfregistervaluelist.cpp b/src/cdlgmdfvaluelist.cpp similarity index 90% rename from src/cdlgmdfregistervaluelist.cpp rename to src/cdlgmdfvaluelist.cpp index 0b129531..83339953 100644 --- a/src/cdlgmdfregistervaluelist.cpp +++ b/src/cdlgmdfvaluelist.cpp @@ -1,4 +1,4 @@ -// cdlgmdfregistervaluelist.cpp +// cdlgmdfvaluelist.cpp // // This file is part of the VSCP (https://www.vscp.org) // @@ -35,9 +35,9 @@ #include -#include "cdlgmdfregistervalue.h" -#include "cdlgmdfregistervaluelist.h" -#include "ui_cdlgmdfregistervaluelist.h" +#include "cdlgmdfvalue.h" +#include "cdlgmdfvaluelist.h" +#include "ui_cdlgmdfvaluelist.h" #include #include @@ -53,9 +53,9 @@ // CTor // -CDlgMdfRegisterValueList::CDlgMdfRegisterValueList(QWidget* parent) +CDlgMdfValueList::CDlgMdfValueList(QWidget* parent) : QDialog(parent) - , ui(new Ui::CDlgMdfRegisterValueList) + , ui(new Ui::CDlgMdfValueList) { m_preg = nullptr; @@ -63,12 +63,12 @@ CDlgMdfRegisterValueList::CDlgMdfRegisterValueList(QWidget* parent) vscpworks* pworks = (vscpworks*)QCoreApplication::instance(); - connect(ui->btnAddRegisterValue, &QToolButton::clicked, this, &CDlgMdfRegisterValueList::addRegisterValue); - connect(ui->btnEditRegisterValue, &QToolButton::clicked, this, &CDlgMdfRegisterValueList::editRegisterValue); - connect(ui->btnDupRegisterValue, &QToolButton::clicked, this, &CDlgMdfRegisterValueList::dupRegisterValue); - connect(ui->btnDelRegisterValue, &QToolButton::clicked, this, &CDlgMdfRegisterValueList::deleteRegisterValue); + connect(ui->btnAddRegisterValue, &QToolButton::clicked, this, &CDlgMdfValueList::addRegisterValue); + connect(ui->btnEditRegisterValue, &QToolButton::clicked, this, &CDlgMdfValueList::editRegisterValue); + connect(ui->btnDupRegisterValue, &QToolButton::clicked, this, &CDlgMdfValueList::dupRegisterValue); + connect(ui->btnDelRegisterValue, &QToolButton::clicked, this, &CDlgMdfValueList::deleteRegisterValue); - connect(ui->listRegisterValues, &QListWidget::doubleClicked, this, &CDlgMdfRegisterValueList::editRegisterValue); + connect(ui->listRegisterValues, &QListWidget::doubleClicked, this, &CDlgMdfValueList::editRegisterValue); this->setFixedSize(this->size()); } @@ -77,7 +77,7 @@ CDlgMdfRegisterValueList::CDlgMdfRegisterValueList(QWidget* parent) // DTor // -CDlgMdfRegisterValueList::~CDlgMdfRegisterValueList() +CDlgMdfValueList::~CDlgMdfValueList() { delete ui; } @@ -87,7 +87,7 @@ CDlgMdfRegisterValueList::~CDlgMdfRegisterValueList() // void -CDlgMdfRegisterValueList::initDialogData(CMDF_Register* preg) +CDlgMdfValueList::initDialogData(CMDF_Register* preg) { QString str; @@ -109,7 +109,7 @@ CDlgMdfRegisterValueList::initDialogData(CMDF_Register* preg) // void -CDlgMdfRegisterValueList::renderValueItems(void) +CDlgMdfValueList::renderValueItems(void) { if (nullptr == m_preg) { return; @@ -141,7 +141,7 @@ CDlgMdfRegisterValueList::renderValueItems(void) // void -CDlgMdfRegisterValueList::addRegisterValue(void) +CDlgMdfValueList::addRegisterValue(void) { bool ok; CMDF_Value* pvaluenew = new CMDF_Value(); @@ -154,7 +154,7 @@ CDlgMdfRegisterValueList::addRegisterValue(void) // Save the selected row int idx = ui->listRegisterValues->currentRow(); - CDlgMdfRegisterValue dlg(this); + CDlgMdfValue dlg(this); dlg.initDialogData(pvaluenew); dlg.setWindowTitle(tr("Add register value")); @@ -181,7 +181,7 @@ CDlgMdfRegisterValueList::addRegisterValue(void) // void -CDlgMdfRegisterValueList::editRegisterValue(void) +CDlgMdfValueList::editRegisterValue(void) { bool ok; @@ -193,7 +193,7 @@ CDlgMdfRegisterValueList::editRegisterValue(void) QListWidgetItem* pitem = ui->listRegisterValues->currentItem(); CMDF_Value* pvalue = m_preg->getListValues()->at(pitem->data(Qt::UserRole).toUInt()); - CDlgMdfRegisterValue dlg(this); + CDlgMdfValue dlg(this); dlg.initDialogData(pvalue); editvaluedlg: @@ -219,7 +219,7 @@ CDlgMdfRegisterValueList::editRegisterValue(void) // void -CDlgMdfRegisterValueList::dupRegisterValue(void) +CDlgMdfValueList::dupRegisterValue(void) { if (-1 != ui->listRegisterValues->currentRow()) { @@ -276,7 +276,7 @@ CDlgMdfRegisterValueList::dupRegisterValue(void) // void -CDlgMdfRegisterValueList::deleteRegisterValue(void) +CDlgMdfValueList::deleteRegisterValue(void) { if (-1 != ui->listRegisterValues->currentRow()) { @@ -310,7 +310,7 @@ CDlgMdfRegisterValueList::deleteRegisterValue(void) // void -CDlgMdfRegisterValueList::accept() +CDlgMdfValueList::accept() { std::string str; if (nullptr != m_preg) { diff --git a/src/cdlgmdfregistervaluelist.h b/src/cdlgmdfvaluelist.h similarity index 91% rename from src/cdlgmdfregistervaluelist.h rename to src/cdlgmdfvaluelist.h index 41c8934e..fc55bdd2 100644 --- a/src/cdlgmdfregistervaluelist.h +++ b/src/cdlgmdfvaluelist.h @@ -26,8 +26,8 @@ // SOFTWARE. // -#ifndef CDLGMDFREGISTERVALUELIST_H -#define CDLGMDFREGISTERVALUELIST_H +#ifndef CDLGMDFVALUELIST_H +#define CDLGMDFVALUELIST_H #include #include @@ -37,15 +37,15 @@ #include namespace Ui { -class CDlgMdfRegisterValueList; +class CDlgMdfValueList; } -class CDlgMdfRegisterValueList : public QDialog { +class CDlgMdfValueList : public QDialog { Q_OBJECT public: - explicit CDlgMdfRegisterValueList(QWidget* parent = nullptr); - ~CDlgMdfRegisterValueList(); + explicit CDlgMdfValueList(QWidget* parent = nullptr); + ~CDlgMdfValueList(); /*! Set edit mode. @@ -108,7 +108,7 @@ public slots: void deleteRegisterValue(void); private: - Ui::CDlgMdfRegisterValueList* ui; + Ui::CDlgMdfValueList* ui; // MDF CMDF_Register* m_preg; diff --git a/src/cdlgmdfvaluelist.ui b/src/cdlgmdfvaluelist.ui index 5b03856b..8f6f9a7a 100644 --- a/src/cdlgmdfvaluelist.ui +++ b/src/cdlgmdfvaluelist.ui @@ -6,19 +6,19 @@ 0 0 - 597 - 300 + 661 + 445 - Dialog + Register values - + 0 - 260 - 591 + 410 + 651 32 @@ -32,69 +32,150 @@ false - + 9 - 10 - 581 - 241 + 19 + 641 + 381 - - - - - - 1 - - - - - - - - QLayout::SetDefaultConstraint - - - - - Add item - - - - - - - Delete Item - - - - - - - Clone item - - - + + + - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + + + + + + Add description item + + + ... + + + + :/add.png:/add.png + + + Ctrl+A + + + + + + + Edit description item + + + ... + + + + :/pencil.svg:/pencil.svg + + + Ctrl+E + + + + + + + Duplicate description item + + + ... + + + + :/images/svg/copy.svg:/images/svg/copy.svg + + + Ctrl+D + + + + + + + Delete Description item + + + ... + + + + :/remove.png:/remove.png + + + Ctrl+X + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - - + + + + + + buttonBox + accepted() + CDlgMdfValueList + accept() + + + 325 + 425 + + + 330 + 222 + + + + + buttonBox + rejected() + CDlgMdfValueList + reject() + + + 325 + 425 + + + 330 + 222 + + + + diff --git a/src/cfrmmdf.cpp b/src/cfrmmdf.cpp index 0552a369..658348ff 100644 --- a/src/cfrmmdf.cpp +++ b/src/cfrmmdf.cpp @@ -52,6 +52,9 @@ #include "cdlgmdfcontact.h" #include "cdlgmdfcontactlist.h" #include "cdlgmdfdescription.h" +#include "cdlgmdfdm.h" +#include "cdlgmdfdmaction.h" +#include "cdlgmdfdmactionparam.h" #include "cdlgmdffile.h" #include "cdlgmdffiledriver.h" #include "cdlgmdffilefirmware.h" @@ -62,11 +65,11 @@ #include "cdlgmdfmanufacturer.h" #include "cdlgmdfmodule.h" #include "cdlgmdfregister.h" -#include "cdlgmdfregisterbit.h" -#include "cdlgmdfregisterbitlist.h" +#include "cdlgmdfbit.h" +#include "cdlgmdfbitlist.h" #include "cdlgmdfregisterlist.h" -#include "cdlgmdfregistervalue.h" -#include "cdlgmdfregistervaluelist.h" +#include "cdlgmdfvalue.h" +#include "cdlgmdfvaluelist.h" #include "cdlgmdfremotevar.h" #include "cdlgmdfremotevarlist.h" @@ -401,19 +404,32 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos) break; case mdf_type_action_param: - menu->addAction(QString(tr("Action Param")), this, SLOT(loadSelectedMdf())); + menu->addAction(QString(tr("Edit Action Parameter")), this, SLOT(editAction())); + break; + + case mdf_type_action_param_item: + case mdf_type_action_param_sub_item: + menu->addAction(QString(tr("Edit Action Parameter Item")), this, SLOT(editAction())); break; case mdf_type_action: - menu->addAction(QString(tr("Action")), this, SLOT(loadSelectedMdf())); + menu->addAction(QString(tr("Edit Actions")), this, SLOT(editAction())); break; case mdf_type_action_item: - menu->addAction(QString(tr("Action item")), this, SLOT(loadSelectedMdf())); + menu->addAction(QString(tr("Edit Action")), this, SLOT(editAction())); + break; + + case mdf_type_action_sub_item: + menu->addAction(QString(tr("Edit Action item")), this, SLOT(editAction())); break; case mdf_type_decision_matrix: - menu->addAction(QString(tr("DM")), this, SLOT(loadSelectedMdf())); + menu->addAction(QString(tr("Edit Decision Matrix")), this, SLOT(editDM())); + break; + + case mdf_type_decision_matrix_item: + menu->addAction(QString(tr("Edit Decision Matrix Item")), this, SLOT(editDM())); break; case mdf_type_event_data: @@ -443,7 +459,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos) break; case mdf_type_alarm: - //menu->addAction(QString(tr("Edit alarm bits")), this, SLOT(editRegisterBit())); + menu->addAction(QString(tr("Edit alarm bits")), this, SLOT(editAlarm())); break; case mdf_type_address: @@ -632,7 +648,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos) break; default: - menu->addAction(QString(tr("Default")), this, SLOT(loadSelectedMdf())); + menu->addAction(QString(tr("Unhandled")), this, SLOT(loadSelectedMdf())); break; } } @@ -802,32 +818,32 @@ CFrmMdf::renderBitInfo(QMdfTreeWidgetItem* pItemParent, CMDF_Bit* pbit) QMdfTreeWidgetItem* pItem; str = QString("Name: %1").arg(pbit->getName().c_str()); - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_name); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_name); pItem->setText(0, str); pItemParent->addChild(pItem); str = QString("Pos: %1").arg(pbit->getPos()); - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_pos); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_pos); pItem->setText(0, str); pItemParent->addChild(pItem); str = QString("Width: %1").arg(pbit->getWidth()); - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_width); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_width); pItem->setText(0, str); pItemParent->addChild(pItem); str = QString("Default: %1").arg(pbit->getDefault()); - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_default); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_default); pItem->setText(0, str); pItemParent->addChild(pItem); str = QString("Min: %1").arg(pbit->getMin()); - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_min); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_min); pItem->setText(0, str); pItemParent->addChild(pItem); str = QString("Max: %1").arg(pbit->getMax()); - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_max); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_max); pItem->setText(0, str); pItemParent->addChild(pItem); @@ -840,7 +856,7 @@ CFrmMdf::renderBitInfo(QMdfTreeWidgetItem* pItemParent, CMDF_Bit* pbit) str += "w"; } str += ")"; - pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfRegisterBit::index_access); + pItem = new QMdfTreeWidgetItem(pItemParent, pbit, mdf_type_bit_sub_item, CDlgMdfBit::index_access); pItem->setText(0, str); pItemParent->addChild(pItem); @@ -915,12 +931,12 @@ CFrmMdf::renderValueInfo(QMdfTreeWidgetItem* pParent, CMDF_Value* pvalue) QMdfTreeWidgetItem* pItem; str = QString("Name: %1").arg(pvalue->getName().c_str()); - pItem = new QMdfTreeWidgetItem(pParent, pvalue, mdf_type_value_sub_item, CDlgMdfRegisterValue::index_name); + pItem = new QMdfTreeWidgetItem(pParent, pvalue, mdf_type_value_sub_item, CDlgMdfValue::index_name); pItem->setText(0, str); pParent->addChild(pItem); str = QString("Value: %1").arg(pvalue->getValue().c_str()); - pItem = new QMdfTreeWidgetItem(pParent, pvalue, mdf_type_value_sub_item, CDlgMdfRegisterValue::index_value); + pItem = new QMdfTreeWidgetItem(pParent, pvalue, mdf_type_value_sub_item, CDlgMdfValue::index_value); pItem->setText(0, str); pParent->addChild(pItem); @@ -2026,6 +2042,357 @@ CFrmMdf::renderFirmwareSubItems(QMdfTreeWidgetItem* pFirmwareItem, CMDF_Firmware renderInfoUrlItems(pFirmwareItem, pFirmwareObj, pFirmwareObj->getMapInfoUrl()); } +/////////////////////////////////////////////////////////////////////////////// +// renderActionParam +// + +void +CFrmMdf::renderActionParam(QMdfTreeWidgetItem* pActionParamHeadItem, + CMDF_ActionParameter* pactionparam) +{ + // int i; + QString str; + QMdfTreeWidgetItem* pItem; + + if ((nullptr == pActionParamHeadItem) && (nullptr == pactionparam)) { + return; + } + + str = QString("Param %1: %2").arg(pactionparam->getOffset()).arg(pactionparam->getName().c_str()); + pActionParamHeadItem->setText(0, str); + + pItem = new QMdfTreeWidgetItem(pActionParamHeadItem, pactionparam, mdf_type_action_param_sub_item, CDlgMdfDmActionParam::index_name); + if (nullptr != pItem) { + str = QString("Name: %2").arg(pactionparam->getName().c_str()); + pItem->setText(0, str); + pActionParamHeadItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pActionParamHeadItem, pactionparam, mdf_type_action_param_sub_item, CDlgMdfDmActionParam::index_offset); + if (nullptr != pItem) { + str = QString("Offset: %1").arg(pactionparam->getOffset()); + pItem->setText(0, str); + pActionParamHeadItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pActionParamHeadItem, pactionparam, mdf_type_action_param_sub_item, CDlgMdfDmActionParam::index_min); + if (nullptr != pItem) { + str = QString("Min: %1").arg(pactionparam->getMin()); + pItem->setText(0, str); + pActionParamHeadItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pActionParamHeadItem, pactionparam, mdf_type_action_param_sub_item, CDlgMdfDmActionParam::index_max); + if (nullptr != pItem) { + str = QString("Max: %1").arg(pactionparam->getMax()); + pItem->setText(0, str); + pActionParamHeadItem->addChild(pItem); + } + + // Fill in bit field info + renderBits(pActionParamHeadItem, *pactionparam->getListBits()); + + // Fill in valid values + renderValues(pActionParamHeadItem, *pactionparam->getListValues()); + + // Descriptions + renderDescriptionItems(pActionParamHeadItem, pactionparam, pactionparam->getMapDescription()); + + // Info URL's + renderInfoUrlItems(pActionParamHeadItem, pactionparam, pactionparam->getMapDescription()); +} + +/////////////////////////////////////////////////////////////////////////////// +// renderActionParameters +// + +void +CFrmMdf::renderActionParameters(QMdfTreeWidgetItem* pActionParamItem, + CMDF_Action* pAction) +{ + QString str; + QMdfTreeWidgetItem* pItem; + + if ((nullptr == pActionParamItem) && (nullptr == pAction)) { + return; + } + + std::deque* pActionParamList = pAction->getListActionParameter(); + if (nullptr == pActionParamList) { + return; + } + + for (int i = 0; i < pActionParamList->size(); i++) { + + CMDF_ActionParameter* pactionparam = (*pActionParamList)[i]; + if (nullptr == pactionparam) { + continue; + } + + QMdfTreeWidgetItem* pActionParamHeadItem = new QMdfTreeWidgetItem(pActionParamItem, pactionparam, mdf_type_action_param_item); + str = QString("Param %1: %2").arg(pactionparam->getOffset()).arg(pactionparam->getName().c_str()); + pActionParamHeadItem->setText(0, str); + pActionParamItem->addChild(pActionParamHeadItem); + + renderActionParam(pActionParamHeadItem, pactionparam); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// renderAction +// + +void +CFrmMdf::renderAction(QMdfTreeWidgetItem* pItemAction, + CMDF_Action* paction) +{ + QString str; + QMdfTreeWidgetItem* pItem; + + if ((nullptr == pItemAction) && (nullptr == paction)) { + return; + } + + QMdfTreeWidgetItem* pSubItemAction = new QMdfTreeWidgetItem(pItemAction, paction, mdf_type_action_item); + + if (nullptr != pSubItemAction) { + + str = QString("Action: %1 %2").arg(paction->getCode()).arg(paction->getName().c_str()); + pSubItemAction->setText(0, str); + pItemAction->addChild(pSubItemAction); + + pItem = new QMdfTreeWidgetItem(pSubItemAction, paction, mdf_type_action_sub_item, CDlgMdfDmAction::index_code); + if (nullptr != pItem) { + str = QString("Code: %1").arg(paction->getCode()); + pItem->setText(0, str); + pSubItemAction->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pSubItemAction, paction, mdf_type_action_sub_item, CDlgMdfDmAction::index_name); + if (nullptr != pItem) { + str = QString("Name: %1").arg(paction->getName().c_str()); + pItem->setText(0, str); + pSubItemAction->addChild(pItem); + } + + // std::deque* pActionParamList = paction->getListActionParameter(); + // if (nullptr != pActionParamList) { + + QMdfTreeWidgetItem* pActionParamItem = new QMdfTreeWidgetItem(pSubItemAction, mdf_type_action_param); + str = QString("Action Parameters"); + pActionParamItem->setText(0, str); + pSubItemAction->addChild(pActionParamItem); + + // for (int j = 0; j < pActionParamList->size(); j++) { + + // CMDF_ActionParameter* pactionparam = (*pActionParamList)[j]; + renderActionParameters(pActionParamItem, paction); + //} + //} + + // Descriptions + renderDescriptionItems(pSubItemAction, paction, paction->getMapDescription()); + + // Info URL's + renderInfoUrlItems(pSubItemAction, paction, paction->getMapDescription()); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// renderDecisionMatrix +// + +void +CFrmMdf::renderDecisionMatrix(QMdfTreeWidgetItem* pItemDM, + CMDF_DecisionMatrix* pdm, + uint16_t selectedIndex) +{ + QString str; + QMdfTreeWidgetItem* pItem; + + if (nullptr != pdm) { + + pItem = new QMdfTreeWidgetItem(pItemDM, pdm, mdf_type_decision_matrix_item, CDlgMdfDM::index_level); + if (nullptr != pItem) { + str = QString("Level: %1").arg(pdm->getLevel()); + pItem->setText(0, str); + pItemDM->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pItemDM, pdm, mdf_type_decision_matrix_item, CDlgMdfDM::index_start_page); + if (nullptr != pItem) { + str = QString("Start page: %1").arg(pdm->getStartPage()); + pItem->setText(0, str); + pItemDM->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pItemDM, pdm, mdf_type_decision_matrix_item, CDlgMdfDM::index_start_offset); + if (nullptr != pItem) { + str = QString("Start offset: %1").arg(pdm->getStartOffset()); + pItem->setText(0, str); + pItemDM->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pItemDM, pdm, mdf_type_decision_matrix_item, CDlgMdfDM::index_rows); + if (nullptr != pItem) { + str = QString("Row count: %1 rows").arg(pdm->getRowCount()); + pItem->setText(0, str); + pItemDM->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pItemDM, pdm, mdf_type_decision_matrix_item, CDlgMdfDM::index_row_size); + if (nullptr != pItem) { + str = QString("Row size: %1 bytes").arg(pdm->getRowSize()); + pItem->setText(0, str); + pItemDM->addChild(pItem); + } + + std::deque* pActionList = pdm->getActionList(); + + if (nullptr != pActionList) { + + QString str; + QMdfTreeWidgetItem* pSubItem; + + QMdfTreeWidgetItem* pItemAction = new QMdfTreeWidgetItem(pItemDM, &m_mdf, mdf_type_action); + if (nullptr != pItemAction) { + str = QString("Actions").arg(pdm->getRowSize()); + pItemAction->setText(0, str); + pItemDM->addChild(pItemAction); + } + + for (int i = 0; i < pActionList->size(); i++) { + CMDF_Action* paction = (*pActionList)[i]; + renderAction(pItemAction, paction); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// renderEvents +// + +void +CFrmMdf::renderEvents(QMdfTreeWidgetItem* pItemEvent) +{ + QString str; + QMdfTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pSubItem; + + std::deque* pEventList = m_mdf.getEventList(); + if (nullptr != pEventList) { + + for (int i = 0; i < pEventList->size(); i++) { + + CMDF_Event* pevent = (*pEventList)[i]; + pSubItem = new QMdfTreeWidgetItem(pItemEvent, mdf_type_event_item); + if (nullptr != pSubItem) { + + str = QString("Event: %1 -- %2").arg(i).arg(pevent->getName().c_str()); + pSubItem->setText(0, str); + pItemEvent->addChild(pSubItem); + + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); + if (nullptr != pItem) { + str = QString("Name: %1").arg(pevent->getName().c_str()); + pItem->setText(0, str); + pSubItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); + if (nullptr != pItem) { + str = QString("VSCP Class: %1").arg(pevent->getClass()); + pItem->setText(0, str); + pSubItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); + if (nullptr != pItem) { + str = QString("VSCP Type: %1").arg(pevent->getType()); + pItem->setText(0, str); + pSubItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); + if (nullptr != pItem) { + str = QString("VSCP Priority: %1").arg(pevent->getPriority()); + pItem->setText(0, str); + pSubItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); + if (nullptr != pItem) { + str = QString("Direction: %1 (%2)").arg((MDF_EVENT_DIR_IN == pevent->getDirection()) ? "In" : "Out").arg(pevent->getDirection()); + pItem->setText(0, str); + pSubItem->addChild(pItem); + } + + // Event Data + QMdfTreeWidgetItem* pItemEventData = new QMdfTreeWidgetItem(pSubItem, mdf_type_event_data); + // pItemEvent->setFont(0, fontTopItem); + // pItemEvent->setForeground(0, greenBrush); + pItemEventData->setText(0, tr("Event data")); + pSubItem->addChild(pItemEventData); + + std::deque* pEventDataList = pevent->getListEventData(); + if (nullptr != pEventDataList) { + + QString str; + QMdfTreeWidgetItem* pEventSubItem; + QMdfTreeWidgetItem* pItem; + + for (int j = 0; j < pEventDataList->size(); j++) { + + CMDF_EventData* pEventData = (*pEventDataList)[j]; + + pEventSubItem = new QMdfTreeWidgetItem(pItemEventData, mdf_type_event_data_item); + if (nullptr != pEventSubItem) { + + // Event data + str = QString("Event data: %1 -- %2").arg(j).arg(pEventData->getName().c_str()); + pEventSubItem->setText(0, str); + pItemEventData->addChild(pEventSubItem); + + pItem = new QMdfTreeWidgetItem(pEventSubItem, mdf_type_generic_string); + if (nullptr != pItem) { + str = QString("Name: %1").arg(pEventData->getName().c_str()); + pItem->setText(0, str); + pEventSubItem->addChild(pItem); + } + + pItem = new QMdfTreeWidgetItem(pEventSubItem, mdf_type_generic_number); + if (nullptr != pItem) { + str = QString("Offset: %1").arg(pEventData->getOffset()); + pItem->setText(0, str); + pEventSubItem->addChild(pItem); + } + + // Fill in bit field info + renderBits(pEventSubItem, *pEventData->getListBits()); + + // Fill in valid values + renderValues(pEventSubItem, *pEventData->getListValues()); + + // Descriptions + renderDescriptionItems(pEventSubItem, pEventData, pEventData->getMapDescription()); + + // Info URL's + renderInfoUrlItems(pEventSubItem, pEventData, pEventData->getMapDescription()); + } + } // EventDataList + } // list exist + + // Descriptions + renderDescriptionItems(pSubItem, pevent, pevent->getMapDescription()); + + // Info URL's + renderInfoUrlItems(pSubItem, pevent, pevent->getMapDescription()); + } + } + } // EventList +} + /////////////////////////////////////////////////////////////////////////////// // removeSubItems // @@ -2394,309 +2761,53 @@ CFrmMdf::loadMdf(void) renderBits(pItemAlarm, *palarm); // * * * Decision Matrix * * * + CMDF_DecisionMatrix* pdm = m_mdf.getDM(); - QMdfTreeWidgetItem* pItemDM = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_decision_matrix); + QMdfTreeWidgetItem* pItemDM = new QMdfTreeWidgetItem(pItemModule, pdm, mdf_type_decision_matrix); m_headDecisionMatrix = pItemDM; pItemDM->setFont(0, fontTopItem); pItemDM->setForeground(0, greenBrush); pItemDM->setText(0, tr("Decision Matrix")); ui->treeMDF->addTopLevelItem(pItemDM); - CMDF_DecisionMatrix* pdm = m_mdf.getDM(); - if (nullptr != pdm) { - - pItem = new QMdfTreeWidgetItem(pItemDM, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Level: %1").arg(pdm->getLevel()); - pItem->setText(0, str); - pItemDM->addChild(pItem); - } + renderDecisionMatrix(pItemDM, pdm); - pItem = new QMdfTreeWidgetItem(pItemDM, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Start page: %1").arg(pdm->getStartPage()); - pItem->setText(0, str); - pItemDM->addChild(pItem); - } + // * * * Events * * * - pItem = new QMdfTreeWidgetItem(pItemDM, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Start offset: %1").arg(pdm->getStartOffset()); - pItem->setText(0, str); - pItemDM->addChild(pItem); - } + QMdfTreeWidgetItem* pItemEvent = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_event); + pItemEvent = pItemEvent; + pItemEvent->setFont(0, fontTopItem); + pItemEvent->setForeground(0, greenBrush); + pItemEvent->setText(0, tr("Events")); + ui->treeMDF->addTopLevelItem(pItemEvent); - pItem = new QMdfTreeWidgetItem(pItemDM, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Row count: %1 rows").arg(pdm->getRowCount()); - pItem->setText(0, str); - pItemDM->addChild(pItem); - } + renderEvents(pItemEvent); - pItem = new QMdfTreeWidgetItem(pItemDM, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Row size: %1 bytes").arg(pdm->getRowSize()); - pItem->setText(0, str); - pItemDM->addChild(pItem); - } + // Recipes + // QMdfTreeWidgetItem *pItemRecipes = new QMdfTreeWidgetItem(pItemModule, 1); + // pItemRecipes->setFont(0, fontTopItem); + // pItemRecipes->setForeground(0, blueBrush); + // pItemRecipes->setText(0, tr("Events")); + // ui->treeMDF->addTopLevelItem(pItemRecipes); - std::deque* pActionList = pdm->getActionList(); + // ui->btnScan->setEnabled(false); + // CFoundNodeWidgetItem *pItem; + // QMdfTreeWidgetItemIterator it(ui->treeFound); + // while (*it) { + // pItem = (CFoundNodeWidgetItem *)(*it); + // doLoadMdf(pItem->m_nodeid); + // ++it; + // } + // ui->btnScan->setEnabled(true); + // QString fileName = QFileDialog::getOpenFileName(this, + // tr("Open Module Description File (MDF)"), ".", tr("MDF Files (*.mdf *.json *.xml)")); - if (nullptr != pActionList) { + // ui->treeMDF->expandAll(); + //} - QString str; - QMdfTreeWidgetItem* pSubItem; - - QMdfTreeWidgetItem* pItemAction = new QMdfTreeWidgetItem(pItemDM, mdf_type_action); - if (nullptr != pItemAction) { - str = QString("Actions").arg(pdm->getRowSize()); - pItemAction->setText(0, str); - pItemDM->addChild(pItemAction); - } - - for (int i = 0; i < pActionList->size(); i++) { - - CMDF_Action* paction = (*pActionList)[i]; - QMdfTreeWidgetItem* pSubItemAction = new QMdfTreeWidgetItem(pItemAction, mdf_type_action_item); - - if (nullptr != pSubItemAction) { - - str = QString("Action: %1 %2").arg(paction->getCode()).arg(paction->getName().c_str()); - pSubItemAction->setText(0, str); - pItemAction->addChild(pSubItemAction); - - pItem = new QMdfTreeWidgetItem(pSubItemAction, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Code: %1").arg(paction->getCode()); - pItem->setText(0, str); - pSubItemAction->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pSubItemAction, mdf_type_generic_string); - if (nullptr != pItem) { - str = QString("Name: %1").arg(paction->getName().c_str()); - pItem->setText(0, str); - pSubItemAction->addChild(pItem); - } - - std::deque* pActionParamList = paction->getListActionParameter(); - if (nullptr != pActionParamList) { - - QMdfTreeWidgetItem* pActionParamItem = new QMdfTreeWidgetItem(pSubItemAction, mdf_type_generic_number); - str = QString("Action Parameters"); - pActionParamItem->setText(0, str); - pSubItemAction->addChild(pActionParamItem); - - for (int j = 0; j < pActionParamList->size(); j++) { - - CMDF_ActionParameter* pactionparam = (*pActionParamList)[j]; - if (nullptr != pSubItemAction) { - - QString str; - - pItem = new QMdfTreeWidgetItem(pActionParamItem, mdf_type_generic_string); - if (nullptr != pItem) { - str = QString("Name: %1 - %2").arg(j).arg(pactionparam->getName().c_str()); - pItem->setText(0, str); - pActionParamItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pActionParamItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Offset: %1").arg(pactionparam->getOffset()); - pItem->setText(0, str); - pActionParamItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pActionParamItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Min: %1").arg(pactionparam->getMin()); - pItem->setText(0, str); - pActionParamItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pActionParamItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Max: %1").arg(pactionparam->getMax()); - pItem->setText(0, str); - pActionParamItem->addChild(pItem); - } - - // Fill in bit field info - renderBits(pActionParamItem, *pactionparam->getListBits()); - - // Fill in valid values - renderValues(pActionParamItem, *pactionparam->getListValues()); - - // Descriptions - renderDescriptionItems(pActionParamItem, pactionparam, pactionparam->getMapDescription()); - - // Info URL's - renderInfoUrlItems(pActionParamItem, pactionparam, pactionparam->getMapDescription()); - } - } - } - - // Descriptions - renderDescriptionItems(pSubItemAction, paction, paction->getMapDescription()); - - // Info URL's - renderInfoUrlItems(pSubItemAction, paction, paction->getMapDescription()); - } - } - - // * * * Events * * * - - QMdfTreeWidgetItem* pItemEvent = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_event); - pItemEvent = pItemEvent; - pItemEvent->setFont(0, fontTopItem); - pItemEvent->setForeground(0, greenBrush); - pItemEvent->setText(0, tr("Events")); - ui->treeMDF->addTopLevelItem(pItemEvent); - - std::deque* pEventList = m_mdf.getEventList(); - - if (nullptr != pEventList) { - - QString str; - QMdfTreeWidgetItem* pItem; - - for (int i = 0; i < pEventList->size(); i++) { - - CMDF_Event* pevent = (*pEventList)[i]; - pSubItem = new QMdfTreeWidgetItem(pItemEvent, mdf_type_event_item); - if (nullptr != pSubItem) { - - str = QString("Event: %1 -- %2").arg(i).arg(pevent->getName().c_str()); - pSubItem->setText(0, str); - pItemEvent->addChild(pSubItem); - - pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); - if (nullptr != pItem) { - str = QString("Name: %1").arg(pevent->getName().c_str()); - pItem->setText(0, str); - pSubItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("VSCP Class: %1").arg(pevent->getClass()); - pItem->setText(0, str); - pSubItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("VSCP Type: %1").arg(pevent->getType()); - pItem->setText(0, str); - pSubItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("VSCP Priority: %1").arg(pevent->getPriority()); - pItem->setText(0, str); - pSubItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); - if (nullptr != pItem) { - str = QString("Direction: %1 (%2)").arg((MDF_EVENT_DIR_IN == pevent->getDirection()) ? "In" : "Out").arg(pevent->getDirection()); - pItem->setText(0, str); - pSubItem->addChild(pItem); - } - - // Event Data - QMdfTreeWidgetItem* pItemEventData = new QMdfTreeWidgetItem(pSubItem, mdf_type_event_data); - // pItemEvent->setFont(0, fontTopItem); - // pItemEvent->setForeground(0, greenBrush); - pItemEventData->setText(0, tr("Event data")); - pSubItem->addChild(pItemEventData); - - std::deque* pEventDataList = pevent->getListEventData(); - if (nullptr != pEventDataList) { - - QString str; - QMdfTreeWidgetItem* pEventSubItem; - QMdfTreeWidgetItem* pItem; - - for (int j = 0; j < pEventDataList->size(); j++) { - - CMDF_EventData* pEventData = (*pEventDataList)[j]; - - pEventSubItem = new QMdfTreeWidgetItem(pItemEventData, mdf_type_event_data_item); - if (nullptr != pEventSubItem) { - - // Event data - str = QString("Event data: %1 -- %2").arg(j).arg(pEventData->getName().c_str()); - pEventSubItem->setText(0, str); - pItemEventData->addChild(pEventSubItem); - - pItem = new QMdfTreeWidgetItem(pEventSubItem, mdf_type_generic_string); - if (nullptr != pItem) { - str = QString("Name: %1").arg(pEventData->getName().c_str()); - pItem->setText(0, str); - pEventSubItem->addChild(pItem); - } - - pItem = new QMdfTreeWidgetItem(pEventSubItem, mdf_type_generic_number); - if (nullptr != pItem) { - str = QString("Offset: %1").arg(pEventData->getOffset()); - pItem->setText(0, str); - pEventSubItem->addChild(pItem); - } - - // Fill in bit field info - renderBits(pEventSubItem, *pEventData->getListBits()); - - // Fill in valid values - renderValues(pEventSubItem, *pEventData->getListValues()); - - // Descriptions - renderDescriptionItems(pEventSubItem, pEventData, pEventData->getMapDescription()); - - // Info URL's - renderInfoUrlItems(pEventSubItem, pEventData, pEventData->getMapDescription()); - } - } // EventDataList - } // list exist - - // Descriptions - renderDescriptionItems(pSubItem, pevent, pevent->getMapDescription()); - - // Info URL's - renderInfoUrlItems(pSubItem, pevent, pevent->getMapDescription()); - } - } - } // EventList - } - } - - // Recipes - // QMdfTreeWidgetItem *pItemRecipes = new QMdfTreeWidgetItem(pItemModule, 1); - // pItemRecipes->setFont(0, fontTopItem); - // pItemRecipes->setForeground(0, blueBrush); - // pItemRecipes->setText(0, tr("Events")); - // ui->treeMDF->addTopLevelItem(pItemRecipes); - - // ui->btnScan->setEnabled(false); - // CFoundNodeWidgetItem *pItem; - // QMdfTreeWidgetItemIterator it(ui->treeFound); - // while (*it) { - // pItem = (CFoundNodeWidgetItem *)(*it); - // doLoadMdf(pItem->m_nodeid); - // ++it; - // } - // ui->btnScan->setEnabled(true); - // QString fileName = QFileDialog::getOpenFileName(this, - // tr("Open Module Description File (MDF)"), ".", tr("MDF Files (*.mdf *.json *.xml)")); - - // ui->treeMDF->expandAll(); - //} - - /////////////////////////////////////////////////////////////////////////////// - // onFindNodesTreeWidgetItemClicked - // + /////////////////////////////////////////////////////////////////////////////// + // onFindNodesTreeWidgetItemClicked + // // void // CFrmMdf::onFindNodesTreeWidgetItemClicked(QMdfTreeWidgetItem* item, int column) @@ -2816,6 +2927,10 @@ CFrmMdf::onItemDoubleClicked(QTreeWidgetItem* item, int column) str = tr("Action item"); break; + case mdf_type_action_sub_item: + str = tr("Action sub item"); + break; + case mdf_type_decision_matrix: str = tr("DM"); break; @@ -3058,19 +3173,19 @@ CFrmMdf::editItem() break; case mdf_type_value: - editRegisterValue(); + editValueDefinition(); break; case mdf_type_value_item: - editRegisterValue(); + editValueDefinition(); break; case mdf_type_bit: - editRegisterBit(); + editBitDefinition(); break; case mdf_type_bit_item: - editRegisterBit(); + editBitDefinition(); break; case mdf_type_register_page: @@ -3102,15 +3217,26 @@ CFrmMdf::editItem() break; case mdf_type_action_param: + case mdf_type_action_param_item: + case mdf_type_action_param_sub_item: + editAction(); break; case mdf_type_action: + editAction(); break; case mdf_type_action_item: + editAction(); + break; + + case mdf_type_action_sub_item: + editAction(); break; case mdf_type_decision_matrix: + case mdf_type_decision_matrix_item: + editDM(); break; case mdf_type_event_data: @@ -3776,6 +3902,7 @@ CFrmMdf::editDescription(void) case mdf_type_email_item: case mdf_type_web_item: case mdf_type_social_item: + // File items case mdf_type_picture_item: case mdf_type_video_item: @@ -3821,6 +3948,15 @@ CFrmMdf::editDescription(void) case mdf_type_value_sub_item: { pmap = pItem->getObject()->getMapDescription(); } break; + + case mdf_type_action: + case mdf_type_action_item: + case mdf_type_action_sub_item: + case mdf_type_action_param: + case mdf_type_action_param_item: + case mdf_type_action_param_sub_item: { + pmap = pItem->getObject()->getMapDescription(); + } break; } if (mdf_type_generic_description == pItem->getObjectType()) { @@ -3903,6 +4039,7 @@ CFrmMdf::deleteDescription(void) case mdf_type_email_item: case mdf_type_web_item: case mdf_type_social_item: + // File items case mdf_type_picture_item: case mdf_type_video_item: @@ -3910,24 +4047,37 @@ CFrmMdf::deleteDescription(void) case mdf_type_firmware_item: case mdf_type_driver_item: case mdf_type_setup_item: + // Register items case mdf_type_register: case mdf_type_register_item: case mdf_type_register_sub_item: + // Remote variable items case mdf_type_remotevar: case mdf_type_remotevar_item: case mdf_type_remotevar_sub_item: + // Bit items case mdf_type_bit: case mdf_type_bit_item: case mdf_type_bit_sub_item: + // Value items case mdf_type_value: case mdf_type_value_item: case mdf_type_value_sub_item: { pmap = pItem->getObject()->getMapDescription(); } break; + + case mdf_type_action: + case mdf_type_action_item: + case mdf_type_action_sub_item: + case mdf_type_action_param: + case mdf_type_action_param_item: + case mdf_type_action_param_sub_item: { + pmap = pItem->getObject()->getMapDescription(); + } break; } std::string selstr = pItem->text(0).split('_').first().left(2).toStdString(); @@ -4002,6 +4152,7 @@ CFrmMdf::editInfoUrl(void) case mdf_type_email_item: case mdf_type_web_item: case mdf_type_social_item: + // File items case mdf_type_picture_item: case mdf_type_video_item: @@ -4028,20 +4179,31 @@ CFrmMdf::editInfoUrl(void) case mdf_type_register: case mdf_type_register_item: case mdf_type_register_sub_item: + // Remote variable items case mdf_type_remotevar: case mdf_type_remotevar_item: case mdf_type_remotevar_sub_item: + // Bit items case mdf_type_bit: case mdf_type_bit_item: case mdf_type_bit_sub_item: + // Value items case mdf_type_value: case mdf_type_value_item: case mdf_type_value_sub_item: { pmap = pItem->getObject()->getMapInfoUrl(); } break; + case mdf_type_action: + case mdf_type_action_item: + case mdf_type_action_sub_item: + case mdf_type_action_param: + case mdf_type_action_param_item: + case mdf_type_action_param_sub_item: { + pmap = pItem->getObject()->getMapDescription(); + } break; } if (mdf_type_generic_help_url == pItem->getObjectType()) { @@ -4124,6 +4286,7 @@ CFrmMdf::deleteInfoUrl(void) case mdf_type_email_item: case mdf_type_web_item: case mdf_type_social_item: + // File items case mdf_type_picture_item: case mdf_type_video_item: @@ -4131,24 +4294,38 @@ CFrmMdf::deleteInfoUrl(void) case mdf_type_firmware_item: case mdf_type_driver_item: case mdf_type_setup_item: + // Register items case mdf_type_register: case mdf_type_register_item: case mdf_type_register_sub_item: + // Remote variable items case mdf_type_remotevar: case mdf_type_remotevar_item: case mdf_type_remotevar_sub_item: + // Bit items case mdf_type_bit: case mdf_type_bit_item: case mdf_type_bit_sub_item: + // Value items case mdf_type_value: case mdf_type_value_item: case mdf_type_value_sub_item: { pmap = pItem->getObject()->getMapInfoUrl(); } break; + + // Actions + case mdf_type_action: + case mdf_type_action_item: + case mdf_type_action_sub_item: + case mdf_type_action_param: + case mdf_type_action_param_item: + case mdf_type_action_param_sub_item: { + pmap = pItem->getObject()->getMapDescription(); + } break; } std::string selstr = pItem->text(0).split('_').first().left(2).toStdString(); @@ -5559,7 +5736,7 @@ CFrmMdf::deleteRegister(void) } mdf_record_type -getTopParentType(QTreeWidgetItem* pcurrentitem) +CFrmMdf::getTopParentType(QTreeWidgetItem* pcurrentitem) { mdf_record_type type = mdf_type_unknown; QTreeWidgetItem* pItem = pcurrentitem; @@ -5577,18 +5754,24 @@ getTopParentType(QTreeWidgetItem* pcurrentitem) } /////////////////////////////////////////////////////////////////////////////// -// editRegisterBit +// editBitDefinition // void -CFrmMdf::editRegisterBit(void) +CFrmMdf::editBitDefinition(void) { - QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); - if (nullptr == pItem) return; - QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; - if (nullptr == pItemHead) return; - QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; - if (nullptr == pItemHeadHead) return; + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + if (nullptr == pItemHeadHead) { + return; + } QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; uint16_t selectedIndex = pItem->getElementIndex(); @@ -5619,7 +5802,7 @@ CFrmMdf::editRegisterBit(void) case mdf_type_bit: { if ((nullptr != pItemHeadHeadHead) && (mdf_type_register == pItemHeadHeadHead->getObjectType())) { CMDF_Register* preg = (CMDF_Register*)pItem->getObject(); - CDlgMdfRegisterBitList dlg(this); + CDlgMdfBitList dlg(this); dlg.initDialogData(preg, mdf_type_register); if (QDialog::Accepted == dlg.exec()) { // Redraw all bit items - We do not know changes @@ -5635,7 +5818,7 @@ CFrmMdf::editRegisterBit(void) } else if ((nullptr != pItemHeadHead) && (mdf_type_remotevar == pItemHeadHead->getObjectType())) { CMDF_RemoteVariable* prvar = (CMDF_RemoteVariable*)pItem->getObject(); - CDlgMdfRegisterBitList dlg(this); + CDlgMdfBitList dlg(this); dlg.initDialogData(prvar, mdf_type_remotevar); if (QDialog::Accepted == dlg.exec()) { // Redraw all bit items - We do not know changes @@ -5650,7 +5833,7 @@ CFrmMdf::editRegisterBit(void) } } else if ((nullptr != pItemHead) && (mdf_type_alarm == pItemHead->getObjectType())) { - CDlgMdfRegisterBitList dlg(this); + CDlgMdfBitList dlg(this); dlg.initDialogData(&m_mdf, mdf_type_alarm); if (QDialog::Accepted == dlg.exec()) { // Redraw all bit items - We do not know changes @@ -5664,6 +5847,21 @@ CFrmMdf::editRegisterBit(void) renderBits(pItem, *m_mdf.getAlarmList(), true); } } + else if ((nullptr != pItemHead) && (mdf_type_action_param_item == pItemHead->getObjectType())) { + CDlgMdfBitList dlg(this); + dlg.initDialogData(pItem->getObject(), mdf_type_action_param); + if (QDialog::Accepted == dlg.exec()) { + // Redraw all bit items - We do not know changes + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderBits(pItem, *((CMDF_ActionParameter*)(pItem->getObject()))->getListBits(), true); + } + } } break; case mdf_type_bit_item: { @@ -5673,7 +5871,7 @@ CFrmMdf::editRegisterBit(void) spdlog::error("MDF register edit - object has nullptr"); return; } - CDlgMdfRegisterBit dlg(this); + CDlgMdfBit dlg(this); dlg.initDialogData(pbit, 0, getTopParentType(pItem)); if (QDialog::Accepted == dlg.exec()) { pItemHead->setExpanded(true); @@ -5702,7 +5900,7 @@ CFrmMdf::editRegisterBit(void) spdlog::error("MDF register bit edit - object has nullptr"); return; } - CDlgMdfRegisterBit dlg(this); + CDlgMdfBit dlg(this); dlg.initDialogData(pbit, selectedIndex, getTopParentType(pItem)); if (QDialog::Accepted == dlg.exec()) { pItemHead->setExpanded(true); @@ -5730,15 +5928,26 @@ CFrmMdf::editRegisterBit(void) } /////////////////////////////////////////////////////////////////////////////// -// deleteRegisterBit +// deleteBitDefinition // void -CFrmMdf::deleteRegisterBit(void) +CFrmMdf::deleteBitDefinition(void) { - QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); - QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent(); - uint16_t selectedIndex = pItem->getElementIndex(); + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + if (nullptr == pItemHeadHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; + uint16_t selectedIndex = pItem->getElementIndex(); // Item must be selected if (nullptr == pItem) { @@ -5766,26 +5975,34 @@ CFrmMdf::deleteRegisterBit(void) break; case mdf_type_bit_item: { - QList childrenList = pItem->takeChildren(); - // Remove children - for (qsizetype i = 0; i < childrenList.size(); ++i) { - QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); - delete item; - } - childrenList.clear(); - std::deque* pvalues = preg->getListBits(); - // Find element and delete it - for (std::deque::iterator it = preg->getListBits()->begin(); it != preg->getListBits()->end();) { - if (*it == pItem->getObject()) { - CMDF_Bit* pbit = *it; - preg->getListBits()->erase(it); - delete pbit; - break; + if ((nullptr != pItemHeadHeadHead) && (mdf_type_register == pItemHeadHeadHead->getObjectType())) { + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + std::deque* pvalues = preg->getListBits(); + // Find element and delete it + for (std::deque::iterator it = preg->getListBits()->begin(); it != preg->getListBits()->end();) { + if (*it == pItem->getObject()) { + CMDF_Bit* pbit = *it; + preg->getListBits()->erase(it); + delete pbit; + break; + } + ++it; } - ++it; - } - pItemHead->removeChild(pItem); + pItemHead->removeChild(pItem); + } + else if ((nullptr != pItemHeadHead) && (mdf_type_remotevar == pItemHeadHead->getObjectType())) { + } + else if ((nullptr != pItemHead) && (mdf_type_alarm == pItemHead->getObjectType())) { + } + else if ((nullptr != pItemHead) && (mdf_type_action_param_item == pItemHead->getObjectType())) { + } } break; case mdf_type_bit_sub_item: { @@ -5821,15 +6038,26 @@ CFrmMdf::deleteRegisterBit(void) } /////////////////////////////////////////////////////////////////////////////// -// editRegisterValue +// editValueDefinition // void -CFrmMdf::editRegisterValue(void) +CFrmMdf::editValueDefinition(void) { - QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); - QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent(); - uint16_t selectedIndex = pItem->getElementIndex(); + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + if (nullptr == pItemHeadHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; + uint16_t selectedIndex = pItem->getElementIndex(); // Item must be selected if (nullptr == pItem) { @@ -5847,19 +6075,41 @@ CFrmMdf::editRegisterValue(void) switch (pItem->getObjectType()) { case mdf_type_value: { - CMDF_Register* preg = (CMDF_Register*)pItem->getObject(); - CDlgMdfRegisterValueList dlg(this); - dlg.initDialogData(preg); - if (QDialog::Accepted == dlg.exec()) { - // Redraw all register items - We do not know changes - QList childrenList = pItem->takeChildren(); - // Remove children - for (qsizetype i = 0; i < childrenList.size(); ++i) { - QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); - delete item; + if ((nullptr != pItemHeadHeadHead) && (mdf_type_register == pItemHeadHeadHead->getObjectType())) { + CMDF_Register* preg = (CMDF_Register*)pItem->getObject(); + CDlgMdfValueList dlg(this); + dlg.initDialogData(preg); + if (QDialog::Accepted == dlg.exec()) { + // Redraw all register items - We do not know changes + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderValues(pItem, *preg->getListValues(), true); } - childrenList.clear(); - renderValues(pItem, *preg->getListValues(), true); + } + else if ((nullptr != pItemHeadHead) && (mdf_type_remotevar == pItemHeadHead->getObjectType())) { + CMDF_RemoteVariable* prval = (CMDF_RemoteVariable*)pItem->getObject(); + CDlgMdfValueList dlg(this); + //dlg.initDialogData(prval); + if (QDialog::Accepted == dlg.exec()) { + // Redraw all register items - We do not know changes + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderValues(pItem, *prval->getListValues(), true); + } + } + else if ((nullptr != pItemHead) && (mdf_type_alarm == pItemHead->getObjectType())) { + } + else if ((nullptr != pItemHead) && (mdf_type_action_param_item == pItemHead->getObjectType())) { } } break; @@ -5870,7 +6120,7 @@ CFrmMdf::editRegisterValue(void) spdlog::error("MDF register value edit - object has nullptr"); return; } - CDlgMdfRegisterValue dlg(this); + CDlgMdfValue dlg(this); dlg.initDialogData(pvalue, 0); if (QDialog::Accepted == dlg.exec()) { pItemHead->setExpanded(true); @@ -5895,7 +6145,7 @@ CFrmMdf::editRegisterValue(void) spdlog::error("MDF register value edit - object has nullptr"); return; } - CDlgMdfRegisterValue dlg(this); + CDlgMdfValue dlg(this); dlg.initDialogData(pvalue, selectedIndex); if (QDialog::Accepted == dlg.exec()) { pItemHead->setExpanded(true); @@ -5919,15 +6169,26 @@ CFrmMdf::editRegisterValue(void) } /////////////////////////////////////////////////////////////////////////////// -// deleteRegisterValue +// deleteValueDefinition // void -CFrmMdf::deleteRegisterValue(void) +CFrmMdf::deleteValueDefinition(void) { - QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); - QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent(); - uint16_t selectedIndex = pItem->getElementIndex(); + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + if (nullptr == pItemHeadHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; + uint16_t selectedIndex = pItem->getElementIndex(); // Item must be selected if (nullptr == pItem) { @@ -5953,29 +6214,37 @@ CFrmMdf::deleteRegisterValue(void) break; case mdf_type_value_item: { - // Get register - CMDF_Register* preg = (CMDF_Register*)pItemHead->getObject(); + if ((nullptr != pItemHeadHeadHead) && (mdf_type_register == pItemHeadHeadHead->getObjectType())) { + // Get register + CMDF_Register* preg = (CMDF_Register*)pItemHead->getObject(); - QList childrenList = pItem->takeChildren(); - // Remove children - for (qsizetype i = 0; i < childrenList.size(); ++i) { - QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); - delete item; - } - childrenList.clear(); - std::deque* pvalues = preg->getListValues(); - // Find element and delete it - for (std::deque::iterator it = preg->getListValues()->begin(); it != preg->getListValues()->end();) { - if (*it == pItem->getObject()) { - CMDF_Value* pvalue = *it; - preg->getListValues()->erase(it); - delete pvalue; - break; + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + std::deque* pvalues = preg->getListValues(); + // Find element and delete it + for (std::deque::iterator it = preg->getListValues()->begin(); it != preg->getListValues()->end();) { + if (*it == pItem->getObject()) { + CMDF_Value* pvalue = *it; + preg->getListValues()->erase(it); + delete pvalue; + break; + } + ++it; } - ++it; - } - pItemHead->removeChild(pItem); + pItemHead->removeChild(pItem); + } + else if ((nullptr != pItemHeadHead) && (mdf_type_remotevar == pItemHeadHead->getObjectType())) { + } + else if ((nullptr != pItemHead) && (mdf_type_alarm == pItemHead->getObjectType())) { + } + else if ((nullptr != pItemHead) && (mdf_type_action_param_item == pItemHead->getObjectType())) { + } } break; case mdf_type_value_sub_item: { @@ -6191,4 +6460,220 @@ CFrmMdf::deleteRemoteVariable(void) } // m_headFileSetupScript->removeChild(pItemHead); +} + +/////////////////////////////////////////////////////////////////////////////// +// editAlarm +// + +void +CFrmMdf::editAlarm(void) +{ + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + if (nullptr == pItemHeadHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; + uint16_t selectedIndex = pItem->getElementIndex(); + + // Item must be selected + if (nullptr == pItem) { + int ret = QMessageBox::critical(this, tr("MDF alarm edit"), tr("No MDF alarm item selected")); + return; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// editDM +// + +void +CFrmMdf::editDM(void) +{ + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + int ret = QMessageBox::critical(this, tr("MDF DM edit"), tr("No MDF DM item selected")); + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + // QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + // if (nullptr == pItemHeadHead) { + // return; + // } + // QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; + uint16_t selectedIndex = pItem->getElementIndex(); + + switch (pItem->getObjectType()) { + + case mdf_type_decision_matrix: { + CDlgMdfDM dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_DecisionMatrix*)pItem->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + pItem->setExpanded(true); + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderDecisionMatrix(pItem, (CMDF_DecisionMatrix*)pItem->getObject()); + } + } break; + + case mdf_type_decision_matrix_item: { + CDlgMdfDM dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_DecisionMatrix*)pItem->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + pItemHead->setExpanded(true); + QList childrenList = pItemHead->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderDecisionMatrix(pItemHead, (CMDF_DecisionMatrix*)pItemHead->getObject(), selectedIndex); + } + } break; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// editAction +// + +void +CFrmMdf::editAction(void) +{ + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + int ret = QMessageBox::critical(this, tr("MDF Action edit"), tr("No MDF Action item selected")); + return; + } + QMdfTreeWidgetItem* pItemHead = (nullptr != pItem) ? (QMdfTreeWidgetItem*)pItem->parent() : nullptr; + if (nullptr == pItemHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHead = (nullptr != pItemHead) ? (QMdfTreeWidgetItem*)pItemHead->parent() : nullptr; + if (nullptr == pItemHeadHead) { + return; + } + QMdfTreeWidgetItem* pItemHeadHeadHead = (nullptr != pItemHeadHead) ? (QMdfTreeWidgetItem*)pItemHeadHead->parent() : nullptr; + uint16_t selectedIndex = pItem->getElementIndex(); + + switch (pItem->getObjectType()) { + + case mdf_type_action: { + // We show DM dialog + CDlgMdfDM dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_DecisionMatrix*)pItemHead->getObject(), 0); + if (QDialog::Accepted == dlg.exec()) { + pItem->setExpanded(true); + QList childrenList = pItemHead->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderDecisionMatrix(pItemHead, (CMDF_DecisionMatrix*)pItemHead->getObject(), selectedIndex); + pItem->setSelected(true); + } + } break; + + case mdf_type_action_item: { + CDlgMdfDmAction dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_Action*)pItem->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + pItem->setExpanded(true); + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + pItemHead->removeChild(pItem); + renderAction(pItemHead, (CMDF_Action*)pItem->getObject()); + pItemHead->sortChildren(0, Qt::AscendingOrder); + } + } break; + + case mdf_type_action_sub_item: { + CDlgMdfDmAction dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_Action*)pItemHead->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + QList childrenList = pItemHead->takeChildren(); + pItemHeadHead->removeChild(pItemHead); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + pItemHead->removeChild(pItemHeadHead); + renderAction(pItemHeadHead, (CMDF_Action*)pItemHead->getObject()); + pItemHeadHead->sortChildren(0, Qt::AscendingOrder); + // getSelectedItem + } + } break; + + case mdf_type_action_param: { + CDlgMdfDmAction dlg(this); + dlg.setReadOnly(); + dlg.initDialogData(&m_mdf, (CMDF_Action*)pItemHead->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderActionParameters(pItem, (CMDF_Action*)pItemHead->getObject()); + } + } break; + + case mdf_type_action_param_item: { + CDlgMdfDmActionParam dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_ActionParameter*)pItem->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderActionParam(pItem, (CMDF_ActionParameter*)pItem->getObject()); + } + } break; + + case mdf_type_action_param_sub_item: { + CDlgMdfDmActionParam dlg(this); + dlg.initDialogData(&m_mdf, (CMDF_ActionParameter*)pItemHead->getObject(), selectedIndex); + if (QDialog::Accepted == dlg.exec()) { + QList childrenList = pItemHead->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderActionParam(pItemHead, (CMDF_ActionParameter*)pItemHead->getObject()); + } + } break; + } } \ No newline at end of file diff --git a/src/cfrmmdf.h b/src/cfrmmdf.h index 84ccffe2..5004efad 100644 --- a/src/cfrmmdf.h +++ b/src/cfrmmdf.h @@ -215,6 +215,13 @@ public slots: */ void showContactDialog(QMdfTreeWidgetItem* pItem, mdf_dlg_contact_type type, QString title); + /*! + Get top item MDF type for a sub MDF item + @param pcurrentitem Pointer to item to test + @return MDF type for top item or mdf_type_unknown if no top item found. + */ + mdf_record_type getTopParentType(QTreeWidgetItem* pcurrentitem); + /// Edit phone/fax/email/web/social data void editContact(void); @@ -239,17 +246,17 @@ public slots: /// Delete register item void deleteRegister(void); - /// Edit register info - void editRegisterBit(void); + /// Edit bit + void editBitDefinition(void); - /// Delete register item - void deleteRegisterBit(void); + /// Delete bit + void deleteBitDefinition(void); - /// Edit register info - void editRegisterValue(void); + /// Edit value + void editValueDefinition(void); - /// Delete register item - void deleteRegisterValue(void); + /// Delete value + void deleteValueDefinition(void); /// Edit remote variable void editRemoteVariable(void); @@ -257,6 +264,15 @@ public slots: /// Delete remote variable void deleteRemoteVariable(void); + /// Edit alarm bits + void editAlarm(void); + + /// Edit decision matrix + void editDM(void); + + /// Edit DM action + void editAction(void); + /*! Fill in data from info map as children to parent item @@ -456,7 +472,9 @@ public slots: @param selectedIndex Item that should be selected */ void - renderManualSubItems(QMdfTreeWidgetItem* pItemManual, CMDF_Manual* pManualObj, uint16_t selectedIndex = 0); + renderManualSubItems(QMdfTreeWidgetItem* pItemManual, + CMDF_Manual* pManualObj, + uint16_t selectedIndex = 0); /*! Render driver items @@ -473,7 +491,9 @@ public slots: @param selectedIndex Item that should be selected */ void - renderDriverSubItems(QMdfTreeWidgetItem* pItemDriver, CMDF_Driver* pDriverObj, uint16_t selectedIndex = 0); + renderDriverSubItems(QMdfTreeWidgetItem* pItemDriver, + CMDF_Driver* pDriverObj, + uint16_t selectedIndex = 0); /*! Render setup items @@ -490,7 +510,9 @@ public slots: @param selectedIndex Item that should be selected */ void - renderSetupSubItems(QMdfTreeWidgetItem* pItemSetup, CMDF_Setup* pSetupObj, uint16_t selectedIndex = 0); + renderSetupSubItems(QMdfTreeWidgetItem* pItemSetup, + CMDF_Setup* pSetupObj, + uint16_t selectedIndex = 0); /*! Render firmware items @@ -507,7 +529,56 @@ public slots: @param selectedIndex Item that should be selected */ void - renderFirmwareSubItems(QMdfTreeWidgetItem* pItemFirmware, CMDF_Firmware* pFirmwareObj, uint16_t selectedIndex = 0); + renderFirmwareSubItems(QMdfTreeWidgetItem* pItemFirmware, + CMDF_Firmware* pFirmwareObj, + uint16_t selectedIndex = 0); + + /*! + Render actions + @param pItemAction Action header + @param paction Pointer to DM to render + @param pSubItemAction Item that should be selected + */ + void + renderAction(QMdfTreeWidgetItem* pItemAction, + CMDF_Action* paction); + + /*! + Render Decision Matrix info + @param pItemDM Pointer to DM header + @param pdm Pointer to DM to render + @param selectedIndex Item that should be selected + */ + void + renderDecisionMatrix(QMdfTreeWidgetItem* pItemDM, + CMDF_DecisionMatrix* pdm, + uint16_t selectedIndex = 0); + + /*! + Render events + @param pItemEvent Event header + */ + + void + renderEvents(QMdfTreeWidgetItem* pItemEvent); + + /*! + Render one action parameter + @param pActionParamHeadItem Pointer to header for action parameters head item + @param pActionParam Pointer to action parameter object that should be rendered + */ + void + renderActionParam(QMdfTreeWidgetItem* pActionParamItem, + CMDF_ActionParameter* pactionparam); + + /*! + Render action parameters + @param pActionParamItem Pointer to header for action parameters + @param pAction Pointer to action for wich parameters should be renderd + */ + void + renderActionParameters(QMdfTreeWidgetItem* pActionParamItem, + CMDF_Action* pAction); /// Do the new operation void newMdf(void);