Qt: Use new-style signals+slots in more places.

This commit is contained in:
Gerald Combs 2021-10-10 11:42:51 -07:00 committed by Wireshark GitLab Utility
parent 7f9b8874b5
commit e5bcf6b402
24 changed files with 33 additions and 38 deletions

View File

@ -38,7 +38,7 @@ AccordionFrame::AccordionFrame(QWidget *parent) :
animation_ = new QPropertyAnimation(this, "maximumHeight", this);
animation_->setDuration(duration_);
animation_->setEasingCurve(QEasingCurve::InOutQuad);
connect(animation_, SIGNAL(finished()), this, SLOT(animationFinished()));
connect(animation_, &QPropertyAnimation::finished, this, &AccordionFrame::animationFinished);
}
void AccordionFrame::animatedShow()

View File

@ -104,15 +104,12 @@ BluetoothDeviceDialog::BluetoothDeviceDialog(QWidget &parent, CaptureFile &cf, Q
WiresharkDialog(parent, cf),
ui(new Ui::BluetoothDeviceDialog)
{
QString titleBdAddr;
QString titleName;
ui->setupUi(this);
resize(parent.width() * 4 / 10, parent.height() * 2 / 2);
setTitle(bdAddr, name);
connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableContextMenu(const QPoint &)));
connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this, &BluetoothDeviceDialog::tableContextMenu);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);

View File

@ -43,8 +43,8 @@ ColumnEditorFrame::ColumnEditorFrame(QWidget *parent) :
ui->typeComboBox->addItem(col_format_desc(i), QVariant(i));
}
connect(ui->fieldsNameLineEdit, SIGNAL(textChanged(QString)),
ui->fieldsNameLineEdit, SLOT(checkCustomColumn(QString)));
connect(ui->fieldsNameLineEdit, &FieldFilterEdit::textChanged,
ui->fieldsNameLineEdit, &FieldFilterEdit::checkCustomColumn);
}
ColumnEditorFrame::~ColumnEditorFrame()

View File

