forked from osmocom/wireshark
Qt: Switch line edits to new-style signals and slots.
Switch SyntaxLineEdit, CaptureFilterEdit, DisplayFilterEdit, FieldFilterEdit, and RangeSyntaxLineEdit to compile time signals and slots. Change-Id: I2fb26c04324997929436c3d920baa1bdc6056e44 Reviewed-on: https://code.wireshark.org/review/31162 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
272becd8ca
commit
4f557ea164
|
@ -146,7 +146,7 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
|
|||
"}"
|
||||
"QToolButton::menu-indicator { image: none; }"
|
||||
);
|
||||
connect(bookmark_button_, SIGNAL(clicked()), this, SLOT(bookmarkClicked()));
|
||||
connect(bookmark_button_, &StockIconToolButton::clicked, this, &CaptureFilterEdit::bookmarkClicked);
|
||||
}
|
||||
|
||||
if (!plain_) {
|
||||
|
@ -162,10 +162,11 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
|
|||
" margin-left: 1px;"
|
||||
"}"
|
||||
);
|
||||
connect(clear_button_, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||
connect(clear_button_, &StockIconToolButton::clicked, this, &CaptureFilterEdit::clearFilter);
|
||||
}
|
||||
|
||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&)));
|
||||
connect(this, &CaptureFilterEdit::textChanged, this,
|
||||
static_cast<void (CaptureFilterEdit::*)(const QString &)>(&CaptureFilterEdit::checkFilter));
|
||||
|
||||
#if 0
|
||||
// Disable the apply button for now
|
||||
|
@ -182,10 +183,10 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
|
|||
" padding: 0 0 0 0;"
|
||||
"}"
|
||||
);
|
||||
connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyCaptureFilter()));
|
||||
connect(apply_button_, &StockIconToolButton::clicked, this, &CaptureFilterEdit::applyCaptureFilter);
|
||||
}
|
||||
#endif
|
||||
connect(this, SIGNAL(returnPressed()), this, SLOT(applyCaptureFilter()));
|
||||
connect(this, &CaptureFilterEdit::returnPressed, this, &CaptureFilterEdit::applyCaptureFilter);
|
||||
|
||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
QSize bksz;
|
||||
|
@ -209,19 +210,21 @@ CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
|
|||
|
||||
QComboBox *cf_combo = qobject_cast<QComboBox *>(parent);
|
||||
if (cf_combo) {
|
||||
connect(cf_combo, SIGNAL(activated(QString)), this, SIGNAL(textEdited(QString)));
|
||||
connect(cf_combo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||
this, &CaptureFilterEdit::textEdited);
|
||||
}
|
||||
|
||||
QThread *syntax_thread = new QThread;
|
||||
syntax_worker_ = new CaptureFilterSyntaxWorker;
|
||||
syntax_worker_->moveToThread(syntax_thread);
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(updateBookmarkMenu()));
|
||||
connect(wsApp, SIGNAL(captureFilterListChanged()), this, SLOT(updateBookmarkMenu()));
|
||||
connect(syntax_thread, SIGNAL(started()), syntax_worker_, SLOT(start()));
|
||||
connect(syntax_thread, SIGNAL(started()), this, SLOT(checkFilter()));
|
||||
connect(syntax_worker_, SIGNAL(syntaxResult(QString,int,QString)),
|
||||
this, SLOT(setFilterSyntaxState(QString,int,QString)));
|
||||
connect(syntax_thread, SIGNAL(finished()), syntax_worker_, SLOT(deleteLater()));
|
||||
connect(wsApp, &WiresharkApplication::appInitialized, this, &CaptureFilterEdit::updateBookmarkMenu);
|
||||
connect(wsApp, &WiresharkApplication::captureFilterListChanged, this, &CaptureFilterEdit::updateBookmarkMenu);
|
||||
connect(syntax_thread, &QThread::started, syntax_worker_, &CaptureFilterSyntaxWorker::start);
|
||||
connect(syntax_thread, &QThread::started, this,
|
||||
static_cast<void (CaptureFilterEdit::*)()>(&CaptureFilterEdit::checkFilter));
|
||||
connect(syntax_worker_, &CaptureFilterSyntaxWorker::syntaxResult,
|
||||
this, &CaptureFilterEdit::setFilterSyntaxState);
|
||||
connect(syntax_thread, &QThread::finished, syntax_worker_, &CaptureFilterSyntaxWorker::deleteLater);
|
||||
syntax_thread->start();
|
||||
updateBookmarkMenu();
|
||||
}
|
||||
|
@ -379,11 +382,11 @@ void CaptureFilterEdit::updateBookmarkMenu()
|
|||
bb_menu->clear();
|
||||
|
||||
save_action_ = bb_menu->addAction(tr("Save this filter"));
|
||||
connect(save_action_, SIGNAL(triggered(bool)), this, SLOT(saveFilter()));
|
||||
connect(save_action_, &QAction::triggered, this, &CaptureFilterEdit::saveFilter);
|
||||
remove_action_ = bb_menu->addAction(tr("Remove this filter"));
|
||||
connect(remove_action_, SIGNAL(triggered(bool)), this, SLOT(removeFilter()));
|
||||
connect(remove_action_, &QAction::triggered, this, &CaptureFilterEdit::removeFilter);
|
||||
QAction *manage_action = bb_menu->addAction(tr("Manage Capture Filters"));
|
||||
connect(manage_action, SIGNAL(triggered(bool)), this, SLOT(showFilters()));
|
||||
connect(manage_action, &QAction::triggered, this, &CaptureFilterEdit::showFilters);
|
||||
bb_menu->addSeparator();
|
||||
|
||||
for (GList *cf_item = get_filter_list_first(CFILTER_LIST); cf_item; cf_item = g_list_next(cf_item)) {
|
||||
|
@ -397,7 +400,7 @@ void CaptureFilterEdit::updateBookmarkMenu()
|
|||
|
||||
QAction *prep_action = bb_menu->addAction(prep_text);
|
||||
prep_action->setData(cf_def->strval);
|
||||
connect(prep_action, SIGNAL(triggered(bool)), this, SLOT(prepareFilter()));
|
||||
connect(prep_action, &QAction::triggered, this, &CaptureFilterEdit::prepareFilter);
|
||||
}
|
||||
|
||||
checkFilter();
|
||||
|
|
|
@ -108,10 +108,11 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, DisplayFilterEditType type
|
|||
" margin-left: 1px;"
|
||||
"}"
|
||||
);
|
||||
connect(clear_button_, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||
connect(clear_button_, &StockIconToolButton::clicked, this, &DisplayFilterEdit::clearFilter);
|
||||
}
|
||||
|
||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&)));
|
||||
connect(this, &DisplayFilterEdit::textChanged, this,
|
||||
static_cast<void (DisplayFilterEdit::*)(const QString &)>(&DisplayFilterEdit::checkFilter));
|
||||
|
||||
if (type_ == DisplayFilterToApply) {
|
||||
apply_button_ = new StockIconToolButton(this, "x-filter-apply");
|
||||
|
@ -126,8 +127,8 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, DisplayFilterEditType type
|
|||
" padding: 0 0 0 0;"
|
||||
"}"
|
||||
);
|
||||
connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyDisplayFilter()));
|
||||
connect(this, SIGNAL(returnPressed()), this, SLOT(applyDisplayFilter()));
|
||||
connect(apply_button_, &StockIconToolButton::clicked, this, &DisplayFilterEdit::applyDisplayFilter);
|
||||
connect(this, &DisplayFilterEdit::returnPressed, this, &DisplayFilterEdit::applyDisplayFilter);
|
||||
}
|
||||
|
||||
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
|
@ -155,8 +156,8 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, DisplayFilterEditType type
|
|||
.arg(cbsz.width() + apsz.width() + frameWidth + 1)
|
||||
);
|
||||
|
||||
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(updateBookmarkMenu()));
|
||||
connect(wsApp, SIGNAL(displayFilterListChanged()), this, SLOT(updateBookmarkMenu()));
|
||||
connect(wsApp, &WiresharkApplication::appInitialized, this, &DisplayFilterEdit::updateBookmarkMenu);
|
||||
connect(wsApp, &WiresharkApplication::displayFilterListChanged, this, &DisplayFilterEdit::updateBookmarkMenu);
|
||||
|
||||
}
|
||||
|
||||
|
@ -318,13 +319,13 @@ void DisplayFilterEdit::updateBookmarkMenu()
|
|||
bb_menu->clear();
|
||||
|
||||
save_action_ = bb_menu->addAction(tr("Save this filter"));
|
||||
connect(save_action_, SIGNAL(triggered(bool)), this, SLOT(saveFilter()));
|
||||
connect(save_action_, &QAction::triggered, this, &DisplayFilterEdit::saveFilter);
|
||||
remove_action_ = bb_menu->addAction(tr("Remove this filter"));
|
||||
connect(remove_action_, SIGNAL(triggered(bool)), this, SLOT(removeFilter()));
|
||||
connect(remove_action_, &QAction::triggered, this, &DisplayFilterEdit::removeFilter);
|
||||
QAction *manage_action = bb_menu->addAction(tr("Manage Display Filters"));
|
||||
connect(manage_action, SIGNAL(triggered(bool)), this, SLOT(showFilters()));
|
||||
connect(manage_action, &QAction::triggered, this, &DisplayFilterEdit::showFilters);
|
||||
QAction *expr_action = bb_menu->addAction(tr("Manage Filter Expressions"));
|
||||
connect(expr_action, SIGNAL(triggered(bool)), this, SLOT(showExpressionPrefs()));
|
||||
connect(expr_action, &QAction::triggered, this, &DisplayFilterEdit::showExpressionPrefs);
|
||||
bb_menu->addSeparator();
|
||||
|
||||
for (GList *df_item = get_filter_list_first(DFILTER_LIST); df_item; df_item = g_list_next(df_item)) {
|
||||
|
@ -338,7 +339,7 @@ void DisplayFilterEdit::updateBookmarkMenu()
|
|||
|
||||
QAction *prep_action = bb_menu->addAction(prep_text);
|
||||
prep_action->setData(df_def->strval);
|
||||
connect(prep_action, SIGNAL(triggered(bool)), this, SLOT(applyOrPrepareFilter()));
|
||||
connect(prep_action, &QAction::triggered, this, &DisplayFilterEdit::applyOrPrepareFilter);
|
||||
}
|
||||
|
||||
checkFilter();
|
||||
|
|
|
@ -65,8 +65,9 @@ FieldFilterEdit::FieldFilterEdit(QWidget *parent) :
|
|||
// Apply (right arrow)
|
||||
// Combo drop-down
|
||||
|
||||
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&)));
|
||||
// connect(this, SIGNAL(returnPressed()), this, SLOT(applyDisplayFilter()));
|
||||
connect(this, &FieldFilterEdit::textChanged, this,
|
||||
static_cast<void (FieldFilterEdit::*)(const QString &)>(&FieldFilterEdit::checkFilter));
|
||||
// connect(this, &FieldFilterEdit::returnPressed, this, &FieldFilterEdit::applyDisplayFilter);
|
||||
}
|
||||
|
||||
void FieldFilterEdit::setDefaultPlaceholderText()
|
||||
|
|
|
@ -16,7 +16,7 @@ RangeSyntaxLineEdit::RangeSyntaxLineEdit(QWidget *parent)
|
|||
: SyntaxLineEdit(parent),
|
||||
maxRange_(0xFFFFFFFF)
|
||||
{
|
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkRange(QString)));
|
||||
connect(this, &RangeSyntaxLineEdit::textChanged, this, &RangeSyntaxLineEdit::checkRange);
|
||||
}
|
||||
|
||||
void RangeSyntaxLineEdit::setMaxRange(unsigned int max)
|
||||
|
|
Loading…
Reference in New Issue