// Check to see if the ws80211 interface list matches the one in our // combobox. Rebuild ours if necessary and select the first interface if // the current selection goes away. void WirelessFrame::timerEvent(QTimerEvent *) { // Don't interfere with user activity. if (ui->interfaceComboBox->view()->isVisible() || ui->channelComboBox->view()->isVisible() || ui->channelTypeComboBox->view()->isVisible() || ui->fcsComboBox->view()->isVisible()) return; ws80211_free_interfaces(interfaces_); interfaces_ = ws80211_find_interfaces(); const QString old_iface = ui->interfaceComboBox->currentText(); guint iface_count = 0; bool list_changed = false; if (interfaces_ && interfaces_->len > 0) { iface_count = interfaces_->len; } if ((int) iface_count != ui->interfaceComboBox->count()) { list_changed = true; } else { for (guint i = 0; i < iface_count; i++) { struct ws80211_interface *iface = g_array_index(interfaces_, struct ws80211_interface *, i); if (ui->interfaceComboBox->itemText(i).compare(iface->ifname) != 0) { list_changed = true; break; } } } if (list_changed) { ui->interfaceComboBox->clear(); for (guint i = 0; i < iface_count; i++) { struct ws80211_interface *iface = g_array_index(interfaces_, struct ws80211_interface *, i); ui->interfaceComboBox->addItem(iface->ifname); if (old_iface.compare(iface->ifname) == 0) { ui->interfaceComboBox->setCurrentIndex(ui->interfaceComboBox->count() - 1); } } } if (ui->interfaceComboBox->currentText().compare(old_iface) != 0) { getInterfaceInfo(); } }
// Check to see if the ws80211 interface list matches the one in our // combobox. Rebuild ours if necessary and select the first interface if // the current selection goes away. void WirelessFrame::timerEvent(QTimerEvent *) { ws80211_free_interfaces(interfaces_); interfaces_ = ws80211_find_interfaces(); const QString old_iface = ui->interfaceComboBox->currentText(); guint iface_count = 0; bool list_changed = false; if (interfaces_ && interfaces_->len > 0) { iface_count = interfaces_->len; } if ((int) iface_count != ui->interfaceComboBox->count()) { list_changed = true; } else { for (guint i = 0; i < iface_count; i++) { struct ws80211_interface *iface = g_array_index(interfaces_, struct ws80211_interface *, i); if (ui->interfaceComboBox->itemText(i).compare(iface->ifname) != 0) { list_changed = true; break; } } } if (list_changed) { ui->interfaceComboBox->clear(); for (guint i = 0; i < iface_count; i++) { struct ws80211_interface *iface = g_array_index(interfaces_, struct ws80211_interface *, i); ui->interfaceComboBox->addItem(iface->ifname); if (old_iface.compare(iface->ifname) == 0) { ui->interfaceComboBox->setCurrentIndex(ui->interfaceComboBox->count() - 1); } } } if (ui->interfaceComboBox->currentText().compare(old_iface) != 0) { on_channelComboBox_activated(ui->interfaceComboBox->currentIndex()); } }