@ -38,7 +38,7 @@ CompiledFilterOutput::CompiledFilterOutput(QWidget *parent, QStringList &intList
copy_bt_ = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
copy_bt_->setToolTip(tr("Copy filter text to the clipboard."));
connect(copy_bt_, SIGNAL(clicked()), this, SLOT(copyFilterText()));
connect(copy_bt_, &QPushButton::clicked, this, &CompiledFilterOutput::copyFilterText);
QPushButton *close_bt = ui->buttonBox->button(QDialogButtonBox::Close);
close_bt->setDefault(true);

View File

@ -72,7 +72,7 @@ CredentialsDialog::CredentialsDialog(QWidget &parent, CaptureFile &cf, PacketLis
ui->auths->setSortingEnabled(true);
ui->auths->sortByColumn(CredentialsModel::COL_NUM, Qt::AscendingOrder);
connect(ui->auths, SIGNAL(clicked(const QModelIndex&)), this, SLOT(actionGoToPacket(const QModelIndex&)));
connect(ui->auths, &QTreeView::clicked, this, &CredentialsDialog::actionGoToPacket);
registerTapListener("credentials", this, "", 0, tapReset, tapPacket, Q_NULLPTR);
cf.retapPackets();

View File

@ -79,7 +79,7 @@ DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf, bool create_ne
fillTable();
connect(model_, SIGNAL(modelReset()), this, SLOT(modelRowsReset()));
connect(model_, &DecodeAsModel::modelReset, this, &DecodeAsDialog::modelRowsReset);
ui->clearToolButton->setEnabled(model_->rowCount() > 0);
if (create_new)

View File

@ -338,7 +338,7 @@ void ExtcapOptionsDialog::updateWidgets()
if (argument->isRequired() && ! argument->isValid())
allowStart = false;
connect(argument, SIGNAL(valueChanged()), this, SLOT(anyValueChanged()));
connect(argument, &ExtcapArgument::valueChanged, this, &ExtcapOptionsDialog::anyValueChanged);
counter++;
}

View File

@ -70,8 +70,8 @@ FileSetDialog::FileSetDialog(QWidget *parent) :
close_button_ = fs_ui_->buttonBox->button(QDialogButtonBox::Close);
connect(fs_ui_->fileSetTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
connect(fs_ui_->fileSetTree->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &FileSetDialog::selectionChanged);
beginAddFile();
addFile();

View File

@ -17,7 +17,7 @@
#include "wireshark_application.h"
// Helper object used for sending close signal to open dialogs from a C function
static FunnelStringDialogHelper dialogHelper;
static FunnelStringDialogHelper dialog_helper_;
const int min_edit_width_ = 20; // em widths
FunnelStringDialog::FunnelStringDialog(const QString title, const QList<QPair<QString, QString>> field_list, funnel_dlg_cb_t dialog_cb, void* dialog_cb_data, funnel_dlg_cb_data_free_t dialog_data_free_cb) :
@ -88,7 +88,7 @@ void FunnelStringDialog::on_buttonBox_accepted()
void FunnelStringDialog::stringDialogNew(const QString title, QList<QPair<QString, QString>> field_list, funnel_dlg_cb_t dialog_cb, void* dialog_cb_data, funnel_dlg_cb_data_free_t dialog_cb_data_free)
{
FunnelStringDialog* fsd = new FunnelStringDialog(title, field_list, dialog_cb, dialog_cb_data, dialog_cb_data_free);
connect(&dialogHelper, SIGNAL(closeDialogs()), fsd, SLOT(close()));
connect(&dialog_helper_, &FunnelStringDialogHelper::closeDialogs, fsd, &FunnelStringDialog::close);
fsd->show();
}
@ -114,5 +114,5 @@ void string_dialog_new(const gchar* title, const gchar** field_names, const gcha
void string_dialogs_close(void)
{
dialogHelper.emitCloseDialogs();
dialog_helper_.emitCloseDialogs();
}

View File

@ -126,7 +126,7 @@ void FunnelTextDialog::addButton(funnel_bt_t *funnel_button, QString label)
QPushButton *button = new QPushButton(label);
ui->buttonBox->addButton(button, QDialogButtonBox::ActionRole);
text_button_to_funnel_button_[button] = funnel_button;
connect(button, SIGNAL(clicked(bool)), this, SLOT(buttonClicked()));
connect(button, &QPushButton::clicked, this, &FunnelTextDialog::buttonClicked);
}
void FunnelTextDialog::buttonClicked()

View File

@ -89,8 +89,8 @@ PacketListModel::PacketListModel(QObject *parent, capture_file *cf) :
if (wtWidget && qobject_cast<WirelessTimeline *>(wtWidget))
{
WirelessTimeline * wt = qobject_cast<WirelessTimeline *>(wtWidget);
connect(this, SIGNAL(bgColorizationProgress(int, int)),
wt, SLOT(bgColorizationProgress(int, int)));
connect(this, &PacketListModel::bgColorizationProgress,
wt, &WirelessTimeline::bgColorizationProgress);
}
}

View File

@ -132,7 +132,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
pd_ui_->filterExpressonsFrame->setUat(uat_get_table_by_name("Display expressions"));
pd_ui_->expertFrame->setUat(uat_get_table_by_name("Expert Info Severity Level Configuration"));
connect(pd_ui_->prefsView, SIGNAL(goToPane(QString)), this, SLOT(selectPane(QString)));
connect(pd_ui_->prefsView, &PrefModuleTreeView::goToPane, this, &PreferencesDialog::selectPane);
/* Create a single-shot timer for debouncing calls to
* updateSearchLineEdit() */

View File

@ -719,7 +719,7 @@ bool RtpAudioStream::prepareForPlay(QAudioDeviceInfo out_device)
temp_file_->seek(start_pos);
if (audio_output_) delete audio_output_;
audio_output_ = new QAudioOutput(out_device, format, this);
connect(audio_output_, SIGNAL(stateChanged(QAudio::State)), this, SLOT(outputStateChanged(QAudio::State)));
connect(audio_output_, &QAudioOutput::stateChanged, this, &RtpAudioStream::outputStateChanged);
return true;
} else {
// Report stopped audio if start position is later than stream ends

View File

@ -45,7 +45,7 @@ SCTPChunkStatisticsDialog::SCTPChunkStatisticsDialog(QWidget *parent, const sctp
this->setWindowTitle(QString(tr("SCTP Chunk Statistics: %1 Port1 %2 Port2 %3"))
.arg(gchar_free_to_qstring(cf_get_display_name(cap_file_)))
.arg(assoc->port1).arg(assoc->port2));
// connect(ui->tableWidget->verticalHeader(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(on_sectionMoved(int, int, int)));
// connect(ui->tableWidget->verticalHeader(), &QHeaderView::sectionMoved, this, &SCTPChunkStatisticsDialog::on_sectionMoved);
ctx_menu_.addAction(ui->actionHideChunkType);
ctx_menu_.addAction(ui->actionChunkTypePreferences);

View File

@ -134,7 +134,7 @@ void SCTPGraphArwndDialog::drawGraph(const sctp_assoc_info_t *selected_assoc)
ui->sctpPlot->setInteractions(QCP::iRangeZoom | QCP::iRangeDrag | QCP::iSelectPlottables);
ui->sctpPlot->axisRect(0)->setRangeZoomAxes(ui->sctpPlot->xAxis, ui->sctpPlot->yAxis);
ui->sctpPlot->axisRect(0)->setRangeZoom(Qt::Horizontal);
connect(ui->sctpPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*, QMouseEvent*)));
connect(ui->sctpPlot, &QCustomPlot::plottableClick, this, &SCTPGraphArwndDialog::graphClicked);
ui->sctpPlot->replot();
}
@ -149,7 +149,7 @@ void SCTPGraphArwndDialog::on_pushButton_4_clicked()
ui->sctpPlot->replot();
}
void SCTPGraphArwndDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event)
void SCTPGraphArwndDialog::graphClicked(QCPAbstractPlottable* plottable, int, QMouseEvent* event)
{
if (plottable->name().contains("Arwnd", Qt::CaseInsensitive)) {
double times = ui->sctpPlot->xAxis->pixelToCoord(event->pos().x());

View File

@ -40,7 +40,7 @@ public slots:
private slots:
void on_pushButton_4_clicked();
void graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event);
void graphClicked(QCPAbstractPlottable* plottable, int, QMouseEvent* event);
void on_saveButton_clicked();

View File

@ -133,7 +133,7 @@ void SCTPGraphByteDialog::drawGraph()
ui->sctpPlot->clearGraphs();
drawBytesGraph(selected_assoc);
ui->sctpPlot->setInteractions(QCP::iRangeZoom | QCP::iRangeDrag | QCP::iSelectPlottables);
connect(ui->sctpPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*, QMouseEvent*)));
connect(ui->sctpPlot, &QCustomPlot::plottableClick, this, &SCTPGraphByteDialog::graphClicked);
ui->sctpPlot->replot();
}
@ -152,7 +152,7 @@ void SCTPGraphByteDialog::on_pushButton_4_clicked()
ui->sctpPlot->replot();
}
void SCTPGraphByteDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event)
void SCTPGraphByteDialog::graphClicked(QCPAbstractPlottable* plottable, int, QMouseEvent* event)
{
if (plottable->name().contains(tr("Bytes"), Qt::CaseInsensitive)) {
double bytes = ui->sctpPlot->yAxis->pixelToCoord(event->pos().y());

View File

@ -40,7 +40,7 @@ public slots:
private slots:
void on_pushButton_4_clicked();
void graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event);
void graphClicked(QCPAbstractPlottable* plottable, int, QMouseEvent* event);
void on_saveButton_clicked();

View File

@ -371,7 +371,7 @@ void SCTPGraphDialog::drawGraph(const sctp_assoc_info_t* selected_assoc)
ui->sctpPlot->xAxis->setLabel(tr("time [secs]"));
ui->sctpPlot->yAxis->setLabel(tr("TSNs"));
ui->sctpPlot->setInteractions(QCP::iRangeZoom | QCP::iRangeDrag | QCP::iSelectPlottables);
connect(ui->sctpPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(graphClicked(QCPAbstractPlottable*, QMouseEvent*)));
connect(ui->sctpPlot, &QCustomPlot::plottableClick, this, &SCTPGraphDialog::graphClicked);
// set axes ranges, so we see all data:
QCPRange myXRange(selected_assoc->min_secs, (selected_assoc->max_secs+1));
if (relative) {
@ -425,7 +425,7 @@ void SCTPGraphDialog::on_pushButton_4_clicked()
ui->sctpPlot->replot();
}
void SCTPGraphDialog::graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event)
void SCTPGraphDialog::graphClicked(QCPAbstractPlottable* plottable, int, QMouseEvent* event)
{
frame_num = 0;
int i=0;

View File

@ -94,7 +94,7 @@ private slots:
void on_pushButton_4_clicked();
void graphClicked(QCPAbstractPlottable* plottable, QMouseEvent* event);
void graphClicked(QCPAbstractPlottable* plottable, int, QMouseEvent* event);
void on_saveButton_clicked();

View File

@ -197,8 +197,8 @@ ServiceResponseTimeDialog::ServiceResponseTimeDialog(QWidget &parent, CaptureFil
setDisplayFilter(filter);
}
connect(statsTreeWidget(), SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(statsTreeWidgetItemChanged()));
connect(statsTreeWidget(), &QTreeWidget::itemChanged,
this, &ServiceResponseTimeDialog::statsTreeWidgetItemChanged);
}
ServiceResponseTimeDialog::~ServiceResponseTimeDialog()

