Remove duplicate status messages.

Adding back progress titles in g3069129fe5 revealed the fact that we had
duplicate messages in the Qt UI and in file.c. Remove the ones in file.c
in favor of the Qt UI, since the latter are translated.

Change-Id: I5ff8f1bd34e963e9e66c01420ad8c5fe9c2f0caa
Reviewed-on: https://code.wireshark.org/review/36646
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:
Gerald Combs 2020-03-31 16:22:02 -07:00 committed by Anders Broman
parent 3885912cca
commit e37a7abf56
2 changed files with 46 additions and 50 deletions

16
file.c
View File

@ -586,10 +586,10 @@ cf_read(capture_file *cf, gboolean reloading)
if (progress_is_slow(progbar, prog_timer, size, file_pos)) {
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
if (reloading)
progbar = delayed_create_progress_dlg(cf->window, "Reloading", name_ptr,
progbar = delayed_create_progress_dlg(cf->window, NULL, NULL,
TRUE, &cf->stop_flag, progbar_val);
else
progbar = delayed_create_progress_dlg(cf->window, "Loading", name_ptr,
progbar = delayed_create_progress_dlg(cf->window, NULL, NULL,
TRUE, &cf->stop_flag, progbar_val);
}
@ -716,7 +716,7 @@ cf_read(capture_file *cf, gboolean reloading)
if (cf->redissection_queued != RESCAN_NONE) {
/* Redissection was queued up. Clear the request and perform it now. */
gboolean redissect = cf->redissection_queued == RESCAN_REDISSECT;
rescan_packets(cf, "Reprocessing", "all packets", redissect);
rescan_packets(cf, NULL, NULL, redissect);
}
if (cf->stop_flag) {
@ -1319,7 +1319,7 @@ merge_callback(merge_event event, int num _U_,
large file, we might take considerably longer than that standard
time in order to get to the next progress bar step). */
if (cb_data->progbar == NULL) {
cb_data->progbar = delayed_create_progress_dlg(cb_data->pd_window, "Merging", "files",
cb_data->progbar = delayed_create_progress_dlg(cb_data->pd_window, NULL, NULL,
FALSE, &cb_data->stop_flag, 0.0f);
}
@ -1509,7 +1509,7 @@ cf_filter_packets(capture_file *cf, gchar *dftext, gboolean force)
cf->redissection_queued = RESCAN_SCAN;
} else if (cf->state != FILE_CLOSED) {
if (dftext == NULL) {
rescan_packets(cf, "Resetting", "Filter", FALSE);
rescan_packets(cf, "Resetting", "filter", FALSE);
} else {
rescan_packets(cf, "Filtering", dftext, FALSE);
}
@ -3588,7 +3588,6 @@ find_packet(capture_file *cf, ws_match_function match_function,
gboolean succeeded;
float progbar_val;
gchar status_str[100];
const char *title;
match_result result;
wtap_rec_init(&rec);
@ -3613,7 +3612,6 @@ find_packet(capture_file *cf, ws_match_function match_function,
cf->stop_flag = FALSE;
title = cf->sfilter?cf->sfilter:"";
for (;;) {
/* Create the progress bar if necessary.
We check on every iteration of the loop, so that it takes no
@ -3621,7 +3619,7 @@ find_packet(capture_file *cf, ws_match_function match_function,
large file, we might take considerably longer than that standard
time in order to get to the next progress bar step). */
if (progbar == NULL)
progbar = delayed_create_progress_dlg(cf->window, "Searching", title,
progbar = delayed_create_progress_dlg(cf->window, NULL, NULL,
FALSE, &cf->stop_flag, progbar_val);
/*
@ -4325,7 +4323,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile)
/* Create the progress bar if necessary. */
if (progress_is_slow(progbar, prog_timer, size, cf->f_datalen)) {
progbar_val = calc_progbar_val(cf, size, cf->f_datalen, status_str, sizeof(status_str));
progbar = delayed_create_progress_dlg(cf->window, "Rescanning", name_ptr,
progbar = delayed_create_progress_dlg(cf->window, NULL, NULL,
TRUE, &cf->stop_flag, progbar_val);
}

View File

@ -16,6 +16,8 @@
#include <epan/proto.h>
#include <epan/strutil.h>
#include <wsutil/utf8_entities.h>
#include "wireshark_application.h"
#include <QKeyEvent>
#include <QCheckBox>
@ -42,8 +44,8 @@ enum {
SearchFrame::SearchFrame(QWidget *parent) :
AccordionFrame(parent),
sf_ui_(new Ui::SearchFrame),
cap_file_(NULL),
regex_(NULL)
cap_file_(nullptr),
regex_(nullptr)
{
sf_ui_->setupUi(this);
@ -148,11 +150,11 @@ bool SearchFrame::regexCompile()
}
if (sf_ui_->searchLineEdit->text().isEmpty()) {
regex_ = NULL;
regex_ = nullptr;
return false;
}
GError *g_error = NULL;
GError *g_error = nullptr;
regex_ = g_regex_new(sf_ui_->searchLineEdit->text().toUtf8().constData(),
(GRegexCompileFlags)flags, (GRegexMatchFlags) 0, &g_error);
if (g_error) {
@ -245,7 +247,7 @@ void SearchFrame::updateWidgets()
guint8 *bytes;
size_t nbytes;
bytes = convert_string_to_hex(sf_ui_->searchLineEdit->text().toUtf8().constData(), &nbytes);
if (bytes == NULL)
if (bytes == nullptr)
sf_ui_->searchLineEdit->setSyntaxState(SyntaxLineEdit::Invalid);
else {
g_free(bytes);
@ -348,10 +350,10 @@ void SearchFrame::on_searchLineEdit_textChanged(const QString &)
void SearchFrame::on_findButton_clicked()
{
guint8 *bytes = NULL;
size_t nbytes;
char *string = NULL;
dfilter_t *dfp;
guint8 *bytes = nullptr;
size_t nbytes = 0;
char *string = nullptr;
dfilter_t *dfp = nullptr;
gboolean found_packet = FALSE;
QString err_string;
@ -362,7 +364,7 @@ void SearchFrame::on_findButton_clicked()
cap_file_->hex = FALSE;
cap_file_->string = FALSE;
cap_file_->case_type = FALSE;
cap_file_->regex = NULL;
cap_file_->regex = nullptr;
cap_file_->packet_data = FALSE;
cap_file_->decode_data = FALSE;
cap_file_->summary_data = FALSE;
@ -371,24 +373,21 @@ void SearchFrame::on_findButton_clicked()
int search_type = sf_ui_->searchTypeComboBox->currentIndex();
switch (search_type) {
case df_search_:
if (!dfilter_compile(sf_ui_->searchLineEdit->text().toUtf8().constData(), &dfp, NULL)) {
if (!dfilter_compile(sf_ui_->searchLineEdit->text().toUtf8().constData(), &dfp, nullptr)) {
err_string = tr("Invalid filter.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
if (dfp == NULL) {
if (dfp == nullptr) {
err_string = tr("That filter doesn't test anything.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
break;
case hex_search_:
bytes = convert_string_to_hex(sf_ui_->searchLineEdit->text().toUtf8().constData(), &nbytes);
if (bytes == NULL) {
if (bytes == nullptr) {
err_string = tr("That's not a valid hex string.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
cap_file_->hex = TRUE;
break;
@ -396,12 +395,11 @@ void SearchFrame::on_findButton_clicked()
case regex_search_:
if (sf_ui_->searchLineEdit->text().isEmpty()) {
err_string = tr("You didn't specify any text for which to search.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
cap_file_->string = TRUE;
cap_file_->case_type = sf_ui_->caseCheckBox->isChecked() ? FALSE : TRUE;
cap_file_->regex = (search_type == regex_search_ ? regex_ : NULL);
cap_file_->regex = (search_type == regex_search_ ? regex_ : nullptr);
switch (sf_ui_->charEncodingComboBox->currentIndex()) {
case narrow_and_wide_chars_:
cap_file_->scs_type = SCS_NARROW_AND_WIDE;
@ -414,15 +412,13 @@ void SearchFrame::on_findButton_clicked()
break;
default:
err_string = tr("No valid character set selected. Please report this to the development team.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
string = convert_string_case(sf_ui_->searchLineEdit->text().toUtf8().constData(), cap_file_->case_type);
break;
default:
err_string = tr("No valid search type selected. Please report this to the development team.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
switch (sf_ui_->searchInComboBox->currentIndex()) {
@ -437,12 +433,13 @@ void SearchFrame::on_findButton_clicked()
break;
default:
err_string = tr("No valid search area selected. Please report this to the development team.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
g_free(cap_file_->sfilter);
cap_file_->sfilter = g_strdup(sf_ui_->searchLineEdit->text().toUtf8().constData());
wsApp->popStatus(WiresharkApplication::FileStatus);
wsApp->pushStatus(WiresharkApplication::FileStatus, tr("Searching for %1" UTF8_HORIZONTAL_ELLIPSIS).arg(sf_ui_->searchLineEdit->text()));
if (cap_file_->hex) {
/* Hex value in packet data */
@ -451,13 +448,12 @@ void SearchFrame::on_findButton_clicked()
if (!found_packet) {
/* We didn't find a packet */
err_string = tr("No packet contained those bytes.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
} else if (cap_file_->string) {
if (search_type == regex_search_ && !cap_file_->regex) {
wsApp->pushStatus(WiresharkApplication::FilterSyntax, regex_error_);
return;
err_string = regex_error_;
goto search_done;
}
if (cap_file_->summary_data) {
/* String in the Info column of the summary line */
@ -465,8 +461,7 @@ void SearchFrame::on_findButton_clicked()
g_free(string);
if (!found_packet) {
err_string = tr("No packet contained that string in its Info column.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
} else if (cap_file_->decode_data) {
/* String in the protocol tree headings */
@ -474,8 +469,7 @@ void SearchFrame::on_findButton_clicked()
g_free(string);
if (!found_packet) {
err_string = tr("No packet contained that string in its dissected display.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
} else if (cap_file_->packet_data && string) {
/* String in the ASCII-converted packet data */
@ -483,8 +477,7 @@ void SearchFrame::on_findButton_clicked()
g_free(string);
if (!found_packet) {
err_string = tr("No packet contained that string in its converted data.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
return;
goto search_done;
}
}
} else {
@ -493,11 +486,16 @@ void SearchFrame::on_findButton_clicked()
dfilter_free(dfp);
if (!found_packet) {
err_string = tr("No packet matched that filter.");
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
g_free(bytes);
return;
goto search_done;
}
}
search_done:
wsApp->popStatus(WiresharkApplication::FileStatus);
if (!err_string.isEmpty()) {
wsApp->pushStatus(WiresharkApplication::FilterSyntax, err_string);
}
}
void SearchFrame::on_cancelButton_clicked()
@ -507,7 +505,7 @@ void SearchFrame::on_cancelButton_clicked()
void SearchFrame::changeEvent(QEvent* event)
{
if (0 != event)
if (event)
{
switch (event->type())
{