diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46bfd3bd..a57b9ede 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,12 +237,10 @@ qt5_wrap_ui(UI src/mainwindow.ui
src/cdlgactionparam.ui
srd/cdlgdatepicker.ui
src/cfrmmdf.ui
- src/cdlgmdfmodule.ui
- src/cdlgmdfbitlist.ui
+ src/cdlgmdfmodule.ui
src/cdlgmdfdm.ui
src/cdlgmdffilepicture.ui
src/cdlgmdfmodule.ui
- src/cdlgmdfbit.ui
src/cdlgmdfevent.ui
src/cdlgmdffilesetup.ui
src/cdlgmdfregister.ui
@@ -260,6 +258,21 @@ qt5_wrap_ui(UI src/mainwindow.ui
src/cdlgmdfmanufacturer.ui
src/cdlgmdfcontact.ui
src/cdlgmdfcontactlist.ui
+
+ src/cdlgmdfregister.ui
+ src/cdlgmdfregisterlist.ui
+ src/cdlgmdfregisterbitlist.ui
+ src/cdlgmdfregisterbit.ui
+ src/cdlgmdfregistervaluelist.ui
+ src/cdlgmdfregistervalue.ui
+
+ src/cdlgmdfregistermapping.ui
+
+ src/cdlgmdfremotevar.ui
+ src/cdlgmdfremotevarbitlist.ui
+ src/cdlgmdfremotevarbit.ui
+ src/cdlgmdfremotevarvaluelist.ui
+ src/cdlgmdfremotevarvalue.ui
)
add_executable(${PROJECT_NAME}
@@ -560,6 +573,16 @@ add_executable(${PROJECT_NAME}
src/cdlgmdffile.cpp
src/cdlgmdffile.h
+ build/ui_cdlgmdfregister.h
+ src/cdlgmdfregister.ui
+ src/cdlgmdfregister.cpp
+ src/cdlgmdfregister.h
+
+ build/ui_cdlgmdfregisterlist.h
+ src/cdlgmdfregisterlist.ui
+ src/cdlgmdfregisterlist.cpp
+ src/cdlgmdfregisterlist.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/mdf/beijing_2.xml b/mdf/beijing_2.xml
index b2062df9..953a63a9 100644
--- a/mdf/beijing_2.xml
+++ b/mdf/beijing_2.xml
@@ -882,13 +882,13 @@
Reserved
-
-
+
+
Enable channel
Set this bit to make the output controllable.
-
+
diff --git a/src/cdlgmdfbitlist.ui b/src/cdlgmdfbitlist.ui
deleted file mode 100644
index 4b1a34e4..00000000
--- a/src/cdlgmdfbitlist.ui
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
- CDlgMdfBitList
-
-
-
- 0
- 0
- 597
- 300
-
-
-
- Dialog
-
-
-
-
- 0
- 260
- 591
- 32
-
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
-
-
- false
-
-
-
-
-
- 9
- 10
- 581
- 241
-
-
-
- -
-
-
-
- 1
-
-
-
-
- -
-
-
- QLayout::SetDefaultConstraint
-
-
-
-
-
- Add item
-
-
-
- -
-
-
- Delete Item
-
-
-
- -
-
-
- Clone item
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/cdlgmdffiledriver.cpp b/src/cdlgmdffiledriver.cpp
index 91481c69..3ff00c52 100644
--- a/src/cdlgmdffiledriver.cpp
+++ b/src/cdlgmdffiledriver.cpp
@@ -60,8 +60,6 @@ CDlgMdfFileDriver::CDlgMdfFileDriver(QWidget* parent)
vscpworks* pworks = (vscpworks*)QCoreApplication::instance();
-
-
setInitialFocus();
}
@@ -98,44 +96,47 @@ CDlgMdfFileDriver::initDialogData(const CMDF_Object* pmdfobj, mdf_driver_index i
ui->editOsVersion->setText(m_pdriver->getOSVer().c_str());
ui->editVersion->setText(m_pdriver->getVersion().c_str());
- QDate dd = QDate::fromString(m_pdriver->getDate().c_str(),"YY-MM_DD");
- ui->date->setDate(dd);
-
+ QDate dd = QDate::fromString(m_pdriver->getDate().c_str(), "YY-MM_DD");
+ ui->date->setDate(dd);
switch (index) {
- case index_driver_name:
+ case index_file_driver_name:
ui->editName->setFocus();
break;
- case index_driver_url:
+ case index_file_driver_url:
ui->editUrl->setFocus();
break;
- case index_driver_type:
+ case index_file_driver_type:
ui->editType->setFocus();
- break;
+ break;
- case index_driver_os:
+ case index_file_driver_os:
ui->editOs->setFocus();
break;
- case index_driver_architecture:
+ case index_file_driver_architecture:
ui->editArchitecture->setFocus();
- break;
+ break;
- case index_driver_os_version:
+ case index_file_driver_os_version:
ui->editOsVersion->setFocus();
- break;
+ break;
- case index_driver_date:
+ case index_file_driver_date:
ui->date->setFocus();
- break;
+ break;
- case index_driver_version:
+ case index_file_driver_version:
ui->editVersion->setFocus();
+ break;
+
+ case index_file_driver_md5:
+ ui->editMd5->setFocus();
break;
- case index_driver_none:
+ case index_file_driver_none:
default:
ui->editName->setFocus();
break;
@@ -283,8 +284,8 @@ CDlgMdfFileDriver::getOsVersion(void)
void
CDlgMdfFileDriver::setDate(const QString& strdate)
{
- QDate dd = QDate::fromString(strdate,"YY-MM_DD");
- ui->date->setDate(dd);
+ QDate dd = QDate::fromString(strdate, "YY-MM_DD");
+ ui->date->setDate(dd);
}
///////////////////////////////////////////////////////////////////////////////
@@ -294,7 +295,7 @@ CDlgMdfFileDriver::setDate(const QString& strdate)
QString
CDlgMdfFileDriver::getDate(void)
{
- QDate dd = ui->date->date();
+ QDate dd = ui->date->date();
return dd.toString("YY-MM-DD");
}
@@ -328,16 +329,29 @@ CDlgMdfFileDriver::accept()
std::string str;
if (nullptr != m_pdriver) {
- /* str = ui->editBlockSize->text().toStdString();
- m_pbootinfo->setBlocksize(vscp_readStringValue(str));
+ str = ui->editName->text().toStdString();
+ m_pdriver->setName(str);
+
+ str = ui->editUrl->text().toStdString();
+ m_pdriver->setUrl(str);
+
+ str = ui->editType->text().toStdString();
+ m_pdriver->setType(str);
+
+ str = ui->editOs->text().toStdString();
+ m_pdriver->setOS(str);
+
+ str = ui->editArchitecture->text().toStdString();
+ m_pdriver->setArchitecture(str);
- str = ui->editBlockCount->text().toStdString();
- m_pbootinfo->setBlockCount(vscp_readStringValue(str));
+ str = ui->editOsVersion->text().toStdString();
+ m_pdriver->setVersion(str);
- // m_pbootinfo->setModuleLevel(ui->comboModuleLevel->currentIndex());
+ str = ui->editMd5->text().toStdString();
+ m_pdriver->setMd5(str);
- int idx = ui->comboBoxAlgorithm->currentIndex(); // ->text().toStdString();
- m_pbootinfo->setAlgorithm(idx); */
+ QDate dd = ui->date->date();
+ m_pdriver->setDate(dd.toString("YY-MM-DD").toStdString());
}
else {
spdlog::error("MDF module information - Invalid MDF object (accept)");
diff --git a/src/cdlgmdffiledriver.h b/src/cdlgmdffiledriver.h
index b4823402..0d4e84b2 100644
--- a/src/cdlgmdffiledriver.h
+++ b/src/cdlgmdffiledriver.h
@@ -38,16 +38,17 @@
// Use to set focus on edit and to write changed values
// in correct position among other things.
typedef enum mdf_driver_index {
- index_driver_none = 0,
- index_driver_name,
- index_driver_url,
- index_driver_type,
- index_driver_os,
- index_driver_architecture,
- index_driver_os_version,
- index_driver_date,
- index_driver_version,
-} mdf_driver_index;
+ index_file_driver_none = 0,
+ index_file_driver_name,
+ index_file_driver_url,
+ index_file_driver_type,
+ index_file_driver_os,
+ index_file_driver_architecture,
+ index_file_driver_os_version,
+ index_file_driver_date,
+ index_file_driver_version,
+ index_file_driver_md5,
+} mdf_file_driver_index;
// Tree prefixes (Text before value in tree table)
#define PREFIX_MDF_DRIVER_NAME tr("Name: ")
@@ -80,7 +81,7 @@ class CDlgMdfFileDriver : public QDialog {
@param index The index for the field that will get focus
*/
- void initDialogData(const CMDF_Object* pmdfobj, mdf_driver_index index = index_driver_none);
+ void initDialogData(const CMDF_Object* pmdfobj, mdf_driver_index index = index_file_driver_none);
// ----------------------------------------------------------------------------
diff --git a/src/cdlgmdffiledriver.ui b/src/cdlgmdffiledriver.ui
index a31eea89..30d997fe 100644
--- a/src/cdlgmdffiledriver.ui
+++ b/src/cdlgmdffiledriver.ui
@@ -7,7 +7,7 @@
0
0
604
- 304
+ 333
@@ -17,7 +17,7 @@
10
- 270
+ 300
581
32
@@ -38,109 +38,123 @@
9
9
581
- 251
+ 281
- -
+
-
Name
- -
+
-
name-of-driver
- -
+
-
URL
- -
+
-
https://www.somewhere.com/driver.zip
- -
+
-
Type
- -
+
-
+
+
+ -
OS
- -
+
-
- -
+
-
Architecture
- -
+
-
- -
+
-
OS Version
- -
+
-
10
- -
+
-
Date
- -
+
-
true
- -
+
-
Version
- -
+
-
0
- -
-
+
-
+
+
+ MD5
+
+
+
+ -
+
+
+ 1
+
+
diff --git a/src/cdlgmdffilefirmware.cpp b/src/cdlgmdffilefirmware.cpp
index a60cb99d..56b209d7 100644
--- a/src/cdlgmdffilefirmware.cpp
+++ b/src/cdlgmdffilefirmware.cpp
@@ -82,7 +82,7 @@ CDlgMdfFileFirmware::~CDlgMdfFileFirmware()
//
void
-CDlgMdfFileFirmware::initDialogData(const CMDF_Object* pmdfobj, mdf_firmware_index index)
+CDlgMdfFileFirmware::initDialogData(const CMDF_Object* pmdfobj, mdf_file_firmware_index index)
{
QString str;
@@ -94,6 +94,7 @@ CDlgMdfFileFirmware::initDialogData(const CMDF_Object* pmdfobj, mdf_firmware_ind
m_pfirmware = (CMDF_Firmware*)pmdfobj;
ui->editName->setText(m_pfirmware->getName().c_str());
+ ui->editTarget->setText(m_pfirmware->getTarget().c_str());
ui->editTargetCode->setText(QString::number(m_pfirmware->getTargetCode()));
ui->editUrl->setText(m_pfirmware->getUrl().c_str());
ui->editFormat->setText(m_pfirmware->getFormat().c_str());
@@ -106,35 +107,39 @@ CDlgMdfFileFirmware::initDialogData(const CMDF_Object* pmdfobj, mdf_firmware_ind
ui->editMd5->setText(m_pfirmware->getMd5().c_str());
switch (index) {
- case index_firmware_name:
+ case index_file_firmware_name:
ui->editName->setFocus();
break;
- case index_firmware_target_code:
+ case index_file_firmware_target_code:
ui->editTargetCode->setFocus();
break;
- case index_firmware_format:
+ case index_file_firmware_target:
+ ui->editTarget->setFocus();
+ break;
+
+ case index_file_firmware_format:
ui->editFormat->setFocus();
break;
- case index_firmware_date:
+ case index_file_firmware_date:
ui->date->setFocus();
break;
- case index_firmware_version:
+ case index_file_firmware_version:
ui->editVersion->setFocus();
break;
- case index_firmware_size:
+ case index_file_firmware_size:
ui->editSize->setFocus();
break;
- case index_firmware_md5:
+ case index_file_firmware_md5:
ui->editMd5->setFocus();
break;
- case index_firmware_none:
+ case index_file_firmware_none:
default:
ui->editName->setFocus();
break;
@@ -195,6 +200,26 @@ CDlgMdfFileFirmware::getTargetCode(void)
return vscp_readStringValue(ui->editTargetCode->text().toStdString());
}
+///////////////////////////////////////////////////////////////////////////////
+// setTarget
+//
+
+void
+CDlgMdfFileFirmware::setTarget(const QString& target)
+{
+ ui->editTarget->setText(target);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// getTarget
+//
+
+QString
+CDlgMdfFileFirmware::getTarget(void)
+{
+ return ui->editTarget->text();
+}
+
///////////////////////////////////////////////////////////////////////////////
// setUrl
//
@@ -349,13 +374,6 @@ CDlgMdfFileFirmware::accept()
str = ui->editMd5->text().toStdString();
m_pfirmware->setMd5(str);
- // str = ui->editBlockCount->text().toStdString();
- // m_pbootinfo->setBlockCount(vscp_readStringValue(str));
-
- // // m_pbootinfo->setModuleLevel(ui->comboModuleLevel->currentIndex());
-
- // int idx = ui->comboBoxAlgorithm->currentIndex(); // ->text().toStdString();
- // m_pbootinfo->setAlgorithm(idx);
}
else {
spdlog::error("MDF module information - Invalid MDF object (accept)");
diff --git a/src/cdlgmdffilefirmware.h b/src/cdlgmdffilefirmware.h
index 3a1f24e3..5d7e58e6 100644
--- a/src/cdlgmdffilefirmware.h
+++ b/src/cdlgmdffilefirmware.h
@@ -37,17 +37,18 @@
// Id for fields to identify them in the UI.
// Use to set focus on edit and to write changed values
// in correct position among other things.
-typedef enum mdf_firmware_index {
- index_firmware_none = 0,
- index_firmware_name,
- index_firmware_target_code,
- index_firmware_url,
- index_firmware_format,
- index_firmware_date,
- index_firmware_version,
- index_firmware_size,
- index_firmware_md5,
-} mdf_firmware_index;
+typedef enum mdf_file_firmware_index {
+ index_file_firmware_none = 0,
+ index_file_firmware_name,
+ index_file_firmware_target,
+ index_file_firmware_target_code,
+ index_file_firmware_url,
+ index_file_firmware_format,
+ index_file_firmware_date,
+ index_file_firmware_version,
+ index_file_firmware_size,
+ index_file_firmware_md5,
+} mdf_file_firmware_index;
// Tree prefixes (Text before value in tree table)
#define PREFIX_MDF_FIRMWARE_NAME tr("Name: ")
@@ -82,7 +83,7 @@ class CDlgMdfFileFirmware : public QDialog {
@param index The index for the field that will get focus
*/
- void initDialogData(const CMDF_Object* pmdfobj, mdf_firmware_index index = index_firmware_none);
+ void initDialogData(const CMDF_Object* pmdfobj, mdf_file_firmware_index index = index_file_firmware_none);
// ----------------------------------------------------------------------------
@@ -95,6 +96,12 @@ class CDlgMdfFileFirmware : public QDialog {
void setName(const QString& name);
QString getName(void);
+ /*!
+ Target getter/setters
+ */
+ void setTarget(const QString& url);
+ QString getTarget(void);
+
/*!
target code getter/setters
*/
diff --git a/src/cdlgmdffilefirmware.ui b/src/cdlgmdffilefirmware.ui
index bcea2872..e4e2eef5 100644
--- a/src/cdlgmdffilefirmware.ui
+++ b/src/cdlgmdffilefirmware.ui
@@ -7,7 +7,7 @@
0
0
597
- 292
+ 336
@@ -17,7 +17,7 @@
10
- 260
+ 300
581
32
@@ -38,7 +38,7 @@
9
9
581
- 251
+ 281
@@ -70,86 +70,100 @@
- -
+
-
URL
- -
+
-
1
- -
+
-
Format
- -
+
-
- -
+
-
Date
- -
+
-
true
- -
+
-
Version
- -
+
-
0
- -
+
-
Size
- -
+
-
1
- -
+
-
MD5
- -
+
-
1
+ -
+
+
+ 0
+
+
+
+ -
+
+
+ Target
+
+
+
diff --git a/src/cdlgmdffilemanual.cpp b/src/cdlgmdffilemanual.cpp
index 4b16fccd..b72acd0b 100644
--- a/src/cdlgmdffilemanual.cpp
+++ b/src/cdlgmdffilemanual.cpp
@@ -61,8 +61,7 @@ CDlgMdfFileManual::CDlgMdfFileManual(QWidget* parent)
vscpworks* pworks = (vscpworks*)QCoreApplication::instance();
// Fill combo with predefined bootloader algorithms (vscp.h)
- //ui->comboBoxAlgorithm->addItem("VSCP", VSCP_BOOTLOADER_VSCP); // VSCP boot loader algorithm
-
+ // ui->comboBoxAlgorithm->addItem("VSCP", VSCP_BOOTLOADER_VSCP); // VSCP boot loader algorithm
// QShortcut* shortcut = new QShortcut(QKeySequence(tr("Ctrl+E", "Edit")), ui->editDate);
// connect(shortcut, &QShortcut::activated, this, &CDlgMdfFileManual::editDesc);
@@ -102,8 +101,8 @@ CDlgMdfFileManual::initDialogData(const CMDF_Object* pmdfobj, mdf_file_manual_in
ui->editFormat->setText(m_pmanual->getFormat().c_str());
ui->editLanguage->setText(m_pmanual->getLanguage().c_str());
- QDate dd = QDate::fromString(m_pmanual->getDate().c_str(),"YY-MM_DD");
- ui->date->setDate(dd);
+ QDate dd = QDate::fromString(m_pmanual->getDate().c_str(), "YY-MM_DD");
+ ui->date->setDate(dd);
switch (index) {
case index_file_manual_url:
@@ -120,7 +119,7 @@ CDlgMdfFileManual::initDialogData(const CMDF_Object* pmdfobj, mdf_file_manual_in
case index_file_manual_language:
ui->editLanguage->setFocus();
- break;
+ break;
case index_file_manual_name:
default:
@@ -230,8 +229,8 @@ CDlgMdfFileManual::getLanguage(void)
void
CDlgMdfFileManual::setDate(const QString& strdate)
{
- QDate dd = QDate::fromString(strdate,"YY-MM_DD");
- ui->date->setDate(dd);
+ QDate dd = QDate::fromString(strdate, "YY-MM_DD");
+ ui->date->setDate(dd);
}
///////////////////////////////////////////////////////////////////////////////
@@ -241,7 +240,7 @@ CDlgMdfFileManual::setDate(const QString& strdate)
QString
CDlgMdfFileManual::getDate(void)
{
- QDate dd = ui->date->date();
+ QDate dd = ui->date->date();
return dd.toString("YY-MM-DD");
}
@@ -267,7 +266,7 @@ CDlgMdfFileManual::accept()
str = ui->editLanguage->text().toStdString();
m_pmanual->setLanguage(str);
- QDate dd = ui->date->date();
+ QDate dd = ui->date->date();
m_pmanual->setDate(dd.toString("YY-MM-DD").toStdString());
}
else {
diff --git a/src/cdlgmdfregister.cpp b/src/cdlgmdfregister.cpp
new file mode 100644
index 00000000..e745193d
--- /dev/null
+++ b/src/cdlgmdfregister.cpp
@@ -0,0 +1,465 @@
+// cdlgmdfregister.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 "cdlgmdfregister.h"
+#include "ui_cdlgmdfregister.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+const char CDlgMdfRegister::pre_str_register[] = "Register: ";
+
+///////////////////////////////////////////////////////////////////////////////
+// CTor
+//
+
+CDlgMdfRegister::CDlgMdfRegister(QWidget* parent)
+ : QDialog(parent)
+ , ui(new Ui::CDlgMdfRegister)
+{
+ ui->setupUi(this);
+
+ // m_type = mdf_type_unknown;
+ m_preg = nullptr;
+
+ vscpworks* pworks = (vscpworks*)QCoreApplication::instance();
+
+ setInitialFocus();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// DTor
+//
+
+CDlgMdfRegister::~CDlgMdfRegister()
+{
+ delete ui;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// initDialogData
+//
+
+void
+CDlgMdfRegister::initDialogData(CMDF* pmdf, CMDF_Register* preg, int index)
+{
+ QString str;
+
+ if (nullptr == pmdf) {
+ spdlog::error("MDF register information - Invalid MDF object (initDialogData)");
+ return;
+ }
+
+ m_pmdf = pmdf;
+
+ if (nullptr == preg) {
+ spdlog::error("MDF register information - Invalid MDF register object (initDialogData)");
+ return;
+ }
+
+ m_preg = preg;
+
+ // Connect set foreground color button
+ connect(ui->btnSetFgColor,
+ SIGNAL(clicked()),
+ this,
+ SLOT(showFgColorDlg()));
+
+ // Connect set background color button
+ connect(ui->btnSetBgColor,
+ SIGNAL(clicked()),
+ this,
+ SLOT(showBgColorDlg()));
+
+ // Connect set background color button
+ connect(ui->btnSetUndef,
+ SIGNAL(clicked()),
+ this,
+ SLOT(setUndef()));
+
+ setName(preg->getName().c_str());
+ setPage(preg->getPage());
+ setOffset(preg->getOffset());
+ setType(preg->getType());
+ setSpan(preg->getSpan());
+ setWidth(preg->getWidth());
+ setMin(preg->getMin());
+ setMax(preg->getMax());
+ setAccess(preg->getAccess());
+ uint8_t val;
+ bool bDefault = preg->getDefault(val);
+ str = preg->getDefault(val) ? QString("%1").arg(val) : "UNDEF";
+ setDefault(str);
+ setForegroundColor(preg->getForegroundColor());
+ setBackgroundColor(preg->getBackgroundColor());
+
+ std::set pages;
+ uint32_t cnt = pmdf->getPages(pages);
+ ui->comboPage->clear();
+ int pos = 0;
+ for (std::set::iterator it=pages.begin(); it!=pages.end(); ++it) {
+ ui->comboPage->addItem(QString("Page %1").arg(*it), *it);
+ if (preg->getPage() == *it) {
+ ui->comboPage->setCurrentIndex(pos);
+ }
+ pos++;
+ }
+
+
+ switch (index) {
+ case index_name:
+ ui->editName->setFocus();
+ break;
+
+ case index_page:
+ ui->comboPage->setFocus();
+ break;
+
+ case index_offset:
+ ui->editOffset->setFocus();
+ break;
+
+ case index_type:
+ ui->comboType->setFocus();
+ break;
+
+ case index_span:
+ ui->spinSpan->setFocus();
+ break;
+
+ case index_width:
+ ui->spinWidth->setFocus();
+ break;
+
+ case index_min:
+ ui->spinMin->setFocus();
+ break;
+
+ case index_max:
+ ui->spinMax->setFocus();
+ break;
+
+ case index_access:
+ ui->comboAccess->setFocus();
+ break;
+
+ case index_default:
+ ui->editDefault->setFocus();
+ break;
+
+ case index_fgcolor:
+ ui->editFgColor->setFocus();
+ break;
+
+ case index_bgcolor:
+ ui->editBgColor->setFocus();
+ break;
+
+ default:
+ ui->editName->setFocus();
+ break;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// setInitialFocus
+//
+
+void
+CDlgMdfRegister::setInitialFocus(void)
+{
+ // ui->editName->setFocus();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// setUndef
+//
+
+void
+CDlgMdfRegister::setUndef(void)
+{
+ ui->editDefault->setText("UNDEF");
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// showFgColorDlg
+//
+
+void
+CDlgMdfRegister::showFgColorDlg(void)
+{
+ QColorDialog dlg(this);
+ dlg.setCurrentColor(QColor(vscp_readStringValue(ui->editFgColor->text().toStdString())));
+
+ if (QDialog::Accepted == dlg.exec()) {
+ setForegroundColor(dlg.selectedColor().rgb());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// showBgColorDlg
+//
+
+void
+CDlgMdfRegister::showBgColorDlg(void)
+{
+ QColorDialog dlg(this);
+ dlg.setCurrentColor(QColor(vscp_readStringValue(ui->editBgColor->text().toStdString())));
+
+ if (QDialog::Accepted == dlg.exec()) {
+ setBackgroundColor(dlg.selectedColor().rgb());
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Getters & Setters
+// ----------------------------------------------------------------------------
+
+QString
+CDlgMdfRegister::getName(void)
+{
+ return ui->editName->text();
+};
+
+void
+CDlgMdfRegister::setName(const QString& name)
+{
+ ui->editName->setText(name);
+};
+
+// -----------------------------------------------------------------------
+
+uint16_t
+CDlgMdfRegister::getPage(void)
+{
+ int index = ui->comboPage->currentIndex();
+ if (-1 == index) {
+ return 0;
+ }
+
+ return ui->comboPage->currentData().toInt();
+}
+
+void
+CDlgMdfRegister::setPage(uint16_t page)
+{
+ for (int i = 0; i < ui->comboPage->count(); i++) {
+ if (page == ui->comboPage->itemData(i)) {
+ ui->comboPage->setCurrentIndex(i);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+uint32_t
+CDlgMdfRegister::getOffset(void)
+{
+ return vscp_readStringValue(ui->editOffset->text().toStdString());
+}
+
+void
+CDlgMdfRegister::setOffset(uint32_t offset)
+{
+ ui->editOffset->setText(QString("%1").arg(offset));
+}
+
+// -----------------------------------------------------------------------
+
+uint8_t
+CDlgMdfRegister::getType(void)
+{
+ return ui->comboPage->currentIndex();
+}
+
+void
+CDlgMdfRegister::setType(uint8_t type)
+{
+ if (type <= MDF_REG_TYPE_BLOCK) {
+ ui->comboPage->setCurrentIndex(type);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+uint16_t
+CDlgMdfRegister::getSpan(void)
+{
+ return ui->spinSpan->value();
+}
+
+void
+CDlgMdfRegister::setSpan(uint16_t span)
+{
+ ui->spinSpan->setValue(span);
+}
+
+// -----------------------------------------------------------------------
+
+uint8_t
+CDlgMdfRegister::getWidth(void)
+{
+ return ui->spinWidth->value();
+}
+
+void
+CDlgMdfRegister::setWidth(uint8_t span)
+{
+ ui->spinWidth->setValue(span);
+}
+
+// -----------------------------------------------------------------------
+
+uint8_t
+CDlgMdfRegister::getMin(void)
+{
+ return ui->spinMin->value();
+}
+
+void
+CDlgMdfRegister::setMin(uint8_t min)
+{
+ ui->spinMin->setValue(min);
+}
+
+// -----------------------------------------------------------------------
+
+uint8_t
+CDlgMdfRegister::getMax(void)
+{
+ return ui->spinMax->value();
+}
+
+void
+CDlgMdfRegister::setMax(uint8_t span)
+{
+ ui->spinMax->setValue(span);
+}
+
+// -----------------------------------------------------------------------
+
+mdf_access_mode
+CDlgMdfRegister::getAccess(void)
+{
+ return static_cast(ui->comboAccess->currentIndex());
+}
+
+void
+CDlgMdfRegister::setAccess(uint8_t access)
+{
+ if (access <= MDF_REG_ACCESS_READ_WRITE) {
+ ui->comboAccess->setCurrentIndex(access);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+QString
+CDlgMdfRegister::getDefault(void)
+{
+ return ui->editDefault->text();
+}
+
+void
+CDlgMdfRegister::setDefault(QString& str)
+{
+ ui->editDefault->setText(str);
+}
+
+// -----------------------------------------------------------------------
+
+uint32_t
+CDlgMdfRegister::getForegroundColor(void)
+{
+ return vscp_readStringValue(ui->editFgColor->text().toStdString());
+}
+
+void
+CDlgMdfRegister::setForegroundColor(uint32_t color)
+{
+ ui->editFgColor->setText(QString("0x%1").arg(color, 8, 16, QChar('0')));
+}
+
+// -----------------------------------------------------------------------
+
+uint32_t
+CDlgMdfRegister::getBackgroundColor(void)
+{
+ return vscp_readStringValue(ui->editBgColor->text().toStdString());
+}
+void
+CDlgMdfRegister::setBackgroundColor(uint32_t color)
+{
+ ui->editBgColor->setText(QString("0x%1").arg(color, 8, 16, QChar('0')));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// accept
+//
+
+void
+CDlgMdfRegister::accept()
+{
+ std::string str;
+ if (nullptr != m_preg) {
+ m_preg->setName(getName().toStdString());
+ m_preg->setPage(getPage());
+ m_preg->setOffset(getOffset());
+ m_preg->setType(static_cast(getType()));
+ m_preg->setSpan(getSpan());
+ m_preg->setWidth(getWidth());
+ m_preg->setMin(getMin());
+ m_preg->setMax(getMax());
+ m_preg->setAccess(getAccess());
+ m_preg->setDefault(getDefault().toStdString());
+ m_preg->setForegroundColor(getForegroundColor());
+ m_preg->setBackgroundColor(getBackgroundColor());
+ }
+ else {
+ spdlog::error("MDF module information - Invalid MDF object (accept)");
+ }
+
+ QDialog::accept();
+}
diff --git a/src/cdlgmdfregister.h b/src/cdlgmdfregister.h
new file mode 100644
index 00000000..8edbcf93
--- /dev/null
+++ b/src/cdlgmdfregister.h
@@ -0,0 +1,166 @@
+// cdlgmdfregister.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 CDLGMDFREGISTER_H
+#define CDLGMDFREGISTER_H
+
+#include
+#include
+
+#include
+
+
+
+namespace Ui {
+class CDlgMdfRegister;
+}
+
+class CDlgMdfRegister : public QDialog {
+ Q_OBJECT
+
+public:
+public:
+ explicit CDlgMdfRegister(QWidget* parent = nullptr);
+ ~CDlgMdfRegister();
+
+ static const int index_name = 0;
+ static const int index_page = 1;
+ static const int index_offset = 2;
+ static const int index_type = 3;
+ static const int index_span = 4;
+ static const int index_width = 5;
+ static const int index_min = 6;
+ static const int index_max = 7;
+ static const int index_access = 8;
+ static const int index_default = 9;
+ static const int index_fgcolor = 10;
+ static const int index_bgcolor = 11;
+
+ static const char pre_str_register[];
+
+ /*!
+ Set inital focus to description
+ */
+ void setInitialFocus(void);
+
+ /*!
+ 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_Register* preg, int index = 0);
+
+
+ // ----------------------------------------------------------------------------
+ // Getters & Setters
+ // ----------------------------------------------------------------------------
+
+ // name
+ QString getName(void);
+ void setName(const QString& name);
+
+ // page
+ uint16_t getPage(void);
+ void setPage(uint16_t page);
+
+ // offset
+ uint32_t getOffset(void);
+ void setOffset(uint32_t offset);
+
+ // type
+ uint8_t getType(void);
+ void setType(uint8_t type);
+
+ // span
+ uint16_t getSpan(void);
+ void setSpan(uint16_t type);
+
+ // width
+ uint8_t getWidth(void);
+ void setWidth(uint8_t type);
+
+ // min
+ uint8_t getMin(void);
+ void setMin(uint8_t min);
+
+ // max
+ uint8_t getMax(void);
+ void setMax(uint8_t max);
+
+ // access
+ mdf_access_mode getAccess(void);
+ void setAccess(uint8_t access);
+
+ // default
+ QString getDefault(void);
+ void setDefault(QString& val);
+
+ // fg color
+ uint32_t getForegroundColor(void);
+ void setForegroundColor(uint32_t color);
+
+ // bg color
+ uint32_t getBackgroundColor(void);
+ void setBackgroundColor(uint32_t color);
+
+public slots:
+
+ /*!
+ Show dialog to select foregrund color
+ */
+ void showFgColorDlg(void);
+
+ /*!
+ Show dialog to select backgrund color
+ */
+ void showBgColorDlg(void);
+
+ /*
+ Set UNDEF for default value
+ */
+ void setUndef(void);
+
+ /*!
+ Accept dialog data and write to register
+ */
+ void accept(void);
+
+
+private:
+ Ui::CDlgMdfRegister* ui;
+
+ /// Pointer to MDF
+ CMDF *m_pmdf;
+
+ /// Pointer to register information
+ CMDF_Register* m_preg;
+};
+
+#endif // CDLGMDFREGISTER_H
diff --git a/src/cdlgmdfregister.ui b/src/cdlgmdfregister.ui
index ab660552..f9ac2d52 100644
--- a/src/cdlgmdfregister.ui
+++ b/src/cdlgmdfregister.ui
@@ -6,19 +6,19 @@
0
0
- 604
- 468
+ 748
+ 463
- Dialog
+ MDF Register Edit
-
+
10
430
- 581
+ 731
32
@@ -32,242 +32,414 @@
false
-
+
- 9
- 9
- 581
- 411
+ 10
+ 10
+ 731
+ 421
-
- -
-
+
+
-
+
+
+ QLayout::SetDefaultConstraint
+
+
-
+
+
-
+
+
-
+
+
+ Remote variable name
+
+
+
+ -
+
+
+ ...
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Name
+
+
+
+ -
+
+
+ A descriptiv name for the register
+
+
+ Name of register
+
+
+
+ -
+
+
+ Page
+
+
+
+ -
+
+
-
+
+
+ Page register is at
+
+
-
+
+ 0
+
+
+
+
+ -
+
+
+ Define new page
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ Offset
+
+
+
+ -
+
+
+ -
+
+
+ Type
+
+
+
+ -
+
+
+ Type of register definition
+
+
-
+
+ std
+
+
+ -
+
+ block
+
+
+ -
+
+ dmatrix1
+
+
+
+
+ -
+
+
+ Span
+
+
+
+ -
+
+
+ 127
+
+
+ 1
+
+
+
+ -
+
+
+ Width
+
+
+
+ -
+
+
+ 1
+
+
+ 8
+
+
+ 8
+
+
+
+ -
+
+
+ Min
+
+
+
+ -
+
+
+ -
+
+
+ Max
+
+
+
+ -
+
+
+ 255
+
+
+ 255
+
+
+
+ -
+
+
+ Access
+
+
+
+ -
+
+
+ Access right for register
+
+
-
+
+ None
+
+
+ -
+
+ Write Only
+
+
+ -
+
+ Read Only
+
+
+ -
+
+ Read/Write
+
+
+
+
+ -
+
+
+ Default
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ Set "no default"
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ fgcolor
+
+
+
+ -
+
+
-
+
+
+ Maximum valid register value
+
+
+ 255
+
+
+
+ -
+
+
+ Open colordialog
+
+
+ ...
+
+
+
+
+
+ -
+
+
+ bgcolor
+
+
+
+ -
+
+
-
+
+
+ Recommended background color code for rendering softare
+
+
+ 0
+
+
+
+ -
+
+
+ Open color dialog
+
+
+ ...
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Register bit definitions
+
+
+ ...
+
+
+
-
-
+
+
+ Register values
+
- Remote variable
+ ...
-
-
+
+
+ Register descriptions
+
- Edit
+ ...
-
-
+
- Qt::Horizontal
+ Qt::Vertical
- 40
- 20
+ 20
+ 40
- -
-
-
- Name
-
-
-
- -
-
-
- Name of register
-
-
-
- -
-
-
- Page
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- Offset
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- Type
-
-
-
- -
-
-
-
-
- std
-
-
- -
-
- block
-
-
- -
-
- dmatrix1
-
-
-
-
- -
-
-
- Span
-
-
-
- -
-
-
- 1
-
-
-
- -
-
-
- Width
-
-
-
- -
-
-
- 8
-
-
-
- -
-
-
- Min
-
-
-
- -
-
-
- 1
-
-
-
- -
-
-
- Max
-
-
-
- -
-
-
- 255
-
-
-
- -
-
-
- Access
-
-
-
- -
-
-
-
-
- Read/Write
-
-
- -
-
- Read Only
-
-
- -
-
- Write Only
-
-
-
-
- -
-
-
- Default
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- fgcolor
-
-
-
- -
-
-
- 0
-
-
-
- -
-
-
- bgcolor
-
-
-
- -
-
-
- 0
-
-
-
-
+
+
+ buttonBox
+ accepted()
+ CDlgMdfRegister
+ accept()
+
+
+ 375
+ 475
+
+
+ 373
+ 250
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegister
+ reject()
+
+
+ 375
+ 475
+
+
+ 373
+ 250
+
+
+
+
diff --git a/src/cdlgmdfregisterbit.ui b/src/cdlgmdfregisterbit.ui
new file mode 100644
index 00000000..007f85dd
--- /dev/null
+++ b/src/cdlgmdfregisterbit.ui
@@ -0,0 +1,147 @@
+
+
+ CDlgMdfRegisterBit
+
+
+
+ 0
+ 0
+ 692
+ 257
+
+
+
+ Dialog
+
+
+
+
+ 10
+ 220
+ 671
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+
+
+
+ 9
+ 19
+ 671
+ 191
+
+
+
+ -
+
+
+ Name:
+
+
+
+ -
+
+
+ A descriptiv name for the register
+
+
+ Name of bit definition
+
+
+
+ -
+
+
+ Position:
+
+
+
+ -
+
+
+ -
+
+
+ Width
+
+
+
+ -
+
+
+ -
+
+
+ Default:
+
+
+
+ -
+
+
+ Min
+
+
+
+ -
+
+
+ Max
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CDlgMdfRegisterBit
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterBit
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/cdlgmdfregisterbitlist.ui b/src/cdlgmdfregisterbitlist.ui
new file mode 100644
index 00000000..cb35b768
--- /dev/null
+++ b/src/cdlgmdfregisterbitlist.ui
@@ -0,0 +1,181 @@
+
+
+ CDlgMdfRegisterBitList
+
+
+
+ 0
+ 0
+ 730
+ 325
+
+
+
+ Dialog
+
+
+
+
+ 0
+ 290
+ 721
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+ false
+
+
+
+
+
+ 9
+ 10
+ 711
+ 251
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
-
+
+
+ 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()
+ CDlgMdfRegisterBitList
+ accept()
+
+
+ 360
+ 305
+
+
+ 364
+ 162
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterBitList
+ reject()
+
+
+ 360
+ 305
+
+
+ 364
+ 162
+
+
+
+
+
diff --git a/src/cdlgmdfregisterlist.cpp b/src/cdlgmdfregisterlist.cpp
new file mode 100644
index 00000000..6e56afeb
--- /dev/null
+++ b/src/cdlgmdfregisterlist.cpp
@@ -0,0 +1,319 @@
+// cdlgmdfregisterlist.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 "cdlgmdfcontact.h"
+#include "cdlgmdfregisterlist.h"
+#include "ui_cdlgmdfregisterlist.h"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+///////////////////////////////////////////////////////////////////////////////
+// CTor
+//
+
+CDlgMdfRegisterList::CDlgMdfRegisterList(QWidget* parent)
+ : QDialog(parent)
+ , ui(new Ui::CDlgMdfRegisterList)
+{
+ m_pmdf = nullptr;
+ m_page = 0;
+
+ ui->setupUi(this);
+
+ vscpworks* pworks = (vscpworks*)QCoreApplication::instance();
+
+ connect(ui->btnAddRegister, &QToolButton::clicked, this, &CDlgMdfRegisterList::addRegister);
+ connect(ui->btnEditRegister, &QToolButton::clicked, this, &CDlgMdfRegisterList::editRegister);
+ connect(ui->btnDupRegister, &QToolButton::clicked, this, &CDlgMdfRegisterList::dupRegister);
+ connect(ui->btnDelRegister, &QToolButton::clicked, this, &CDlgMdfRegisterList::deleteRegister);
+
+ setInitialFocus();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// DTor
+//
+
+CDlgMdfRegisterList::~CDlgMdfRegisterList()
+{
+ delete ui;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// initDialogData
+//
+
+void
+CDlgMdfRegisterList::initDialogData(CMDF* pmdf, uint16_t page)
+{
+ QString str;
+
+ if (nullptr == pmdf) {
+ QMessageBox::critical(this, tr("MDF contact information"), tr("Invalid MDF manufacturing object"));
+ spdlog::error("MDF contact information - Invalid MDF manufacturing object");
+ return;
+ }
+
+ // Save MDF and page
+ m_pmdf = pmdf;
+ m_page = page;
+
+ setWindowTitle(tr("Registers on page %1").arg(page));
+
+ // Fill in defined register items
+ renderRegisterItems();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// renderRegisterItems
+//
+
+void
+CDlgMdfRegisterList::renderRegisterItems(void)
+{
+ std::map pages;
+
+ if (nullptr == m_pmdf) {
+ return;
+ }
+
+ m_pmdf->getRegisterMap(m_page, pages);
+
+ std::deque* regs = m_pmdf->getRegisterObjList();
+
+ for (auto it = regs->cbegin(); it != regs->cend(); ++it) {
+ QString str = QString("Register %1 %2").arg((*it)->getOffset()).arg((*it)->getName().c_str());
+ ui->listRegister->addItem(str);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// setInitialFocus
+//
+
+void
+CDlgMdfRegisterList::setInitialFocus(void)
+{
+ // ui->editGuid->setFocus();
+}
+
+// ----------------------------------------------------------------------------
+// Getters & Setters
+// ----------------------------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////////////////////////
+// addRegister
+//
+
+void
+CDlgMdfRegisterList::addRegister(void)
+{
+ bool ok;
+ std::string str = QInputDialog::getText(this,
+ tr("Add contact item"),
+ tr("Contact value:"),
+ QLineEdit::Normal,
+ "",
+ &ok)
+ .toStdString();
+
+ if (ok && str.length()) {
+ CMDF_Item* pitem = new CMDF_Item();
+ if (nullptr != pitem) {
+ pitem->setValue(str);
+ // m_pContactList->push_back(pitem);
+ // ui->listContact->clear();
+ // fillContactItems();
+ }
+ else {
+ QMessageBox::warning(this, tr(APPNAME), tr("Memory problem could not add item"), QMessageBox::Ok);
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editRegister
+//
+
+void
+CDlgMdfRegisterList::editRegister(void)
+{
+ bool ok;
+
+ // if (-1 != ui->listContact->currentRow()) {
+
+ // // Save the selected row
+ // int idx = ui->listContact->currentRow();
+
+ // QListWidgetItem* pitem = ui->listContact->currentItem();
+
+ // std::string str = QInputDialog::getText(this,
+ // tr("Edit contact item"),
+ // tr("Contact value:"),
+ // QLineEdit::Normal,
+ // pitem->text(),
+ // &ok)
+ // .toStdString();
+
+ // if (ok && str.length()) {
+ // pitem->setText(str.c_str());
+ // CMDF_Item* pitem = m_pContactList->at(idx);
+ // if (nullptr != pitem) {
+ // pitem->setValue(str);
+ // }
+ // else {
+ // QMessageBox::warning(this, tr(APPNAME), tr("Contact item was not found"), QMessageBox::Ok);
+ // }
+ // ui->listContact->clear();
+ // fillContactItems();
+ // ui->listContact->setCurrentRow(idx);
+ // }
+ // }
+ // else {
+ // QMessageBox::warning(this, tr(APPNAME), tr("An item must be selected"), QMessageBox::Ok);
+ // }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// dupRegister
+//
+
+void
+CDlgMdfRegisterList::dupRegister(void)
+{
+ bool ok;
+
+ // if (-1 != ui->listContact->currentRow()) {
+
+ // // Save the selected row
+ // int idx = ui->listContact->currentRow();
+
+ // QListWidgetItem* pitem = ui->listContact->currentItem();
+ // QString selstr = pitem->text().split('_').first().left(2);
+
+ // std::string str = QInputDialog::getText(this,
+ // tr("Edit contact item"),
+ // tr("Contact value:"),
+ // QLineEdit::Normal,
+ // pitem->text(),
+ // &ok)
+ // .toStdString();
+
+ // if (ok && str.length()) {
+
+ // CMDF_Item* pitem = new CMDF_Item();
+ // if (nullptr != pitem) {
+ // pitem->setValue(str);
+ // m_pContactList->push_back(pitem);
+ // ui->listContact->clear();
+ // fillContactItems();
+ // }
+ // else {
+ // QMessageBox::warning(this, tr(APPNAME), tr("Memory problem could not add item"), QMessageBox::Ok);
+ // }
+ // }
+ // }
+ // else {
+ // QMessageBox::warning(this, tr("vscpworks+"), tr("An item must be selected"), QMessageBox::Ok);
+ // }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// deleteRegister
+//
+
+void
+CDlgMdfRegisterList::deleteRegister(void)
+{
+ // if (-1 != ui->listContact->currentRow()) {
+
+ // // Save the row
+ // int idx = ui->listContact->currentRow();
+
+ // QListWidgetItem* pitem = ui->listContact->currentItem();
+ // ui->listContact->removeItemWidget(pitem);
+ // m_pContactList->erase(m_pContactList->cbegin()+idx);
+
+ // ui->listContact->clear();
+ // fillContactItems();
+ // }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// accept
+//
+
+void
+CDlgMdfRegisterList::accept()
+{
+ std::string str;
+ if (nullptr != m_pmdf) {
+
+ // str = ui->editName->text().toStdString();
+ // m_pmdf->setModuleName(str);
+
+ // str = ui->editModel->text().toStdString();
+ // m_pmdf->setModuleModel(str);
+
+ // m_pmdf->setModuleLevel(ui->comboModuleLevel->currentIndex());
+
+ // str = ui->editVersion->text().toStdString();
+ // m_pmdf->setModuleVersion(str);
+
+ // str = ui->editDate->text().toStdString();
+ // m_pmdf->setModuleChangeDate(str);
+
+ // m_pmdf->setModuleBufferSize(ui->editBufferSize->value());
+
+ // str = ui->editCopyright->text().toStdString();
+ // m_pmdf->setModuleCopyright(str);
+ }
+ else {
+ spdlog::error("MDF module information - Invalid MDF object (accept)");
+ }
+
+ QDialog::accept();
+}
diff --git a/src/cdlgmdfregisterlist.h b/src/cdlgmdfregisterlist.h
new file mode 100644
index 00000000..59054ec6
--- /dev/null
+++ b/src/cdlgmdfregisterlist.h
@@ -0,0 +1,105 @@
+// cdlgmdfregisterlist.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 CDLGMDFREGISTERLIST_H
+#define CDLGMDFREGISTERLIST_H
+
+#include
+#include
+
+#include "cdlgmdfregister.h"
+
+#include
+
+
+
+
+namespace Ui {
+class CDlgMdfRegisterList;
+}
+
+class CDlgMdfRegisterList : public QDialog {
+ Q_OBJECT
+
+public:
+ explicit CDlgMdfRegisterList(QWidget* parent = nullptr);
+ ~CDlgMdfRegisterList();
+
+ /*!
+ Set inital focus to description
+ */
+ void setInitialFocus(void);
+
+ /*!
+ Set edit mode.
+ GUID will be READ ONLY
+ */
+ void setEditMode();
+
+ /*!
+ Init dialog data
+ @param pmdf Pointer to MDF object
+ */
+ void initDialogData(CMDF *pmdf, uint16_t page=0);
+
+ /*!
+ Fill in contact items
+ */
+ void renderRegisterItems(void);
+
+
+ // ----------------------------------------------------------------------------
+ // Getters & Setters
+ // ----------------------------------------------------------------------------
+
+ /*!
+ Name getter/setters
+ */
+ // void setValue(const QString& name);
+ // QString getValue(void);
+
+public slots:
+ void accept(void);
+
+ // Description buttons
+ void addRegister(void);
+ void editRegister(void);
+ void dupRegister(void);
+ void deleteRegister(void);
+
+private:
+ Ui::CDlgMdfRegisterList* ui;
+
+ // MDF
+ CMDF *m_pmdf;
+
+ // Register page
+ uint16_t m_page;
+};
+
+#endif // CDLGMDFREGISTERLIST_H
diff --git a/src/cdlgmdfregisterlist.ui b/src/cdlgmdfregisterlist.ui
new file mode 100644
index 00000000..ae1364ab
--- /dev/null
+++ b/src/cdlgmdfregisterlist.ui
@@ -0,0 +1,181 @@
+
+
+ CDlgMdfRegisterList
+
+
+
+ 0
+ 0
+ 499
+ 564
+
+
+
+ Dialog
+
+
+
+
+ 10
+ 530
+ 481
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+ false
+
+
+
+
+
+ 9
+ 10
+ 481
+ 511
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
-
+
+
+ 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()
+ CDlgMdfRegisterList
+ accept()
+
+
+ 360
+ 305
+
+
+ 364
+ 162
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterList
+ reject()
+
+
+ 360
+ 305
+
+
+ 364
+ 162
+
+
+
+
+
diff --git a/src/cdlgmdfbit.ui b/src/cdlgmdfregistervalue.ui
similarity index 53%
rename from src/cdlgmdfbit.ui
rename to src/cdlgmdfregistervalue.ui
index ce520757..90a06e23 100644
--- a/src/cdlgmdfbit.ui
+++ b/src/cdlgmdfregistervalue.ui
@@ -1,24 +1,24 @@
- CDlgMdfBit
-
+ CDlgMdfRegisterValue
+
0
0
- 597
- 320
+ 692
+ 293
Dialog
-
+
- 0
- 280
- 591
+ 10
+ 250
+ 671
32
@@ -28,127 +28,87 @@
QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
-
- false
-
- 9
- 9
- 581
- 261
+ 10
+ 10
+ 671
+ 231
-
-
+
- Type
+ Name:
-
-
-
-
-
- Value
-
-
- -
-
- Value List
-
-
+
+
+ A descriptiv name for the register
+
+
+ Name of value
+
-
-
+
- Name
+ Value
-
-
-
- name-of-bit
-
-
+
-
-
+
- Pos
+ Default:
-
-
-
- 0
-
-
+
-
-
+
Width
- -
-
-
- 1
-
-
-
-
-
-
- Default
-
-
-
- -
-
-
- true
-
-
-
- -
-
+
Min
- -
-
+
-
+
- 0
+ Max
-
-
+
- Max
+ Access
-
-
-
- 1
+
+
+ Access right for register
-
-
- -
-
-
Read/Write
@@ -166,16 +126,51 @@
- -
-
-
- Access
-
-
+
-
+
+
+ -
+
+
+ -
+
-
+
+
+ buttonBox
+ accepted()
+ CDlgMdfRegisterValue
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterValue
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
diff --git a/src/cdlgmdfregistervaluelist.ui b/src/cdlgmdfregistervaluelist.ui
new file mode 100644
index 00000000..2c06bc21
--- /dev/null
+++ b/src/cdlgmdfregistervaluelist.ui
@@ -0,0 +1,188 @@
+
+
+ CDlgMdfRegisterValueList
+
+
+
+ 0
+ 0
+ 661
+ 445
+
+
+
+ Contacts
+
+
+
+
+ 0
+ 410
+ 651
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+ false
+
+
+
+
+
+ 9
+ 19
+ 641
+ 381
+
+
+
+ -
+
+
+ Contact items
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
-
+
+
+ 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/cdlgmdfremotevar.ui b/src/cdlgmdfremotevar.ui
index 69e0ca99..8ca47717 100644
--- a/src/cdlgmdfremotevar.ui
+++ b/src/cdlgmdfremotevar.ui
@@ -7,7 +7,7 @@
0
0
604
- 415
+ 411
@@ -50,7 +50,10 @@
-
-
+
+
+ Name of remote variable
+
Name of remote variable
@@ -64,20 +67,83 @@
-
-
+
+
+ Type for remote variable
+
+
-
+
+ string
+
+
+ -
+
+ block
+
+
+ -
+
+ bool
+
+
-
- uint8
+ int8 (1) - aka char
-
- uint16
+ uint8 (1) - aka byte
-
- uint32
+ int16 (2) - aka short, integer
+
+
+ -
+
+ uint16 (2) -
+
+
+ -
+
+ int32 (4) - aka long
+
+
+ -
+
+ uint32(4) - aka ulong
+
+
+ -
+
+ int64 (8)
+
+
+ -
+
+ uint64 (8)
+
+
+ -
+
+ float (4)
+
+
+ -
+
+ double (8)
+
+
+ -
+
+ date (4)
+
+
+ -
+
+ time (4)
@@ -89,13 +155,6 @@
- -
-
-
- 0
-
-
-
-
@@ -103,13 +162,6 @@
- -
-
-
- 0
-
-
-
-
@@ -117,13 +169,6 @@
- -
-
-
- 1
-
-
-
-
@@ -131,13 +176,6 @@
- -
-
-
- 1
-
-
-
-
@@ -145,13 +183,6 @@
- -
-
-
- 255
-
-
-
-
@@ -160,7 +191,10 @@
-
-
+
+
+ Access rights for reemote variable
+
-
Read/Write
@@ -186,7 +220,10 @@
-
-
+
+
+ Default value for remote variable
+
0
@@ -199,13 +236,6 @@
- -
-
-
- 0
-
-
-
-
@@ -213,12 +243,73 @@
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
-
-
-
- 0
-
-
+
+
-
+
+
+ Recommended background color code for rendering softare
+
+
+ 0
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
-
+
+
+ Recommended foreground color code for rendering softare
+
+
+ 0
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ ...
+
+
+
+
diff --git a/src/cdlgmdfremotevarbit.ui b/src/cdlgmdfremotevarbit.ui
new file mode 100644
index 00000000..007f85dd
--- /dev/null
+++ b/src/cdlgmdfremotevarbit.ui
@@ -0,0 +1,147 @@
+
+
+ CDlgMdfRegisterBit
+
+
+
+ 0
+ 0
+ 692
+ 257
+
+
+
+ Dialog
+
+
+
+
+ 10
+ 220
+ 671
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+
+
+
+ 9
+ 19
+ 671
+ 191
+
+
+
+ -
+
+
+ Name:
+
+
+
+ -
+
+
+ A descriptiv name for the register
+
+
+ Name of bit definition
+
+
+
+ -
+
+
+ Position:
+
+
+
+ -
+
+
+ -
+
+
+ Width
+
+
+
+ -
+
+
+ -
+
+
+ Default:
+
+
+
+ -
+
+
+ Min
+
+
+
+ -
+
+
+ Max
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CDlgMdfRegisterBit
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterBit
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/cdlgmdfremotevarbitlist.ui b/src/cdlgmdfremotevarbitlist.ui
new file mode 100644
index 00000000..7eb0b9c8
--- /dev/null
+++ b/src/cdlgmdfremotevarbitlist.ui
@@ -0,0 +1,181 @@
+
+
+ CDlgRemoteVarBitList
+
+
+
+ 0
+ 0
+ 730
+ 325
+
+
+
+ Dialog
+
+
+
+
+ 0
+ 290
+ 721
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+ false
+
+
+
+
+
+ 9
+ 10
+ 711
+ 251
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
-
+
+
+ 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()
+ CDlgRemoteVarBitList
+ accept()
+
+
+ 360
+ 305
+
+
+ 364
+ 162
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgRemoteVarBitList
+ reject()
+
+
+ 360
+ 305
+
+
+ 364
+ 162
+
+
+
+
+
diff --git a/src/cdlgmdfremotevarvalue.ui b/src/cdlgmdfremotevarvalue.ui
new file mode 100644
index 00000000..90a06e23
--- /dev/null
+++ b/src/cdlgmdfremotevarvalue.ui
@@ -0,0 +1,176 @@
+
+
+ CDlgMdfRegisterValue
+
+
+
+ 0
+ 0
+ 692
+ 293
+
+
+
+ Dialog
+
+
+
+
+ 10
+ 250
+ 671
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+
+
+
+ 10
+ 10
+ 671
+ 231
+
+
+
+ -
+
+
+ Name:
+
+
+
+ -
+
+
+ A descriptiv name for the register
+
+
+ Name of value
+
+
+
+ -
+
+
+ Value
+
+
+
+ -
+
+
+ -
+
+
+ Default:
+
+
+
+ -
+
+
+ -
+
+
+ Width
+
+
+
+ -
+
+
+ Min
+
+
+
+ -
+
+
+ Max
+
+
+
+ -
+
+
+ Access
+
+
+
+ -
+
+
+ Access right for register
+
+
-
+
+ Read/Write
+
+
+ -
+
+ Read Only
+
+
+ -
+
+ Write Only
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CDlgMdfRegisterValue
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterValue
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/cdlgmdfremotevarvaluelist.ui b/src/cdlgmdfremotevarvaluelist.ui
new file mode 100644
index 00000000..2c06bc21
--- /dev/null
+++ b/src/cdlgmdfremotevarvaluelist.ui
@@ -0,0 +1,188 @@
+
+
+ CDlgMdfRegisterValueList
+
+
+
+ 0
+ 0
+ 661
+ 445
+
+
+
+ Contacts
+
+
+
+
+ 0
+ 410
+ 651
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+ false
+
+
+
+
+
+ 9
+ 19
+ 641
+ 381
+
+
+
+ -
+
+
+ Contact items
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
-
+
+
+ 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/cdlgregistermapping.ui b/src/cdlgregistermapping.ui
new file mode 100644
index 00000000..12e19270
--- /dev/null
+++ b/src/cdlgregistermapping.ui
@@ -0,0 +1,99 @@
+
+
+ CDlgMdfRegisterMap
+
+
+
+ 0
+ 0
+ 743
+ 644
+
+
+
+ Register mapping
+
+
+
+
+ 10
+ 610
+ 721
+ 32
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok
+
+
+
+
+
+ 9
+ 10
+ 721
+ 591
+
+
+
+ -
+
+
+
+ Page
+
+
+
+
+ Offset
+
+
+
+
+ Remote Variable
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ CDlgMdfRegisterMap
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ CDlgMdfRegisterMap
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/cfrmmdf.cpp b/src/cfrmmdf.cpp
index 5ce61da1..c7a8e0b4 100644
--- a/src/cfrmmdf.cpp
+++ b/src/cfrmmdf.cpp
@@ -61,6 +61,8 @@
#include "cdlgmdffilevideo.h"
#include "cdlgmdfmanufacturer.h"
#include "cdlgmdfmodule.h"
+#include "cdlgmdfregister.h"
+#include "cdlgmdfregisterlist.h"
#include
#include
@@ -143,8 +145,8 @@ CFrmMdf::CFrmMdf(QWidget* parent, const char* path)
ui->setupUi(this);
- // QStatusBar *m_bar = new QStatusBar(this);
- // ui->statusbar->addWidget(m_bar);
+ QStatusBar* m_bar = new QStatusBar(this);
+ ui->statusbar->addWidget(m_bar);
ui->treeMDF->setContextMenuPolicy(Qt::CustomContextMenu);
ui->treeMDF->setEditTriggers(QAbstractItemView::NoEditTriggers);
@@ -153,13 +155,7 @@ CFrmMdf::CFrmMdf(QWidget* parent, const char* path)
spdlog::debug(std::string(tr("Node configuration module opened").toStdString()));
if (nullptr == path) {
- // spdlog::trace(std::string(tr("path is null").toStdString()));
- // QMessageBox::information(this,
- // tr("vscpworks+"),
- // tr("Can't open node configuration window - "
- // "application configuration data is missing"),
- // QMessageBox::Ok);
- // return;
+ spdlog::warn(std::string(tr("[cfrmmdf] path is null").toStdString()));
}
setWindowTitle(str);
@@ -184,15 +180,18 @@ CFrmMdf::CFrmMdf(QWidget* parent, const char* path)
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openMdf()));
// Open has been selected in the menu - Edit Module info
- connect(ui->actionEdit_item, SIGNAL(triggered()), this, SLOT(editData()));
+ connect(ui->actionEdit_item, SIGNAL(triggered()), this, SLOT(editItem()));
+
+ // Open has been selected in the menu - Edit Module info
+ connect(ui->actionDelete_item, SIGNAL(triggered()), this, SLOT(deleteItem()));
- // Register row has been clicked.
+ // MDF row has been clicked.
connect(ui->treeMDF,
&QTreeWidget::itemClicked,
this,
&CFrmMdf::onItemClicked);
- // Register row has been double clicked.
+ // MDF row has been double clicked.
connect(ui->treeMDF,
&QTreeWidget::itemDoubleClicked,
this,
@@ -205,6 +204,28 @@ CFrmMdf::CFrmMdf(QWidget* parent, const char* path)
CFrmMdf::~CFrmMdf()
{
+ m_bar = nullptr;
+
+ m_headModule = nullptr;
+ m_headManufacturer = nullptr;
+ m_headManufacturerPhone = nullptr;
+ m_headManufacturerFax = nullptr;
+ m_headManufacturerEmail = nullptr;
+ m_headManufacturerWeb = nullptr;
+ m_headManufacturerSocial = nullptr;
+ m_headBootLoader = nullptr;
+ m_headFile = nullptr;
+ m_headFilePicture = nullptr;
+ m_headFileVideo = nullptr;
+ m_headFileManual = nullptr;
+ m_headFileFirmware = nullptr;
+ m_headFileDriver = nullptr;
+ m_headFileSetupScript = nullptr;
+ m_headRegister = nullptr;
+ m_headRemoteVariabel = nullptr;
+ m_headAlarm = nullptr;
+ m_headDecisionMatrix = nullptr;
+ m_headEvent = nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -324,23 +345,29 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
break;
case mdf_type_register_page:
- menu->addAction(QString(tr("Register Page")), this, SLOT(loadSelectedMdf()));
+ menu->addAction(QString(tr("Register list for page")), this, SLOT(editRegister()));
break;
case mdf_type_register:
- menu->addAction(QString(tr("Register")), this, SLOT(loadSelectedMdf()));
+ menu->addAction(QString(tr("Add register")), this, SLOT(editRegister()));
break;
case mdf_type_register_item:
- menu->addAction(QString(tr("Register item")), this, SLOT(loadSelectedMdf()));
+ menu->addAction(QString(tr("Edit register")), this, SLOT(editRegister()));
+ menu->addAction(QString(tr("Delete register")), this, SLOT(deleteRegister()));
+ break;
+
+ case mdf_type_register_sub_item:
+ menu->addAction(QString(tr("Edit register")), this, SLOT(editRegister()));
+ menu->addAction(QString(tr("Delete register")), this, SLOT(deleteRegister()));
break;
case mdf_type_remotevar:
- menu->addAction(QString(tr("Remote Variable")), this, SLOT(loadSelectedMdf()));
+ menu->addAction(QString(tr("Edit remote variable")), this, SLOT(loadSelectedMdf()));
break;
case mdf_type_remotevar_item:
- menu->addAction(QString(tr("Remote Variable Item")), this, SLOT(loadSelectedMdf()));
+ menu->addAction(QString(tr("Eemote remote variable")), this, SLOT(loadSelectedMdf()));
break;
case mdf_type_action_param:
@@ -413,6 +440,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_email_item:
menu->addAction(QString(tr("Edit email item")), this, SLOT(editContact()));
+ menu->addAction(QString(tr("Delete email item")), this, SLOT(deleteContact()));
break;
case mdf_type_phone:
@@ -421,6 +449,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_phone_item:
menu->addAction(QString(tr("Edit phone item")), this, SLOT(editContact()));
+ menu->addAction(QString(tr("Delete phone item")), this, SLOT(deleteContact()));
break;
case mdf_type_fax:
@@ -429,6 +458,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_fax_item:
menu->addAction(QString(tr("Edit fax item")), this, SLOT(editContact()));
+ menu->addAction(QString(tr("Delete fax item")), this, SLOT(deleteContact()));
break;
case mdf_type_web:
@@ -437,6 +467,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_web_item:
menu->addAction(QString(tr("Edit web item")), this, SLOT(editContact()));
+ menu->addAction(QString(tr("Delete web item")), this, SLOT(deleteContact()));
break;
case mdf_type_social:
@@ -445,10 +476,11 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_social_item:
menu->addAction(QString(tr("Edit social item")), this, SLOT(editContact()));
+ menu->addAction(QString(tr("Delete social item")), this, SLOT(deleteContact()));
break;
case mdf_type_file:
- menu->addAction(QString(tr("Edit file items")), this, SLOT(loadSelectedMdf()));
+ // Do nothing
break;
case mdf_type_picture:
@@ -457,10 +489,12 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_picture_item:
menu->addAction(QString(tr("Edit picture item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete picture item")), this, SLOT(deleteFile()));
break;
case mdf_type_picture_sub_item:
menu->addAction(QString(tr("Edit picture item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete picture item")), this, SLOT(deleteFile()));
break;
case mdf_type_video:
@@ -468,7 +502,13 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
break;
case mdf_type_video_item:
- menu->addAction(QString(tr("Edit video")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Edit video item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete video item")), this, SLOT(deleteFile()));
+ break;
+
+ case mdf_type_video_sub_item:
+ menu->addAction(QString(tr("Edit video item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete video item")), this, SLOT(deleteFile()));
break;
case mdf_type_firmware:
@@ -476,7 +516,13 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
break;
case mdf_type_firmware_item:
- menu->addAction(QString(tr("Edit firmware")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Edit firmware item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete firmware item")), this, SLOT(deleteFile()));
+ break;
+
+ case mdf_type_firmware_sub_item:
+ menu->addAction(QString(tr("Edit firmware item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete firmware item")), this, SLOT(deleteFile()));
break;
case mdf_type_driver:
@@ -484,15 +530,27 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
break;
case mdf_type_driver_item:
- menu->addAction(QString(tr("Edit driver")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Edit driver item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete driver item")), this, SLOT(deleteFile()));
+ break;
+
+ case mdf_type_driver_sub_item:
+ menu->addAction(QString(tr("Edit driver item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete driver item")), this, SLOT(deleteFile()));
break;
case mdf_type_setup:
- menu->addAction(QString(tr("Edit setup items")), this, SLOT(editFileList()));
+ menu->addAction(QString(tr("Edit setup script items")), this, SLOT(editFileList()));
break;
case mdf_type_setup_item:
- menu->addAction(QString(tr("Edit Setup")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Edit setup-script item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete setup-script item")), this, SLOT(deleteFile()));
+ break;
+
+ case mdf_type_setup_sub_item:
+ menu->addAction(QString(tr("Edit setup-script item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete setup-script item")), this, SLOT(deleteFile()));
break;
case mdf_type_manual:
@@ -500,7 +558,13 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
break;
case mdf_type_manual_item:
- menu->addAction(QString(tr("Edit manual")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Edit manual item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete manual item")), this, SLOT(deleteFile()));
+ break;
+
+ case mdf_type_manual_sub_item:
+ menu->addAction(QString(tr("Edit manual item")), this, SLOT(editFile()));
+ menu->addAction(QString(tr("Delete manual item")), this, SLOT(deleteFile()));
break;
case mdf_type_generic_string:
@@ -529,6 +593,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_generic_description_item:
menu->addAction(QString(tr("Edit Description")), this, SLOT(editDescription(void)));
+ menu->addAction(QString(tr("Delete Description")), this, SLOT(deleteDescription(void)));
break;
case mdf_type_generic_help_url:
@@ -537,6 +602,7 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
case mdf_type_generic_help_url_item:
menu->addAction(QString(tr("Edit Info URL")), this, SLOT(editInfoUrl(void)));
+ menu->addAction(QString(tr("Delete Info URL")), this, SLOT(deleteInfoUrl(void)));
break;
default:
@@ -549,14 +615,14 @@ CFrmMdf::showMdfContextMenu(const QPoint& pos)
}
///////////////////////////////////////////////////////////////////////////////
-// fillDescriptionItems
+// renderDescriptionItems
//
void
-CFrmMdf::fillDescriptionItems(QTreeWidgetItem* pParent,
- CMDF_Object* pobj,
- std::map* pObjMap,
- bool bChildIsKnown)
+CFrmMdf::renderDescriptionItems(QTreeWidgetItem* pParent,
+ CMDF_Object* pobj,
+ std::map* pObjMap,
+ bool bChildIsKnown)
{
QString str;
QMdfTreeWidgetItem* pItemModuleDescription;
@@ -601,14 +667,14 @@ CFrmMdf::fillDescriptionItems(QTreeWidgetItem* pParent,
}
///////////////////////////////////////////////////////////////////////////////
-// fillInfoUrlItems
+// renderInfoUrlItems
//
void
-CFrmMdf::fillInfoUrlItems(QTreeWidgetItem* pParent,
- CMDF_Object* pobj,
- std::map* pObjMap,
- bool bChildIsKnown)
+CFrmMdf::renderInfoUrlItems(QTreeWidgetItem* pParent,
+ CMDF_Object* pobj,
+ std::map* pObjMap,
+ bool bChildIsKnown)
{
QString str;
QMdfTreeWidgetItem* pItemModuleHelpUrl;
@@ -653,11 +719,11 @@ CFrmMdf::fillInfoUrlItems(QTreeWidgetItem* pParent,
}
///////////////////////////////////////////////////////////////////////////////
-// fillRegisterInfo
+// renderRegisterInfo
//
void
-CFrmMdf::fillBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits)
+CFrmMdf::renderBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits)
{
QString str;
QMdfTreeWidgetItem* pItem;
@@ -738,22 +804,22 @@ CFrmMdf::fillBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits)
pItemParent->addChild(pItem);
// Valid values
- fillValueInfo(pItemParent, *pbit->getListValues());
+ renderValueInfo(pItemParent, *pbit->getListValues());
// Descriptions
- fillDescriptionItems(pItemParent, pbit, pbit->getMapDescription());
+ renderDescriptionItems(pItemParent, pbit, pbit->getMapDescription());
// Info URL's
- fillInfoUrlItems(pItemParent, pbit, pbit->getMapDescription());
+ renderInfoUrlItems(pItemParent, pbit, pbit->getMapDescription());
}
}
///////////////////////////////////////////////////////////////////////////////
-// fillValueInfo
+// renderValueInfo
//
void
-CFrmMdf::fillValueInfo(QTreeWidgetItem* pParent, std::deque& dequevalues)
+CFrmMdf::renderValueInfo(QTreeWidgetItem* pParent, std::deque& dequevalues)
{
QString str;
QMdfTreeWidgetItem* pItem;
@@ -796,19 +862,19 @@ CFrmMdf::fillValueInfo(QTreeWidgetItem* pParent, std::deque& dequev
pItemValue->addChild(pItem);
// Descriptions
- fillDescriptionItems(pItemParent, pvalue, pvalue->getMapDescription());
+ renderDescriptionItems(pItemParent, pvalue, pvalue->getMapDescription());
// Info URL's
- fillInfoUrlItems(pItemParent, pvalue, pvalue->getMapDescription());
+ renderInfoUrlItems(pItemParent, pvalue, pvalue->getMapDescription());
}
}
///////////////////////////////////////////////////////////////////////////////
-// fillRegisterInfo
+// renderRegisterInfo
//
void
-CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg)
+CFrmMdf::renderRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg)
{
QString str;
QMdfTreeWidgetItem* pItem;
@@ -821,70 +887,77 @@ CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg)
return;
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_string);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_name);
if (nullptr != pItem) {
str = QString("Name: %1").arg(preg->getName().c_str());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_page);
if (nullptr != pItem) {
str = QString("Page: %1").arg(preg->getPage());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_offset);
if (nullptr != pItem) {
str = QString("Offset: %1").arg(preg->getOffset());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_type);
if (nullptr != pItem) {
- str = QString("Default value: %1").arg(preg->getDefault().c_str());
- pItem->setText(0, str);
- pParent->addChild(pItem);
- }
+ str = QString("Type: %1").arg(preg->getType());
+ switch (preg->getType()) {
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
- if (nullptr != pItem) {
- str = QString("Min value: %1").arg(preg->getMin());
+ case MDF_REG_TYPE_STANDARD:
+ str += " - (std)";
+ break;
+
+ case MDF_REG_TYPE_DMATRIX1:
+ str += " - (dm1)";
+ break;
+
+ case MDF_REG_TYPE_BLOCK:
+ str += " - (block)";
+ break;
+ }
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_span);
if (nullptr != pItem) {
- str = QString("Max value: %1").arg(preg->getMax());
+ str = QString("Span: %1").arg(preg->getSpan());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_width);
if (nullptr != pItem) {
- str = QString("Register span: %1").arg(preg->getSpan());
+ str = QString("Width: %1").arg(preg->getWidth());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_min);
if (nullptr != pItem) {
- str = QString("Register width: %1").arg(preg->getWidth());
+ str = QString("Min: %1").arg(preg->getMin());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_max);
if (nullptr != pItem) {
- str = QString("Size: %1").arg(preg->getSize());
+ str = QString("Max: %1").arg(preg->getMax());
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_access);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_access);
if (nullptr != pItem) {
str = QString("Access: %1 (").arg(preg->getAccess());
if (2 & preg->getAccess()) {
@@ -898,52 +971,43 @@ CFrmMdf::fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg)
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_number);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_default);
if (nullptr != pItem) {
- str = QString("Type: %1").arg(preg->getType());
- switch (preg->getType()) {
-
- case MDF_REG_TYPE_STANDARD:
- str += " - (std)";
- break;
-
- case MDF_REG_TYPE_DMATRIX1:
- str += " - (dm1)";
- break;
-
- case MDF_REG_TYPE_BLOCK:
- str += " - (block)";
- break;
+ if (preg->getDefault() == "UNDEF") {
+ str = tr("Default: no default value");
+ }
+ else {
+ str = QString("Default: %1").arg(preg->getDefault().c_str());
}
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_string);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_fgcolor);
if (nullptr != pItem) {
- str = QString("Foreground color: 0x%1").arg(preg->getForegroundColor(), 1, 16);
+ str = QString("Foreground color: 0x%1").arg(preg->getForegroundColor(), 8, 16, QChar('0'));
pItem->setText(0, str);
pParent->addChild(pItem);
}
- pItem = new QMdfTreeWidgetItem(pParent, mdf_type_generic_string);
+ pItem = new QMdfTreeWidgetItem(pParent, preg, mdf_type_register_sub_item, CDlgMdfRegister::index_bgcolor);
if (nullptr != pItem) {
- str = QString("Background color: 0x%1").arg(preg->getBackgroundColor(), 1, 16);
+ str = QString("Background color: 0x%1").arg(preg->getBackgroundColor(), 8, 16, QChar('0'));
pItem->setText(0, str);
pParent->addChild(pItem);
}
// Fill in bit field info
- fillBitInfo(pParent, *preg->getListBits());
+ renderBitInfo(pParent, *preg->getListBits());
// Fill in valid values
- fillValueInfo(pParent, *preg->getListValues());
+ renderValueInfo(pParent, *preg->getListValues());
// Descriptions
- fillDescriptionItems(pParent, preg, preg->getMapDescription());
+ renderDescriptionItems(pParent, preg, preg->getMapDescription());
// Info URL's
- fillInfoUrlItems(pParent, preg, preg->getMapDescription());
+ renderInfoUrlItems(pParent, preg, preg->getMapDescription());
}
///////////////////////////////////////////////////////////////////////////////
@@ -963,12 +1027,12 @@ CFrmMdf::renderManufacturerEmail(QMdfTreeWidgetItem* pItemEmailHead)
pItem = new QMdfTreeWidgetItem(pItemEmailHead, pItemEmail, mdf_type_email_item, index);
pItem->setText(0, pItemEmail->getName().c_str());
pItemEmailHead->addChild(pItem);
- fillDescriptionItems(pItem,
- pItemEmail,
- pItemEmail->getMapDescription());
- fillInfoUrlItems(pItem,
- pItemEmail,
- pItemEmail->getMapInfoUrl());
+ renderDescriptionItems(pItem,
+ pItemEmail,
+ pItemEmail->getMapDescription());
+ renderInfoUrlItems(pItem,
+ pItemEmail,
+ pItemEmail->getMapInfoUrl());
index++;
}
} while (nullptr != pItemEmail);
@@ -991,12 +1055,12 @@ CFrmMdf::renderManufacturerPhone(QMdfTreeWidgetItem* pItemPhoneHead)
pItem = new QMdfTreeWidgetItem(pItemPhoneHead, pItemPhone, mdf_type_phone_item, index);
pItem->setText(0, pItemPhone->getName().c_str());
pItemPhoneHead->addChild(pItem);
- fillDescriptionItems(pItem,
- pItemPhone,
- pItemPhone->getMapDescription());
- fillInfoUrlItems(pItem,
- pItemPhone,
- pItemPhone->getMapInfoUrl());
+ renderDescriptionItems(pItem,
+ pItemPhone,
+ pItemPhone->getMapDescription());
+ renderInfoUrlItems(pItem,
+ pItemPhone,
+ pItemPhone->getMapInfoUrl());
index++;
}
} while (nullptr != pItemPhone);
@@ -1019,12 +1083,12 @@ CFrmMdf::renderManufacturerFax(QMdfTreeWidgetItem* pItemFaxHead)
pItem = new QMdfTreeWidgetItem(pItemFaxHead, pItemFax, mdf_type_phone_item, index);
pItem->setText(0, pItemFax->getName().c_str());
pItemFaxHead->addChild(pItem);
- fillDescriptionItems(pItem,
- pItemFax,
- pItemFax->getMapDescription());
- fillInfoUrlItems(pItem,
- pItemFax,
- pItemFax->getMapInfoUrl());
+ renderDescriptionItems(pItem,
+ pItemFax,
+ pItemFax->getMapDescription());
+ renderInfoUrlItems(pItem,
+ pItemFax,
+ pItemFax->getMapInfoUrl());
index++;
}
} while (nullptr != pItemFax);
@@ -1047,12 +1111,12 @@ CFrmMdf::renderManufacturerWeb(QMdfTreeWidgetItem* pItemWebHead)
pItem = new QMdfTreeWidgetItem(pItemWebHead, pItemWeb, mdf_type_phone_item, index);
pItem->setText(0, pItemWeb->getName().c_str());
pItemWebHead->addChild(pItem);
- fillDescriptionItems(pItem,
- pItemWeb,
- pItemWeb->getMapDescription());
- fillInfoUrlItems(pItem,
- pItemWeb,
- pItemWeb->getMapInfoUrl());
+ renderDescriptionItems(pItem,
+ pItemWeb,
+ pItemWeb->getMapDescription());
+ renderInfoUrlItems(pItem,
+ pItemWeb,
+ pItemWeb->getMapInfoUrl());
index++;
}
} while (nullptr != pItemWeb);
@@ -1075,12 +1139,12 @@ CFrmMdf::renderManufacturerSocial(QMdfTreeWidgetItem* pItemSocialHead)
pItem = new QMdfTreeWidgetItem(pItemSocialHead, pItemSocial, mdf_type_phone_item, index);
pItem->setText(0, pItemSocial->getName().c_str());
pItemSocialHead->addChild(pItem);
- fillDescriptionItems(pItem,
- pItemSocial,
- pItemSocial->getMapDescription());
- fillInfoUrlItems(pItem,
- pItemSocial,
- pItemSocial->getMapInfoUrl());
+ renderDescriptionItems(pItem,
+ pItemSocial,
+ pItemSocial->getMapDescription());
+ renderInfoUrlItems(pItem,
+ pItemSocial,
+ pItemSocial->getMapInfoUrl());
index++;
}
} while (nullptr != pItemSocial);
@@ -1187,36 +1251,36 @@ CFrmMdf::renderPictureSubItems(QMdfTreeWidgetItem* pPictureItem, CMDF_Picture* p
str = QString(CDlgMdfFile::pre_str_picture) + QString(" ") + pPictureObj->getName().c_str();
pPictureItem->setText(0, str);
- pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, 0);
+ pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, static_cast(index_file_picture_name));
if (nullptr != pSubItem) {
str = QString("Name: ") + pPictureObj->getName().c_str();
pSubItem->setText(0, str);
pPictureItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, 1);
+ pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, static_cast(index_file_picture_url));
if (nullptr != pSubItem) {
str = QString("URL: ") + pPictureObj->getUrl().c_str();
pSubItem->setText(0, str);
pPictureItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, 2);
+ pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, static_cast(index_file_picture_format));
if (nullptr != pSubItem) {
str = QString("Format: ") + pPictureObj->getFormat().c_str();
pSubItem->setText(0, str);
pPictureItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, 3);
+ pSubItem = new QMdfTreeWidgetItem(pPictureItem, pPictureObj, mdf_type_picture_sub_item, static_cast(index_file_picture_date));
if (nullptr != pSubItem) {
str = QString("Date: %1").arg(pPictureObj->getDate().c_str());
pSubItem->setText(0, str);
pPictureItem->addChild(pSubItem);
}
- fillDescriptionItems(pPictureItem, pPictureObj, pPictureObj->getMapDescription());
- fillInfoUrlItems(pPictureItem, pPictureObj, pPictureObj->getMapInfoUrl());
+ renderDescriptionItems(pPictureItem, pPictureObj, pPictureObj->getMapDescription());
+ renderInfoUrlItems(pPictureItem, pPictureObj, pPictureObj->getMapInfoUrl());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1270,36 +1334,39 @@ CFrmMdf::renderVideoSubItems(QMdfTreeWidgetItem* pVideoItem, CMDF_Video* pVideoO
return;
}
- pSubItem = new QMdfTreeWidgetItem(pVideoItem, mdf_type_video_sub_item);
+ str = QString(CDlgMdfFile::pre_str_video) + QString(" ") + pVideoObj->getName().c_str();
+ pVideoItem->setText(0, str);
+
+ pSubItem = new QMdfTreeWidgetItem(pVideoItem, pVideoObj, mdf_type_video_sub_item, static_cast(index_file_video_name));
if (nullptr != pSubItem) {
str = QString("Name: ") + pVideoObj->getName().c_str();
pSubItem->setText(0, str);
pVideoItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pVideoItem, mdf_type_video_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pVideoItem, pVideoObj, mdf_type_video_sub_item, static_cast(index_file_video_url));
if (nullptr != pSubItem) {
str = QString("URL: ") + pVideoObj->getUrl().c_str();
pSubItem->setText(0, str);
pVideoItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pVideoItem, mdf_type_video_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pVideoItem, pVideoObj, mdf_type_video_sub_item, static_cast(index_file_video_format));
if (nullptr != pSubItem) {
str = QString("Format: ") + pVideoObj->getFormat().c_str();
pSubItem->setText(0, str);
pVideoItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pVideoItem, mdf_type_video_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pVideoItem, pVideoObj, mdf_type_video_sub_item, static_cast(index_file_video_date));
if (nullptr != pSubItem) {
str = QString("Date: %1").arg(pVideoObj->getDate().c_str());
pSubItem->setText(0, str);
pVideoItem->addChild(pSubItem);
}
- fillDescriptionItems(pVideoItem, pVideoObj, pVideoObj->getMapDescription());
- fillInfoUrlItems(pVideoItem, pVideoObj, pVideoObj->getMapInfoUrl());
+ renderDescriptionItems(pVideoItem, pVideoObj, pVideoObj->getMapDescription());
+ renderInfoUrlItems(pVideoItem, pVideoObj, pVideoObj->getMapInfoUrl());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1348,36 +1415,39 @@ CFrmMdf::renderManualSubItems(QMdfTreeWidgetItem* pManualItem, CMDF_Manual* pMan
return;
}
- pSubItem = new QMdfTreeWidgetItem(pManualItem, mdf_type_manual_sub_item);
+ str = QString(CDlgMdfFile::pre_str_manual) + QString(" ") + pManualObj->getName().c_str();
+ pManualItem->setText(0, str);
+
+ pSubItem = new QMdfTreeWidgetItem(pManualItem, pManualObj, mdf_type_manual_sub_item, static_cast(index_file_manual_name));
if (nullptr != pSubItem) {
str = QString("Name: %1").arg(pManualObj->getName().c_str());
pSubItem->setText(0, str);
pManualItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pManualItem, mdf_type_manual_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pManualItem, pManualObj, mdf_type_manual_sub_item, static_cast(index_file_manual_url));
if (nullptr != pSubItem) {
str = QString("URL: ") + pManualObj->getUrl().c_str();
pSubItem->setText(0, str);
pManualItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pManualItem, mdf_type_manual_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pManualItem, pManualObj, mdf_type_manual_sub_item, static_cast(index_file_manual_format));
if (nullptr != pSubItem) {
str = QString("Format: ") + pManualObj->getFormat().c_str();
pSubItem->setText(0, str);
pManualItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pManualItem, mdf_type_manual_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pManualItem, pManualObj, mdf_type_manual_sub_item, static_cast(index_file_manual_date));
if (nullptr != pSubItem) {
str = QString("Date: %1").arg(pManualObj->getDate().c_str());
pSubItem->setText(0, str);
pManualItem->addChild(pSubItem);
}
- fillDescriptionItems(pManualItem, pManualObj, pManualObj->getMapDescription());
- fillInfoUrlItems(pManualItem, pManualObj, pManualObj->getMapInfoUrl());
+ renderDescriptionItems(pManualItem, pManualObj, pManualObj->getMapDescription());
+ renderInfoUrlItems(pManualItem, pManualObj, pManualObj->getMapInfoUrl());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1426,71 +1496,74 @@ CFrmMdf::renderDriverSubItems(QMdfTreeWidgetItem* pDriverItem, CMDF_Driver* pDri
return;
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ str = QString(CDlgMdfFile::pre_str_driver) + QString(" ") + pDriverObj->getName().c_str();
+ pDriverItem->setText(0, str);
+
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_name));
if (nullptr != pSubItem) {
str = QString("Name: %1").arg(pDriverObj->getName().c_str());
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_version));
if (nullptr != pSubItem) {
str = QString("Version: %1.%2.%3").arg(pDriverObj->getVersionMajor()).arg(pDriverObj->getVersionMinor()).arg(pDriverObj->getVersionPatch());
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_date));
if (nullptr != pSubItem) {
str = QString("Date: ") + pDriverObj->getDate().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_url));
if (nullptr != pSubItem) {
str = QString("URL: ") + pDriverObj->getUrl().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_type));
if (nullptr != pSubItem) {
str = QString("Type: ") + pDriverObj->getType().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_architecture));
if (nullptr != pSubItem) {
str = QString("Architecture: ") + pDriverObj->getFormat().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_os));
if (nullptr != pSubItem) {
str = QString("OS: ") + pDriverObj->getOS().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_os_version));
if (nullptr != pSubItem) {
str = QString("OS Version: ") + pDriverObj->getOSVer().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pDriverItem, mdf_type_driver_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pDriverItem, pDriverObj, mdf_type_driver_sub_item, static_cast(index_file_driver_md5));
if (nullptr != pSubItem) {
str = QString("MD5 Checksum: ") + pDriverObj->getMd5().c_str();
pSubItem->setText(0, str);
pDriverItem->addChild(pSubItem);
}
- fillDescriptionItems(pDriverItem, pDriverObj, pDriverObj->getMapDescription());
- fillInfoUrlItems(pDriverItem, pDriverObj, pDriverObj->getMapInfoUrl());
+ renderDescriptionItems(pDriverItem, pDriverObj, pDriverObj->getMapDescription());
+ renderInfoUrlItems(pDriverItem, pDriverObj, pDriverObj->getMapInfoUrl());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1541,21 +1614,24 @@ CFrmMdf::renderSetupSubItems(QMdfTreeWidgetItem* pSetupItem, CMDF_Setup* pSetupO
return;
}
- pSubItem = new QMdfTreeWidgetItem(pSetupItem, mdf_type_setup_sub_item);
+ str = QString(CDlgMdfFile::pre_str_setup) + QString(" ") + pSetupObj->getName().c_str();
+ pSetupItem->setText(0, str);
+
+ pSubItem = new QMdfTreeWidgetItem(pSetupItem, pSetupObj, mdf_type_setup_sub_item, static_cast(index_file_setup_name));
if (nullptr != pSubItem) {
str = QString("Name: %1").arg(pSetupObj->getName().c_str());
pSubItem->setText(0, str);
pSetupItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pSetupItem, mdf_type_setup_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pSetupItem, pSetupObj, mdf_type_setup_sub_item, static_cast(index_file_setup_url));
if (nullptr != pSubItem) {
str = QString("URL: ") + pSetupObj->getUrl().c_str();
pSubItem->setText(0, str);
pSetupItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pSetupItem, mdf_type_setup_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pSetupItem, pSetupObj, mdf_type_setup_sub_item, static_cast(index_file_setup_format));
if (nullptr != pSubItem) {
str = QString("Format: ") + pSetupObj->getFormat().c_str();
// pSubItem->setFont(0, fontTopItem);
@@ -1564,15 +1640,15 @@ CFrmMdf::renderSetupSubItems(QMdfTreeWidgetItem* pSetupItem, CMDF_Setup* pSetupO
pSetupItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pSetupItem, mdf_type_setup_sub_item);
+ pSubItem = new QMdfTreeWidgetItem(pSetupItem, pSetupObj, mdf_type_setup_sub_item, static_cast(index_file_setup_date));
if (nullptr != pSubItem) {
str = QString("Date: %1").arg(pSetupObj->getDate().c_str());
pSubItem->setText(0, str);
pSetupItem->addChild(pSubItem);
}
- fillDescriptionItems(pSetupItem, pSetupObj, pSetupObj->getMapDescription());
- fillInfoUrlItems(pSetupItem, pSetupObj, pSetupObj->getMapInfoUrl());
+ renderDescriptionItems(pSetupItem, pSetupObj, pSetupObj->getMapDescription());
+ renderInfoUrlItems(pSetupItem, pSetupObj, pSetupObj->getMapInfoUrl());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1617,75 +1693,78 @@ CFrmMdf::renderFirmwareSubItems(QMdfTreeWidgetItem* pFirmwareItem, CMDF_Firmware
QString str;
QMdfTreeWidgetItem* pSubItem;
+ str = QString(CDlgMdfFile::pre_str_firmware) + QString(" ") + pFirmwareObj->getName().c_str();
+ pFirmwareItem->setText(0, str);
+
if ((nullptr == pFirmwareObj) && (nullptr == pFirmwareItem)) {
return;
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_string);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_name));
if (nullptr != pSubItem) {
str = QString("Name: %1").arg(pFirmwareObj->getName().c_str());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_string);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_version));
if (nullptr != pSubItem) {
str = QString("Version: %1.%2.%3").arg(pFirmwareObj->getVersionMajor()).arg(pFirmwareObj->getVersionMinor()).arg(pFirmwareObj->getVersionPatch());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_url);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_url));
if (nullptr != pSubItem) {
str = QString("URL: %1").arg(pFirmwareObj->getUrl().c_str());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_date);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_date));
if (nullptr != pSubItem) {
str = QString("Date: %1").arg(pFirmwareObj->getDate().c_str());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_number);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_target_code));
if (nullptr != pSubItem) {
str = QString("Target Code: %1").arg(pFirmwareObj->getTargetCode());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_string);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_target));
if (nullptr != pSubItem) {
str = QString("Target: %1").arg(pFirmwareObj->getTarget().c_str());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_string);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_format));
if (nullptr != pSubItem) {
str = QString("Format: %1").arg(pFirmwareObj->getFormat().c_str());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_number);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_size));
if (nullptr != pSubItem) {
str = QString("Size: %1").arg(pFirmwareObj->getSize());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, mdf_type_generic_string);
+ pSubItem = new QMdfTreeWidgetItem(pFirmwareItem, pFirmwareObj, mdf_type_firmware_sub_item, static_cast(index_file_firmware_md5));
if (nullptr != pSubItem) {
str = QString("MD5 Checksum: %1").arg(pFirmwareObj->getMd5().c_str());
pSubItem->setText(0, str);
pFirmwareItem->addChild(pSubItem);
}
- fillDescriptionItems(pFirmwareItem, pFirmwareObj, pFirmwareObj->getMapDescription());
- fillInfoUrlItems(pFirmwareItem, pFirmwareObj, pFirmwareObj->getMapInfoUrl());
+ renderDescriptionItems(pFirmwareItem, pFirmwareObj, pFirmwareObj->getMapDescription());
+ renderInfoUrlItems(pFirmwareItem, pFirmwareObj, pFirmwareObj->getMapInfoUrl());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1789,8 +1868,8 @@ CFrmMdf::loadMdf(void)
pItem->setText(0, str);
pItemModule->addChild(pItem);
- fillDescriptionItems(pItemModule, &m_mdf, m_mdf.getMapDescription());
- fillInfoUrlItems(pItemModule, &m_mdf, m_mdf.getHelpUrlMap());
+ renderDescriptionItems(pItemModule, &m_mdf, m_mdf.getMapDescription());
+ renderInfoUrlItems(pItemModule, &m_mdf, m_mdf.getHelpUrlMap());
// * * * Manufacturer info * * *
@@ -1877,6 +1956,7 @@ CFrmMdf::loadMdf(void)
mdf_type_email);
// pItemEmailHead->setFont(0, fontTopItem);
// pItemEmailHead->setForeground(0, darkMagentaBrush);
+ m_headManufacturerEmail = pItemEmailHead;
pItemEmailHead->setText(0, tr("Email"));
pItemModule->addChild(pItemEmailHead);
@@ -1887,6 +1967,7 @@ CFrmMdf::loadMdf(void)
mdf_type_phone);
// pItemPhoneHead->setFont(0, fontTopItem);
// pItemEmailHead->setForeground(0, darkMagentaBrush);
+ m_headManufacturerPhone = pItemPhoneHead;
pItemPhoneHead->setText(0, tr("Phone"));
pItemModule->addChild(pItemPhoneHead);
@@ -1897,6 +1978,7 @@ CFrmMdf::loadMdf(void)
mdf_type_fax);
// pItemFaxHead->setFont(0, fontTopItem);
// pItemEmailHead->setForeground(0, darkMagentaBrush);
+ m_headManufacturerFax = pItemFaxHead;
pItemFaxHead->setText(0, tr("Fax"));
pItemModule->addChild(pItemFaxHead);
@@ -1907,6 +1989,7 @@ CFrmMdf::loadMdf(void)
mdf_type_web);
// pItemWebHead->setFont(0, fontTopItem);
// pItemEmailHead->setForeground(0, darkMagentaBrush);
+ m_headManufacturerWeb = pItemWebHead;
pItemWebHead->setText(0, tr("Web"));
pItemModule->addChild(pItemWebHead);
@@ -1917,6 +2000,7 @@ CFrmMdf::loadMdf(void)
mdf_type_social);
// pItemSocialHead->setFont(0, fontTopItem);
// pItemEmailHead->setForeground(0, darkMagentaBrush);
+ m_headManufacturerSocial = pItemSocialHead;
pItemSocialHead->setText(0, tr("Social"));
pItemModule->addChild(pItemSocialHead);
@@ -1952,7 +2036,7 @@ CFrmMdf::loadMdf(void)
// Picture file(s)
QMdfTreeWidgetItem* pItemPicture = new QMdfTreeWidgetItem(pItemFiles, &m_mdf, mdf_type_picture);
- m_headFilePicture = m_headFilePicture;
+ m_headFilePicture = pItemPicture;
pItemPicture->setFont(0, fontTopItem);
pItemPicture->setText(0, tr("Pictures"));
pItemFiles->addChild(pItemPicture);
@@ -1962,7 +2046,7 @@ CFrmMdf::loadMdf(void)
// Video file(s)
QMdfTreeWidgetItem* pItemVideo = new QMdfTreeWidgetItem(pItemFiles, &m_mdf, mdf_type_video);
- m_headFileVideo = m_headFileVideo;
+ m_headFileVideo = pItemVideo;
pItemVideo->setFont(0, fontTopItem);
pItemVideo->setText(0, tr("Videos"));
pItemFiles->addChild(pItemVideo);
@@ -1972,7 +2056,7 @@ CFrmMdf::loadMdf(void)
// Manuals
QMdfTreeWidgetItem* pItemManual = new QMdfTreeWidgetItem(pItemFiles, &m_mdf, mdf_type_manual);
- m_headFileManual = m_headFileManual;
+ m_headFileManual = pItemManual;
pItemManual->setFont(0, fontTopItem);
pItemManual->setText(0, tr("Manuals"));
pItemFiles->addChild(pItemManual);
@@ -1982,7 +2066,7 @@ CFrmMdf::loadMdf(void)
// Firmware file(s)
QMdfTreeWidgetItem* pItemFirmware = new QMdfTreeWidgetItem(pItemFiles, &m_mdf, mdf_type_firmware);
- m_headFileFirmware = m_headFileFirmware;
+ m_headFileFirmware = pItemFirmware;
pItemFirmware->setFont(0, fontTopItem);
pItemFirmware->setText(0, tr("Firmware"));
pItemFiles->addChild(pItemFirmware);
@@ -1992,7 +2076,7 @@ CFrmMdf::loadMdf(void)
// Drivers
QMdfTreeWidgetItem* pItemDriver = new QMdfTreeWidgetItem(pItemFiles, &m_mdf, mdf_type_driver);
- m_headFileDriver = m_headFileDriver;
+ m_headFileDriver = pItemDriver;
pItemDriver->setFont(0, fontTopItem);
pItemDriver->setText(0, tr("Drivers"));
pItemFiles->addChild(pItemDriver);
@@ -2016,7 +2100,7 @@ CFrmMdf::loadMdf(void)
std::set pages;
QMdfTreeWidgetItem* pSubItem;
- QMdfTreeWidgetItem* pItemRegister = new QMdfTreeWidgetItem(pItemModule, mdf_type_register);
+ QMdfTreeWidgetItem* pItemRegister = new QMdfTreeWidgetItem(pItemModule, &m_mdf, mdf_type_register);
m_headRegister = pItemRegister;
pItemRegister->setFont(0, fontTopItem);
pItemRegister->setForeground(0, greenBrush);
@@ -2031,7 +2115,7 @@ CFrmMdf::loadMdf(void)
if (nPages > 1) {
for (auto itr : pages) {
- pItem = new QMdfTreeWidgetItem(pItemRegister, mdf_type_register_page);
+ pItem = new QMdfTreeWidgetItem(pItemRegister, &m_mdf, mdf_type_register_page, itr);
if (nullptr != pItem) {
str = QString("Register page: %1").arg(itr);
@@ -2041,12 +2125,12 @@ CFrmMdf::loadMdf(void)
// Add registers for page
for (auto it = regs->cbegin(); it != regs->cend(); ++it) {
if (itr == (*it)->getPage()) {
- pSubItem = new QMdfTreeWidgetItem(pItem, mdf_type_register_item);
+ pSubItem = new QMdfTreeWidgetItem(pItem, (*it), mdf_type_register_item);
if (nullptr != pSubItem) {
str = QString("Register %1 %2").arg((*it)->getOffset()).arg((*it)->getName().c_str());
pSubItem->setText(0, str);
pItem->addChild(pSubItem);
- fillRegisterInfo(pSubItem, *it);
+ renderRegisterInfo(pSubItem, *it);
}
}
}
@@ -2057,7 +2141,7 @@ CFrmMdf::loadMdf(void)
else {
std::map mapRegs;
m_mdf.getRegisterMap(0, mapRegs);
- fillRegisterInfo(pItem, mapRegs[0]);
+ renderRegisterInfo(pItem, mapRegs[0]);
}
// * * * Remote variables * * *
@@ -2162,16 +2246,16 @@ CFrmMdf::loadMdf(void)
}
// Fill in bit field info
- fillBitInfo(pSubItem, *pvar->getListBits());
+ renderBitInfo(pSubItem, *pvar->getListBits());
// Fill in valid values
- fillValueInfo(pSubItem, *pvar->getListValues());
+ renderValueInfo(pSubItem, *pvar->getListValues());
// Descriptions
- fillDescriptionItems(pSubItem, pvar, pvar->getMapDescription());
+ renderDescriptionItems(pSubItem, pvar, pvar->getMapDescription());
// Info URL's
- fillInfoUrlItems(pSubItem, pvar, pvar->getMapDescription());
+ renderInfoUrlItems(pSubItem, pvar, pvar->getMapDescription());
}
}
}
@@ -2188,7 +2272,7 @@ CFrmMdf::loadMdf(void)
std::deque* palarm = m_mdf.getAlarmList();
// Fill in bit field info
- fillBitInfo(pItemAlarm, *palarm);
+ renderBitInfo(pItemAlarm, *palarm);
// * * * Decision Matrix * * *
@@ -2320,25 +2404,25 @@ CFrmMdf::loadMdf(void)
}
// Fill in bit field info
- fillBitInfo(pActionParamItem, *pactionparam->getListBits());
+ renderBitInfo(pActionParamItem, *pactionparam->getListBits());
// Fill in valid values
- fillValueInfo(pActionParamItem, *pactionparam->getListValues());
+ renderValueInfo(pActionParamItem, *pactionparam->getListValues());
// Descriptions
- fillDescriptionItems(pActionParamItem, pactionparam, pactionparam->getMapDescription());
+ renderDescriptionItems(pActionParamItem, pactionparam, pactionparam->getMapDescription());
// Info URL's
- fillInfoUrlItems(pActionParamItem, pactionparam, pactionparam->getMapDescription());
+ renderInfoUrlItems(pActionParamItem, pactionparam, pactionparam->getMapDescription());
}
}
}
// Descriptions
- fillDescriptionItems(pSubItemAction, paction, paction->getMapDescription());
+ renderDescriptionItems(pSubItemAction, paction, paction->getMapDescription());
// Info URL's
- fillInfoUrlItems(pSubItemAction, paction, paction->getMapDescription());
+ renderInfoUrlItems(pSubItemAction, paction, paction->getMapDescription());
}
}
@@ -2444,25 +2528,25 @@ CFrmMdf::loadMdf(void)
}
// Fill in bit field info
- fillBitInfo(pEventSubItem, *pEventData->getListBits());
+ renderBitInfo(pEventSubItem, *pEventData->getListBits());
// Fill in valid values
- fillValueInfo(pEventSubItem, *pEventData->getListValues());
+ renderValueInfo(pEventSubItem, *pEventData->getListValues());
// Descriptions
- fillDescriptionItems(pEventSubItem, pEventData, pEventData->getMapDescription());
+ renderDescriptionItems(pEventSubItem, pEventData, pEventData->getMapDescription());
// Info URL's
- fillInfoUrlItems(pEventSubItem, pEventData, pEventData->getMapDescription());
+ renderInfoUrlItems(pEventSubItem, pEventData, pEventData->getMapDescription());
}
} // EventDataList
} // list exist
// Descriptions
- fillDescriptionItems(pSubItem, pevent, pevent->getMapDescription());
+ renderDescriptionItems(pSubItem, pevent, pevent->getMapDescription());
// Info URL's
- fillInfoUrlItems(pSubItem, pevent, pevent->getMapDescription());
+ renderInfoUrlItems(pSubItem, pevent, pevent->getMapDescription());
}
}
} // EventList
@@ -2829,11 +2913,11 @@ CFrmMdf::deleteMdfWidgetChildItems(QMdfTreeWidgetItem* pItem, mdf_record_type ty
}
///////////////////////////////////////////////////////////////////////////////
-// editData
+// editItem
//
void
-CFrmMdf::editData()
+CFrmMdf::editItem()
{
QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
@@ -2864,12 +2948,19 @@ CFrmMdf::editData()
break;
case mdf_type_register_page:
+ editRegister();
break;
case mdf_type_register:
+ editRegister();
break;
case mdf_type_register_item:
+ editRegister();
+ break;
+
+ case mdf_type_register_sub_item:
+ editRegister();
break;
case mdf_type_remotevar:
@@ -2966,39 +3057,75 @@ CFrmMdf::editData()
break;
case mdf_type_picture:
+ editFileList();
break;
case mdf_type_picture_item:
+ editFile();
+ break;
+
+ case mdf_type_picture_sub_item:
+ editFile();
break;
case mdf_type_video:
+ editFileList();
break;
case mdf_type_video_item:
+ editFile();
+ break;
+
+ case mdf_type_video_sub_item:
+ editFile();
break;
case mdf_type_firmware:
+ editFileList();
break;
case mdf_type_firmware_item:
+ editFile();
+ break;
+
+ case mdf_type_firmware_sub_item:
+ editFile();
break;
case mdf_type_driver:
+ editFileList();
break;
case mdf_type_driver_item:
+ editFile();
+ break;
+
+ case mdf_type_driver_sub_item:
+ editFile();
break;
case mdf_type_setup:
+ editFileList();
break;
case mdf_type_setup_item:
+ editFile();
+ break;
+
+ case mdf_type_setup_sub_item:
+ editFile();
break;
case mdf_type_manual:
+ editFileList();
break;
case mdf_type_manual_item:
+ editFile();
+ break;
+
+ case mdf_type_manual_sub_item:
+ editFile();
break;
case mdf_type_generic_string:
@@ -3017,15 +3144,19 @@ CFrmMdf::editData()
break;
case mdf_type_generic_description:
+ editDescription();
break;
case mdf_type_generic_description_item:
+ editDescription();
break;
case mdf_type_generic_help_url:
+ editInfoUrl();
break;
case mdf_type_generic_help_url_item:
+ editInfoUrl();
break;
default:
@@ -3034,301 +3165,265 @@ CFrmMdf::editData()
}
///////////////////////////////////////////////////////////////////////////////
-// editModuleData
+// deleteItem
//
void
-CFrmMdf::editModuleData()
+CFrmMdf::deleteItem()
{
- QMdfTreeWidgetItem* pItemModule = nullptr; // Pointer to module top item
- QMdfTreeWidgetItem* pItemDescription = nullptr; // Pointer to description top item
- QMdfTreeWidgetItem* pItemItemInfoURL = nullptr; // Pointer to info URL top item
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
- // Item must be selected
- if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF module item selected"));
- return;
- }
+ switch (pItem->getObjectType()) {
+ case mdf_type_unknown:
- // Must have an object
- if (nullptr == pItem->getObject()) {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Internal error: Invalid module object"));
- spdlog::error("MDF module edit - object has nullptr");
- return;
- }
+ break;
- // Must be correct object type
- if ((mdf_type_mdf != pItem->getObjectType()) && (mdf_type_mdf_item != pItem->getObjectType())) {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("This is not a module item"));
- spdlog::error("MDF module edit - Not a module item");
- return;
- }
+ case mdf_type_redirection:
- // Set pointer to module top item
- if (mdf_type_mdf == pItem->getObjectType()) {
+ break;
- pItemModule = pItem;
+ case mdf_type_mdf:
+ editModuleData();
+ break;
- // Make sure it is expanded
- pItem->setExpanded(true);
- }
- else if (mdf_type_mdf_item == pItem->getObjectType()) {
- pItemModule = (QMdfTreeWidgetItem*)pItem->parent();
- }
- else {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid module top item object type"));
- spdlog::error("MDF module edit - Invalid module top item object type");
- return;
- }
+ case mdf_type_mdf_item:
+ editModuleData();
+ break;
- // piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItemModule);
- // do {
- // if (nullptr == piter)
- // return nullptr;
- // if( (mdf_type_generic_description == piter->getObjectType()) {
- // return piter;
- // }
- // piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(piter);
- // while (mdf_type_mdf_item == piter->getObjectType());
+ case mdf_type_value:
+ break;
- pItemDescription = findMdfWidgetItem(pItemModule, mdf_type_generic_description); // findDocumentItem(pItemModule);
- pItemItemInfoURL = findMdfWidgetItem(pItemModule, mdf_type_generic_help_url); // findInfoUrlItem(pItemModule);
+ case mdf_type_bit:
+ break;
- CDlgMdfModule dlg(this);
- dlg.initDialogData(pItem->getObject(), static_cast(pItem->getElementIndex()));
+ case mdf_type_bit_item:
+ break;
- if (QDialog::Accepted == dlg.exec()) {
- // Update Module items
+ case mdf_type_register_page:
+ break;
- QMdfTreeWidgetItem* piter = nullptr;
- // if (nullptr != pItem->parent()) {
+ case mdf_type_register:
+ break;
- // // Module sub item selected
- // piter = (QMdfTreeWidgetItem*)pItem->parent();
+ case mdf_type_register_item:
+ break;
- // // QMdfTreeWidgetItem* pitemBelow = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem->parent());
- // // if (nullptr != pitemBelow) {
- // // ui->statusbar->showMessage(pitemBelow->text(0), 3000);
- // // piter = (QMdfTreeWidgetItem*)pItem->parent();
- // // }
- // }
- // else {
+ case mdf_type_remotevar:
+ break;
- // // Module top item selected
- // // ui->statusbar->showMessage(pItem->text(0), 3000);
- // piter = (QMdfTreeWidgetItem*)pItem;
+ case mdf_type_remotevar_item:
+ break;
- // // QMdfTreeWidgetItem* pitemBelow = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- // // if (nullptr != pitemBelow) {
- // // ui->statusbar->showMessage(pitemBelow->text(0), 3000);
- // // piter = (QMdfTreeWidgetItem*)pItem->parent();
- // // }
- // }
+ case mdf_type_action_param:
+ break;
- // Protect against a null pointer
- // if (nullptr == piter) {
- // int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid NULL module item"));
- // spdlog::error("MDF module edit - module item has nullptr");
- // return;
- // }
+ case mdf_type_action:
+ break;
- // Iterate over module items and update ui
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItemModule);
- do {
+ case mdf_type_action_item:
+ break;
- switch (piter->getElementIndex()) {
+ case mdf_type_decision_matrix:
+ break;
- case index_module_name:
- piter->setText(0, PREFIX_MDF_MODULE_NAME + m_mdf.getModuleName().c_str());
- break;
+ case mdf_type_event_data:
+ break;
- case index_module_model:
- piter->setText(0, PREFIX_MDF_MODULE_MODEL + m_mdf.getModuleModel().c_str());
- break;
+ case mdf_type_event_data_item:
+ break;
- case index_module_level: {
- QString str;
- str = PREFIX_MDF_MODULE_LEVEL + str.arg(m_mdf.getModuleLevel() + 1);
- piter->setText(0, str);
- } break;
+ case mdf_type_event:
+ break;
- case index_module_version:
- piter->setText(0, PREFIX_MDF_MODULE_VERSION + m_mdf.getModuleVersion().c_str());
- break;
+ case mdf_type_event_item:
+ break;
- case index_module_change_date:
- piter->setText(0, PREFIX_MDF_MODULE_CHANGE_DATE + m_mdf.getModuleChangeDate().c_str());
- break;
+ case mdf_type_value_item:
+ break;
- case index_module_buffer_size: {
- QString str;
- str = PREFIX_MDF_MODULE_BUFFER_SIZE + str.arg(m_mdf.getModuleBufferSize());
- piter->setText(0, str);
- } break;
+ case mdf_type_bootloader:
+ break;
- case index_module_copyright: // Copyright
- piter->setText(0, PREFIX_MDF_MODULE_COPYRIGHT + m_mdf.getModuleCopyright().c_str());
- break;
+ case mdf_type_alarm:
+ break;
- default: // Hmmmm.-.. unkown field index
- break;
- }
+ case mdf_type_address:
+ break;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(piter);
- } while (mdf_type_mdf_item == piter->getObjectType());
+ case mdf_type_manufacturer:
+ editManufacturerData();
+ break;
- // Find module descriptions
- // int n = piter->childCount();
- // if (mdf_type_generic_description == piter->getObjectType()) {
- // piter->setExpanded(false);
- // n = ui->treeMDF->indexOfTopLevelItem(piter);
- // n = ui->treeMDF->topLevelItemCount();
- // n = n + 1;
- // }
+ case mdf_type_manufacturer_item:
+ editManufacturerData();
+ break;
- deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
- fillDescriptionItems(pItemDescription, &m_mdf, m_mdf.getMapDescription(), true);
+ case mdf_type_email:
+ deleteContact();
+ break;
- deleteMdfWidgetChildItems(pItemItemInfoURL, mdf_type_generic_help_url_item);
- fillInfoUrlItems(pItemItemInfoURL, &m_mdf, m_mdf.getHelpUrlMap(), true);
+ case mdf_type_email_item:
+ deleteContact();
+ break;
- } // accept
-}
+ case mdf_type_phone:
+ deleteContact();
+ break;
-///////////////////////////////////////////////////////////////////////////////
-// editDescription
-//
+ case mdf_type_phone_item:
+ deleteContact();
+ break;
-void
-CFrmMdf::editDescription(void)
-{
- int index = 0;
- QString selstr = "";
- QMdfTreeWidgetItem* pItemDescription = nullptr; // Pointer to description top item
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
- std::map* pmap = nullptr;
+ case mdf_type_fax:
+ deleteContact();
+ break;
- // Item must be selected
- if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF description item selected"));
- return;
- }
+ case mdf_type_fax_item:
+ deleteContact();
+ break;
- // Must have an object
- if (nullptr == pItem->getObject()) {
- QMessageBox::critical(this, tr("MDF module edit"), tr("Internal error: Invalid module object"));
- spdlog::error("MDF module edit - object has nullptr");
- return;
- }
+ case mdf_type_web:
+ deleteContact();
+ break;
- // Set pointer to module top item
- if (mdf_type_generic_description == pItem->getObjectType()) {
+ case mdf_type_web_item:
+ deleteContact();
+ break;
- pItemDescription = pItem;
+ case mdf_type_social:
+ deleteContact();
+ break;
- // Make sure it is expanded
- pItemDescription->setExpanded(true);
- }
- else if (mdf_type_generic_description_item == pItem->getObjectType()) {
- pItemDescription = (QMdfTreeWidgetItem*)pItem->parent();
- selstr = pItem->text(0).split('_').first().left(2);
- }
- else {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid module top item object type"));
- spdlog::error("MDF module edit - Invalid module top item object type");
- return;
- }
+ case mdf_type_social_item:
+ deleteContact();
+ break;
- QMdfTreeWidgetItem* pParentToItemDescription = (QMdfTreeWidgetItem*)pItemDescription->parent();
- if (nullptr == pParentToItemDescription) {
- return;
- }
+ case mdf_type_file:
+ break;
- // Get correct pointer to description map
- switch (pParentToItemDescription->getObjectType()) {
+ case mdf_type_picture:
+ // editFileList();
+ break;
- case mdf_type_mdf:
- pmap = m_mdf.getMapDescription();
+ case mdf_type_picture_item:
+ deleteFile();
break;
- case mdf_type_manufacturer:
- pmap = m_mdf.getManufacturer()->getMapDescription();
+ case mdf_type_picture_sub_item:
+ deleteFile();
+ break;
+
+ case mdf_type_video:
+ // editFileList();
break;
- // Contact items
- case mdf_type_phone_item:
- case mdf_type_fax_item:
- 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:
- case mdf_type_manual_item:
+ deleteFile();
+ break;
+
+ case mdf_type_video_sub_item:
+ deleteFile();
+ break;
+
+ case mdf_type_firmware:
+ // editFileList();
+ break;
+
case mdf_type_firmware_item:
+ deleteFile();
+ break;
+
+ case mdf_type_firmware_sub_item:
+ deleteFile();
+ break;
+
+ case mdf_type_driver:
+ // editFileList();
+ break;
+
case mdf_type_driver_item:
- case mdf_type_setup_item: {
+ deleteFile();
+ break;
- qDebug() << pParentToItemDescription->getObjectType() << pItem->getObjectType() << pItem->text(0) << pParentToItemDescription->text(0) << pParentToItemDescription->parent()->text(0);
+ case mdf_type_driver_sub_item:
+ deleteFile();
+ break;
- if (mdf_type_generic_description == pItem->getObjectType()) {
- pmap = pItem->getObject()->getMapDescription();
- }
- else if (mdf_type_generic_description_item == pItem->getObjectType()) {
- pmap = pItem->getObject()->getMapDescription();
- }
- else {
- QMessageBox::critical(this, tr("Cintact description edit"), tr("Internal error: Invalid object type"));
- spdlog::error("MDF contact description edit - objttype is not mdf_type_generic_description or mdf_type_generic_description_item");
- }
- } break;
- }
+ case mdf_type_setup:
+ // editFileList();
+ break;
- if (mdf_type_generic_description == pItem->getObjectType()) {
- CDlgEditMap dlg(this);
- dlg.setWindowTitle(tr("Description"));
- dlg.initDialogData(pmap, map_type_description, &selstr);
+ case mdf_type_setup_item:
+ deleteFile();
+ break;
- if (QDialog::Accepted == dlg.exec()) {
- // Update Module items
- deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
- fillDescriptionItems(pItemDescription, pItem->getObject(), pmap, true);
+ case mdf_type_setup_sub_item:
+ deleteFile();
+ break;
- QMdfTreeWidgetItem* piter = nullptr;
- }
- }
- else { // item
- CDlgMdfDescription dlg(this);
- dlg.setWindowTitle(tr("MDF Description"));
- selstr = pItem->text(0).split('_').first().left(2);
- dlg.initDialogData(pmap, &selstr);
- if (QDialog::Accepted == dlg.exec()) {
- // Update Module items
- deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
- fillDescriptionItems(pItemDescription, pItem->getObject(), pmap, true);
+ case mdf_type_manual:
+ // editFileList();
+ break;
- // QMdfTreeWidgetItem* piter = nullptr;
- }
+ case mdf_type_manual_item:
+ deleteFile();
+ break;
+
+ case mdf_type_manual_sub_item:
+ deleteFile();
+ break;
+
+ case mdf_type_generic_string:
+ break;
+
+ case mdf_type_generic_number:
+ break;
+
+ case mdf_type_generic_url:
+ break;
+
+ case mdf_type_generic_date:
+ break;
+
+ case mdf_type_generic_access:
+ break;
+
+ case mdf_type_generic_description:
+ editDescription();
+ break;
+
+ case mdf_type_generic_description_item:
+ editDescription();
+ break;
+
+ case mdf_type_generic_help_url:
+ editInfoUrl();
+ break;
+
+ case mdf_type_generic_help_url_item:
+ editInfoUrl();
+ break;
+
+ default:
+ break;
}
}
///////////////////////////////////////////////////////////////////////////////
-// editInfoUrl
+// editModuleData
//
void
-CFrmMdf::editInfoUrl(void)
+CFrmMdf::editModuleData()
{
- int index = 0;
- QString selstr = "";
- QMdfTreeWidgetItem* pItemInfoUrl = nullptr; // Pointer to info url top item
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
- std::map* pmap = nullptr;
+ QMdfTreeWidgetItem* pItemModule = nullptr; // Pointer to module top item
+ QMdfTreeWidgetItem* pItemDescription = nullptr; // Pointer to description top item
+ QMdfTreeWidgetItem* pItemItemInfoURL = nullptr; // Pointer to info URL top item
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
// Item must be selected
if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF info url item selected"));
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF module item selected"));
return;
}
@@ -3339,17 +3434,23 @@ CFrmMdf::editInfoUrl(void)
return;
}
+ // Must be correct object type
+ if ((mdf_type_mdf != pItem->getObjectType()) && (mdf_type_mdf_item != pItem->getObjectType())) {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("This is not a module item"));
+ spdlog::error("MDF module edit - Not a module item");
+ return;
+ }
+
// Set pointer to module top item
- if (mdf_type_generic_help_url == pItem->getObjectType()) {
+ if (mdf_type_mdf == pItem->getObjectType()) {
- pItemInfoUrl = pItem;
+ pItemModule = pItem;
// Make sure it is expanded
- pItemInfoUrl->setExpanded(true);
+ pItem->setExpanded(true);
}
- else if (mdf_type_generic_help_url_item == pItem->getObjectType()) {
- pItemInfoUrl = (QMdfTreeWidgetItem*)pItem->parent();
- selstr = pItem->text(0).split('_').first().left(2);
+ else if (mdf_type_mdf_item == pItem->getObjectType()) {
+ pItemModule = (QMdfTreeWidgetItem*)pItem->parent();
}
else {
int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid module top item object type"));
@@ -3357,73 +3458,231 @@ CFrmMdf::editInfoUrl(void)
return;
}
- QMdfTreeWidgetItem* pParentToItemInfoUrl = (QMdfTreeWidgetItem*)pItemInfoUrl->parent();
- if (nullptr == pParentToItemInfoUrl) {
- return;
- }
+ // piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItemModule);
+ // do {
+ // if (nullptr == piter)
+ // return nullptr;
+ // if( (mdf_type_generic_description == piter->getObjectType()) {
+ // return piter;
+ // }
+ // piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(piter);
+ // while (mdf_type_mdf_item == piter->getObjectType());
- // Get correct pointer to description map
- switch (pParentToItemInfoUrl->getObjectType()) {
+ pItemDescription = findMdfWidgetItem(pItemModule, mdf_type_generic_description); // findDocumentItem(pItemModule);
+ pItemItemInfoURL = findMdfWidgetItem(pItemModule, mdf_type_generic_help_url); // findInfoUrlItem(pItemModule);
- case mdf_type_mdf:
- pmap = m_mdf.getMapInfoUrl();
- break;
+ CDlgMdfModule dlg(this);
+ dlg.initDialogData(pItem->getObject(), static_cast(pItem->getElementIndex()));
- case mdf_type_manufacturer:
- pmap = m_mdf.getManufacturer()->getMapInfoUrl();
- break;
+ if (QDialog::Accepted == dlg.exec()) {
+ // Update Module items
- // Contact items
- case mdf_type_phone_item:
- case mdf_type_fax_item:
- 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:
- case mdf_type_manual_item:
- case mdf_type_firmware_item:
- case mdf_type_driver_item:
- case mdf_type_setup_item: {
+ QMdfTreeWidgetItem* piter = nullptr;
+ // if (nullptr != pItem->parent()) {
- qDebug() << pParentToItemInfoUrl->getObjectType() << pItem->getObjectType() << pItem->text(0) << pParentToItemInfoUrl->text(0) << pParentToItemInfoUrl->parent()->text(0);
+ // // Module sub item selected
+ // piter = (QMdfTreeWidgetItem*)pItem->parent();
- if (mdf_type_generic_help_url == pItem->getObjectType()) {
- pmap = pItem->getObject()->getMapInfoUrl();
- }
- else if (mdf_type_generic_help_url_item == pItem->getObjectType()) {
- pmap = pItem->getObject()->getMapInfoUrl();
- }
- else {
- QMessageBox::critical(this, tr("Cintact description edit"), tr("Internal error: Invalid object type"));
- spdlog::error("MDF contact description edit - objttype is not mdf_type_generic_description or mdf_type_generic_description_item");
- }
- } break;
- }
+ // // QMdfTreeWidgetItem* pitemBelow = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem->parent());
+ // // if (nullptr != pitemBelow) {
+ // // ui->statusbar->showMessage(pitemBelow->text(0), 3000);
+ // // piter = (QMdfTreeWidgetItem*)pItem->parent();
+ // // }
+ // }
+ // else {
- if (mdf_type_generic_help_url == pItem->getObjectType()) {
+ // // Module top item selected
+ // // ui->statusbar->showMessage(pItem->text(0), 3000);
+ // piter = (QMdfTreeWidgetItem*)pItem;
+
+ // // QMdfTreeWidgetItem* pitemBelow = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // // if (nullptr != pitemBelow) {
+ // // ui->statusbar->showMessage(pitemBelow->text(0), 3000);
+ // // piter = (QMdfTreeWidgetItem*)pItem->parent();
+ // // }
+ // }
+
+ // Protect against a null pointer
+ // if (nullptr == piter) {
+ // int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid NULL module item"));
+ // spdlog::error("MDF module edit - module item has nullptr");
+ // return;
+ // }
+
+ // Iterate over module items and update ui
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItemModule);
+ do {
+
+ switch (piter->getElementIndex()) {
+
+ case index_module_name:
+ piter->setText(0, PREFIX_MDF_MODULE_NAME + m_mdf.getModuleName().c_str());
+ break;
+
+ case index_module_model:
+ piter->setText(0, PREFIX_MDF_MODULE_MODEL + m_mdf.getModuleModel().c_str());
+ break;
+
+ case index_module_level: {
+ QString str;
+ str = PREFIX_MDF_MODULE_LEVEL + str.arg(m_mdf.getModuleLevel() + 1);
+ piter->setText(0, str);
+ } break;
+
+ case index_module_version:
+ piter->setText(0, PREFIX_MDF_MODULE_VERSION + m_mdf.getModuleVersion().c_str());
+ break;
+
+ case index_module_change_date:
+ piter->setText(0, PREFIX_MDF_MODULE_CHANGE_DATE + m_mdf.getModuleChangeDate().c_str());
+ break;
+
+ case index_module_buffer_size: {
+ QString str;
+ str = PREFIX_MDF_MODULE_BUFFER_SIZE + str.arg(m_mdf.getModuleBufferSize());
+ piter->setText(0, str);
+ } break;
+
+ case index_module_copyright: // Copyright
+ piter->setText(0, PREFIX_MDF_MODULE_COPYRIGHT + m_mdf.getModuleCopyright().c_str());
+ break;
+
+ default: // Hmmmm.-.. unkown field index
+ break;
+ }
+
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(piter);
+ } while (mdf_type_mdf_item == piter->getObjectType());
+
+ // Find module descriptions
+ // int n = piter->childCount();
+ // if (mdf_type_generic_description == piter->getObjectType()) {
+ // piter->setExpanded(false);
+ // n = ui->treeMDF->indexOfTopLevelItem(piter);
+ // n = ui->treeMDF->topLevelItemCount();
+ // n = n + 1;
+ // }
+
+ deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
+ renderDescriptionItems(pItemDescription, &m_mdf, m_mdf.getMapDescription(), true);
+
+ deleteMdfWidgetChildItems(pItemItemInfoURL, mdf_type_generic_help_url_item);
+ renderInfoUrlItems(pItemItemInfoURL, &m_mdf, m_mdf.getHelpUrlMap(), true);
+
+ } // accept
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editDescription
+//
+
+void
+CFrmMdf::editDescription(void)
+{
+ int index = 0;
+ QString selstr = "";
+ QMdfTreeWidgetItem* pItemDescription = nullptr; // Pointer to description top item
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ std::map* pmap = nullptr;
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF description item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ QMessageBox::critical(this, tr("MDF module edit"), tr("Internal error: Invalid module object"));
+ spdlog::error("MDF module edit - object has nullptr");
+ return;
+ }
+
+ // Set pointer to module top item
+ if (mdf_type_generic_description == pItem->getObjectType()) {
+
+ pItemDescription = pItem;
+
+ // Make sure it is expanded
+ pItemDescription->setExpanded(true);
+ }
+ else if (mdf_type_generic_description_item == pItem->getObjectType()) {
+ pItemDescription = (QMdfTreeWidgetItem*)pItem->parent();
+ selstr = pItem->text(0).split('_').first().left(2);
+ }
+ else {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid module top item object type"));
+ spdlog::error("MDF module edit - Invalid module top item object type");
+ return;
+ }
+
+ QMdfTreeWidgetItem* pParentToItemDescription = (QMdfTreeWidgetItem*)pItemDescription->parent();
+ if (nullptr == pParentToItemDescription) {
+ return;
+ }
+
+ // Get correct pointer to description map
+ switch (pParentToItemDescription->getObjectType()) {
+
+ case mdf_type_mdf:
+ pmap = m_mdf.getMapDescription();
+ break;
+
+ case mdf_type_manufacturer:
+ pmap = m_mdf.getManufacturer()->getMapDescription();
+ break;
+
+ // Contact items
+ case mdf_type_phone_item:
+ case mdf_type_fax_item:
+ 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:
+ case mdf_type_manual_item:
+ case mdf_type_firmware_item:
+ case mdf_type_driver_item:
+ case mdf_type_setup_item: {
+
+ qDebug() << pParentToItemDescription->getObjectType() << pItem->getObjectType() << pItem->text(0) << pParentToItemDescription->text(0) << pParentToItemDescription->parent()->text(0);
+
+ if (mdf_type_generic_description == pItem->getObjectType()) {
+ pmap = pItem->getObject()->getMapDescription();
+ }
+ else if (mdf_type_generic_description_item == pItem->getObjectType()) {
+ pmap = pItem->getObject()->getMapDescription();
+ }
+ else {
+ QMessageBox::critical(this, tr("Contact description edit"), tr("Internal error: Invalid object type"));
+ spdlog::error("MDF contact description edit - objttype is not mdf_type_generic_description or mdf_type_generic_description_item");
+ }
+ } break;
+ }
+
+ if (mdf_type_generic_description == pItem->getObjectType()) {
CDlgEditMap dlg(this);
- dlg.setWindowTitle(tr("Info URL"));
- dlg.initDialogData(pmap, map_type_info_url, &selstr);
+ dlg.setWindowTitle(tr("Description"));
+ dlg.initDialogData(pmap, map_type_description, &selstr);
if (QDialog::Accepted == dlg.exec()) {
// Update Module items
- deleteMdfWidgetChildItems(pItemInfoUrl, mdf_type_generic_help_url_item);
- fillInfoUrlItems(pItemInfoUrl, pItem->getObject(), pmap, true);
+ deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
+ renderDescriptionItems(pItemDescription, pItem->getObject(), pmap, true);
QMdfTreeWidgetItem* piter = nullptr;
}
}
else { // item
CDlgMdfDescription dlg(this);
- dlg.setWindowTitle(tr("MDF Info URL"));
+ dlg.setWindowTitle(tr("MDF Description"));
selstr = pItem->text(0).split('_').first().left(2);
dlg.initDialogData(pmap, &selstr);
if (QDialog::Accepted == dlg.exec()) {
// Update Module items
- deleteMdfWidgetChildItems(pItemInfoUrl, mdf_type_generic_help_url_item);
- fillDescriptionItems(pItemInfoUrl, pItem->getObject(), pmap, true);
+ deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
+ renderDescriptionItems(pItemDescription, pItem->getObject(), pmap, true);
// QMdfTreeWidgetItem* piter = nullptr;
}
@@ -3431,70 +3690,325 @@ CFrmMdf::editInfoUrl(void)
}
///////////////////////////////////////////////////////////////////////////////
-// editManufacturerData
+// deleteDescription
//
void
-CFrmMdf::editManufacturerData()
+CFrmMdf::deleteDescription(void)
{
- QMdfTreeWidgetItem* pItemManufacturer = nullptr; // Pointer to module top item
- QMdfTreeWidgetItem* pItemEmail = nullptr; // Pointer to description top item
- QMdfTreeWidgetItem* pItemWeb = nullptr; // Pointer to info URL top item
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pItemDescription = nullptr; // Pointer to description top item
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ std::map* pmap = nullptr;
// Item must be selected
if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("No MDF manufacturer item selected"));
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF description item selected"));
return;
}
// Must have an object
if (nullptr == pItem->getObject()) {
- int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("Internal error: Invalid manufacturer object"));
- spdlog::error("MDF manufacturer edit - object has nullptr");
+ QMessageBox::critical(this, tr("MDF module edit"), tr("Internal error: Invalid module object"));
+ spdlog::error("MDF module edit - object has nullptr");
return;
}
- // Must be correct object type
- if ((mdf_type_manufacturer != pItem->getObjectType()) && (mdf_type_manufacturer_item != pItem->getObjectType())) {
- int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("This is not a manufacturer item"));
- spdlog::error("MDF manufacturer edit - Not a manufacturer item");
+ if (QMessageBox::Yes != QMessageBox::question(this, tr("MDF module item delete"), tr("Are you sure?"))) {
return;
}
- // Set pointer to module top item
- if (mdf_type_manufacturer == pItem->getObjectType()) {
-
- pItemManufacturer = pItem;
+ pItemDescription = (QMdfTreeWidgetItem*)pItem->parent();
- // Make sure it is expanded
- pItem->setExpanded(true);
- }
- else if (mdf_type_manufacturer_item == pItem->getObjectType()) {
- pItemManufacturer = (QMdfTreeWidgetItem*)pItem->parent();
- }
- else {
- int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("Invalid manufacturer top item object type"));
- spdlog::error("MDF manufacturer edit - Invalid manufacturer top item object type");
+ QMdfTreeWidgetItem* pParentToItemDescription = (QMdfTreeWidgetItem*)pItemDescription->parent();
+ if (nullptr == pParentToItemDescription) {
return;
}
- CDlgMdfManufacturer dlg(this);
- dlg.initDialogData(pItem->getObject(), static_cast(pItem->getElementIndex()));
+ // Get correct pointer to description map
+ switch (pParentToItemDescription->getObjectType()) {
- if (QDialog::Accepted == dlg.exec()) {
+ case mdf_type_mdf:
+ pmap = m_mdf.getMapDescription();
+ break;
- // Update Module items
+ case mdf_type_manufacturer:
+ pmap = m_mdf.getManufacturer()->getMapDescription();
+ break;
- CMDF_Manufacturer* pmanufacturer = (CMDF_Manufacturer*)pItem->getObject();
- pmanufacturer->setName(dlg.getName().toStdString());
- pmanufacturer->getAddressObj()->setStreet(dlg.getStreet().toStdString());
- pmanufacturer->getAddressObj()->setTown(dlg.getTown().toStdString());
- pmanufacturer->getAddressObj()->setCity(dlg.getCity().toStdString());
- pmanufacturer->getAddressObj()->setPostCode(dlg.getPostCode().toStdString());
- pmanufacturer->getAddressObj()->setState(dlg.getState().toStdString());
- pmanufacturer->getAddressObj()->setRegion(dlg.getRegion().toStdString());
- pmanufacturer->getAddressObj()->setCountry(dlg.getCountry().toStdString());
+ // Contact items
+ case mdf_type_phone_item:
+ case mdf_type_fax_item:
+ 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:
+ case mdf_type_manual_item:
+ case mdf_type_firmware_item:
+ case mdf_type_driver_item:
+ case mdf_type_setup_item: {
+ pmap = pItem->getObject()->getMapDescription();
+ } break;
+ }
+
+ std::string selstr = pItem->text(0).split('_').first().left(2).toStdString();
+ pmap->erase(selstr);
+
+ pItemDescription->removeChild(pItem);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editInfoUrl
+//
+
+void
+CFrmMdf::editInfoUrl(void)
+{
+ int index = 0;
+ QString selstr = "";
+ QMdfTreeWidgetItem* pItemInfoUrl = nullptr; // Pointer to info url top item
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ std::map* pmap = nullptr;
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF info url item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Internal error: Invalid module object"));
+ spdlog::error("MDF module edit - object has nullptr");
+ return;
+ }
+
+ // Set pointer to module top item
+ if (mdf_type_generic_help_url == pItem->getObjectType()) {
+
+ pItemInfoUrl = pItem;
+
+ // Make sure it is expanded
+ pItemInfoUrl->setExpanded(true);
+ }
+ else if (mdf_type_generic_help_url_item == pItem->getObjectType()) {
+ pItemInfoUrl = (QMdfTreeWidgetItem*)pItem->parent();
+ selstr = pItem->text(0).split('_').first().left(2);
+ }
+ else {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Invalid module top item object type"));
+ spdlog::error("MDF module edit - Invalid module top item object type");
+ return;
+ }
+
+ QMdfTreeWidgetItem* pParentToItemInfoUrl = (QMdfTreeWidgetItem*)pItemInfoUrl->parent();
+ if (nullptr == pParentToItemInfoUrl) {
+ return;
+ }
+
+ // Get correct pointer to description map
+ switch (pParentToItemInfoUrl->getObjectType()) {
+
+ case mdf_type_mdf:
+ pmap = m_mdf.getMapInfoUrl();
+ break;
+
+ case mdf_type_manufacturer:
+ pmap = m_mdf.getManufacturer()->getMapInfoUrl();
+ break;
+
+ // Contact items
+ case mdf_type_phone_item:
+ case mdf_type_fax_item:
+ 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:
+ case mdf_type_manual_item:
+ case mdf_type_firmware_item:
+ case mdf_type_driver_item:
+ case mdf_type_setup_item: {
+
+ qDebug() << pParentToItemInfoUrl->getObjectType() << pItem->getObjectType() << pItem->text(0) << pParentToItemInfoUrl->text(0) << pParentToItemInfoUrl->parent()->text(0);
+
+ if (mdf_type_generic_help_url == pItem->getObjectType()) {
+ pmap = pItem->getObject()->getMapInfoUrl();
+ }
+ else if (mdf_type_generic_help_url_item == pItem->getObjectType()) {
+ pmap = pItem->getObject()->getMapInfoUrl();
+ }
+ else {
+ QMessageBox::critical(this, tr("Contact description edit"), tr("Internal error: Invalid object type"));
+ spdlog::error("MDF contact description edit - objttype is not mdf_type_generic_description or mdf_type_generic_description_item");
+ }
+ } break;
+ }
+
+ if (mdf_type_generic_help_url == pItem->getObjectType()) {
+ CDlgEditMap dlg(this);
+ dlg.setWindowTitle(tr("Info URL"));
+ dlg.initDialogData(pmap, map_type_info_url, &selstr);
+
+ if (QDialog::Accepted == dlg.exec()) {
+ // Update Module items
+ deleteMdfWidgetChildItems(pItemInfoUrl, mdf_type_generic_help_url_item);
+ renderInfoUrlItems(pItemInfoUrl, pItem->getObject(), pmap, true);
+
+ QMdfTreeWidgetItem* piter = nullptr;
+ }
+ }
+ else { // item
+ CDlgMdfDescription dlg(this);
+ dlg.setWindowTitle(tr("MDF Info URL"));
+ selstr = pItem->text(0).split('_').first().left(2);
+ dlg.initDialogData(pmap, &selstr);
+ if (QDialog::Accepted == dlg.exec()) {
+ // Update Module items
+ deleteMdfWidgetChildItems(pItemInfoUrl, mdf_type_generic_help_url_item);
+ renderDescriptionItems(pItemInfoUrl, pItem->getObject(), pmap, true);
+
+ // QMdfTreeWidgetItem* piter = nullptr;
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// deleteInfoUrl
+//
+
+void
+CFrmMdf::deleteInfoUrl(void)
+{
+ QMdfTreeWidgetItem* pItemInfoUrl = nullptr; // Pointer to info url top item
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ std::map* pmap = nullptr;
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("No MDF info url item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF module edit"), tr("Internal error: Invalid module object"));
+ spdlog::error("MDF module edit - object has nullptr");
+ return;
+ }
+
+ if (QMessageBox::Yes != QMessageBox::question(this, tr("MDF module item delete"), tr("Are you sure?"))) {
+ return;
+ }
+
+ pItemInfoUrl = (QMdfTreeWidgetItem*)pItem->parent();
+
+ QMdfTreeWidgetItem* pParentToItemInfoUrl = (QMdfTreeWidgetItem*)pItemInfoUrl->parent();
+ if (nullptr == pParentToItemInfoUrl) {
+ return;
+ }
+
+ // Get correct pointer to InfoUrl map
+ switch (pParentToItemInfoUrl->getObjectType()) {
+
+ case mdf_type_mdf:
+ pmap = m_mdf.getMapInfoUrl();
+ break;
+
+ case mdf_type_manufacturer:
+ pmap = m_mdf.getManufacturer()->getMapInfoUrl();
+ break;
+
+ // Contact items
+ case mdf_type_phone_item:
+ case mdf_type_fax_item:
+ 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:
+ case mdf_type_manual_item:
+ case mdf_type_firmware_item:
+ case mdf_type_driver_item:
+ case mdf_type_setup_item: {
+ pmap = pItem->getObject()->getMapInfoUrl();
+ } break;
+ }
+
+ std::string selstr = pItem->text(0).split('_').first().left(2).toStdString();
+ pmap->erase(selstr);
+
+ pItemInfoUrl->removeChild(pItem);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editManufacturerData
+//
+
+void
+CFrmMdf::editManufacturerData()
+{
+ QMdfTreeWidgetItem* pItemManufacturer = nullptr; // Pointer to module top item
+ QMdfTreeWidgetItem* pItemEmail = nullptr; // Pointer to description top item
+ QMdfTreeWidgetItem* pItemWeb = nullptr; // Pointer to info URL top item
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("No MDF manufacturer item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("Internal error: Invalid manufacturer object"));
+ spdlog::error("MDF manufacturer edit - object has nullptr");
+ return;
+ }
+
+ // Must be correct object type
+ if ((mdf_type_manufacturer != pItem->getObjectType()) && (mdf_type_manufacturer_item != pItem->getObjectType())) {
+ int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("This is not a manufacturer item"));
+ spdlog::error("MDF manufacturer edit - Not a manufacturer item");
+ return;
+ }
+
+ // Set pointer to module top item
+ if (mdf_type_manufacturer == pItem->getObjectType()) {
+
+ pItemManufacturer = pItem;
+
+ // Make sure it is expanded
+ pItem->setExpanded(true);
+ }
+ else if (mdf_type_manufacturer_item == pItem->getObjectType()) {
+ pItemManufacturer = (QMdfTreeWidgetItem*)pItem->parent();
+ }
+ else {
+ int ret = QMessageBox::critical(this, tr("MDF manufacturer edit"), tr("Invalid manufacturer top item object type"));
+ spdlog::error("MDF manufacturer edit - Invalid manufacturer top item object type");
+ return;
+ }
+
+ CDlgMdfManufacturer dlg(this);
+ dlg.initDialogData(pItem->getObject(), static_cast(pItem->getElementIndex()));
+
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Update Module items
+
+ CMDF_Manufacturer* pmanufacturer = (CMDF_Manufacturer*)pItem->getObject();
+ pmanufacturer->setName(dlg.getName().toStdString());
+ pmanufacturer->getAddressObj()->setStreet(dlg.getStreet().toStdString());
+ pmanufacturer->getAddressObj()->setTown(dlg.getTown().toStdString());
+ pmanufacturer->getAddressObj()->setCity(dlg.getCity().toStdString());
+ pmanufacturer->getAddressObj()->setPostCode(dlg.getPostCode().toStdString());
+ pmanufacturer->getAddressObj()->setState(dlg.getState().toStdString());
+ pmanufacturer->getAddressObj()->setRegion(dlg.getRegion().toStdString());
+ pmanufacturer->getAddressObj()->setCountry(dlg.getCountry().toStdString());
QMdfTreeWidgetItem* piter = nullptr;
piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItemManufacturer);
@@ -3526,403 +4040,1132 @@ CFrmMdf::editManufacturerData()
piter->setText(0, PREFIX_MDF_MANUFACTURER_STATE + pmanufacturer->getAddressObj()->getState().c_str());
break;
- case index_manufacturer_region:
- piter->setText(0, PREFIX_MDF_MANUFACTURER_REGION + pmanufacturer->getAddressObj()->getRegion().c_str());
- break;
+ case index_manufacturer_region:
+ piter->setText(0, PREFIX_MDF_MANUFACTURER_REGION + pmanufacturer->getAddressObj()->getRegion().c_str());
+ break;
+
+ case index_manufacturer_country:
+ piter->setText(0, PREFIX_MDF_MANUFACTURER_COUNTRY + pmanufacturer->getAddressObj()->getCountry().c_str());
+ break;
+ }
+
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(piter);
+
+ } while (mdf_type_manufacturer_item == piter->getObjectType());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// showContactDialog
+//
+
+void
+CFrmMdf::showContactDialog(QMdfTreeWidgetItem* pItem, mdf_dlg_contact_type type, QString title)
+{
+ CMDF_Item* pContactObj = (CMDF_Item*)pItem->getObject();
+ if (nullptr == pContactObj) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ return;
+ }
+
+ CDlgMdfContact dlg(this);
+ dlg.setWindowTitle(title);
+ dlg.initDialogData(pContactObj, type, title);
+ if (QDialog::Accepted == dlg.exec()) {
+
+ pItem->setText(0, dlg.getValue());
+ QMdfTreeWidgetItem* pItemDescription = findMdfWidgetItem(pItem, mdf_type_generic_description); // findDocumentItem(pItemModule);
+ QMdfTreeWidgetItem* pItemItemInfoURL = findMdfWidgetItem(pItem, mdf_type_generic_help_url); // findInfoUrlItem(pItemModule);
+
+ deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
+ renderDescriptionItems(pItemDescription,
+ (CMDF_Item*)pItem->getObject(),
+ ((CMDF_Item*)pItem->getObject())->getMapDescription(),
+ true);
+ renderInfoUrlItems(pItemItemInfoURL,
+ (CMDF_Item*)pItem->getObject(),
+ ((CMDF_Item*)pItem->getObject())->getMapInfoUrl(),
+ true);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editContact
+//
+
+void
+CFrmMdf::editContact(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No MDF contact item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("Internal error: Invalid contact object"));
+ spdlog::error("MDF contact edit - object has nullptr");
+ return;
+ }
+
+ switch (pItem->getObjectType()) {
+
+ case mdf_type_phone: {
+ CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
+ if (nullptr == pManufacturer) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ return;
+ }
+
+ CDlgMdfContactList dlg(this);
+ dlg.initDialogData(pManufacturer, dlg_type_contact_phone, "Edit phone contact items");
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Expand to make traversion possible
+ pItem->setExpanded(true);
+
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_phone_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderManufacturerPhone(pItem);
+ }
+ } break;
+
+ case mdf_type_phone_item:
+ showContactDialog(pItem, dlg_type_contact_phone, "Edit phone contacts");
+ break;
+
+ case mdf_type_fax: {
+ CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
+ if (nullptr == pManufacturer) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ return;
+ }
+
+ CDlgMdfContactList dlg(this);
+ dlg.initDialogData(pManufacturer, dlg_type_contact_fax, "Edit fax contact items");
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Expand to make traversion possible
+ pItem->setExpanded(true);
+
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_fax_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderManufacturerFax(pItem);
+ }
+ } break;
+
+ case mdf_type_fax_item:
+ showContactDialog(pItem, dlg_type_contact_fax, "Edit fax contacts");
+ break;
+
+ case mdf_type_email: {
+ CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
+ if (nullptr == pManufacturer) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ return;
+ }
+
+ CDlgMdfContactList dlg(this);
+ dlg.initDialogData(pManufacturer, dlg_type_contact_email, "Edit email contact items");
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Expand to make traversion possible
+ pItem->setExpanded(true);
+
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_email_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderManufacturerEmail(pItem);
+ }
+ } break;
+
+ case mdf_type_email_item:
+ showContactDialog(pItem, dlg_type_contact_email, "Edit email contacts");
+ break;
+
+ case mdf_type_web: {
+ CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
+ if (nullptr == pManufacturer) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ return;
+ }
+
+ CDlgMdfContactList dlg(this);
+ dlg.initDialogData(pManufacturer, dlg_type_contact_web, "Edit web contact items");
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Expand to make traversion possible
+ pItem->setExpanded(true);
+
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_web_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderManufacturerWeb(pItem);
+ }
+ } break;
+
+ case mdf_type_web_item:
+ showContactDialog(pItem, dlg_type_contact_web, "Edit fax contacts");
+ break;
+
+ case mdf_type_social: {
+ CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
+ if (nullptr == pManufacturer) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ return;
+ }
+
+ CDlgMdfContactList dlg(this);
+ dlg.initDialogData(pManufacturer, dlg_type_contact_social, "Edit social contact items");
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Expand to make traversion possible
+ pItem->setExpanded(true);
+
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_social_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderManufacturerSocial(pItem);
+ }
+ } break;
+
+ case mdf_type_social_item:
+ showContactDialog(pItem, dlg_type_contact_social, "Edit social contacts");
+ break;
+
+ default:
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("This is not a contact item"));
+ spdlog::error("MDF contact edit - Not a contact item");
+ break;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// deleteContact
+//
+
+void
+CFrmMdf::deleteContact(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No MDF contact item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("Internal error: Invalid contact object"));
+ spdlog::error("MDF contact edit - object has nullptr");
+ return;
+ }
+
+ if (QMessageBox::Yes != QMessageBox::question(this, tr("MDF module item delete"), tr("Are you sure?"))) {
+ return;
+ }
+
+ CMDF_Manufacturer* pManufacturer = m_mdf.getManufacturer();
+
+ switch (pItem->getObjectType()) {
+
+ case mdf_type_phone: {
+ } break;
+
+ case mdf_type_phone_item:
+ for (std::deque::iterator it = pManufacturer->getPhoneContactList()->begin();
+ it != pManufacturer->getPhoneContactList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Item* pPhone = *it;
+ pManufacturer->getPhoneContactList()->erase(it);
+ delete pPhone;
+ break;
+ }
+ ++it;
+ }
+
+ m_headManufacturerPhone->removeChild(pItem);
+ break;
+
+ case mdf_type_fax: {
+ } break;
+
+ case mdf_type_fax_item:
+ for (std::deque::iterator it = pManufacturer->getFaxContactList()->begin();
+ it != pManufacturer->getFaxContactList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Item* pFax = *it;
+ pManufacturer->getFaxContactList()->erase(it);
+ delete pFax;
+ break;
+ }
+ ++it;
+ }
+
+ m_headManufacturerFax->removeChild(pItem);
+ break;
+
+ case mdf_type_email: {
+ } break;
+
+ case mdf_type_email_item: {
+ for (std::deque::iterator it = pManufacturer->getEmailContactList()->begin();
+ it != pManufacturer->getEmailContactList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Item* pEmail = *it;
+ pManufacturer->getEmailContactList()->erase(it);
+ delete pEmail;
+ break;
+ }
+ ++it;
+ }
+
+ m_headManufacturerEmail->removeChild(pItem);
+ } break;
+
+ case mdf_type_web: {
+ } break;
+
+ case mdf_type_web_item:
+ for (std::deque::iterator it = pManufacturer->getWebContactList()->begin();
+ it != pManufacturer->getWebContactList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Item* pWeb = *it;
+ pManufacturer->getWebContactList()->erase(it);
+ delete pWeb;
+ break;
+ }
+ ++it;
+ }
+
+ m_headManufacturerWeb->removeChild(pItem);
+ break;
+
+ case mdf_type_social: {
+ } break;
+
+ case mdf_type_social_item:
+ for (std::deque::iterator it = pManufacturer->getSocialContactList()->begin();
+ it != pManufacturer->getSocialContactList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Item* pSocial = *it;
+ pManufacturer->getSocialContactList()->erase(it);
+ delete pSocial;
+ break;
+ }
+ ++it;
+ }
+
+ m_headManufacturerSocial->removeChild(pItem);
+ break;
+
+ default:
+ int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("This is not a contact item"));
+ spdlog::error("MDF contact edit - Not a contact item");
+ break;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editBootLoader
+//
+
+void
+CFrmMdf::editBootLoader(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pBootHeadItem = nullptr;
+ uint16_t selectedIndex = pItem->getElementIndex();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("No MDF bootloader item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("Internal error: Invalid bootloader object"));
+ spdlog::error("MDF bootloader edit - object has nullptr");
+ return;
+ }
+
+ CMDF_BootLoaderInfo* pBootInfo = (CMDF_BootLoaderInfo*)pItem->getObject();
+ if (nullptr == pBootInfo) {
+ int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("No bootloader item object"));
+ return;
+ }
+
+ CDlgMdfBootLoader dlg(this);
+
+ switch (pItem->getObjectType()) {
+
+ case mdf_type_bootloader:
+ pBootHeadItem = pItem;
+ pBootHeadItem->setExpanded(true);
+ break;
+
+ case mdf_type_bootloader_item: {
+ pBootHeadItem = (QMdfTreeWidgetItem*)pItem->parent();
+ break;
+ }
+
+ default:
+ int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("This is not a bootloader item"));
+ spdlog::error("MDF bootloader edit - Not a bootloader item");
+ break;
+ }
+
+ dlg.initDialogData(pBootInfo, static_cast(selectedIndex));
+ if (QDialog::Accepted == dlg.exec()) {
+
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pBootHeadItem);
+ while (mdf_type_bootloader_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pBootHeadItem);
+ }
+
+ renderBootLoadInfo(pBootHeadItem, selectedIndex);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editFileList
+//
+
+void
+CFrmMdf::editFileList(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pFileHeadItem = (QMdfTreeWidgetItem*)pItem->parent();
+ uint16_t selectedIndex = pItem->getElementIndex();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF file list edit"), tr("No MDF file list item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF file list edit"), tr("Internal error: Invalid file list object"));
+ spdlog::error("MDF bootloader edit - object has nullptr");
+ return;
+ }
+
+ CDlgMdfFile dlg(this);
+ dlg.initDialogData(pItem->getObject(), pItem->getObjectType());
+ if (QDialog::Accepted == dlg.exec()) {
+
+ // Expand to make traversion possible
+ pItem->setExpanded(true);
+
+ switch (pItem->getObjectType()) {
+
+ case mdf_type_picture: {
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while ((nullptr != piter) && (mdf_type_picture_item == piter->getObjectType())) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderPictureItems(pItem, selectedIndex);
+ } break;
+
+ case mdf_type_video: {
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_video_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderVideoItems(pItem, selectedIndex);
+ } break;
+
+ case mdf_type_firmware: {
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_firmware_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderFirmwareItems(pItem, selectedIndex);
+ } break;
+
+ case mdf_type_driver: {
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_driver_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderDriverItems(pItem, selectedIndex);
+ } break;
+
+ case mdf_type_setup: {
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while ((nullptr != piter) && (mdf_type_picture_item == piter->getObjectType())) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderPictureItems(pItem, selectedIndex);
+ } break;
+
+ case mdf_type_manual: {
+ QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ while (mdf_type_manual_item == piter->getObjectType()) {
+ pItem->removeChild(piter);
+ delete piter;
+ piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ }
+
+ renderManualItems(pItem, selectedIndex);
+ } break;
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// editFile
+//
+
+void
+CFrmMdf::editFile(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent();
+ uint16_t selectedIndex = pItem->getElementIndex();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("No MDF bootloader item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF file edit"), tr("Internal error: Invalid file object"));
+ spdlog::error("MDF bootloader edit - object has nullptr");
+ return;
+ }
+
+ switch (pItem->getObjectType()) {
+
+ // Picture
+
+ case mdf_type_picture_item: {
+ CMDF_Picture* pobj = (CMDF_Picture*)pItem->getObject();
+ CDlgMdfFilePicture dlg(this);
+ dlg.initDialogData(pobj);
+ if (QDialog::Accepted == dlg.exec()) {
+ qDebug() << "Item = " << pItem->text(0) << ((CMDF_Picture*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItem->getObject())->getMdfObjectType();
+
+ QList childrenList = pItem->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
+
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
+
+ renderPictureSubItems(pItem, pobj);
+
+ // Expand to make items visible
+ pItem->setExpanded(true);
+ }
+ } break;
+
+ case mdf_type_picture_sub_item: {
+ CMDF_Picture* pobj = (CMDF_Picture*)pItemHead->getObject();
+ if (nullptr == pobj) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid picture object"));
+ spdlog::error("MDF picture edit - object has nullptr");
+ return;
+ }
+ CDlgMdfFilePicture dlg(this);
+ dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
+ if (QDialog::Accepted == dlg.exec()) {
+
+ QList childrenList = pItemHead->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
+
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
+
+ selectedIndex = pItem->getElementIndex();
+ renderPictureSubItems(pItemHead, pobj);
+ }
+ } break;
+
+ // Video
+
+ case mdf_type_video_item: {
+ CMDF_Video* pobj = (CMDF_Video*)pItem->getObject();
+ CDlgMdfFileVideo dlg(this);
+ dlg.initDialogData(pobj);
+ if (QDialog::Accepted == dlg.exec()) {
+ // qDebug() << "Item = " << pItem->text(0) << ((CMDF_Videoe*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Video*)pItem->getObject())->getMdfObjectType();
+
+ QList childrenList = pItem->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
+
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
+
+ renderVideoSubItems(pItem, pobj);
+
+ // Expand to make items visible
+ pItem->setExpanded(true);
+ }
+ } break;
+
+ case mdf_type_video_sub_item: {
+ CMDF_Video* pobj = (CMDF_Video*)pItemHead->getObject();
+ if (nullptr == pobj) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid video object"));
+ spdlog::error("MDF video edit - object has nullptr");
+ return;
+ }
+ CDlgMdfFileVideo dlg(this);
+ dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
+ if (QDialog::Accepted == dlg.exec()) {
+
+ QList childrenList = pItemHead->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
+
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
+
+ selectedIndex = pItem->getElementIndex();
+ renderVideoSubItems(pItemHead, pobj);
+ }
+ } break;
+
+ // Manual
+
+ case mdf_type_manual_item: {
+ CMDF_Manual* pobj = (CMDF_Manual*)pItem->getObject();
+ CDlgMdfFileManual dlg(this);
+ dlg.initDialogData(pobj);
+ if (QDialog::Accepted == dlg.exec()) {
+ // qDebug() << "Item = " << pItem->text(0) << ((CMDF_Manaul*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Manual*)pItem->getObject())->getMdfObjectType();
+
+ QList childrenList = pItem->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
+
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
+
+ renderManualSubItems(pItem, pobj);
- case index_manufacturer_country:
- piter->setText(0, PREFIX_MDF_MANUFACTURER_COUNTRY + pmanufacturer->getAddressObj()->getCountry().c_str());
- break;
+ // Expand to make items visible
+ pItem->setExpanded(true);
}
+ } break;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(piter);
-
- } while (mdf_type_manufacturer_item == piter->getObjectType());
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// showContactDialog
-//
+ case mdf_type_manual_sub_item: {
+ CMDF_Manual* pobj = (CMDF_Manual*)pItemHead->getObject();
+ if (nullptr == pobj) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid manual object"));
+ spdlog::error("MDF manual edit - object has nullptr");
+ return;
+ }
+ CDlgMdfFileManual dlg(this);
+ dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
+ if (QDialog::Accepted == dlg.exec()) {
-void
-CFrmMdf::showContactDialog(QMdfTreeWidgetItem* pItem, mdf_dlg_contact_type type, QString title)
-{
- CMDF_Item* pContactObj = (CMDF_Item*)pItem->getObject();
- if (nullptr == pContactObj) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
- return;
- }
+ QList childrenList = pItemHead->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- CDlgMdfContact dlg(this);
- dlg.setWindowTitle(title);
- dlg.initDialogData(pContactObj, type, title);
- if (QDialog::Accepted == dlg.exec()) {
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
- pItem->setText(0, dlg.getValue());
- QMdfTreeWidgetItem* pItemDescription = findMdfWidgetItem(pItem, mdf_type_generic_description); // findDocumentItem(pItemModule);
- QMdfTreeWidgetItem* pItemItemInfoURL = findMdfWidgetItem(pItem, mdf_type_generic_help_url); // findInfoUrlItem(pItemModule);
+ selectedIndex = pItem->getElementIndex();
+ renderManualSubItems(pItemHead, pobj);
+ }
+ } break;
- deleteMdfWidgetChildItems(pItemDescription, mdf_type_generic_description_item);
- fillDescriptionItems(pItemDescription,
- (CMDF_Item*)pItem->getObject(),
- ((CMDF_Item*)pItem->getObject())->getMapDescription(),
- true);
- fillInfoUrlItems(pItemItemInfoURL,
- (CMDF_Item*)pItem->getObject(),
- ((CMDF_Item*)pItem->getObject())->getMapInfoUrl(),
- true);
- }
-}
+ // Firmware
-///////////////////////////////////////////////////////////////////////////////
-// editContact
-//
+ case mdf_type_firmware_item: {
+ CMDF_Firmware* pobj = (CMDF_Firmware*)pItem->getObject();
+ CDlgMdfFileFirmware dlg(this);
+ dlg.initDialogData(pobj);
+ if (QDialog::Accepted == dlg.exec()) {
+ // qDebug() << "Item = " << pItem->text(0) << ((CMDF_Firmware*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Firmware*)pItem->getObject())->getMdfObjectType();
-void
-CFrmMdf::editContact(void)
-{
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QList childrenList = pItem->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- // Item must be selected
- if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No MDF contact item selected"));
- return;
- }
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
+ }
+ childrenList.clear();
- // Must have an object
- if (nullptr == pItem->getObject()) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("Internal error: Invalid contact object"));
- spdlog::error("MDF contact edit - object has nullptr");
- return;
- }
+ renderFirmwareSubItems(pItem, pobj);
- switch (pItem->getObjectType()) {
+ // Expand to make items visible
+ pItem->setExpanded(true);
+ }
+ } break;
- case mdf_type_phone: {
- CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
- if (nullptr == pManufacturer) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ case mdf_type_firmware_sub_item: {
+ CMDF_Firmware* pobj = (CMDF_Firmware*)pItemHead->getObject();
+ if (nullptr == pobj) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid firmware object"));
+ spdlog::error("MDF firmware edit - object has nullptr");
return;
}
-
- CDlgMdfContactList dlg(this);
- dlg.initDialogData(pManufacturer, dlg_type_contact_phone, "Edit phone contact items");
+ CDlgMdfFileFirmware dlg(this);
+ dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
if (QDialog::Accepted == dlg.exec()) {
- // Expand to make traversion possible
- pItem->setExpanded(true);
+ QList childrenList = pItemHead->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_phone_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
}
+ childrenList.clear();
- renderManufacturerPhone(pItem);
+ selectedIndex = pItem->getElementIndex();
+ renderFirmwareSubItems(pItemHead, pobj);
}
} break;
- case mdf_type_phone_item:
- showContactDialog(pItem, dlg_type_contact_phone, "Edit phone contacts");
- break;
-
- case mdf_type_fax: {
- CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
- if (nullptr == pManufacturer) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
- return;
- }
+ // Driver
- CDlgMdfContactList dlg(this);
- dlg.initDialogData(pManufacturer, dlg_type_contact_fax, "Edit fax contact items");
+ case mdf_type_driver_item: {
+ CMDF_Driver* pobj = (CMDF_Driver*)pItem->getObject();
+ CDlgMdfFileDriver dlg(this);
+ dlg.initDialogData(pobj);
if (QDialog::Accepted == dlg.exec()) {
+ // qDebug() << "Item = " << pItem->text(0) << ((CMDF_Driver*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Driver*)pItem->getObject())->getMdfObjectType();
- // Expand to make traversion possible
- pItem->setExpanded(true);
+ QList childrenList = pItem->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_fax_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
}
+ childrenList.clear();
- renderManufacturerFax(pItem);
+ renderDriverSubItems(pItem, pobj);
+
+ // Expand to make items visible
+ pItem->setExpanded(true);
}
} break;
- case mdf_type_fax_item:
- showContactDialog(pItem, dlg_type_contact_fax, "Edit fax contacts");
- break;
-
- case mdf_type_email: {
- CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
- if (nullptr == pManufacturer) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ case mdf_type_driver_sub_item: {
+ CMDF_Driver* pobj = (CMDF_Driver*)pItemHead->getObject();
+ if (nullptr == pobj) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid driver object"));
+ spdlog::error("MDF driver edit - object has nullptr");
return;
}
-
- CDlgMdfContactList dlg(this);
- dlg.initDialogData(pManufacturer, dlg_type_contact_email, "Edit email contact items");
+ CDlgMdfFileDriver dlg(this);
+ dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
if (QDialog::Accepted == dlg.exec()) {
- // Expand to make traversion possible
- pItem->setExpanded(true);
+ QList childrenList = pItemHead->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Driver*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Driver*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_email_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
}
+ childrenList.clear();
- renderManufacturerEmail(pItem);
+ selectedIndex = pItem->getElementIndex();
+ renderDriverSubItems(pItemHead, pobj);
}
} break;
- case mdf_type_email_item:
- showContactDialog(pItem, dlg_type_contact_email, "Edit email contacts");
- break;
-
- case mdf_type_web: {
- CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
- if (nullptr == pManufacturer) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
- return;
- }
+ // Setup Script
- CDlgMdfContactList dlg(this);
- dlg.initDialogData(pManufacturer, dlg_type_contact_web, "Edit web contact items");
+ case mdf_type_setup_item: {
+ CMDF_Setup* pobj = (CMDF_Setup*)pItem->getObject();
+ CDlgMdfFileSetup dlg(this);
+ dlg.initDialogData(pobj);
if (QDialog::Accepted == dlg.exec()) {
+ // qDebug() << "Item = " << pItem->text(0) << ((CMDF_Setup*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Setup*)pItem->getObject())->getMdfObjectType();
- // Expand to make traversion possible
- pItem->setExpanded(true);
+ QList childrenList = pItem->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Setup*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Setup*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_web_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
}
+ childrenList.clear();
- renderManufacturerWeb(pItem);
+ renderSetupSubItems(pItem, pobj);
+
+ // Expand to make items visible
+ pItem->setExpanded(true);
}
} break;
- case mdf_type_web_item:
- showContactDialog(pItem, dlg_type_contact_web, "Edit fax contacts");
- break;
-
- case mdf_type_social: {
- CMDF_Manufacturer* pManufacturer = (CMDF_Manufacturer*)pItem->getObject();
- if (nullptr == pManufacturer) {
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("No contact item object"));
+ case mdf_type_setup_sub_item: {
+ CMDF_Setup* pobj = (CMDF_Setup*)pItemHead->getObject();
+ if (nullptr == pobj) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid setup object"));
+ spdlog::error("MDF setup edit - object has nullptr");
return;
}
-
- CDlgMdfContactList dlg(this);
- dlg.initDialogData(pManufacturer, dlg_type_contact_social, "Edit social contact items");
+ CDlgMdfFileSetup dlg(this);
+ dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
if (QDialog::Accepted == dlg.exec()) {
- // Expand to make traversion possible
- pItem->setExpanded(true);
+ QList childrenList = pItemHead->takeChildren();
+ // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Setup*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Setup*)pItemHead->getObject())->getMdfObjectType();
+ // qDebug() << "Take children: size = " << childrenList.size();
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_social_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ // qDebug() << item->text(0);
+ delete item;
}
+ childrenList.clear();
- renderManufacturerSocial(pItem);
+ selectedIndex = pItem->getElementIndex();
+ renderSetupSubItems(pItemHead, pobj);
}
} break;
- case mdf_type_social_item:
- showContactDialog(pItem, dlg_type_contact_social, "Edit social contacts");
- break;
-
- default:
- int ret = QMessageBox::critical(this, tr("MDF contact edit"), tr("This is not a contact item"));
- spdlog::error("MDF contact edit - Not a contact item");
- break;
- }
+ } // Switch
}
///////////////////////////////////////////////////////////////////////////////
-// editBootLoader
+// deleteFile
//
void
-CFrmMdf::editBootLoader(void)
-{
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
- QMdfTreeWidgetItem* pBootHeadItem = nullptr;
- uint16_t selectedIndex = pItem->getElementIndex();
+CFrmMdf::deleteFile(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent();
+ uint16_t selectedIndex = pItem->getElementIndex();
// Item must be selected
if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("No MDF bootloader item selected"));
+ int ret = QMessageBox::critical(this, tr("MDF file edit"), tr("No MDF file item selected"));
return;
}
// Must have an object
if (nullptr == pItem->getObject()) {
- int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("Internal error: Invalid bootloader object"));
- spdlog::error("MDF bootloader edit - object has nullptr");
+ int ret = QMessageBox::critical(this, tr("MDF file edit"), tr("Internal error: Invalid file object"));
+ spdlog::error("MDF file edit - object has nullptr");
return;
}
- CMDF_BootLoaderInfo* pBootInfo = (CMDF_BootLoaderInfo*)pItem->getObject();
- if (nullptr == pBootInfo) {
- int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("No bootloader item object"));
+ if (QMessageBox::Yes != QMessageBox::question(this, tr("MDF module item delete"), tr("Are you sure?"))) {
return;
}
- CDlgMdfBootLoader dlg(this);
-
switch (pItem->getObjectType()) {
- case mdf_type_bootloader:
- pBootHeadItem = pItem;
- pBootHeadItem->setExpanded(true);
- break;
+ // Picture
- case mdf_type_bootloader_item: {
- pBootHeadItem = (QMdfTreeWidgetItem*)pItem->parent();
- break;
- }
+ case mdf_type_picture_item: {
- default:
- int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("This is not a bootloader item"));
- spdlog::error("MDF bootloader edit - Not a bootloader item");
- break;
- }
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getPictureObjList()->begin(); it != m_mdf.getPictureObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Picture* pPicture = *it;
+ m_mdf.getPictureObjList()->erase(it);
+ delete pPicture;
+ break;
+ }
+ ++it;
+ }
- dlg.initDialogData(pBootInfo, static_cast(selectedIndex));
- if (QDialog::Accepted == dlg.exec()) {
+ m_headFilePicture->removeChild(pItem);
+ } break;
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pBootHeadItem);
- while (mdf_type_bootloader_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pBootHeadItem);
- }
+ case mdf_type_picture_sub_item: {
- renderBootLoadInfo(pBootHeadItem, selectedIndex);
- }
-}
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getPictureObjList()->begin(); it != m_mdf.getPictureObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Picture* pPicture = *it;
+ m_mdf.getPictureObjList()->erase(it);
+ delete pPicture;
+ break;
+ }
+ ++it;
+ }
-///////////////////////////////////////////////////////////////////////////////
-// editFileList
-//
+ m_headFilePicture->removeChild(pItemHead);
+ } break;
-void
-CFrmMdf::editFileList(void)
-{
- QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
- QMdfTreeWidgetItem* pFileHeadItem = (QMdfTreeWidgetItem*)pItem->parent();
- uint16_t selectedIndex = pItem->getElementIndex();
+ // Video
- // Item must be selected
- if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF file list edit"), tr("No MDF file list item selected"));
- return;
- }
+ case mdf_type_video_item: {
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getVideoObjList()->begin(); it != m_mdf.getVideoObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Video* pVideo = *it;
+ m_mdf.getVideoObjList()->erase(it);
+ delete pVideo;
+ break;
+ }
+ ++it;
+ }
- // Must have an object
- if (nullptr == pItem->getObject()) {
- int ret = QMessageBox::critical(this, tr("MDF file list edit"), tr("Internal error: Invalid file list object"));
- spdlog::error("MDF bootloader edit - object has nullptr");
- return;
- }
+ m_headFileVideo->removeChild(pItem);
+ } break;
- CDlgMdfFile dlg(this);
- dlg.initDialogData(pItem->getObject(), pItem->getObjectType());
- if (QDialog::Accepted == dlg.exec()) {
+ case mdf_type_video_sub_item: {
- // Expand to make traversion possible
- pItem->setExpanded(true);
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getVideoObjList()->begin(); it != m_mdf.getVideoObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Video* pVideo = *it;
+ m_mdf.getVideoObjList()->erase(it);
+ delete pVideo;
+ break;
+ ;
+ }
+ ++it;
+ }
- switch (pItem->getObjectType()) {
+ m_headFileVideo->removeChild(pItemHead);
+ } break;
- case mdf_type_picture: {
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while ((nullptr != piter) && (mdf_type_picture_item == piter->getObjectType())) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Manual
+
+ case mdf_type_manual_item: {
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getManualObjList()->begin(); it != m_mdf.getManualObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Manual* pManual = *it;
+ m_mdf.getManualObjList()->erase(it);
+ delete pManual;
+ break;
}
+ ++it;
+ }
- renderPictureItems(pItem, selectedIndex);
- } break;
+ m_headFileManual->removeChild(pItem);
+ } break;
- case mdf_type_video: {
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_video_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ case mdf_type_manual_sub_item: {
+
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getManualObjList()->begin(); it != m_mdf.getManualObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Manual* pManual = *it;
+ m_mdf.getManualObjList()->erase(it);
+ delete pManual;
+ break;
+ ;
}
+ ++it;
+ }
- renderVideoItems(pItem, selectedIndex);
- } break;
+ m_headFileManual->removeChild(pItemHead);
+ } break;
- case mdf_type_firmware: {
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_firmware_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Firmware
+
+ case mdf_type_firmware_item: {
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getFirmwareObjList()->begin(); it != m_mdf.getFirmwareObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Firmware* pFirmware = *it;
+ m_mdf.getFirmwareObjList()->erase(it);
+ delete pFirmware;
+ break;
}
+ ++it;
+ }
- renderFirmwareItems(pItem, selectedIndex);
- } break;
+ m_headFileFirmware->removeChild(pItem);
+ } break;
- case mdf_type_driver: {
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_driver_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ case mdf_type_firmware_sub_item: {
+
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getFirmwareObjList()->begin(); it != m_mdf.getFirmwareObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Firmware* pFirmware = *it;
+ m_mdf.getFirmwareObjList()->erase(it);
+ delete pFirmware;
+ break;
+ ;
}
+ ++it;
+ }
- renderDriverItems(pItem, selectedIndex);
- } break;
+ m_headFileFirmware->removeChild(pItemHead);
+ } break;
- case mdf_type_setup: {
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while ((nullptr != piter) && (mdf_type_picture_item == piter->getObjectType())) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ // Driver
+
+ case mdf_type_driver_item: {
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getDriverObjList()->begin(); it != m_mdf.getDriverObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Driver* pDriver = *it;
+ m_mdf.getDriverObjList()->erase(it);
+ delete pDriver;
+ break;
}
+ ++it;
+ }
- renderPictureItems(pItem, selectedIndex);
- } break;
+ m_headFileDriver->removeChild(pItem);
+ } break;
- case mdf_type_manual: {
- QMdfTreeWidgetItem* piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
- while (mdf_type_manual_item == piter->getObjectType()) {
- pItem->removeChild(piter);
- delete piter;
- piter = (QMdfTreeWidgetItem*)ui->treeMDF->itemBelow(pItem);
+ case mdf_type_driver_sub_item: {
+
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getDriverObjList()->begin(); it != m_mdf.getDriverObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Driver* pDriver = *it;
+ m_mdf.getDriverObjList()->erase(it);
+ delete pDriver;
+ break;
+ ;
}
+ ++it;
+ }
- renderManualItems(pItem, selectedIndex);
- } break;
- }
- }
+ m_headFileDriver->removeChild(pItemHead);
+ } break;
+
+ // Setup
+
+ case mdf_type_setup_item: {
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getSetupObjList()->begin(); it != m_mdf.getSetupObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Setup* pSetup = *it;
+ m_mdf.getSetupObjList()->erase(it);
+ delete pSetup;
+ break;
+ }
+ ++it;
+ }
+
+ m_headFileSetupScript->removeChild(pItem);
+ } break;
+
+ case mdf_type_setup_sub_item: {
+
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getSetupObjList()->begin(); it != m_mdf.getSetupObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Setup* pSetup = *it;
+ m_mdf.getSetupObjList()->erase(it);
+ delete pSetup;
+ break;
+ ;
+ }
+ ++it;
+ }
+
+ m_headFileSetupScript->removeChild(pItemHead);
+ } break;
+
+ } // switch
}
///////////////////////////////////////////////////////////////////////////////
-// editFile
+// editRegister
//
void
-CFrmMdf::editFile(void)
+CFrmMdf::editRegister(void)
{
QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent();
@@ -3930,60 +5173,65 @@ CFrmMdf::editFile(void)
// Item must be selected
if (nullptr == pItem) {
- int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("No MDF bootloader item selected"));
+ int ret = QMessageBox::critical(this, tr("MDF register edit"), tr("No MDF register item selected"));
return;
}
// Must have an object
if (nullptr == pItem->getObject()) {
- int ret = QMessageBox::critical(this, tr("MDF bootloader edit"), tr("Internal error: Invalid bootloader object"));
- spdlog::error("MDF bootloader edit - object has nullptr");
+ int ret = QMessageBox::critical(this, tr("MDF register edit"), tr("Internal error: Invalid register object"));
+ spdlog::error("MDF register edit - object has nullptr");
return;
}
switch (pItem->getObjectType()) {
- case mdf_type_picture_item: {
- CMDF_Picture* pobj = (CMDF_Picture*)pItem->getObject();
- CDlgMdfFilePicture dlg(this);
- dlg.initDialogData(pobj);
+ case mdf_type_register_page: {
+ CDlgMdfRegisterList dlg(this);
+ dlg.initDialogData(&m_mdf, selectedIndex);
if (QDialog::Accepted == dlg.exec()) {
- qDebug() << "Item = " << pItem->text(0) << ((CMDF_Picture*)pItem->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItem->getObject())->getMdfObjectType();
+ }
+ } break;
- QList childrenList = pItem->takeChildren();
- // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
- // qDebug() << "Take children: size = " << childrenList.size();
+ case mdf_type_register: {
+ // Should not come here. But if we do don't do an anything. :))))
+ } break;
+ case mdf_type_register_item: {
+ CMDF_Register* preg = (CMDF_Register*)pItem->getObject();
+ if (nullptr == preg) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid firmware object"));
+ spdlog::error("MDF register edit - object has nullptr");
+ return;
+ }
+ CDlgMdfRegister dlg(this);
+ dlg.initDialogData(&m_mdf, preg, 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);
- // qDebug() << item->text(0);
delete item;
}
childrenList.clear();
-
- renderPictureSubItems(pItem, pobj);
-
- // Expand to make items visible
- pItem->setExpanded(true);
+ pItem->setText(0, QString("Register %1 %2").arg(preg->getOffset()).arg(preg->getName().c_str()));
+ renderRegisterInfo(pItem, preg);
}
} break;
- case mdf_type_picture_sub_item: {
- CMDF_Picture* pobj = (CMDF_Picture*)pItemHead->getObject();
- if (nullptr == pobj) {
- int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid picture object"));
- spdlog::error("MDF picture edit - object has nullptr");
+ case mdf_type_register_sub_item: {
+ CMDF_Register* preg = (CMDF_Register*)pItem->getObject();
+ if (nullptr == preg) {
+ int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid firmware object"));
+ spdlog::error("MDF register edit - object has nullptr");
return;
}
- CDlgMdfFilePicture dlg(this);
- dlg.initDialogData(pobj, static_cast(pItem->getElementIndex()));
+ CDlgMdfRegister dlg(this);
+ dlg.initDialogData(&m_mdf, preg, selectedIndex);
if (QDialog::Accepted == dlg.exec()) {
-
+ pItemHead->setExpanded(true);
QList childrenList = pItemHead->takeChildren();
- // qDebug() << "Header = " << pItemHead->text(0) << ((CMDF_Picture*)pItemHead->getObject())->getName().c_str() << " type = " << ((CMDF_Picture*)pItemHead->getObject())->getMdfObjectType();
- // qDebug() << "Take children: size = " << childrenList.size();
-
// Remove children
for (qsizetype i = 0; i < childrenList.size(); ++i) {
QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
@@ -3991,10 +5239,98 @@ CFrmMdf::editFile(void)
delete item;
}
childrenList.clear();
+ pItemHead->setText(0, QString("Register %1 %2").arg(preg->getOffset()).arg(preg->getName().c_str()));
+ renderRegisterInfo(pItemHead, preg);
+ }
+ } break;
+ }
+}
- selectedIndex = pItem->getElementIndex();
- renderPictureSubItems(pItemHead, pobj);
+///////////////////////////////////////////////////////////////////////////////
+// deleteRegister
+//
+
+void
+CFrmMdf::deleteRegister(void)
+{
+ QMdfTreeWidgetItem* pItem = (QMdfTreeWidgetItem*)ui->treeMDF->currentItem();
+ QMdfTreeWidgetItem* pItemHead = (QMdfTreeWidgetItem*)pItem->parent();
+ uint16_t selectedIndex = pItem->getElementIndex();
+
+ // Item must be selected
+ if (nullptr == pItem) {
+ int ret = QMessageBox::critical(this, tr("MDF file edit"), tr("No MDF file item selected"));
+ return;
+ }
+
+ // Must have an object
+ if (nullptr == pItem->getObject()) {
+ int ret = QMessageBox::critical(this, tr("MDF file edit"), tr("Internal error: Invalid file object"));
+ spdlog::error("MDF file edit - object has nullptr");
+ return;
+ }
+
+ if (QMessageBox::Yes != QMessageBox::question(this, tr("MDF module item delete"), tr("Are you sure?"))) {
+ return;
+ }
+
+ switch (pItem->getObjectType()) {
+
+ case mdf_type_register:
+ // Nothing to do and should not come here :)
+ break;
+
+ case mdf_type_register_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 *pregisters = m_mdf.getRegisterObjList();
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getRegisterObjList()->begin(); it != m_mdf.getRegisterObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Register* pReg = *it;
+ m_mdf.getRegisterObjList()->erase(it);
+ delete pReg;
+ break;
+ }
+ ++it;
}
+
+ pItemHead->removeChild(pItem);
} break;
+
+ case mdf_type_register_sub_item: {
+ QMdfTreeWidgetItem* pItemHeadHead = (QMdfTreeWidgetItem*)pItemHead->parent();
+ QList childrenList = pItemHead->takeChildren();
+ // Remove children
+ for (qsizetype i = 0; i < childrenList.size(); ++i) {
+ QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i);
+ delete item;
+ }
+ childrenList.clear();
+
+ std::deque *pregisters = m_mdf.getRegisterObjList();
+ // Find element and delete it
+ for (std::deque::iterator it = m_mdf.getRegisterObjList()->begin(); it != m_mdf.getRegisterObjList()->end();) {
+ if (*it == pItem->getObject()) {
+ CMDF_Register* pReg = *it;
+ m_mdf.getRegisterObjList()->erase(it);
+ delete pReg;
+ break;
+ }
+ ++it;
+ }
+
+ pItemHeadHead->removeChild(pItemHead);
+ }break;
+
+ case mdf_type_register_page:
+ break;
}
-}
\ No newline at end of file
+
+ //m_headFileSetupScript->removeChild(pItemHead);
+}
diff --git a/src/cfrmmdf.h b/src/cfrmmdf.h
index 8acb035e..0e50a2e7 100644
--- a/src/cfrmmdf.h
+++ b/src/cfrmmdf.h
@@ -184,7 +184,10 @@ public slots:
void onItemDoubleClicked(QTreeWidgetItem* item, int column);
/// Edit MDF data
- void editData(void);
+ void editItem(void);
+
+ /// Delete MDF data
+ void deleteItem(void);
/// Edit MDF module data
void editModuleData(void);
@@ -192,9 +195,15 @@ public slots:
/// Edit MDF descriptions
void editDescription(void);
+ /// Delete MDF descriptions
+ void deleteDescription(void);
+
/// Edit MDF info URL's
void editInfoUrl(void);
+ /// Delete MDF info URL's
+ void deleteInfoUrl(void);
+
/// Edit MDF manufacturer data
void editManufacturerData(void);
@@ -207,7 +216,10 @@ public slots:
void showContactDialog(QMdfTreeWidgetItem* pItem, mdf_dlg_contact_type type, QString title);
/// Edit phone/fax/email/web/social data
- void editContact(void);
+ void editContact(void);
+
+ /// Delete phone/fax/email/web/social data
+ void deleteContact(void);
/// Edit bootloader data
void editBootLoader(void);
@@ -215,9 +227,18 @@ public slots:
/// Edit file list (top item file header)
void editFileList(void);
- /// Edit file objects
+ /// Edit file object
void editFile(void);
+ /// Delete file object
+ void deleteFile(void);
+
+ /// Edit register info
+ void editRegister();
+
+ /// Delete register item
+ void deleteRegister();
+
/*!
Fill in data from info map as children to parent item
@@ -227,7 +248,7 @@ public slots:
@param bChildIsKnown Set to true of pParent points to description head
*/
void
- fillDescriptionItems(QTreeWidgetItem* pParent,
+ renderDescriptionItems(QTreeWidgetItem* pParent,
CMDF_Object* pobj,
std::map* pObjMap,
bool bChildIsKnown = false);
@@ -241,7 +262,7 @@ public slots:
@param bChildIsKnown Set to true of pParent points to info URL head
*/
void
- fillInfoUrlItems(QTreeWidgetItem* pParent,
+ renderInfoUrlItems(QTreeWidgetItem* pParent,
CMDF_Object* pobj,
std::map* pObjMap,
bool bChildIsKnown = false);
@@ -252,7 +273,7 @@ public slots:
@param dequebits Reference for std:deque holding bit infor objects
*/
void
- fillBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits);
+ renderBitInfo(QTreeWidgetItem* pParent, std::deque& dequebits);
/*!
Fill value list info
@@ -261,7 +282,7 @@ public slots:
@param dequevalues Reference for std:deque holding bit infor objects
*/
void
- fillValueInfo(QTreeWidgetItem* pParent, std::deque& dequevalues);
+ renderValueInfo(QTreeWidgetItem* pParent, std::deque& dequevalues);
/*!
Fill in register info
@@ -270,7 +291,7 @@ public slots:
@preg Pointer to register definition
*/
void
- fillRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg);
+ renderRegisterInfo(QTreeWidgetItem* pParent, CMDF_Register* preg);
/*!
Remove all subitems of a head item that have a speciified type.
@@ -477,6 +498,11 @@ public slots:
*/
QMdfTreeWidgetItem* m_headModule;
QMdfTreeWidgetItem* m_headManufacturer;
+ QMdfTreeWidgetItem* m_headManufacturerPhone;
+ QMdfTreeWidgetItem* m_headManufacturerFax;
+ QMdfTreeWidgetItem* m_headManufacturerEmail;
+ QMdfTreeWidgetItem* m_headManufacturerWeb;
+ QMdfTreeWidgetItem* m_headManufacturerSocial;
QMdfTreeWidgetItem* m_headBootLoader;
QMdfTreeWidgetItem* m_headFile;
QMdfTreeWidgetItem* m_headFilePicture;
diff --git a/src/cfrmmdf.ui b/src/cfrmmdf.ui
index 4503c029..4ea332b4 100644
--- a/src/cfrmmdf.ui
+++ b/src/cfrmmdf.ui
@@ -7,7 +7,7 @@
0
0
635
- 716
+ 703
@@ -233,10 +233,13 @@
&Edit
+
+
+
-
+
@@ -306,6 +309,17 @@
&Redraw MDF tree
+
+ Ctrl+R
+
+
+
+
+ &Delete Item
+
+
+ Ctrl+D
+