Qt: Improve status bar messages

Use pushStatus() in C++ code, improve translation support and end
each message with a dot.

Change-Id: I3f673da4736c3fe49203048da282afa1abf92337
Reviewed-on: https://code.wireshark.org/review/37887
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Stig Bjørlykke 2020-07-17 13:45:01 +02:00 committed by Anders Broman
parent 6432e18b2a
commit e1df757c46
5 changed files with 13 additions and 15 deletions

View File

@ -169,7 +169,7 @@ void AddressEditorFrame::on_buttonBox_accepted()
QString addr = ui->addressComboBox->currentText();
QString name = ui->nameLineEdit->text();
if (!cf_add_ip_name_from_string(cap_file_, addr.toUtf8().constData(), name.toUtf8().constData())) {
QString error_msg = tr("Can't assign %1 to %2").arg(name).arg(addr);
QString error_msg = tr("Can't assign %1 to %2.").arg(name).arg(addr);
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, error_msg);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
return;

View File

@ -14,7 +14,7 @@
#include "interface_toolbar.h"
#include <ui/qt/widgets/interface_toolbar_lineedit.h>
#include "simple_dialog.h"
#include "ui/main_statusbar.h"
#include "wireshark_application.h"
#include <ui_interface_toolbar.h>
#include "capture_opts.h"
@ -555,7 +555,7 @@ void InterfaceToolbar::controlReceived(QString ifname, int num, int command, QBy
break;
case commandStatusMessage:
statusbar_push_temporary_msg("%s", payload.data());
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, payload);
break;
case commandInformationMessage:

View File

@ -663,7 +663,7 @@ void MainWindow::captureEventHandler(CaptureEvent ev)
switch (ev.eventType()) {
case CaptureEvent::Started:
wsApp->popStatus(WiresharkApplication::FileStatus);
wsApp->pushStatus(WiresharkApplication::FileStatus, tr("Merging files"), QString());
wsApp->pushStatus(WiresharkApplication::FileStatus, tr("Merging files."), QString());
break;
case CaptureEvent::Finished:
wsApp->popStatus(WiresharkApplication::FileStatus);
@ -832,7 +832,7 @@ void MainWindow::startCapture() {
/* did the user ever select a capture interface before? */
if (global_capture_opts.num_selected == 0) {
QString msg = QString(tr("No interface selected"));
QString msg = QString(tr("No interface selected."));
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
main_ui_->actionCaptureStart->setChecked(false);
return;
@ -842,7 +842,7 @@ void MainWindow::startCapture() {
// toolbar buttons and menu items. This may not be the
// case, e.g. with QtMacExtras.
if (!capture_filter_valid_) {
QString msg = QString(tr("Invalid capture filter"));
QString msg = QString(tr("Invalid capture filter."));
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, msg);
main_ui_->actionCaptureStart->setChecked(false);
return;
@ -2724,9 +2724,7 @@ void MainWindow::matchFieldFilter(FilterAction::Action action, FilterAction::Act
}
if (field_filter.isEmpty()) {
QString err = tr("No filter available. Try another ");
err.append(packet_list_->contextMenuActive() ? "column" : "item");
err.append(".");
QString err = tr("No filter available. Try another %1.").arg(packet_list_->contextMenuActive() ? tr("column") : tr("item"));
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
return;
}
@ -3704,7 +3702,7 @@ void MainWindow::on_actionCaptureStart_triggered()
#ifdef HAVE_LIBPCAP
if (global_capture_opts.num_selected == 0) {
QString err_msg = tr("No Interface Selected");
QString err_msg = tr("No Interface Selected.");
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err_msg);
main_ui_->actionCaptureStart->setChecked(false);
return;

View File

@ -357,7 +357,7 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
// XXX Use updateProgress instead. We'd have to switch from std::sort to
// something we can interrupt.
if (!col_title.isEmpty()) {
QString busy_msg = tr("Sorting \"%1\"").arg(col_title);
QString busy_msg = tr("Sorting \"%1\"" UTF8_HORIZONTAL_ELLIPSIS).arg(col_title);
wsApp->pushStatus(WiresharkApplication::BusyStatus, busy_msg);
}

View File

@ -48,8 +48,6 @@
#include "packet_list.h"
#include <ui/qt/models/packet_list_model.h>
#include "ui/main_statusbar.h"
/* we start rendering this number of microseconds left of the left edge - to ensure
* NAV lines are drawn correctly, and that small errors in time order don't prevent some
* frames from being rendered.
@ -259,11 +257,13 @@ void WirelessTimeline::captureFileReadFinished()
for (guint32 n = 1; n < cfile.count; n++) {
struct wlan_radio *w = get_wlan_radio(n);
if (w->start_tsf == 0 || w->end_tsf == 0) {
statusbar_push_temporary_msg("Packet number %u does not include TSF timestamp, not showing timeline.", n);
QString err = tr("Packet number %1 does not include TSF timestamp, not showing timeline.").arg(n);
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
return;
}
if (w->ifs < -RENDER_EARLY) {
statusbar_push_temporary_msg("Packet number %u has large negative jump in TSF, not showing timeline. Perhaps TSF reference point is set wrong?", n);
QString err = tr("Packet number %u has large negative jump in TSF, not showing timeline. Perhaps TSF reference point is set wrong?").arg(n);
wsApp->pushStatus(WiresharkApplication::TemporaryStatus, err);
return;
}
}