Commit 63e437c0 authored by Roland Knall's avatar Roland Knall 💬
Browse files

Qt: Move Signal/Slots to DisplayFilterEdit

Move the handling of Signal/Slots for the display filters to the
LineEdit class, instead of having it being handled in the mainwindow

Change-Id: Ibddea7d31b6d0abec91baa46ffb6965f64db94d6
Reviewed-on: https://code.wireshark.org/review/35012


Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall's avatarRoland Knall <rknall@gmail.com>
parent 43499619
Pipeline #94350459 passed with stages
in 46 minutes and 54 seconds
......@@ -100,7 +100,8 @@ static gboolean menus_registered = FALSE;
FunnelStatistics::FunnelStatistics(QObject *parent, CaptureFile &cf) :
QObject(parent),
capture_file_(cf)
capture_file_(cf),
prepared_filter_(QString())
{
funnel_ops_ = new(struct _funnel_ops_t);
memset(funnel_ops_, 0, sizeof(struct _funnel_ops_t));
......@@ -154,7 +155,8 @@ const char *FunnelStatistics::displayFilter()
void FunnelStatistics::emitSetDisplayFilter(const QString filter)
{
emit setDisplayFilter(filter);
prepared_filter_ = filter;
emit setDisplayFilter(filter, FilterAction::ActionPrepare, FilterAction::ActionTypePlain);
}
void FunnelStatistics::reloadPackets()
......@@ -169,7 +171,7 @@ void FunnelStatistics::reloadLuaPlugins()
void FunnelStatistics::emitApplyDisplayFilter()
{
emit applyDisplayFilter();
emit setDisplayFilter(prepared_filter_, FilterAction::ActionApply, FilterAction::ActionTypePlain);
}
void FunnelStatistics::emitOpenCaptureFile(QString cf_path, QString filter)
......
......@@ -13,8 +13,8 @@
#include <QObject>
#include "capture_file.h"
#include "funnel_text_dialog.h"
#include <ui/qt/filter_action.h>
struct _funnel_ops_t;
struct _funnel_progress_window_t;
......@@ -36,9 +36,8 @@ public:
static const QString &actionName() { return action_name_; }
signals:
void setDisplayFilter(const QString filter);
void applyDisplayFilter();
void openCaptureFile(QString cf_path, QString filter);
void setDisplayFilter(QString filter, FilterAction::Action action, FilterAction::ActionType filterType);
public slots:
void funnelActionTriggered();
......@@ -49,6 +48,7 @@ private:
struct _funnel_ops_t *funnel_ops_;
CaptureFile &capture_file_;
QByteArray display_filter_;
QString prepared_filter_;
};
extern "C" {
......
......@@ -373,15 +373,11 @@ MainWindow::MainWindow(QWidget *parent) :
#endif
df_combo_box_ = new DisplayFilterCombo(this);
const DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(df_combo_box_->lineEdit());
funnel_statistics_ = new FunnelStatistics(this, capture_file_);
connect(df_edit, SIGNAL(textChanged(QString)), funnel_statistics_, SLOT(displayFilterTextChanged(QString)));
connect(funnel_statistics_, SIGNAL(setDisplayFilter(QString)), df_edit, SLOT(setText(QString)));
connect(funnel_statistics_, SIGNAL(applyDisplayFilter()), df_combo_box_, SLOT(applyDisplayFilter()));
connect(funnel_statistics_, &FunnelStatistics::setDisplayFilter, this, &MainWindow::setDisplayFilter);
connect(funnel_statistics_, SIGNAL(openCaptureFile(QString, QString)),
this, SLOT(openCaptureFile(QString, QString)));
connect(this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
file_set_dialog_ = new FileSetDialog(this);
connect(file_set_dialog_, SIGNAL(fileSetOpenCaptureFile(QString)),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment