Skip to content

Commit

Permalink
Alarmbit edit added
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Jan 15, 2024
1 parent 585d739 commit c84453d
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 85 deletions.
28 changes: 26 additions & 2 deletions src/cdlgmdfregisterbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ CDlgMdfRegisterBit::CDlgMdfRegisterBit(QWidget* parent)

// m_type = mdf_type_unknown;
m_pbit = nullptr;

m_index = 0;
m_type = mdf_type_unknown;
vscpworks* pworks = (vscpworks*)QCoreApplication::instance();

setInitialFocus();
Expand All @@ -84,7 +85,7 @@ CDlgMdfRegisterBit::~CDlgMdfRegisterBit()
//

void
CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index)
CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index, mdf_record_type type)
{
QString str;

Expand All @@ -94,6 +95,8 @@ CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index)
}

m_pbit = pbit;
m_index = index;
m_type = type;

setName(pbit->getName().c_str());
setPos(pbit->getPos());
Expand Down Expand Up @@ -136,6 +139,27 @@ CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index)
ui->editName->setFocus();
break;
}

if (mdf_type_register == type) {
setWindowTitle("Register bit definitions");
}
else if (mdf_type_remotevar == type) {
setWindowTitle("Remote variable bit definitions");
}
else if (mdf_type_alarm == type) {
setWindowTitle("Alarm bit definitions");
ui->spinWidth->setValue(1);
ui->spinWidth->setEnabled(false);
ui->spinDefault->setValue(0);
ui->spinDefault->setEnabled(false);
ui->spinMin->setValue(0);
ui->spinMin->setEnabled(false);
ui->spinMax->setValue(1);
ui->spinMax->setEnabled(false);
ui->comboAccess->setCurrentIndex(3);
ui->comboAccess->setEnabled(false);
}

}

///////////////////////////////////////////////////////////////////////////////
Expand Down
8 changes: 7 additions & 1 deletion src/cdlgmdfregisterbit.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CDlgMdfRegisterBit : public QDialog {
@param index Selected file item
*/
void initDialogData(CMDF_Bit* pbit, int index = 0);
void initDialogData(CMDF_Bit* pbit, int index = 0, mdf_record_type type = mdf_type_register);

// ----------------------------------------------------------------------------
// Getters & Setters
Expand Down Expand Up @@ -117,6 +117,12 @@ public slots:

/// Pointer to bit information
CMDF_Bit* m_pbit;

/// Selected field in dialog
int m_index;

/// MDF record owner type we are editing
mdf_record_type m_type;
};

#endif // CDLGMDFREGISTERBIT_H
Loading

0 comments on commit c84453d

Please sign in to comment.