void TraceAnalyzer::createPidFilter(QMap<int, int> &map, bool orlogic, bool inclusive) { /* * An empty map is interpreted to mean that no filtering is desired, * a map of the same size as the taskMap should mean that the user * wants to filter on all pids, which is the same as no filtering */ if (map.isEmpty() || map.size() == taskMap.size()) { if (filterState.isEnabled(FilterState::FILTER_PID)) disableFilter(FilterState::FILTER_PID); return; } if (orlogic) { OR_pidFilterInclusive = inclusive; OR_filterPidMap = map; OR_filterState.enable(FilterState::FILTER_PID); } else { pidFilterInclusive = inclusive; filterPidMap = map; filterState.enable(FilterState::FILTER_PID); } if (filterState.isEnabled()) processAllFilters(); }
void FilterExpressionToolBar::onCustomMenuHandler(const QPoint& pos) { QAction * filterAction = actionAt(pos); if ( ! filterAction ) return; QMenu * filterMenu = new QMenu(this); QAction *actFilter = filterMenu->addAction(tr("Filter Button Preferences...")); connect(actFilter, SIGNAL(triggered()), this, SLOT(toolBarShowPreferences())); actFilter->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_)); actFilter->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_)); actFilter->setData(filterAction->data()); filterMenu->addSeparator(); QAction * actEdit = filterMenu->addAction(tr("Edit")); connect(actEdit, SIGNAL(triggered()), this, SLOT(editFilter())); actEdit->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_)); actEdit->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_)); actEdit->setData(filterAction->data()); QAction * actDisable = filterMenu->addAction(tr("Disable")); connect(actDisable, SIGNAL(triggered()), this, SLOT(disableFilter())); actDisable->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_)); actDisable->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_)); actDisable->setData(filterAction->data()); QAction * actRemove = filterMenu->addAction(tr("Remove")); connect(actRemove, SIGNAL(triggered()), this, SLOT(removeFilter())); actRemove->setProperty(dfe_property_label_, filterAction->property(dfe_property_label_)); actRemove->setProperty(dfe_property_expression_, filterAction->property(dfe_property_expression_)); actRemove->setData(filterAction->data()); filterMenu->exec(mapToGlobal(pos)); }
void TraceAnalyzer::createEventFilter(QMap<event_t, event_t> &map, bool orlogic) { /* * An empty map is interpreted to mean that no filtering is desired, * a map of the same size as the taskMap should mean that the user * wants to filter on all pids, which is the same as no filtering */ if (map.isEmpty() || map.size() == TraceEvent::getNrEvents()) { if (filterState.isEnabled(FilterState::FILTER_EVENT)) disableFilter(FilterState::FILTER_EVENT); return; } if (orlogic) { OR_filterEventMap = map; OR_filterState.enable(FilterState::FILTER_EVENT); } else { filterEventMap = map; filterState.enable(FilterState::FILTER_EVENT); } /* No need to process filters if we only have OR-filters */ if (filterState.isEnabled()) processAllFilters(); }
SInt IOEthernetInterface::syncSIOCADDMULTI(IONetworkController * ctr) { IOReturn ret; // Make sure multicast filter is active. ret = enableFilter(ctr, gIONetworkFilterGroup, kIOPacketFilterMulticast); if ( ret == kIOReturnSuccess ) { // Load multicast addresses only if the filter was activated. ret = setupMulticastFilter(ctr); // If the list is now empty, then deactivate the multicast filter. if ( _mcAddrCount == 0 ) { IOReturn dret = disableFilter(ctr, gIONetworkFilterGroup, kIOPacketFilterMulticast); if (ret == kIOReturnSuccess) ret = dret; } } return errnoFromReturn(ret); }
void TraceAnalyzer::removePidFromFilter(int pid) { DEFINE_FILTER_PIDMAP_ITERATOR(iter); if (!filterState.isEnabled(FilterState::FILTER_PID)) return; iter = filterPidMap.find(pid); if (iter == filterPidMap.end()) { return; } iter = filterPidMap.erase(iter); if (filterPidMap.isEmpty()) { disableFilter(FilterState::FILTER_PID); return; } processAllFilters(); }
void TraceAnalyzer::addPidToFilter(int pid) { DEFINE_FILTER_PIDMAP_ITERATOR(iter); iter = filterPidMap.find(pid); if (iter != filterPidMap.end()) { if (filterState.isEnabled(FilterState::FILTER_PID)) return; goto epilogue; } filterPidMap[pid] = pid; epilogue: /* Disable filter if we are filtering on all pids */ if (filterPidMap.size() == taskMap.size()) { disableFilter(FilterState::FILTER_PID); return; } filterState.enable(FilterState::FILTER_PID); processAllFilters(); }
int IOEthernetInterface::syncSIOCSIFFLAGS(IONetworkController * ctr) { UInt16 flags = getFlags(); IOReturn ret = kIOReturnSuccess; if ( ( ((flags & IFF_UP) == 0) || _controllerLostPower ) && ( flags & IFF_RUNNING ) ) { // If interface is marked down and it is currently running, // then stop it. ctr->doDisable(this); flags &= ~IFF_RUNNING; _ctrEnabled = false; } else if ( ( flags & IFF_UP ) && ( _controllerLostPower == false ) && ((flags & IFF_RUNNING) == 0) ) { // If interface is marked up and it is currently stopped, // then start it. if ( (ret = enableController(ctr)) == kIOReturnSuccess ) flags |= IFF_RUNNING; } if ( flags & IFF_RUNNING ) { IOReturn rc; // We don't expect multiple flags to be changed for a given // SIOCSIFFLAGS call. // Promiscuous mode rc = (flags & IFF_PROMISC) ? enableFilter(ctr, gIONetworkFilterGroup, kIOPacketFilterPromiscuous) : disableFilter(ctr, gIONetworkFilterGroup, kIOPacketFilterPromiscuous); if (ret == kIOReturnSuccess) ret = rc; // Multicast-All mode rc = (flags & IFF_ALLMULTI) ? enableFilter(ctr, gIONetworkFilterGroup, kIOPacketFilterMulticastAll) : disableFilter(ctr, gIONetworkFilterGroup, kIOPacketFilterMulticastAll); if (ret == kIOReturnSuccess) ret = rc; } // Update the flags field to pick up any modifications. Also update the // property table to reflect any flag changes. setFlags(flags, ~flags); return errnoFromReturn(ret); }
IOReturn IOEthernetInterface::enableController(IONetworkController * ctr) { IOReturn ret = kIOReturnSuccess; bool enabled = false; assert(ctr); do { // Is controller already enabled? If so, exit and return success. if ( _ctrEnabled ) break; // Send the controller an enable command. if ( (ret = ctr->doEnable(this)) != kIOReturnSuccess ) break; // unable to enable the controller. enabled = true; // Disable all Wake-On-LAN filters. disableFilter(ctr, gIOEthernetWakeOnLANFilterGroup, ~0, kFilterOptionNoStateChange); // Restore current filter selection. SET_ACTIVE_FILTERS(gIONetworkFilterGroup, 0); ret = enableFilter(ctr, gIONetworkFilterGroup, 0, kFilterOptionSyncPendingIO); if ( ret != kIOReturnSuccess ) break; // Restore multicast filter settings. syncSIOCADDMULTI(ctr); // Re-apply the user supplied link-level address. OSData * lladdr = OSDynamicCast(OSData, getProperty(kIOMACAddress)); if ( lladdr && lladdr->getLength() == ETHER_ADDR_LEN ) { ctr->setHardwareAddress( lladdr->getBytesNoCopy(), lladdr->getLength() ); } _ctrEnabled = true; // Publish WOL support flags after interface is marked enabled. reportInterfaceWakeFlags(ctr); } while (false); // Disable the controller if a serious error has occurred after the // controller has been enabled. if ( enabled && (ret != kIOReturnSuccess) ) { ctr->doDisable(this); } return ret; }
bool StdWidgetFactory::startEditing(const QCString &classname, QWidget *w, KFormDesigner::Container *container) { setWidget(w, container); // m_container = container; if(classname == "KLineEdit") { KLineEdit *lineedit = static_cast<KLineEdit*>(w); createEditor(classname, lineedit->text(), lineedit, container, lineedit->geometry(), lineedit->alignment(), true); return true; } else if(classname == "QLabel") { QLabel *label = static_cast<QLabel*>(w); if(label->textFormat() == RichText) { //m_widget = w; // setWidget(w, container); editText(); } else createEditor(classname, label->text(), label, container, label->geometry(), label->alignment()); return true; } else if(classname == "KPushButton") { KPushButton *push = static_cast<KPushButton*>(w); QRect r = w->style().subRect(QStyle::SR_PushButtonContents, w); QRect editorRect = QRect(push->x() + r.x(), push->y() + r.y(), r.width(), r.height()); //r.setX(r.x() + 5); //r.setY(r.y() + 5); //r.setWidth(r.width()-10); //r.setHeight(r.height() - 10); createEditor(classname, push->text(), push, container, editorRect, Qt::AlignCenter, false, false, Qt::PaletteButton); return true; } else if(classname == "QRadioButton") { QRadioButton *radio = static_cast<QRadioButton*>(w); QRect r = w->style().subRect(QStyle::SR_RadioButtonContents, w); QRect editorRect = QRect(radio->x() + r.x(), radio->y() + r.y(), r.width(), r.height()); createEditor(classname, radio->text(), radio, container, editorRect, Qt::AlignAuto); return true; } else if(classname == "QCheckBox") { QCheckBox *check = static_cast<QCheckBox*>(w); //QRect r(check->geometry()); //r.setX(r.x() + 20); QRect r = w->style().subRect(QStyle::SR_CheckBoxContents, w); QRect editorRect = QRect(check->x() + r.x(), check->y() + r.y(), r.width(), r.height()); createEditor(classname, check->text(), check, container, editorRect, Qt::AlignAuto); return true; } else if((classname == "KComboBox") || (classname == "KListBox")) { QStringList list; if(classname == "KListBox") { KListBox *listbox = (KListBox*)w; for(uint i=0; i < listbox->count(); i++) list.append(listbox->text(i)); } else if(classname == "KComboBox") { KComboBox *combo = (KComboBox*)w; for(int i=0; i < combo->count(); i++) list.append(combo->text(i)); } if(editList(w, list)) { if(classname == "KListBox") { ((KListBox*)w)->clear(); ((KListBox*)w)->insertStringList(list); } else if(classname == "KComboBox") { ((KComboBox*)w)->clear(); ((KComboBox*)w)->insertStringList(list); } } return true; } else if((classname == "KTextEdit") || (classname == "KDateTimeWidget") || (classname == "KTimeWidget") || (classname == "KDateWidget") || (classname == "KIntSpinBox")) { disableFilter(w, container); return true; } return false; }