void QOfonoModemInterface::objectPathChanged(const QString &path, const QVariantMap *) { // The base implementation would immediately create the D-Bus interface // object. However we need to check if our interface is actually available // and postpone creation of the D-Bus interface object if our interface // isn't there (see onModemInterfacesChanged below) bool wasReady = isReady(); Private *d_ptr = privateData(); if (!d_ptr->modem.isNull()) { disconnect(d_ptr->modem.data(), SIGNAL(interfacesChanged(QStringList)), this, SLOT(onModemInterfacesChanged(QStringList))); d_ptr->modem.reset(); } setDbusInterface(NULL, NULL); d_ptr->modem = QOfonoModem::instance(objectPath()); connect(d_ptr->modem.data(), SIGNAL(interfacesChanged(QStringList)), this, SLOT(onModemInterfacesChanged(QStringList))); Q_EMIT modemPathChanged(path); onModemInterfacesChanged(d_ptr->modem->interfaces()); if (wasReady != isReady()) { Q_EMIT readyChanged(); } }
CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : GeometryStateDialog(parent), ui(new Ui::CaptureInterfacesDialog) { ui->setupUi(this); loadGeometry(); setWindowTitle(wsApp->windowTitleString(tr("Capture Interfaces"))); stat_timer_ = NULL; stat_cache_ = NULL; // XXX - Enable / disable as needed ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start")); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0)? true: false); // Start out with the list *not* sorted, so they show up in the order // in which they were provided ui->interfaceTree->sortByColumn(-1, Qt::AscendingOrder); ui->interfaceTree->setItemDelegateForColumn(col_interface_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_traffic_, new SparkLineDelegate()); ui->interfaceTree->setItemDelegateForColumn(col_link_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_snaplen_, &interface_item_delegate_); #ifdef SHOW_BUFFER_COLUMN ui->interfaceTree->setItemDelegateForColumn(col_buffer_, &interface_item_delegate_); #else ui->interfaceTree->setColumnHidden(col_buffer_, true); #endif #ifndef SHOW_MONITOR_COLUMN ui->interfaceTree->setColumnHidden(col_monitor_, true); #endif ui->interfaceTree->setItemDelegateForColumn(col_filter_, &interface_item_delegate_); interface_item_delegate_.setTree(ui->interfaceTree); #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) ui->filenameLineEdit->setPlaceholderText(tr("Leave blank to use a temporary file")); #endif // Changes in interface selections or capture filters should be propagated // to the main welcome screen where they will be applied to the global // capture options. connect(this, SIGNAL(interfacesChanged()), ui->captureFilterComboBox, SIGNAL(interfacesChanged())); connect(ui->captureFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(updateWidgets())); connect(ui->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(filterEdited())); connect(ui->captureFilterComboBox->lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(captureFilterTextEdited(QString))); connect(&interface_item_delegate_, SIGNAL(filterChanged(QString)), ui->captureFilterComboBox->lineEdit(), SLOT(setText(QString))); connect(&interface_item_delegate_, SIGNAL(filterChanged(QString)), this, SIGNAL(captureFilterTextEdited(QString))); connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); }
OfonoModemInterface::OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent) : QObject(parent) { m_m = new OfonoModem(modemSetting, modemPath, this); connect(m_m, SIGNAL(validityChanged(bool)), this, SLOT(modemValidityChanged(bool))); connect(m_m, SIGNAL(interfacesChanged(QStringList)), this, SLOT(interfacesChanged(QStringList))); m_if = new OfonoInterface(m_m->path(), ifname, propertySetting, this); connect(m_m, SIGNAL(pathChanged(QString)), m_if, SLOT(setPath(const QString&))); m_isValid = checkValidity(); }
CaptureFilterCombo::CaptureFilterCombo(QWidget *parent, bool plain) : QComboBox(parent), cf_edit_(NULL) { cf_edit_ = new CaptureFilterEdit(this, plain); setEditable(true); // Enabling autocompletion here gives us two simultaneous completions: // Inline (highlighted text) for entire filters, handled here and popup // completion for fields handled by CaptureFilterEdit. setAutoCompletion(false); setLineEdit(cf_edit_); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setInsertPolicy(QComboBox::NoInsert); setAccessibleName(tr("Capture filter selector")); setStyleSheet( "QComboBox {" #ifdef Q_OS_MAC " border: 1px solid gray;" #else " border: 1px solid palette(shadow);" #endif " border-radius: 3px;" " padding: 0px 0px 0px 0px;" " margin-left: 0px;" " min-width: 20em;" " }" "QComboBox::drop-down {" " subcontrol-origin: padding;" " subcontrol-position: top right;" " width: 16px;" " border-left-width: 0px;" " }" "QComboBox::down-arrow {" " image: url(:/icons/toolbar/14x14/x-filter-dropdown.png);" " }" "QComboBox::down-arrow:on { /* shift the arrow when popup is open */" " top: 1px;" " left: 1px;" "}" ); connect(this, SIGNAL(interfacesChanged()), cf_edit_, SLOT(checkFilter())); connect(cf_edit_, SIGNAL(pushFilterSyntaxStatus(const QString&)), this, SIGNAL(pushFilterSyntaxStatus(const QString&))); connect(cf_edit_, SIGNAL(popFilterSyntaxStatus()), this, SIGNAL(popFilterSyntaxStatus())); connect(cf_edit_, SIGNAL(captureFilterSyntaxChanged(bool)), this, SIGNAL(captureFilterSyntaxChanged(bool))); connect(cf_edit_, SIGNAL(startCapture()), this, SIGNAL(startCapture())); connect(cf_edit_, SIGNAL(startCapture()), this, SLOT(saveAndRebuildFilterList())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(rebuildFilterList())); connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(rebuildFilterList())); rebuildFilterList(); clearEditText(); }
CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CaptureInterfacesDialog) { ui->setupUi(this); setWindowTitle(wsApp->windowTitleString(tr("Capture Interfaces"))); stat_timer_ = NULL; stat_cache_ = NULL; // XXX - Enable / disable as needed start_bt_ = ui->buttonBox->addButton(tr("Start"), QDialogButtonBox::YesRole); start_bt_->setEnabled((global_capture_opts.num_selected > 0)? true: false); connect(start_bt_, SIGNAL(clicked(bool)), this, SLOT(start_button_clicked())); ui->interfaceTree->sortByColumn(col_interface_, Qt::AscendingOrder); ui->interfaceTree->setItemDelegateForColumn(col_interface_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_traffic_, new SparkLineDelegate()); ui->interfaceTree->setItemDelegateForColumn(col_link_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_pmode_, &interface_item_delegate_); ui->interfaceTree->setItemDelegateForColumn(col_snaplen_, &interface_item_delegate_); #ifdef SHOW_BUFFER_COLUMN ui->interfaceTree->setItemDelegateForColumn(col_buffer_, &interface_item_delegate_); #else ui->interfaceTree->setColumnHidden(col_buffer_, true); #endif #ifdef SHOW_MONITOR_COLUMN ui->interfaceTree->setItemDelegateForColumn(col_monitor_, &interface_item_delegate_); #else ui->interfaceTree->setColumnHidden(col_monitor_, true); #endif ui->interfaceTree->setItemDelegateForColumn(col_filter_, &interface_item_delegate_); interface_item_delegate_.setTree(ui->interfaceTree); ui->interfaceTree->setColumnWidth(col_link_, 100); connect(ui->interfaceTree,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(interfaceClicked(QTreeWidgetItem*,int))); connect(ui->interfaceTree, SIGNAL(itemSelectionChanged()), this, SLOT(interfaceSelected())); connect(ui->allFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(allFilterChanged())); connect(this, SIGNAL(interfacesChanged()), ui->allFilterComboBox, SIGNAL(interfacesChanged())); connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); }
void QOfonoCallSettings::setModemPath(const QString &path) { if (path == d_ptr->modemPath || path.isEmpty()) return; if (!d_ptr->modem.isNull()) disconnect(d_ptr->modem.data(), SIGNAL(interfacesChanged(QStringList)), this, SLOT(modemInterfacesChanged(QStringList))); d_ptr->modemPath = path; connectOfono(); d_ptr->modem = QOfonoModem::instance(path); connect(d_ptr->modem.data(), SIGNAL(interfacesChanged(QStringList)), this, SLOT(modemInterfacesChanged(QStringList))); Q_EMIT modemPathChanged(path); }
CaptureFilterCombo::CaptureFilterCombo(QWidget *parent) : QComboBox(parent), cf_edit_(NULL) { cf_edit_ = new CaptureFilterEdit(); setEditable(true); setLineEdit(cf_edit_); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setInsertPolicy(QComboBox::NoInsert); setAccessibleName(tr("Capture filter selector")); setStyleSheet( "QComboBox {" #ifdef Q_OS_MAC " border: 1px solid gray;" #else " border: 1px solid palette(shadow);" #endif " border-radius: 3px;" " padding: 0px 0px 0px 0px;" " margin-left: 0px;" " min-width: 20em;" " }" "QComboBox::drop-down {" " subcontrol-origin: padding;" " subcontrol-position: top right;" " width: 16px;" " border-left-width: 0px;" " }" "QComboBox::down-arrow {" " image: url(:/dfilter/dfilter_dropdown.png);" " }" "QComboBox::down-arrow:on { /* shift the arrow when popup is open */" " top: 1px;" " left: 1px;" "}" ); completer()->setCompletionMode(QCompleter::PopupCompletion); connect(this, SIGNAL(interfacesChanged()), cf_edit_, SLOT(checkFilter())); connect(cf_edit_, SIGNAL(pushFilterSyntaxStatus(QString&)), this, SIGNAL(pushFilterSyntaxStatus(QString&))); connect(cf_edit_, SIGNAL(popFilterSyntaxStatus()), this, SIGNAL(popFilterSyntaxStatus())); connect(cf_edit_, SIGNAL(captureFilterSyntaxChanged(bool)), this, SIGNAL(captureFilterSyntaxChanged(bool))); connect(cf_edit_, SIGNAL(startCapture()), this, SIGNAL(startCapture())); connect(cf_edit_, SIGNAL(startCapture()), this, SLOT(rebuildFilterList())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(rebuildFilterList())); connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(rebuildFilterList())); rebuildFilterList(false); clearEditText(); }
void CaptureInterfacesDialog::interfaceSelected() { InterfaceTree::updateGlobalDeviceSelections(ui->interfaceTree, col_interface_); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled((global_capture_opts.num_selected > 0) ? true: false); emit interfacesChanged(); updateSelectedFilter(); updateWidgets(); }
CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CaptureInterfacesDialog) { ui->setupUi(this); stat_timer_ = NULL; stat_cache_ = NULL; // XXX - Enable / disable as needed start_bt_ = ui->buttonBox->addButton(tr("Start"), QDialogButtonBox::YesRole); start_bt_->setEnabled((global_capture_opts.num_selected > 0)? true: false); connect(start_bt_, SIGNAL(clicked(bool)), this, SLOT(start_button_clicked())); connect(ui->tbInterfaces,SIGNAL(itemClicked(QTableWidgetItem *)),this,SLOT(tableItemClicked(QTableWidgetItem *))); connect(ui->tbInterfaces, SIGNAL(itemSelectionChanged()), this, SLOT(tableSelected())); connect(ui->allFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(allFilterChanged())); connect(this, SIGNAL(interfacesChanged()), ui->allFilterComboBox, SIGNAL(interfacesChanged())); connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); }
void CaptureInterfacesDialog::interfaceSelected() { if (sender() == ui->interfaceTree) { // Local changes, propagate our changes updateGlobalDeviceSelections(); emit interfacesChanged(); } else { // Changes from the welcome screen, adjust to its state. updateFromGlobalDeviceSelections(); } updateSelectedFilter(); updateWidgets(); }
void CaptureInterfacesDialog::tableItemClicked(QTableWidgetItem * item) { Q_UNUSED(item) interface_t device; guint i; global_capture_opts.num_selected = 0; QString filter = ui->allFilterComboBox->currentText(); QList<QTableWidgetItem*> selected = ui->tbInterfaces->selectedItems(); for (int row = 0; row < ui->tbInterfaces->rowCount(); row++) { QTableWidgetItem *it = ui->tbInterfaces->item(row, INTERFACE); QString interface_name = it->text(); for (i = 0; i < global_capture_opts.all_ifaces->len; i++) { device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); if (interface_name.compare(device.display_name)) { continue; } else { break; } } if (selected.contains(it)) { device.selected = true; global_capture_opts.num_selected++; } else { device.selected = false; } global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i); g_array_insert_val(global_capture_opts.all_ifaces, i, device); start_bt_->setEnabled((global_capture_opts.num_selected > 0)? true: false); if (filter.compare(QString(""))) { emit interfacesChanged(); } emit setSelectedInterfaces(); } }