void MediaLibrary::viewChanged( ViewController *view ) { MediaListView *mlv = qobject_cast<MediaListView*>( view ); if ( mlv == NULL ) return ; m_mediaListView = mlv; //Force an update as the media has changed filterUpdated( m_ui->filterInput->text() ); }
// Constructor. LteMacStatisticsDialog::LteMacStatisticsDialog(QWidget &parent, CaptureFile &cf, const char *filter) : TapParameterDialog(parent, cf, HELP_STATS_LTE_MAC_TRAFFIC_DIALOG), commonStatsCurrent_(false) { setWindowSubtitle(tr("LTE Mac Statistics")); loadGeometry(parent.width() * 1, parent.height() * 3 / 4, "LTEMacStatisticsDialog"); clearCommonStats(); // Create common_stats_grid to appear just above the filter area. int statstree_layout_idx = verticalLayout()->indexOf(filterLayout()->widget()); QGridLayout *common_stats_grid = new QGridLayout(); // Insert into the vertical layout verticalLayout()->insertLayout(statstree_layout_idx, common_stats_grid); int one_em = fontMetrics().height(); common_stats_grid->setColumnMinimumWidth(2, one_em * 2); common_stats_grid->setColumnStretch(2, 1); common_stats_grid->setColumnMinimumWidth(5, one_em * 2); common_stats_grid->setColumnStretch(5, 1); // Create statistics label. commonStatsLabel_ = new QLabel(this); commonStatsLabel_->setObjectName("statisticsLabel"); commonStatsLabel_->setTextFormat(Qt::RichText); commonStatsLabel_->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse); common_stats_grid->addWidget(commonStatsLabel_); // Create a grid for filtering-related widgetsto also appear in layout. int filter_controls_layout_idx = verticalLayout()->indexOf(filterLayout()->widget()); QGridLayout *filter_controls_grid = new QGridLayout(); // Insert into the vertical layout verticalLayout()->insertLayout(filter_controls_layout_idx, filter_controls_grid); filter_controls_grid->setColumnMinimumWidth(2, one_em * 2); filter_controls_grid->setColumnStretch(2, 1); filter_controls_grid->setColumnMinimumWidth(5, one_em * 2); filter_controls_grid->setColumnStretch(5, 1); // Add individual controls into the grid showSRFilterCheckBox_ = new QCheckBox(tr("Include SR frames in filter")); filter_controls_grid->addWidget(showSRFilterCheckBox_); showRACHFilterCheckBox_ = new QCheckBox(tr("Include RACH frames in filter")); filter_controls_grid->addWidget(showRACHFilterCheckBox_); // Will set whole-UE headings originally. updateHeaderLabels(); statsTreeWidget()->setItemDelegateForColumn(col_ul_padding_percent_, new PercentBarDelegate()); statsTreeWidget()->setItemDelegateForColumn(col_dl_padding_percent_, new PercentBarDelegate()); statsTreeWidget()->sortByColumn(col_rnti_, Qt::AscendingOrder); // Set up column widths. // resizeColumnToContents doesn't work well here, so set sizes manually. for (int col = 0; col < statsTreeWidget()->columnCount() - 1; col++) { switch (col) { case col_rnti_: statsTreeWidget()->setColumnWidth(col, one_em * 8); break; case col_ul_frames_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_ul_bytes_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_ul_mb_s_: statsTreeWidget()->setColumnWidth(col, one_em * 4); break; case col_ul_padding_percent_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_ul_retx_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_frames_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_dl_bytes_: statsTreeWidget()->setColumnWidth(col, one_em * 5); break; case col_dl_mb_s_: statsTreeWidget()->setColumnWidth(col, one_em * 4); break; case col_dl_padding_percent_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_crc_failed_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; case col_dl_retx_: statsTreeWidget()->setColumnWidth(col, one_em * 6); break; default: // The rest are numeric statsTreeWidget()->setColumnWidth(col, one_em * 4); statsTreeWidget()->headerItem()->setTextAlignment(col, Qt::AlignRight); break; } } addFilterActions(); if (filter) { setDisplayFilter(filter); } // Set handler for when the tree item changes to set the appropriate labels. connect(statsTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(updateHeaderLabels())); // Set handler for when display filter string is changed. connect(this, SIGNAL(updateFilter(QString)), this, SLOT(filterUpdated(QString))); }
void MediaLibrary::filterTypeChanged() { filterUpdated( m_ui->filterInput->text() ); }