diff --git a/CMakeLists.txt b/CMakeLists.txt index b1250864..f442184c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,7 +235,9 @@ qt5_wrap_ui(UI src/mainwindow.ui src/cfrmnodeconfig.ui src/cfrmnodescan.ui src/cdlgactionparam.ui + srd/cdlgdatepicker.ui src/cfrmmdf.ui + src/cdlgmdfmodule.ui src/cdlgmdfbitlist.ui src/cdlgmdfdm.ui src/cdlgmdffilepicture.ui @@ -467,10 +469,21 @@ add_executable(${PROJECT_NAME} src/xyseries.h src/xyseries.cpp + build/ui_cdlgdatepicker.h + src/cdlgdatepicker.ui + src/cdlgdatepicker.cpp + src/cdlgdatepicker.h + + build/ui_cfrmmdf.h src/cfrmmdf.ui src/cfrmmdf.h src/cfrmmdf.cpp + build/ui_cdlgmdfmodule.h + src/cdlgmdfmodule.ui + src/cdlgmdfmodule.cpp + src/cdlgmdfmodule.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/docs/codes.txt b/docs/codes.txt new file mode 100644 index 00000000..d2321868 --- /dev/null +++ b/docs/codes.txt @@ -0,0 +1,65 @@ +MDF tree codes +-------------- + +MSB | MSB+1 | MSB+2 | MSB+3 + +MSB +--- +0 Redirect +1 Module + +MSB+1 +----- +0 Description +1 Info URL +2 Name +3 Change Date +4 VSCP Level +5 Model +6 Version +7 Buffer size +9 MANUFACTURER +10 BOOT +11 FILES +12 REGISTER +13 REMOTE VARIABLES +14 ALARM +15 DECISION MATRIX +16 EVENTS + +Manufacturer +----- +0 Description (Reserved) +1 Info URL (Reserved) +2 Name +3 Street +4 City +5 Town +6 Post Code +7 Region +8 State +9 Country +10 Email +11 Phone +12 Fax +13 Web +14 Social + +Boot +---- +0 Description (Reserved) +1 Info URL (Reserved) +2 Algorithm +3 Block size +4 Block count + +Files +----- +0 Description (Reserved) +1 Info URL (Reserved) +2 Manuals +3 Pictures +4 Videos +5 Firmware +6 Drivers +7 Setup scripts \ No newline at end of file diff --git a/mdf/beijing_2.xml b/mdf/beijing_2.xml index 3e4358e8..eed50608 100644 --- a/mdf/beijing_2.xml +++ b/mdf/beijing_2.xml @@ -3,6 +3,7 @@ Beijing IO controller + (C) 2000-2023 Grodans Paradis AB 1 B 9 diff --git a/src/cdlgdatepicker.cpp b/src/cdlgdatepicker.cpp new file mode 100644 index 00000000..e697c7d7 --- /dev/null +++ b/src/cdlgdatepicker.cpp @@ -0,0 +1,172 @@ +// cdlgdatepicker.cpp +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2023 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 "cdlgdatepicker.h" +#include "ui_cdlgdatepicker.h" + +#include +#include + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// CTor +// + +CDlgDatePicker::CDlgDatePicker(QWidget *parent) : + QDialog(parent), + ui(new Ui::CDlgDatePicker) +{ + ui->setupUi(this); + + vscpworks *pworks = (vscpworks *)QCoreApplication::instance(); + + //connect(ui->btnSetDummyGuid, &QPushButton::clicked, this, &cdlgdatepicker::setDummyGuid); + + setInitialFocus(); +} + +/////////////////////////////////////////////////////////////////////////////// +// DTor +// + +CDlgDatePicker::~CDlgDatePicker() +{ + delete ui; +} + +/////////////////////////////////////////////////////////////////////////////// +// setInitialFocus +// + +void CDlgDatePicker::setInitialFocus(void) +{ + // ui->editGuid->setFocus(); +} + +/////////////////////////////////////////////////////////////////////////////// +// setEditMode +// + +void CDlgDatePicker::setEditMode(void) +{ + // ui->editGuid->setReadOnly(true); + // ui->btnSetDummyGuid->setVisible(false); + // ui->editName->setFocus(); +} + +/////////////////////////////////////////////////////////////////////////////// +// setDummyGuid +// + +// void cdlgdatepicker::setDummyGuid(void) +// { +// //ui->editGuid->setText("00:00:00:00:00:00:00:00:00:00:00:00:xx:xx:xx:xx"); +// } + + +// ---------------------------------------------------------------------------- +// Getters & Setters +// ---------------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +// getGuid +// + +// QString cdlgdatepicker::getGuid(void) +// { +// //return (ui->editGuid->text()); +// } + +/////////////////////////////////////////////////////////////////////////////// +// setGuid +// + +// void cdlgdatepicker::setGuid(const QString& str) +// { +// //ui->editGuid->setText(str); +// } + +/////////////////////////////////////////////////////////////////////////////// +// getName +// + +// QString cdlgdatepicker::getName(void) +// { +// return (ui->editName->text()); +// } + +/////////////////////////////////////////////////////////////////////////////// +// setName +// + +// void cdlgdatepicker::setName(const QString& str) +// { +// ui->editName->setText(str); +// } + +/////////////////////////////////////////////////////////////////////////////// +// getDescription +// + +// QString cdlgdatepicker::getDescription(void) +// { +// #if QT_VERSION >= 0x050E00 +// //return (ui->editDescription->toMarkdown()); +// return (ui->editDescription->toPlainText()); +// #else +// return (ui->editDescription->toPlainText()); +// #endif +// } + +/////////////////////////////////////////////////////////////////////////////// +// setDescription +// + +// void cdlgdatepicker::setDescription(const QString& str) +// { +// #if QT_VERSION >= 0x050E00 +// ui->editDescription->setMarkdown(str); +// #else +// ui->editDescription->setText(str); +// #endif +// } + + diff --git a/src/cdlgdatepicker.h b/src/cdlgdatepicker.h new file mode 100644 index 00000000..47eee292 --- /dev/null +++ b/src/cdlgdatepicker.h @@ -0,0 +1,83 @@ +// cdlgdatepicker.h +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2023 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 CDLGDATEPICKER_H +#define CDLGDATEPICKER_H + +#include + +#include + + +namespace Ui { +class CDlgDatePicker; +} + + +class CDlgDatePicker : public QDialog +{ + Q_OBJECT + +public: + + +public: + explicit CDlgDatePicker(QWidget *parent = nullptr); + ~CDlgDatePicker(); + + /*! + Set inital focus to description + */ + void setInitialFocus(void); + + /*! + Set edit mode. + GUID will be READ ONLY + */ + void setEditMode(void); + + + + + // ---------------------------------------------------------------------------- + // Getters & Setters + // ---------------------------------------------------------------------------- + + + + public slots: + + +private: + + Ui::CDlgDatePicker *ui; + +}; + + +#endif // CDLGDATEPICKER_H diff --git a/src/cdlgdatepicker.ui b/src/cdlgdatepicker.ui new file mode 100644 index 00000000..d412ae6b --- /dev/null +++ b/src/cdlgdatepicker.ui @@ -0,0 +1,78 @@ + + + CDlgDatePicker + + + + 0 + 0 + 597 + 194 + + + + Dialog + + + + + 500 + 10 + 81 + 171 + + + + Qt::Vertical + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 10 + 471 + 171 + + + + + + + + buttonBox + accepted() + CDlgDatePicker + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + CDlgDatePicker + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/cdlgmdfmodule.cpp b/src/cdlgmdfmodule.cpp new file mode 100644 index 00000000..962240e0 --- /dev/null +++ b/src/cdlgmdfmodule.cpp @@ -0,0 +1,148 @@ +// cdlgmdfmodule.cpp +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2023 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 "cdlgmdfmodule.h" +#include "ui_cdlgmdfmodule.h" + +#include +#include + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// CTor +// + +CDlgMdfModule::CDlgMdfModule(QWidget *parent) : + QDialog(parent), + ui(new Ui::CDlgMdfModule) +{ + ui->setupUi(this); + + vscpworks *pworks = (vscpworks *)QCoreApplication::instance(); + + //connect(ui->btnSetDummyGuid, &QPushButton::clicked, this, &cdlgmdfmodule::setDummyGuid); + + setInitialFocus(); +} + +/////////////////////////////////////////////////////////////////////////////// +// DTor +// + +CDlgMdfModule::~CDlgMdfModule() +{ + delete ui; +} + +/////////////////////////////////////////////////////////////////////////////// +// setInitialFocus +// + +void CDlgMdfModule::setInitialFocus(void) +{ + //ui->editGuid->setFocus(); +} + +/////////////////////////////////////////////////////////////////////////////// +// setEditMode +// + +// void CDlgMdfModule::setEditMode(void) +// { +// ui->editGuid->setReadOnly(true); +// ui->btnSetDummyGuid->setVisible(false); +// ui->editName->setFocus(); +// } + + + +// ---------------------------------------------------------------------------- +// Getters & Setters +// ---------------------------------------------------------------------------- + + + +/////////////////////////////////////////////////////////////////////////////// +// getName +// + +QString CDlgMdfModule::getName(void) +{ + return (ui->editName->text()); +} + +/////////////////////////////////////////////////////////////////////////////// +// setName +// + +void CDlgMdfModule::setName(const QString& str) +{ + ui->editName->setText(str); +} + +/////////////////////////////////////////////////////////////////////////////// +// getDescription +// + +// QString cdlgmdfmodule::getDescription(void) +// { +// #if QT_VERSION >= 0x050E00 +// //return (ui->editDescription->toMarkdown()); +// return (ui->editDescription->toPlainText()); +// #else +// return (ui->editDescription->toPlainText()); +// #endif +// } + +/////////////////////////////////////////////////////////////////////////////// +// setDescription +// + +// void cdlgmdfmodule::setDescription(const QString& str) +// { +// #if QT_VERSION >= 0x050E00 +// ui->editDescription->setMarkdown(str); +// #else +// ui->editDescription->setText(str); +// #endif +// } + + diff --git a/src/cdlgmdfmodule.h b/src/cdlgmdfmodule.h new file mode 100644 index 00000000..bcb279cc --- /dev/null +++ b/src/cdlgmdfmodule.h @@ -0,0 +1,128 @@ +// cdlgmdfmodule.h +// +// This file is part of the VSCP (https://www.vscp.org) +// +// The MIT License (MIT) +// +// Copyright © 2000-2023 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 CDLGMDFMODULE_H +#define CDLGMDFMODULE_H + +#include + +#include + + +namespace Ui { +class CDlgMdfModule; +} + + +class CDlgMdfModule : public QDialog +{ + Q_OBJECT + +public: + + +public: + explicit CDlgMdfModule(QWidget *parent = nullptr); + ~CDlgMdfModule(); + + /*! + Set inital focus to description + */ + void setInitialFocus(void); + + /*! + Set edit mode. + GUID will be READ ONLY + */ + void setEditMode(void); + + /*! + Set Dummy GUID + */ + void setDummyGuid(void); + + + // ---------------------------------------------------------------------------- + // Getters & Setters + // ---------------------------------------------------------------------------- + + /*! + Name getter/setters + */ + void setName(const QString& name); + QString getName(void); + + /*! + GUID getter/setters + */ + void setModel(const QString& guid); + QString getModel(void); + + /*! + GUID getter/setters + */ + void setVersion(const QString& guid); + QString getVersion(void); + + /*! + GUID getter/setters + */ + void setChangeDate(const QString& guid); + QString getChangeDate(void); + + /*! + GUID getter/setters + */ + void setBufferSize(int size); + int getBufferSize(void); + + /*! + GUID getter/setters + */ + void setCopyright(const QString& guid); + QString getCopyright(void); + + /*! + GUID getter/setters + */ + void setDescription(const QString& guid); + QString getDescription(void); + + + + public slots: + + +private: + + Ui::CDlgMdfModule *ui; + +}; + + +#endif // CDLGMDFMODULE_H diff --git a/src/cdlgmdfmodule.ui b/src/cdlgmdfmodule.ui index 1bb424fb..968a2971 100644 --- a/src/cdlgmdfmodule.ui +++ b/src/cdlgmdfmodule.ui @@ -23,29 +23,6 @@ - - - - Copyright - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::WheelFocus - - - Description for connection used in connection table - - - - - - @@ -57,7 +34,7 @@ - + Path to file containg VSCP events @@ -67,7 +44,7 @@ - + Path to file containg VSCP events @@ -106,7 +83,7 @@ - + Description @@ -116,7 +93,7 @@ - + Info.URL @@ -126,18 +103,8 @@ - - - - Buffer size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Path to file containg VSCP events @@ -146,38 +113,50 @@ - - - - Path to file containg VSCP events - + + - + Buffer size + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Path to file containg VSCP events - + + - + Copyright + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + Qt::WheelFocus + - Path to file containg VSCP events + Description for connection used in connection table + + + + + + + + + - + diff --git a/src/cfrmmdf.cpp b/src/cfrmmdf.cpp index 1333f229..ceefa06d 100644 --- a/src/cfrmmdf.cpp +++ b/src/cfrmmdf.cpp @@ -64,6 +64,55 @@ // ---------------------------------------------------------------------------- +QMdfTreeWidgetItem::QMdfTreeWidgetItem(const QString& text) + : QTreeWidgetItem(0) +{ + m_objType = mdf_type_unknown; + m_fieldIndex = 0; + m_pMdfRecord = nullptr; +} + +QMdfTreeWidgetItem::QMdfTreeWidgetItem(mdf_record_type objtype) + : QTreeWidgetItem(QTreeWidgetItem::Type) +{ + m_objType = objtype; + m_fieldIndex = 0; + m_pMdfRecord = nullptr; +} + +QMdfTreeWidgetItem::QMdfTreeWidgetItem(CMDF_Object* pobj, mdf_record_type objtype) + : QTreeWidgetItem(QTreeWidgetItem::Type) +{ + m_objType = objtype; + m_fieldIndex = 0; + m_pMdfRecord = pobj; +} + +QMdfTreeWidgetItem::QMdfTreeWidgetItem(QTreeWidgetItem* parent, mdf_record_type objtype) + : QTreeWidgetItem(parent, QTreeWidgetItem::Type) +{ + m_objType = objtype; + m_fieldIndex = 0; + m_pMdfRecord = nullptr; +} + +QMdfTreeWidgetItem::QMdfTreeWidgetItem(QTreeWidgetItem* parent, CMDF_Object* pobj, mdf_record_type objtype) + : QTreeWidgetItem(parent, QTreeWidgetItem::Type) +{ + m_objType = objtype; + m_fieldIndex = 0; + m_pMdfRecord = nullptr; +} + +QMdfTreeWidgetItem::~QMdfTreeWidgetItem() +{ + ; +} + +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- + /////////////////////////////////////////////////////////////////////////////// // CFrmMdf // @@ -76,6 +125,9 @@ CFrmMdf::CFrmMdf(QWidget* parent, const char* path) ui->setupUi(this); + // QStatusBar *m_bar = new QStatusBar(this); + // ui->statusbar->addWidget(m_bar); + ui->treeMDF->setContextMenuPolicy(Qt::CustomContextMenu); ui->treeMDF->setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -114,10 +166,16 @@ CFrmMdf::CFrmMdf(QWidget* parent, const char* path) connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openMdf())); // Register row has been clicked. - // connect(ui->treeMDF, - // &QTreeWidget::itemClicked, - // this, - // &CFrmMdf::onFindNodesTreeWidgetItemClicked); + connect(ui->treeMDF, + &QTreeWidget::itemClicked, + this, + &CFrmMdf::onItemClicked); + + // Register row has been double clicked. + connect(ui->treeMDF, + &QTreeWidget::itemDoubleClicked, + this, + &CFrmMdf::onItemDoubleClicked); } /////////////////////////////////////////////////////////////////////////////// @@ -202,13 +260,229 @@ void CFrmMdf::showMdfContextMenu(const QPoint& pos) { QMenu* menu = new QMenu(this); - menu->addAction(QString(tr("Fetch MDF")), this, SLOT(loadSelectedMdf())); - menu->addAction(QString(tr("Fetch ALL MDF")), this, SLOT(loadAllMdf())); - menu->addSeparator(); - menu->addAction(QString(tr("Rescan")), this, SLOT(doScan())); - menu->addSeparator(); - menu->addAction(QString(tr("Configure")), this, SLOT(goConfig())); - menu->addAction(QString(tr("Session")), this, SLOT(goSession())); + + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + if (nullptr == pItem) { + menu->addAction(QString(tr("Fetch MDF")), this, SLOT(loadSelectedMdf())); + menu->addAction(QString(tr("Fetch ALL MDF")), this, SLOT(loadAllMdf())); + menu->addSeparator(); + menu->addAction(QString(tr("Rescan")), this, SLOT(doScan())); + menu->addSeparator(); + menu->addAction(QString(tr("Configure")), this, SLOT(goConfig())); + menu->addAction(QString(tr("Session")), this, SLOT(goSession())); + } + else { + switch (pItem->getObjectType() /*pItem->type() - QTreeWidgetItem::UserType*/) { + case mdf_type_unknown: + menu->addAction(QString(tr("Unknown")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_redirection: + menu->addAction(QString(tr("redirection")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_mdf: + menu->addAction(QString(tr("MDF")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_value: + menu->addAction(QString(tr("Value")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_bit: + menu->addAction(QString(tr("Bit")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_bit_item: + menu->addAction(QString(tr("Bit item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_register_page: + menu->addAction(QString(tr("Register Page")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_register: + menu->addAction(QString(tr("Register")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_register_item: + menu->addAction(QString(tr("Register item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_remotevar: + menu->addAction(QString(tr("Remote Variable")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_remotevar_item: + menu->addAction(QString(tr("Remote Variable Item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_action_param: + menu->addAction(QString(tr("Action Param")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_action: + menu->addAction(QString(tr("Action")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_action_item: + menu->addAction(QString(tr("Action item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_decision_matrix: + menu->addAction(QString(tr("DM")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_event_data: + menu->addAction(QString(tr("Event Data")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_event_data_item: + menu->addAction(QString(tr("Event Data item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_event: + menu->addAction(QString(tr("Event")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_event_item: + menu->addAction(QString(tr("Event item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_value_item: + menu->addAction(QString(tr("Value Item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_bootloader: + menu->addAction(QString(tr("Bootloader")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_alarm: + menu->addAction(QString(tr("Alarm")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_address: + menu->addAction(QString(tr("Address")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_manufacturer: + menu->addAction(QString(tr("Manufacturer")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_file: + menu->addAction(QString(tr("File")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_picture: + menu->addAction(QString(tr("Picture")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_picture_item: + menu->addAction(QString(tr("Picture item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_video: + menu->addAction(QString(tr("Video")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_video_item: + menu->addAction(QString(tr("Video item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_firmware: + menu->addAction(QString(tr("Firmware")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_firmware_item: + menu->addAction(QString(tr("Firmware item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_driver: + menu->addAction(QString(tr("Driver")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_driver_item: + menu->addAction(QString(tr("Driver")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_setup: + menu->addAction(QString(tr("Setup")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_setup_item: + menu->addAction(QString(tr("Setup")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_manual: + menu->addAction(QString(tr("Manual")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_manual_item: + menu->addAction(QString(tr("Manual item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_email: + menu->addAction(QString(tr("email")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_phone: + menu->addAction(QString(tr("phone")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_fax: + menu->addAction(QString(tr("fax")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_web: + menu->addAction(QString(tr("web")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_social: + menu->addAction(QString(tr("social")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_string: + menu->addAction(QString(tr("string")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_number: + menu->addAction(QString(tr("number")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_url: + menu->addAction(QString(tr("url")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_date: + menu->addAction(QString(tr("date")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_access: + menu->addAction(QString(tr("access")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_description: + menu->addAction(QString(tr("description")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_description_item: + menu->addAction(QString(tr("description item")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_help_url: + menu->addAction(QString(tr("help url")), this, SLOT(loadSelectedMdf())); + break; + + case mdf_type_generic_help_url_item: + menu->addAction(QString(tr("help url item")), this, SLOT(loadSelectedMdf())); + break; + + default: + menu->addAction(QString(tr("Default")), this, SLOT(loadSelectedMdf())); + break; + } + } + menu->popup(ui->treeMDF->viewport()->mapToGlobal(pos)); } @@ -220,7 +494,8 @@ void CFrmMdf::fillDescriptionItems(QTreeWidgetItem* pParent, std::map* pObjMap) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; +https: // www.facebook.com/v10.0/dialog/share?app_id=69103156693&channel_url=https%3A%2F%2Fstaticxx.facebook.com%2Fx%2Fconnect%2Fxd_arbiter%2F%3Fversion%3D46%23cb%3Df150d58de1db8e4%26domain%3Dwww.kickstarter.com%26is_canvas%3Dfalse%26origin%3Dhttps%253A%252F%252Fwww.kickstarter.com%252Ffe4a197826998%26relation%3Dopener&display=popup&e2e=%7B%7D&fallback_redirect_uri=https%3A%2F%2Fwww.kickstarter.com%2Fprojects%2Ffolkparksminnen60-99%2Ffolkparksminnen%3Ffbclid%3DIwAR2INbiHAcN1yOkmITEWLu_t0m3KC6et_gZUFpPQhuqO9UhYd_Xr1dLzW4Q&href=https%3A%2F%2Fwww.kickstarter.com%2Fprojects%2Ffolkparksminnen60-99%2Ffolkparksminnen%3Fref%3Dproject_facebook&locale=en_US&next=https%3A%2F%2Fstaticxx.facebook.com%2Fx%2Fconnect%2Fxd_arbiter%2F%3Fversion%3D46%23cb%3Df293d257f56a6d8%26domain%3Dwww.kickstarter.com%26is_canvas%3Dfalse%26origin%3Dhttps%253A%252F%252Fwww.kickstarter.com%252Ffe4a197826998%26relation%3Dopener%26frame%3Df133ebcd98d41c8%26result%3D%2522xxRESULTTOKENxx%2522&sdk=joey&version=v10.0 // Must be valid pointer if (nullptr == pParent) { @@ -231,7 +506,7 @@ CFrmMdf::fillDescriptionItems(QTreeWidgetItem* pParent, std::mapsetText(0, "Description"); pParent->addChild(pItemModuleDescription); @@ -243,7 +518,7 @@ CFrmMdf::fillDescriptionItems(QTreeWidgetItem* pParent, std::map* pmap = pObjMap; for (auto const& x : *pmap) { str = x.first.c_str() + QString(": ") + x.second.c_str(); - pItem = new QTreeWidgetItem(pItemModuleDescription, 0); + pItem = new QMdfTreeWidgetItem(pItemModuleDescription, mdf_type_generic_description_item); pItem->setText(0, str); pParent->addChild(pItem); } @@ -257,7 +532,7 @@ void CFrmMdf::fillHelpUrlItems(QTreeWidgetItem* pParent, std::map* pObjMap) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; // Must be valid pointer if (nullptr == pParent) { @@ -268,7 +543,7 @@ CFrmMdf::fillHelpUrlItems(QTreeWidgetItem* pParent, std::mapsetText(0, "Help/Info URL"); pParent->addChild(pItemModuleHelpUrl); @@ -280,7 +555,7 @@ CFrmMdf::fillHelpUrlItems(QTreeWidgetItem* pParent, std::map* pmap = pObjMap; for (auto const& x : *pmap) { str = x.first.c_str() + QString(": ") + x.second.c_str(); - pItem = new QTreeWidgetItem(pItemModuleHelpUrl, 0); + pItem = new QMdfTreeWidgetItem(pItemModuleHelpUrl, mdf_type_generic_help_url_item); pItem->setText(0, str); pParent->addChild(pItem); } @@ -294,14 +569,14 @@ void CFrmMdf::fillBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; // Must be valid pointer if (nullptr == pParent) { return; } - QTreeWidgetItem* pItemBitDefs = new QTreeWidgetItem(pParent, 0); + QMdfTreeWidgetItem* pItemBitDefs = new QMdfTreeWidgetItem(pParent, mdf_type_bit); pItemBitDefs->setText(0, "Bit definitions"); pParent->addChild(pItemBitDefs); @@ -319,37 +594,37 @@ CFrmMdf::fillBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits) str += QString(" %1 ").arg(j); } str += "}"; - QTreeWidgetItem* pItemParent = new QTreeWidgetItem(pItemBitDefs, 0); + QMdfTreeWidgetItem* pItemParent = new QMdfTreeWidgetItem(pItemBitDefs, mdf_type_bit_item); pItemParent->setText(0, str); pItemBitDefs->addChild(pItemParent); str = QString("Name: %1").arg(pbit->getName().c_str()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_string); pItem->setText(0, str); pItemBitDefs->addChild(pItem); str = QString("Pos: %1").arg(pbit->getPos()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_number); pItem->setText(0, str); pItemBitDefs->addChild(pItem); str = QString("Width: %1").arg(pbit->getWidth()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_number); pItem->setText(0, str); pItemBitDefs->addChild(pItem); str = QString("Default: %1").arg(pbit->getDefault()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_number); pItem->setText(0, str); pItemBitDefs->addChild(pItem); str = QString("Min: %1").arg(pbit->getMin()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_number); pItem->setText(0, str); pItemBitDefs->addChild(pItem); str = QString("Max: %1").arg(pbit->getMax()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_number); pItem->setText(0, str); pItemBitDefs->addChild(pItem); @@ -362,12 +637,12 @@ CFrmMdf::fillBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits) str += "w"; } str += ")"; - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_access); pItem->setText(0, str); pItemParent->addChild(pItem); str = QString("Mask: 0b%1").arg(pbit->getMask(), 1, 2); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_string); pItem->setText(0, str); pItemParent->addChild(pItem); @@ -390,14 +665,14 @@ void CFrmMdf::fillValueInfo(QTreeWidgetItem* pParent, std::deque& dequevalues) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; // Must be valid pointer if (nullptr == pParent) { return; } - QTreeWidgetItem* pItemValue = new QTreeWidgetItem(pParent, 0); + QMdfTreeWidgetItem* pItemValue = new QMdfTreeWidgetItem(pParent, mdf_type_value); pItemValue->setText(0, "Valid values"); pParent->addChild(pItemValue); @@ -415,17 +690,17 @@ CFrmMdf::fillValueInfo(QTreeWidgetItem* pParent, std::deque& dequev // str += QString(" %1 ").arg(j); // } // str += "}"; - QTreeWidgetItem* pItemParent = new QTreeWidgetItem(pItemValue, 0); + QMdfTreeWidgetItem* pItemParent = new QMdfTreeWidgetItem(pItemValue, mdf_type_value_item); pItemParent->setText(0, str); pItemValue->addChild(pItemParent); str = QString("Name: %1").arg(pvalue->getName().c_str()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_string); pItem->setText(0, str); pItemValue->addChild(pItem); str = QString("Value: %1").arg(pvalue->getValue().c_str()); - pItem = new QTreeWidgetItem(pItemParent, 0); + pItem = new QMdfTreeWidgetItem(pItemParent, mdf_type_generic_number); pItem->setText(0, str); pItemValue->addChild(pItem); @@ -445,7 +720,7 @@ void CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; // Check pointers if (nullptr == pParent) { @@ -455,70 +730,70 @@ CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg) return; } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Name: %1").arg(preg->getName().c_str()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Page: %1").arg(preg->getPage()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Offset: %1").arg(preg->getOffset()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Default value: %1").arg(preg->getDefault().c_str()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Min value: %1").arg(preg->getMin()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Max value: %1").arg(preg->getMax()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Register span: %1").arg(preg->getSpan()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Register width: %1").arg(preg->getWidth()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Size: %1").arg(preg->getSize()); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_access); if (nullptr != pItem) { str = QString("Access: %1 (").arg(preg->getAccess()); if (2 & preg->getAccess()) { @@ -532,7 +807,7 @@ CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg) pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Type: %1").arg(preg->getType()); switch (preg->getType()) { @@ -553,14 +828,14 @@ CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg) pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Foreground color: 0x%1").arg(preg->getForegroundColor(), 1, 16); pItem->setText(0, str); pParent->addChild(pItem); } - pItem = new QTreeWidgetItem(pParent, 1); + pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Background color: 0x%1").arg(preg->getBackgroundColor(), 1, 16); pItem->setText(0, str); @@ -589,7 +864,7 @@ CFrmMdf::loadMdf(void) { QString str; size_t index = 0; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; // Clear the treeview ui->treeMDF->clear(); @@ -600,82 +875,61 @@ CFrmMdf::loadMdf(void) QFont fontTopItem; fontTopItem.setBold(true); - pItem = new QTreeWidgetItem(1); + pItem = new QMdfTreeWidgetItem(&m_mdf, mdf_type_redirection); pItem->setText(0, tr("Redirection")); - pItem->setDisabled(true); + // pItem->setDisabled(true); ui->treeMDF->addTopLevelItem(pItem); // Module - QTreeWidgetItem* pItemModule = new QTreeWidgetItem(1); + QMdfTreeWidgetItem* pItemModule = new QMdfTreeWidgetItem(&m_mdf, mdf_type_mdf); + pItemModule->setObject(&m_mdf); pItemModule->setFont(0, fontTopItem); pItemModule->setForeground(0, blueBrush); pItemModule->setText(0, tr("Module")); + pItemModule->setObject(&m_mdf); ui->treeMDF->addTopLevelItem(pItemModule); // Module information - // std::string str = m_mdf.getModuleName().c_str(); - QTreeWidgetItem* pItemModuleInfo = new QTreeWidgetItem(pItemModule, 1); - pItemModuleInfo->setText(0, QString("Name: ") + m_mdf.getModuleName().c_str()); - pItemModule->addChild(pItemModuleInfo); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_string); + pItem->setText(0, QString("Name: ") + m_mdf.getModuleName().c_str()); + pItemModule->addChild(pItem); + + str = QString("Copyright: ") + m_mdf.getModuleCopyright().c_str(); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_string); + pItem->setText(0, str); + pItemModule->addChild(pItem); str = QString("Change Date: ") + m_mdf.getModuleChangeDate().c_str(); - pItem = new QTreeWidgetItem(pItemModule, 0); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = "VSCP Level: " + QString::number(m_mdf.getModuleLevel() + 1); - pItem = new QTreeWidgetItem(pItemModule, 0); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_number); pItem->setText(0, str); pItemModule->addChild(pItem); str = "Model: " + QString(m_mdf.getModuleModel().c_str()); - pItem = new QTreeWidgetItem(pItemModule, 0); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = "Version: " + QString(m_mdf.getModuleVersion().c_str()); - pItem = new QTreeWidgetItem(pItemModule, 0); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = "Buffer size: " + QString::number(m_mdf.getModuleBufferSize()); - pItem = new QTreeWidgetItem(pItemModule, 0); + pItem = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_generic_number); pItem->setText(0, str); pItemModule->addChild(pItem); fillDescriptionItems(pItemModule, m_mdf.getModuleDescriptionMap()); - // { - // QTreeWidgetItem* pItemModuleDescription = new QTreeWidgetItem(pItemModule, 0); - // pItemModuleDescription->setText(0, "Description"); - // pItemModule->addChild(pItemModuleDescription); - - // std::map* pmap = m_mdf.getModuleDescriptionMap(); - // for (auto const& x : *pmap) { - // str = x.first.c_str() + QString(": ") + x.second.c_str(); - // pItem = new QTreeWidgetItem(pItemModuleDescription, 0); - // pItem->setText(0, str); - // pItemModule->addChild(pItem); - // } - // } - fillHelpUrlItems(pItemModule, m_mdf.getModuleHelpUrlMap()); - // { - // QTreeWidgetItem* pItemModuleHelpUrl = new QTreeWidgetItem(pItemModule, 0); - // pItemModuleHelpUrl->setText(0, "Help/Info URL"); - // pItemModule->addChild(pItemModuleHelpUrl); - - // std::map* pmap = m_mdf.getModuleHelpUrlMap(); - // for (auto const& x : *pmap) { - // str = x.first.c_str() + QString(": ") + x.second.c_str(); - // pItem = new QTreeWidgetItem(pItemModuleHelpUrl, 0); - // pItem->setText(0, str); - // pItemModule->addChild(pItem); - // } - // } // * * * Manufacturer info * * * - QTreeWidgetItem* pItemManufacturer = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemManufacturer = new QMdfTreeWidgetItem(pItemModule, mdf_type_manufacturer); pItemManufacturer->setFont(0, fontTopItem); pItemManufacturer->setForeground(0, greenBrush); pItemManufacturer->setText(0, tr("Manufacturer")); @@ -685,42 +939,42 @@ CFrmMdf::loadMdf(void) if (nullptr != pManufacturer) { str = QString("Name: ") + m_mdf.getManufacturerName().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("Street: ") + m_mdf.getManufacturerStreetAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("City: ") + m_mdf.getManufacturerCityAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("Town: ") + m_mdf.getManufacturerTownAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("Post Code: ") + m_mdf.getManufacturerPostCodeAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("Region: ") + m_mdf.getManufacturerRegionAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("State: ") + m_mdf.getManufacturerStateAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); str = QString("Country: ") + m_mdf.getManufacturerCountryAddress().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_generic_string); pItem->setText(0, str); pItemModule->addChild(pItem); @@ -731,7 +985,7 @@ CFrmMdf::loadMdf(void) pItemEmail = pManufacturer->getEmailObj(index++); if (nullptr != pItemEmail) { str = QString("Email ") + QString::number(index) + ": " + pItemEmail->getName().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_email); pItem->setText(0, str); pItemModule->addChild(pItem); fillDescriptionItems(pItem, pManufacturer->getEmailObj()->getDescriptionMap()); @@ -746,7 +1000,7 @@ CFrmMdf::loadMdf(void) pItemPhone = pManufacturer->getPhoneObj(index++); if (nullptr != pItemPhone) { str = QString("Phone ") + QString::number(index) + ": " + pItemPhone->getName().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_phone); pItem->setText(0, str); pItemModule->addChild(pItem); fillDescriptionItems(pItem, pManufacturer->getPhoneObj()->getDescriptionMap()); @@ -761,7 +1015,7 @@ CFrmMdf::loadMdf(void) pItemFax = pManufacturer->getFaxObj(index++); if (nullptr != pItemFax) { str = QString("Fax ") + QString::number(index) + ": " + pItemFax->getName().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_fax); pItem->setText(0, str); pItemModule->addChild(pItem); fillDescriptionItems(pItem, pManufacturer->getFaxObj()->getDescriptionMap()); @@ -776,7 +1030,7 @@ CFrmMdf::loadMdf(void) pItemWeb = pManufacturer->getWebObj(index++); if (nullptr != pItemWeb) { str = QString("Web ") + QString::number(index) + ": " + pItemWeb->getName().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_web); pItem->setText(0, str); pItemModule->addChild(pItem); fillDescriptionItems(pItem, pManufacturer->getWebObj()->getDescriptionMap()); @@ -791,7 +1045,7 @@ CFrmMdf::loadMdf(void) pItemSocial = pManufacturer->getSocialObj(index++); if (nullptr != pItemSocial) { str = QString("Social ") + QString::number(index) + ": " + pItemSocial->getName().c_str(); - pItem = new QTreeWidgetItem(pItemManufacturer, 0); + pItem = new QMdfTreeWidgetItem(pItemManufacturer, mdf_type_social); pItem->setText(0, str); pItemModule->addChild(pItem); fillDescriptionItems(pItem, pManufacturer->getSocialObj()->getDescriptionMap()); @@ -805,7 +1059,7 @@ CFrmMdf::loadMdf(void) // * * * Boot info * * * - QTreeWidgetItem* pItemBoot = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemBoot = new QMdfTreeWidgetItem(pItemModule, mdf_type_bootloader); pItemBoot->setFont(0, fontTopItem); pItemBoot->setForeground(0, greenBrush); pItemBoot->setText(0, tr("Boot")); @@ -814,17 +1068,17 @@ CFrmMdf::loadMdf(void) CMDF_BootLoaderInfo* pboot = m_mdf.getBootLoaderObj(); if (nullptr != pboot) { str = QString("Algorithm: %1").arg(pboot->getAlgorithm()); - pItem = new QTreeWidgetItem(pItemBoot, 0); + pItem = new QMdfTreeWidgetItem(pItemBoot, mdf_type_generic_number); pItem->setText(0, str); pItemBoot->addChild(pItem); str = QString("Block Size: %1").arg(pboot->getBlockSize()); - pItem = new QTreeWidgetItem(pItemBoot, 0); + pItem = new QMdfTreeWidgetItem(pItemBoot, mdf_type_generic_number); pItem->setText(0, str); pItemBoot->addChild(pItem); str = QString("Block Count: %1").arg(pboot->getBlockCount()); - pItem = new QTreeWidgetItem(pItemBoot, 0); + pItem = new QMdfTreeWidgetItem(pItemBoot, mdf_type_generic_number); pItem->setText(0, str); pItemBoot->addChild(pItem); } @@ -834,7 +1088,7 @@ CFrmMdf::loadMdf(void) // * * * Files * * * - QTreeWidgetItem* pItemFiles = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemFiles = new QMdfTreeWidgetItem(pItemModule, mdf_type_file); pItemFiles->setFont(0, fontTopItem); pItemFiles->setForeground(0, greenBrush); pItemFiles->setText(0, tr("Files")); @@ -844,7 +1098,7 @@ CFrmMdf::loadMdf(void) if (m_mdf.getManualCount()) { - QTreeWidgetItem* pItemManual = new QTreeWidgetItem(pItemFiles, 1); + QMdfTreeWidgetItem* pItemManual = new QMdfTreeWidgetItem(pItemFiles, mdf_type_manual); pItemManual->setFont(0, fontTopItem); // pItemManual->setForeground(0, greenBrush); pItemManual->setText(0, tr("Manuals")); @@ -856,28 +1110,28 @@ CFrmMdf::loadMdf(void) do { pManualObj = m_mdf.getManualObj(index); if (nullptr != pManualObj) { - QTreeWidgetItem* pItem = new QTreeWidgetItem(pItemManual, 1); - str = QString("Manual %1 - %2").arg(index).arg(pManualObj->getName().c_str()); + QMdfTreeWidgetItem* pItem = new QMdfTreeWidgetItem(pItemManual, mdf_type_manual_item); + str = QString("Manual %1 - %2").arg(index).arg(pManualObj->getName().c_str()); pItem->setText(0, str); pItemManual->addChild(pItem); - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Name: %1").arg(pManualObj->getName().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_url); if (nullptr != pSubItem) { str = QString("URL: ") + pManualObj->getUrl().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Format: ") + pManualObj->getFormat().c_str(); pSubItem->setText(0, str); @@ -897,7 +1151,7 @@ CFrmMdf::loadMdf(void) if (m_mdf.getPictureCount()) { - QTreeWidgetItem* pItemPicture = new QTreeWidgetItem(pItemFiles, 1); + QMdfTreeWidgetItem* pItemPicture = new QMdfTreeWidgetItem(pItemFiles, mdf_type_picture); pItemPicture->setFont(0, fontTopItem); // pItemPicture->setForeground(0, greenBrush); pItemPicture->setText(0, tr("Pictures")); @@ -909,28 +1163,28 @@ CFrmMdf::loadMdf(void) do { pPictureObj = m_mdf.getPictureObj(index); if (nullptr != pPictureObj) { - QTreeWidgetItem* pItem = new QTreeWidgetItem(pItemPicture, 1); - str = QString("Picture %1 - ").arg(index) + pPictureObj->getName().c_str(); + QMdfTreeWidgetItem* pItem = new QMdfTreeWidgetItem(pItemPicture, mdf_type_picture_item); + str = QString("Picture %1 - ").arg(index) + pPictureObj->getName().c_str(); pItem->setText(0, str); pItemPicture->addChild(pItem); - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Name: ") + pPictureObj->getName().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_url); if (nullptr != pSubItem) { str = QString("URL: ") + pPictureObj->getUrl().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Format: ") + pPictureObj->getFormat().c_str(); pSubItem->setText(0, str); @@ -950,7 +1204,7 @@ CFrmMdf::loadMdf(void) if (m_mdf.getVideoCount()) { - QTreeWidgetItem* pItemVideo = new QTreeWidgetItem(pItemFiles, 1); + QMdfTreeWidgetItem* pItemVideo = new QMdfTreeWidgetItem(pItemFiles, mdf_type_video); pItemVideo->setFont(0, fontTopItem); // pItemVideo->setForeground(0, greenBrush); pItemVideo->setText(0, tr("Videos")); @@ -962,28 +1216,28 @@ CFrmMdf::loadMdf(void) do { pVideoObj = m_mdf.getVideoObj(index); if (nullptr != pVideoObj) { - QTreeWidgetItem* pItem = new QTreeWidgetItem(pItemVideo, 1); - str = QString("Video %1 - ").arg(index) + pVideoObj->getName().c_str(); + QMdfTreeWidgetItem* pItem = new QMdfTreeWidgetItem(pItemVideo, mdf_type_video_item); + str = QString("Video %1 - ").arg(index) + pVideoObj->getName().c_str(); pItem->setText(0, str); pItemVideo->addChild(pItem); - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Name: ") + pVideoObj->getName().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_url); if (nullptr != pSubItem) { str = QString("URL: ") + pVideoObj->getUrl().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Format: ") + pVideoObj->getFormat().c_str(); pSubItem->setText(0, str); @@ -1003,7 +1257,7 @@ CFrmMdf::loadMdf(void) if (m_mdf.getFirmwareCount()) { - QTreeWidgetItem* pItemFirmware = new QTreeWidgetItem(pItemFiles, 1); + QMdfTreeWidgetItem* pItemFirmware = new QMdfTreeWidgetItem(pItemFiles, mdf_type_firmware); pItemFirmware->setFont(0, fontTopItem); // pItemFirmware->setForeground(0, greenBrush); pItemFirmware->setText(0, tr("Firmware")); @@ -1015,70 +1269,70 @@ CFrmMdf::loadMdf(void) do { pFirmwareObj = m_mdf.getFirmwareObj(index); if (nullptr != pFirmwareObj) { - QTreeWidgetItem* pItem = new QTreeWidgetItem(pItemFirmware, 1); - str = QString("Firmware %1 - %2 %3").arg(index).arg(pFirmwareObj->getDate().c_str()).arg(pFirmwareObj->getName().c_str()); + QMdfTreeWidgetItem* pItem = new QMdfTreeWidgetItem(pItemFirmware, mdf_type_firmware_item); + str = QString("Firmware %1 - %2 %3").arg(index).arg(pFirmwareObj->getDate().c_str()).arg(pFirmwareObj->getName().c_str()); pItem->setText(0, str); pItemFirmware->addChild(pItem); - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Name: %1").arg(pFirmwareObj->getName().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Version: %1.%2.%3").arg(pFirmwareObj->getVersionMajor()).arg(pFirmwareObj->getVersionMinor()).arg(pFirmwareObj->getVersionPatch()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_url); if (nullptr != pSubItem) { str = QString("URL: %s").arg(pFirmwareObj->getUrl().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_date); if (nullptr != pSubItem) { str = QString("Date: %1").arg(pFirmwareObj->getDate().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_number); if (nullptr != pSubItem) { str = QString("Target Code: %1").arg(pFirmwareObj->getTargetCode()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Target: %1").arg(pFirmwareObj->getTarget().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Format: %1").arg(pFirmwareObj->getFormat().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_number); if (nullptr != pSubItem) { str = QString("Size: %1").arg(pFirmwareObj->getSize()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("MD5 Checksum: %1").arg(pFirmwareObj->getMd5().c_str()); pSubItem->setText(0, str); @@ -1098,7 +1352,7 @@ CFrmMdf::loadMdf(void) if (m_mdf.getDriverCount()) { - QTreeWidgetItem* pItemDriver = new QTreeWidgetItem(pItemFiles, 1); + QMdfTreeWidgetItem* pItemDriver = new QMdfTreeWidgetItem(pItemFiles, mdf_type_driver); pItemDriver->setFont(0, fontTopItem); // pItemDriver->setForeground(0, greenBrush); pItemDriver->setText(0, tr("Drivers")); @@ -1110,70 +1364,70 @@ CFrmMdf::loadMdf(void) do { pDriverObj = m_mdf.getDriverObj(index); if (nullptr != pDriverObj) { - QTreeWidgetItem* pItem = new QTreeWidgetItem(pItemDriver, 1); - str = QString("Driver %1 - %2 %3").arg(index).arg(pDriverObj->getName().c_str()).arg(pDriverObj->getDate().c_str()); + QMdfTreeWidgetItem* pItem = new QMdfTreeWidgetItem(pItemDriver, mdf_type_driver_item); + str = QString("Driver %1 - %2 %3").arg(index).arg(pDriverObj->getName().c_str()).arg(pDriverObj->getDate().c_str()); pItem->setText(0, str); pItemDriver->addChild(pItem); - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Name: %1").arg(pDriverObj->getName().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Version: %1.%2.%3").arg(pDriverObj->getVersionMajor()).arg(pDriverObj->getVersionMinor()).arg(pDriverObj->getVersionPatch()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_date); if (nullptr != pSubItem) { str = QString("Date: ") + pDriverObj->getDate().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_url); if (nullptr != pSubItem) { str = QString("URL: ") + pDriverObj->getUrl().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Type: ") + pDriverObj->getType().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Architecture: ") + pDriverObj->getFormat().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("OS: ") + pDriverObj->getOS().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("OS Version: ") + pDriverObj->getOSVer().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("MD5 Checksum: ") + pDriverObj->getMd5().c_str(); pSubItem->setText(0, str); @@ -1193,7 +1447,7 @@ CFrmMdf::loadMdf(void) if (m_mdf.getSetupCount()) { - QTreeWidgetItem* pItemSetup = new QTreeWidgetItem(pItemFiles, 1); + QMdfTreeWidgetItem* pItemSetup = new QMdfTreeWidgetItem(pItemFiles, mdf_type_setup); pItemSetup->setFont(0, fontTopItem); // pItemSetup->setForeground(0, greenBrush); pItemSetup->setText(0, tr("Setup scripts")); @@ -1205,28 +1459,28 @@ CFrmMdf::loadMdf(void) do { pSetupObj = m_mdf.getSetupObj(index); if (nullptr != pSetupObj) { - QTreeWidgetItem* pItem = new QTreeWidgetItem(pItemSetup, 1); - str = QString("Script %1 - %2").arg(index).arg(pSetupObj->getName().c_str()); + QMdfTreeWidgetItem* pItem = new QMdfTreeWidgetItem(pItemSetup, mdf_type_setup_item); + str = QString("Script %1 - %2").arg(index).arg(pSetupObj->getName().c_str()); pItem->setText(0, str); pItemSetup->addChild(pItem); - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Name: %1").arg(pSetupObj->getName().c_str()); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_url); if (nullptr != pSubItem) { str = QString("URL: ") + pSetupObj->getUrl().c_str(); pSubItem->setText(0, str); pItem->addChild(pSubItem); } - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_generic_string); if (nullptr != pSubItem) { str = QString("Format: ") + pSetupObj->getFormat().c_str(); pSubItem->setFont(0, fontTopItem); @@ -1248,9 +1502,9 @@ CFrmMdf::loadMdf(void) uint32_t nPages; std::set pages; - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - QTreeWidgetItem* pItemRegister = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemRegister = new QMdfTreeWidgetItem(pItemModule, mdf_type_register); pItemRegister->setFont(0, fontTopItem); pItemRegister->setForeground(0, greenBrush); pItemRegister->setText(0, tr("Registers")); @@ -1264,7 +1518,7 @@ CFrmMdf::loadMdf(void) if (nPages > 1) { for (auto itr : pages) { - pItem = new QTreeWidgetItem(pItemRegister, 1); + pItem = new QMdfTreeWidgetItem(pItemRegister, mdf_type_register_page); if (nullptr != pItem) { str = QString("Register page: %1").arg(itr); @@ -1274,7 +1528,7 @@ CFrmMdf::loadMdf(void) // Add registers for page for (auto it = regs->cbegin(); it != regs->cend(); ++it) { if (itr == (*it)->getPage()) { - pSubItem = new QTreeWidgetItem(pItem, 1); + pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_register_item); if (nullptr != pSubItem) { str = QString("Register %1 %2").arg((*it)->getOffset()).arg((*it)->getName().c_str()); pSubItem->setText(0, str); @@ -1295,7 +1549,7 @@ CFrmMdf::loadMdf(void) // * * * Remote variables * * * - QTreeWidgetItem* pItemRemoteVar = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemRemoteVar = new QMdfTreeWidgetItem(pItemModule, mdf_type_remotevar); pItemRemoteVar->setFont(0, fontTopItem); pItemRemoteVar->setForeground(0, greenBrush); pItemRemoteVar->setText(0, tr("Remote Variables")); @@ -1305,66 +1559,66 @@ CFrmMdf::loadMdf(void) if (nullptr != pRemoteVarList) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; for (int i = 0; i < pRemoteVarList->size(); i++) { CMDF_RemoteVariable* pvar = (*pRemoteVarList)[i]; - pSubItem = new QTreeWidgetItem(pItemRemoteVar, 1); + pSubItem = new QMdfTreeWidgetItem(pItemRemoteVar, mdf_type_remotevar_item); if (nullptr != pSubItem) { str = QString("Remote variable: %1 -- %2").arg(i).arg(pvar->getName().c_str()); pSubItem->setText(0, str); pItemRemoteVar->addChild(pSubItem); - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Name: %1").arg(pvar->getName().c_str()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Type: %1 (%2)").arg(pvar->getType()).arg(pvar->getTypeString().c_str()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Byte count: %1").arg(pvar->getTypeByteCount()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Default: %1").arg(pvar->getDefault().c_str()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Offset: %1").arg(pvar->getOffset()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Page: %1").arg(pvar->getPage()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Bit position: %1").arg(pvar->getBitPos()); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_access); if (nullptr != pItem) { str = QString("Access: %1 (").arg(pvar->getAccess()); if (2 & pvar->getAccess()) { @@ -1379,14 +1633,14 @@ CFrmMdf::loadMdf(void) pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Foreground color: 0x%1").arg(pvar->getForegroundColor(), 1, 16); pItem->setText(0, str); pSubItem->addChild(pItem); } - pItem = new QTreeWidgetItem(pSubItem, 1); + pItem = new QMdfTreeWidgetItem(pSubItem, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Background color: 0x%1").arg(pvar->getBackgroundColor(), 1, 16); pItem->setText(0, str); @@ -1410,7 +1664,7 @@ CFrmMdf::loadMdf(void) // * * * Alarm * * * - QTreeWidgetItem* pItemAlarm = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemAlarm = new QMdfTreeWidgetItem(pItemModule, mdf_type_alarm); pItemAlarm->setFont(0, fontTopItem); pItemAlarm->setForeground(0, greenBrush); pItemAlarm->setText(0, tr("Alarm")); @@ -1423,7 +1677,7 @@ CFrmMdf::loadMdf(void) // * * * Decision Matrix * * * - QTreeWidgetItem* pItemDM = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemDM = new QMdfTreeWidgetItem(pItemModule, mdf_type_decision_matrix); pItemDM->setFont(0, fontTopItem); pItemDM->setForeground(0, greenBrush); pItemDM->setText(0, tr("Decision Matrix")); @@ -1432,35 +1686,35 @@ CFrmMdf::loadMdf(void) CMDF_DecisionMatrix* pdm = m_mdf.getDM(); if (nullptr != pdm) { - pItem = new QTreeWidgetItem(pItemDM, 1); + 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); } - pItem = new QTreeWidgetItem(pItemDM, 1); + 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); } - pItem = new QTreeWidgetItem(pItemDM, 1); + 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); } - pItem = new QTreeWidgetItem(pItemDM, 1); + 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); } - pItem = new QTreeWidgetItem(pItemDM, 1); + pItem = new QMdfTreeWidgetItem(pItemDM, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Row size: %1 bytes").arg(pdm->getRowSize()); pItem->setText(0, str); @@ -1472,9 +1726,9 @@ CFrmMdf::loadMdf(void) if (nullptr != pActionList) { QString str; - QTreeWidgetItem* pSubItem; + QMdfTreeWidgetItem* pSubItem; - QTreeWidgetItem* pItemAction = new QTreeWidgetItem(pItemDM, 1); + QMdfTreeWidgetItem* pItemAction = new QMdfTreeWidgetItem(pItemDM, mdf_type_action); if (nullptr != pItemAction) { str = QString("Actions").arg(pdm->getRowSize()); pItemAction->setText(0, str); @@ -1483,8 +1737,8 @@ CFrmMdf::loadMdf(void) for (int i = 0; i < pActionList->size(); i++) { - CMDF_Action* paction = (*pActionList)[i]; - QTreeWidgetItem* pSubItemAction = new QTreeWidgetItem(pItemAction, 1); + CMDF_Action* paction = (*pActionList)[i]; + QMdfTreeWidgetItem* pSubItemAction = new QMdfTreeWidgetItem(pItemAction, mdf_type_action_item); if (nullptr != pSubItemAction) { @@ -1492,14 +1746,14 @@ CFrmMdf::loadMdf(void) pSubItemAction->setText(0, str); pItemAction->addChild(pSubItemAction); - pItem = new QTreeWidgetItem(pSubItemAction, 1); + 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 QTreeWidgetItem(pSubItemAction, 1); + pItem = new QMdfTreeWidgetItem(pSubItemAction, mdf_type_generic_string); if (nullptr != pItem) { str = QString("Name: %1").arg(paction->getName().c_str()); pItem->setText(0, str); @@ -1509,8 +1763,8 @@ CFrmMdf::loadMdf(void) std::deque* pActionParamList = paction->getListActionParameter(); if (nullptr != pActionParamList) { - QTreeWidgetItem* pActionParamItem = new QTreeWidgetItem(pSubItemAction, 1); - str = QString("Action Parameters"); + QMdfTreeWidgetItem* pActionParamItem = new QMdfTreeWidgetItem(pSubItemAction, mdf_type_generic_number); + str = QString("Action Parameters"); pActionParamItem->setText(0, str); pSubItemAction->addChild(pActionParamItem); @@ -1521,28 +1775,28 @@ CFrmMdf::loadMdf(void) QString str; - pItem = new QTreeWidgetItem(pActionParamItem, 1); + 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 QTreeWidgetItem(pActionParamItem, 1); + 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 QTreeWidgetItem(pActionParamItem, 1); + 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 QTreeWidgetItem(pActionParamItem, 1); + pItem = new QMdfTreeWidgetItem(pActionParamItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Max: %1").arg(pactionparam->getMax()); pItem->setText(0, str); @@ -1574,7 +1828,7 @@ CFrmMdf::loadMdf(void) // * * * Events * * * - QTreeWidgetItem* pItemEvent = new QTreeWidgetItem(pItemModule, 1); + QMdfTreeWidgetItem* pItemEvent = new QMdfTreeWidgetItem(pItemModule, mdf_type_event); pItemEvent->setFont(0, fontTopItem); pItemEvent->setForeground(0, greenBrush); pItemEvent->setText(0, tr("Events")); @@ -1585,47 +1839,47 @@ CFrmMdf::loadMdf(void) if (nullptr != pEventList) { QString str; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pItem; for (int i = 0; i < pEventList->size(); i++) { CMDF_Event* pevent = (*pEventList)[i]; - pSubItem = new QTreeWidgetItem(pItemEvent, 1); + 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 QTreeWidgetItem(pSubItem, 1); + 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 QTreeWidgetItem(pSubItem, 1); + 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 QTreeWidgetItem(pSubItem, 1); + 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 QTreeWidgetItem(pSubItem, 1); + 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 QTreeWidgetItem(pSubItem, 1); + 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); @@ -1633,7 +1887,7 @@ CFrmMdf::loadMdf(void) } // Event Data - QTreeWidgetItem* pItemEventData = new QTreeWidgetItem(pSubItem, 1); + QMdfTreeWidgetItem* pItemEventData = new QMdfTreeWidgetItem(pSubItem, mdf_type_event_data); // pItemEvent->setFont(0, fontTopItem); // pItemEvent->setForeground(0, greenBrush); pItemEventData->setText(0, tr("Event data")); @@ -1643,14 +1897,14 @@ CFrmMdf::loadMdf(void) if (nullptr != pEventDataList) { QString str; - QTreeWidgetItem* pEventSubItem; - QTreeWidgetItem* pItem; + QMdfTreeWidgetItem* pEventSubItem; + QMdfTreeWidgetItem* pItem; for (int j = 0; j < pEventDataList->size(); j++) { CMDF_EventData* pEventData = (*pEventDataList)[j]; - pEventSubItem = new QTreeWidgetItem(pItemEventData, 1); + pEventSubItem = new QMdfTreeWidgetItem(pItemEventData, mdf_type_event_data_item); if (nullptr != pEventSubItem) { // Event data @@ -1658,14 +1912,14 @@ CFrmMdf::loadMdf(void) pEventSubItem->setText(0, str); pItemEventData->addChild(pEventSubItem); - pItem = new QTreeWidgetItem(pEventSubItem, 1); + 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 QTreeWidgetItem(pEventSubItem, 1); + pItem = new QMdfTreeWidgetItem(pEventSubItem, mdf_type_generic_number); if (nullptr != pItem) { str = QString("Offset: %1").arg(pEventData->getOffset()); pItem->setText(0, str); @@ -1699,7 +1953,7 @@ CFrmMdf::loadMdf(void) } // Recipes - // QTreeWidgetItem *pItemRecipes = new QTreeWidgetItem(pItemModule, 1); + // QMdfTreeWidgetItem *pItemRecipes = new QMdfTreeWidgetItem(pItemModule, 1); // pItemRecipes->setFont(0, fontTopItem); // pItemRecipes->setForeground(0, blueBrush); // pItemRecipes->setText(0, tr("Events")); @@ -1707,7 +1961,7 @@ CFrmMdf::loadMdf(void) // ui->btnScan->setEnabled(false); // CFoundNodeWidgetItem *pItem; - // QTreeWidgetItemIterator it(ui->treeFound); + // QMdfTreeWidgetItemIterator it(ui->treeFound); // while (*it) { // pItem = (CFoundNodeWidgetItem *)(*it); // doLoadMdf(pItem->m_nodeid); @@ -1725,7 +1979,7 @@ CFrmMdf::loadMdf(void) // // void -// CFrmMdf::onFindNodesTreeWidgetItemClicked(QTreeWidgetItem* item, int column) +// CFrmMdf::onFindNodesTreeWidgetItemClicked(QMdfTreeWidgetItem* item, int column) //{ // CFoundNodeWidgetItem *pItem = (CFoundNodeWidgetItem *)item; // if (nullptr == pItem) { @@ -1742,3 +1996,257 @@ CFrmMdf::loadMdf(void) // ui->infoArea->setText(tr("MDF info should be loaded before device info can be viewed")); // } //} + +/////////////////////////////////////////////////////////////////////////////// +// onItemClicked +// + +void +CFrmMdf::onItemClicked(QTreeWidgetItem* item, int column) +{ + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)item; + if (nullptr == pItem) { + return; + } + + QMessageBox msgBox; + msgBox.setText("Item has been Clicked."); + msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Save); + // int ret = msgBox.exec(); + if (nullptr != pItem->getObject()) { + // ui->statusbar->showMessage(/*pItem->text(0)*/pItem->getObject()->getObjectTypeString().c_str(), 5000); + ui->statusbar->showMessage("object", 1000); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// onItemDoubleClicked +// + +void +CFrmMdf::onItemDoubleClicked(QTreeWidgetItem* item, int column) +{ + QString str; + QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)item; + if (nullptr == pItem) { + return; + } + + // QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem(); + + switch (pItem->getObjectType()) { + case mdf_type_unknown: + str = tr("Unknown"); + break; + + case mdf_type_redirection: + str = tr("redirection"); + break; + + case mdf_type_mdf: + str = tr("MDF"); + + break; + + case mdf_type_value: + str = tr("Value"); + break; + + case mdf_type_bit: + str = tr("Bit"); + break; + + case mdf_type_bit_item: + str = tr("Bit item"); + break; + + case mdf_type_register_page: + str = tr("Register Page"); + break; + + case mdf_type_register: + str = tr("Register"); + break; + + case mdf_type_register_item: + str = tr("Register item"); + break; + + case mdf_type_remotevar: + str = tr("Remote Variable"); + break; + + case mdf_type_remotevar_item: + str = tr("Remote Variable Item"); + break; + + case mdf_type_action_param: + str = tr("Action Param"); + break; + + case mdf_type_action: + str = tr("Action"); + break; + + case mdf_type_action_item: + str = tr("Action item"); + break; + + case mdf_type_decision_matrix: + str = tr("DM"); + break; + + case mdf_type_event_data: + str = tr("Event Data"); + break; + + case mdf_type_event_data_item: + str = tr("Event Data item"); + break; + + case mdf_type_event: + str = tr("Event"); + break; + + case mdf_type_event_item: + str = tr("Event item"); + break; + + case mdf_type_value_item: + str = tr("Value Item"); + break; + + case mdf_type_bootloader: + str = tr("Bootloader"); + break; + + case mdf_type_alarm: + str = tr("Alarm"); + break; + + case mdf_type_address: + str = tr("Address"); + break; + + case mdf_type_manufacturer: + str = tr("Manufacturer"); + break; + + case mdf_type_file: + str = tr("File"); + break; + + case mdf_type_picture: + str = tr("Picture"); + break; + + case mdf_type_picture_item: + str = tr("Picture item"); + break; + + case mdf_type_video: + str = tr("Video"); + break; + + case mdf_type_video_item: + str = tr("Video item"); + break; + + case mdf_type_firmware: + str = tr("Firmware"); + break; + + case mdf_type_firmware_item: + str = tr("Firmware item"); + break; + + case mdf_type_driver: + str = tr("Driver"); + break; + + case mdf_type_driver_item: + str = tr("Driver"); + break; + + case mdf_type_setup: + str = tr("Setup"); + break; + + case mdf_type_setup_item: + str = tr("Setup"); + break; + + case mdf_type_manual: + str = tr("Manual"); + break; + + case mdf_type_manual_item: + str = tr("Manual item"); + break; + + case mdf_type_email: + str = tr("email"); + break; + + case mdf_type_phone: + str = tr("phone"); + break; + + case mdf_type_fax: + str = tr("fax"); + break; + + case mdf_type_web: + str = tr("web"); + break; + + case mdf_type_social: + str = tr("social"); + break; + + case mdf_type_generic_string: + str = tr("string"); + break; + + case mdf_type_generic_number: + str = tr("number"); + break; + + case mdf_type_generic_url: + str = tr("url"); + break; + + case mdf_type_generic_date: + str = tr("date"); + break; + + case mdf_type_generic_access: + str = tr("access"); + break; + + case mdf_type_generic_description: + str = tr("description"); + break; + + case mdf_type_generic_description_item: + str = tr("description item"); + break; + + case mdf_type_generic_help_url: + str = tr("help url"); + break; + + case mdf_type_generic_help_url_item: + str = tr("help url item"); + break; + + default: + str = tr("Default"); + break; + } + + QMessageBox msgBox; + msgBox.setText(str); + msgBox.exec(); +} \ No newline at end of file diff --git a/src/cfrmmdf.h b/src/cfrmmdf.h index 6bbf491c..dcba276c 100644 --- a/src/cfrmmdf.h +++ b/src/cfrmmdf.h @@ -75,10 +75,79 @@ class CFrmMdf; // ---------------------------------------------------------------------------- +/*! + Class that represent a row in the TX list +*/ +class QMdfTreeWidgetItem : public QTreeWidgetItem +{ + + public: + + QMdfTreeWidgetItem(const QString& text); + QMdfTreeWidgetItem(mdf_record_type objtype); + QMdfTreeWidgetItem(CMDF_Object *pobj, mdf_record_type objtype); + QMdfTreeWidgetItem(QTreeWidgetItem* parent, mdf_record_type objtype); + QMdfTreeWidgetItem(QTreeWidgetItem* parent, CMDF_Object *pobj, mdf_record_type objtype); + virtual ~QMdfTreeWidgetItem(); + + /*! + Get MDF object type + @return Return MDF object type + */ + mdf_record_type getObjectType(void) { return m_objType; /*(type() - QTreeWidgetItem::UserType);*/ }; + + /*! + Set MDF object type + @param type MDF object type + */ + void setObjectType(mdf_record_type objtype) { m_objType = objtype;}; + + /*! + Get index for element + @return Return element index + */ + uint16_t getElementIndex(void) { return m_fieldIndex; }; + + /*! + Set index for element + @param idx Element index used or direct editing + */ + void setElementIndex(uint16_t idx) { m_fieldIndex = idx;}; + + /*! + Get MDF object + @return Return pointer to MDF object + */ + CMDF_Object *getObject(void) { return m_pMdfRecord; }; + + /*! + Set pointer to MDF object + @param pobj Pointer to MDF object + */ + void setObject(CMDF_Object *pobj) { m_pMdfRecord = pobj;}; + + private: + + /*! + This is the index for fields of a record. + */ + uint16_t m_fieldIndex; + + /*! + Pointer to MDF record + */ + CMDF_Object *m_pMdfRecord; + + /*! + Pointer to MDF record + */ + mdf_record_type m_objType; +}; + // ---------------------------------------------------------------------------- /*! - The session window + The session window */ class CFrmMdf : public QMainWindow { @@ -104,6 +173,12 @@ public slots: /// Show find nodes context menu void showMdfContextMenu(const QPoint& pos); + /// Item has been clicked + void onItemClicked(QTreeWidgetItem *item, int column); + + /// Item has been double clicked + void onItemDoubleClicked(QTreeWidgetItem *item, int column); + /*! Fill in data from info map as children to parent item @@ -165,6 +240,9 @@ public slots: // Object that holds mdf definition in parsed form CMDF m_mdf; + + // The statusbar + QStatusBar *m_bar; }; #endif // CFrmMdf_H diff --git a/src/cfrmnodeconfig.cpp b/src/cfrmnodeconfig.cpp index 73329df9..360a59b5 100644 --- a/src/cfrmnodeconfig.cpp +++ b/src/cfrmnodeconfig.cpp @@ -5002,7 +5002,7 @@ CFrmNodeConfig::onMdfFileTreeWidgetItemDoubleClicked(QTreeWidgetItem* item, int { vscpworks* pworks = (vscpworks*)QCoreApplication::instance(); CMdfFileWidgetItem* pitem = (CMdfFileWidgetItem*)item; - if (nullptr == item) { + if (nullptr != item) { spdlog::critical("Doubleclick: MDF file item is NULL {0}", pitem->text(0).toStdString()); ui->infoArea->setHtml(tr("Doubleclick: MDF file item is NULL")); return; @@ -5415,7 +5415,7 @@ CFrmNodeConfig::fillMdfFileHtmlInfo(QTreeWidgetItem *item, int column) std::string html; std::string str; CMdfFileWidgetItem* pitem = (CMdfFileWidgetItem*)item; - if (nullptr == item) { + if (nullptr != item) { spdlog::critical("MDF file item is NULL {0}", pitem->text(0).toStdString()); ui->infoArea->setHtml(tr("MDF file item is NULL")); return;