void ConfigureFTDIDMXOut::slotTestToggled(bool state) { QTreeWidgetItem* item = NULL; if (state == true) { item = m_list->currentItem(); if (item == NULL) { /* If there is no selection, don't toggle the button */ m_testButton->setDown(false); } else { /* Get the number of the universe to test */ m_output = item->text(KColumnOutput).toInt(); /* Open the output line for testing */ m_plugin->open(m_output); /* Disable the listview so that the selection cannot be changed during testing */ m_list->setEnabled(false); m_buttonBox->setEnabled(false); /* Start a 1sec timer that blinks all channels of the selected universe on and off */ m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTestTimeout())); m_timer->start(1000); /* Do the first cycle already here, since the first timeout occurs after one second */ slotTestTimeout(); } } else { delete m_timer; m_timer = NULL; /* Open the output line for testing */ m_plugin->close(m_output); m_list->setEnabled(true); m_buttonBox->setEnabled(true); /* Reset channel values to zero */ if (m_testMod == 1) { m_testMod = 0; slotTestTimeout(); m_testMod = 0; } m_output = KOutputInvalid; } }
void ConfigureLlaOut::slotTestToggled(bool state) { QTreeWidgetItem* item; if (state == true) { item = m_listView->currentItem(); if (item == NULL) { /* If there is no selection, don't toggle the button */ m_testButton->setChecked(false); } else { /* Get the number of the universe to test */ m_testUniverse = item->text(0).toInt() - 1; /* Disable the listview so that the selection cannot be changed during testing */ m_listView->setEnabled(false); /* Start a 1sec timer that blinks all channels of the selected universe on and off */ m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTestTimeout())); m_timer->start(1000); /* Do the first cycle already here, since the first timeout occurs after one second */ m_testMod = 1; slotTestTimeout(); } } else { delete m_timer; m_timer = NULL; m_listView->setEnabled(true); /* Reset channel values to zero */ if (m_testMod == 1) { m_testMod = 0; slotTestTimeout(); m_testMod = 0; } m_testUniverse = -1; } }