View File

@ -27,7 +27,7 @@ TimeShiftDialog::TimeShiftDialog(QWidget *parent, capture_file *cf) :
setWindowTitle(wsApp->windowTitleString(tr("Time Shift")));
apply_button_ = ts_ui_->buttonBox->button(QDialogButtonBox::Apply);
apply_button_->setDefault(true);
connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyTimeShift()));
connect(apply_button_, &QPushButton::clicked, this, &TimeShiftDialog::applyTimeShift);
QStyleOption style_opt;
int rb_label_offset = ts_ui_->shiftAllButton->style()->subElementRect(QStyle::SE_RadioButtonContents, &style_opt).left();

View File

@ -82,8 +82,7 @@ SplashOverlay::SplashOverlay(QWidget *parent) :
)
.arg(QColor(tango_aluminium_4).name()));
connect(wsApp, SIGNAL(splashUpdate(register_action_e,const char*)),
this, SLOT(splashUpdate(register_action_e,const char*)));
connect(wsApp, &WiresharkApplication::splashUpdate, this, &SplashOverlay::splashUpdate);
}
SplashOverlay::~SplashOverlay()

View File

@ -39,8 +39,7 @@ WiresharkDialog::WiresharkDialog(QWidget &parent, CaptureFile &capture_file) :
setWindowIcon(wsApp->normalIcon());
setWindowSubtitle(QString());
connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent)),
this, SLOT(captureEvent(CaptureEvent)));
connect(&cap_file_, &CaptureFile::captureEvent, this, &WiresharkDialog::captureEvent);
}
void WiresharkDialog::accept()