Skip to content

Commit

Permalink
Added event editing
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Feb 8, 2024
1 parent 7ff74cc commit ce19ffb
Show file tree
Hide file tree
Showing 14 changed files with 2,211 additions and 219 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ qt5_wrap_ui(UI src/mainwindow.ui
src/cdlgmdfdm.ui
src/cdlgmdfdmaction.ui
str/cdlgmdfdmactionparam.ui

src/cdlgmdfevents.ui
src/cdlgmdfeventdata.ui
)

add_executable(${PROJECT_NAME}
Expand Down Expand Up @@ -633,6 +636,16 @@ add_executable(${PROJECT_NAME}
src/cdlgmdfdmactionparam.cpp
src/cdlgmdfdmactionparam.h

build/ui_cdlgmdfevent.h
src/cdlgmdfevent.ui
src/cdlgmdfevent.cpp
src/cdlgmdfevent.h

build/ui_cdlgmdfeventdata.h
src/cdlgmdfeventdata.ui
src/cdlgmdfeventdata.cpp
src/cdlgmdfeventdata.h

${VSCP_PATH}/src/vscp/common/version.h
${VSCP_PATH}/src/vscp/common/vscp.h
${VSCP_PATH}/src/vscp/common/vscpremotetcpif.h
Expand Down
49 changes: 40 additions & 9 deletions src/cdlgmdfdm.ui
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>Level I</string>
Expand All @@ -78,6 +84,12 @@
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinStartPage">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>65535</number>
</property>
Expand All @@ -91,7 +103,14 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="editStartOffset"/>
<widget class="QLineEdit" name="editStartOffset">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
Expand All @@ -102,6 +121,12 @@
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinRowCnt">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
Expand All @@ -116,6 +141,12 @@
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="spinRowSize">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
Expand All @@ -140,36 +171,36 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="btnEditAction">
<widget class="QToolButton" name="btnAddAction">
<property name="toolTip">
<string>Edit action item</string>
<string>Add action item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/pencil.svg</normaloff>:/pencil.svg</iconset>
<normaloff>:/add.png</normaloff>:/add.png</iconset>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
<string>Ctrl+A</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnAddAction">
<widget class="QToolButton" name="btnEditAction">
<property name="toolTip">
<string>Add action item</string>
<string>Edit action item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/add.png</normaloff>:/add.png</iconset>
<normaloff>:/pencil.svg</normaloff>:/pencil.svg</iconset>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
<string>Ctrl+E</string>
</property>
</widget>
</item>
Expand Down
21 changes: 12 additions & 9 deletions src/cdlgmdfdmaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,11 @@ CDlgMdfDmAction::editActionParam(void)
int idx = ui->listActionParams->currentRow();

QListWidgetItem* pitem = ui->listActionParams->currentItem();
printf("data=%d\n", pitem->data(QListWidgetItem::UserType).toUInt());
CMDF_ActionParameter* pactionparam = m_paction->getActionParam(pitem->data(QListWidgetItem::UserType).toUInt());
CMDF_ActionParameter* pactionparam =
m_paction->getActionParam(pitem->data(QListWidgetItem::UserType).toUInt());
if (nullptr == pactionparam) {
return;
}

CDlgMdfDmActionParam dlg(this);
dlg.initDialogData(m_pmdf, pactionparam);
Expand Down Expand Up @@ -296,7 +299,7 @@ CDlgMdfDmAction::addActionParam(void)
}

CDlgMdfDmActionParam dlg(this);
adddlg:
adddlg:
dlg.initDialogData(m_pmdf, pactionparam);
// If DM is level I only offset 0 is allowd
if (VSCP_LEVEL1 == m_pmdf->getLevel()) {
Expand Down Expand Up @@ -328,7 +331,7 @@ CDlgMdfDmAction::dupActionParam(void)
// Save the selected row
int idx = ui->listActionParams->currentRow();

QListWidgetItem* pitem = ui->listActionParams->currentItem();
QListWidgetItem* pitem = ui->listActionParams->currentItem();
CMDF_ActionParameter* pactionparam = m_paction->getActionParam(pitem->data(QListWidgetItem::UserType).toUInt());
if (nullptr == pactionparam) {
return;
Expand Down Expand Up @@ -377,20 +380,20 @@ CDlgMdfDmAction::deleteActionParam(void)
// Save the selected row
int idx = ui->listActionParams->currentRow();

QListWidgetItem* pitem = ui->listActionParams->currentItem();
QListWidgetItem* pitem = ui->listActionParams->currentItem();
CMDF_ActionParameter* pactionparam = m_paction->getActionParam(pitem->data(QListWidgetItem::UserType).toUInt());
if (nullptr == pactionparam) {
return;
}

if (QMessageBox::No == QMessageBox::question(this,
tr("MDF delete action parameter"),
tr("Delete action parameter with offset %1.").arg(pactionparam->getOffset()))) {
if (QMessageBox::No == QMessageBox::question(this,
tr("MDF delete action parameter"),
tr("Delete action parameter with offset %1.").arg(pactionparam->getOffset()))) {
return;
}

if (!m_paction->deleteActionParam(pactionparam)) {
QMessageBox::warning(this, tr("MDF add new action parameter"), tr("Failed to remove action parameter with offset %1.").arg(pactionparam->getOffset()));
QMessageBox::warning(this, tr("MDF add new action parameter"), tr("Failed to remove action parameter with offset %1.").arg(pactionparam->getOffset()));
}

renderActionParams();
Expand Down
22 changes: 14 additions & 8 deletions src/cdlgmdfdmaction.ui
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinCode">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<number>65535</number>
</property>
Expand Down Expand Up @@ -92,36 +98,36 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="btnEditActionParam">
<widget class="QToolButton" name="btnAddActionParam">
<property name="toolTip">
<string>Edit action parameter item</string>
<string>Add action parameter item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/pencil.svg</normaloff>:/pencil.svg</iconset>
<normaloff>:/add.png</normaloff>:/add.png</iconset>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
<string>Ctrl+A</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnAddActionParam">
<widget class="QToolButton" name="btnEditActionParam">
<property name="toolTip">
<string>Add action parameter item</string>
<string>Edit action parameter item</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="vscpworks.qrc">
<normaloff>:/add.png</normaloff>:/add.png</iconset>
<normaloff>:/pencil.svg</normaloff>:/pencil.svg</iconset>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
<string>Ctrl+E</string>
</property>
</widget>
</item>
Expand Down
Loading

0 comments on commit ce19ffb

Please sign in to comment.