Skip to content

Commit

Permalink
Added register edit
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Nov 13, 2023
1 parent 52e8167 commit f539bfe
Show file tree
Hide file tree
Showing 29 changed files with 5,568 additions and 1,401 deletions.
29 changes: 26 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions mdf/beijing_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,13 @@
<description lang="en">
Reserved
</description>
</bit>
<bit pos="7" default="true" >
</bit>
<bit pos="7" default="true" >
<name lang="en">Enable channel</name>
<description lang="en">
Set this bit to make the output controllable.
</description>
</bit>
</bit>
</reg>

<reg page="0" offset="25" default="0x98" bgcolor="0xF0F5F5" >
Expand Down
100 changes: 0 additions & 100 deletions src/cdlgmdfbitlist.ui

This file was deleted.

70 changes: 42 additions & 28 deletions src/cdlgmdffiledriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ CDlgMdfFileDriver::CDlgMdfFileDriver(QWidget* parent)

vscpworks* pworks = (vscpworks*)QCoreApplication::instance();



setInitialFocus();
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -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");
}

Expand Down Expand Up @@ -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)");
Expand Down
23 changes: 12 additions & 11 deletions src/cdlgmdffiledriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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: ")
Expand Down Expand Up @@ -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);


// ----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit f539bfe

Please sign in to comment.