void addAlarmToList (CAlarmMessage * alarm){
bool found = false;
//Find if the alarm just exist int the list
int count = twAlarms->count();
for (int i = count-1; i >= 0; i--) {
QVBox * tab = (QVBox *) twAlarms->page(i);
if ( !strcmp(twAlarms->label(i).latin1(),"Alarm Type 1") ) {
Alarm1 * alm = (Alarm1 *) tab->child("Alarm Type 1");
if ( (alarm->getTrackId() == alm->getTrackId()) && (alarm->getType()==alm->getType()) )
found = true;
}
else {
Alarm2 * alm = (Alarm2 *) tab->child("Alarm Type 2");
if ( (alarm->getTrackId() == alm->getTrackId()) && (alarm->getType()==alm->getType()) )
found = true;
}
}
if (!found) {
//Add Alarm to Alarms List
QVBox * newTab = new QVBox( twAlarms, "tab" );
newTab->setMargin(5);
QFont newTab_font
( newTab
->font
() );
newTab_font.setBold( false );
newTab->setFont( newTab_font );
if ( (alarm->getType() == AL_TC_2_2)) {
Alarm1 * alm = new Alarm1(alarm, HIL, newTab);
connect(alm, SIGNAL(buttonClicked()), this, SLOT(alarmSent()));
twAlarms
->addTab
( newTab,
QString::fromLatin1("Alarm Type 1") );
twAlarms->showPage( newTab );
} else
if (alarm->getType()== AL_TU_2 || alarm->getType()== AL_TU_3) {
Alarm2 * alm = new Alarm2(alarm, HIL, newTab);
connect(alm, SIGNAL(buttonClicked()), this, SLOT(alarmConfirm()));
twAlarms
->addTab
( newTab,
QString::fromLatin1("Alarm Type 2") );
twAlarms->showPage( newTab );
}
}
}
void addAlarmToList (CAlarmMessage * alarm){
bool found = false;
//Find if the alarm just exist int the list
int count = twAlarms->count();
for (int i = count-1; i >= 0; i--) {
QVBox * tab = (QVBox *) twAlarms->page(i);
if ( !strcmp(twAlarms->label(i).latin1(),"Alarm Type 1") ) {
Alarm1 * alm = (Alarm1 *) tab->child("Alarm Type 1");
if ( (alarm->getTrackId() == alm->getTrackId()) && (alarm->getType()==alm->getType()) )
found = true;
}
else {
Alarm2 * alm = (Alarm2 *) tab->child("Alarm Type 2");
if ( (alarm->getTrackId() == alm->getTrackId()) && (alarm->getType()==alm->getType()) )
found = true;
}
}
if (!found) {
//Add Alarm to Alarms List
QVBox * newTab = new QVBox( twAlarms, "tab" );
newTab->setMargin(5);
QFont newTab_font( newTab->font() );
newTab_font.setBold( false );
newTab->setFont( newTab_font );
if ( (alarm->getType() == AL_TC_2_2)) {
Alarm1 * alm = new Alarm1(alarm, HIL, newTab);
connect(alm, SIGNAL(buttonClicked()), this, SLOT(alarmSent()));
twAlarms->addTab( newTab, QString::fromLatin1("Alarm Type 1") );
twAlarms->showPage( newTab );
} else
if (alarm->getType()== AL_TU_2 || alarm->getType()== AL_TU_3) {
Alarm2 * alm = new Alarm2(alarm, HIL, newTab);
connect(alm, SIGNAL(buttonClicked()), this, SLOT(alarmConfirm()));
twAlarms->addTab( newTab, QString::fromLatin1("Alarm Type 2") );
twAlarms->showPage( newTab );
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks