diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2012-10-04 18:16:08 +0000 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2012-10-04 18:16:08 +0000 |
commit | 79d7ae18aaf55c7a19a12240516122639ad3b2a5 (patch) | |
tree | e048f692638bd1832d8585ba229c7aceb5a0e5be | |
parent | 061131b17259d269208ec5d5c5b1450a6f13f6aa (diff) | |
download | wireshark-79d7ae18aaf55c7a19a12240516122639ad3b2a5.tar.gz |
Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=45312
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 10 | ||||
-rw-r--r-- | ui/qt/import_text_dialog.cpp | 6 | ||||
-rw-r--r-- | ui/qt/main_status_bar.cpp | 30 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 45 |
4 files changed, 41 insertions, 50 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index 08488cf563..1bd67cc298 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -250,27 +250,27 @@ void CaptureFileDialog::addPreview(QVBoxLayout &v_box) { preview_grid->setColumnStretch(0, 0); preview_grid->setColumnStretch(1, 10); - lbl = new QLabel("Format:"); + lbl = new QLabel(tr("Format:")); preview_grid->addWidget(lbl, 0, 0); preview_grid->addWidget(&preview_format_, 0, 1); preview_labels_ << lbl << &preview_format_; - lbl = new QLabel("Size:"); + lbl = new QLabel(tr("Size:")); preview_grid->addWidget(lbl, 1, 0); preview_grid->addWidget(&preview_size_, 1, 1); preview_labels_ << lbl << &preview_size_; - lbl = new QLabel("Packets:"); + lbl = new QLabel(tr("Packets:")); preview_grid->addWidget(lbl, 2, 0); preview_grid->addWidget(&preview_packets_, 2, 1); preview_labels_ << lbl << &preview_packets_; - lbl = new QLabel("First Packet:"); + lbl = new QLabel(tr("First Packet:")); preview_grid->addWidget(lbl, 3, 0); preview_grid->addWidget(&preview_first_, 3, 1); preview_labels_ << lbl << &preview_first_; - lbl = new QLabel("Elapsed Time:"); + lbl = new QLabel(tr("Elapsed Time:")); preview_grid->addWidget(lbl, 4, 0); preview_grid->addWidget(&preview_elapsed_, 4, 1); preview_labels_ << lbl << &preview_elapsed_; diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp index e40f6502b8..21e0c94ac1 100644 --- a/ui/qt/import_text_dialog.cpp +++ b/ui/qt/import_text_dialog.cpp @@ -279,7 +279,7 @@ void ImportTextDialog::on_textFileBrowseButton_clicked() break; } - QString file_name = QFileDialog::getOpenFileName(this, "Wireshark: Import text file", open_dir); + QString file_name = QFileDialog::getOpenFileName(this, tr("Wireshark: Import text file"), open_dir); ui->textFileLineEdit->setText(file_name); } @@ -320,9 +320,9 @@ void ImportTextDialog::on_dateTimeLineEdit_textChanged(const QString &time_forma time(&cur_time); cur_tm = localtime(&cur_time); strftime(time_str, 100, ui->dateTimeLineEdit->text().toUtf8().constData(), cur_tm); - ui->timestampExampleLabel->setText(QString("Example: %1").arg(time_str)); + ui->timestampExampleLabel->setText(QString(tr("Example: %1")).arg(time_str)); } else { - ui->timestampExampleLabel->setText("<i>(No format will be applied)</i>"); + ui->timestampExampleLabel->setText(tr("<i>(No format will be applied)</i>")); } } diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp index 0acc521509..78df2ec623 100644 --- a/ui/qt/main_status_bar.cpp +++ b/ui/qt/main_status_bar.cpp @@ -95,29 +95,25 @@ packets_bar_update(void) /* Do we have any packets? */ if (cfile.count) { - packetsStr.append(QString("Packets: %1 " UTF8_MIDDLE_DOT " Displayed: %2 " UTF8_MIDDLE_DOT " Marked: %3") -// packetsStr.append(QString(QObject::tr("Packets: %1 Displayed: %2 Marked: %3")) + packetsStr.append(QString(QObject::tr("Packets: %1 %4 Displayed: %2 %4 Marked: %3")) .arg(cfile.count) .arg(cfile.displayed_count) - .arg(cfile.marked_count)); + .arg(cfile.marked_count) + .arg(UTF8_MIDDLE_DOT)); if(cfile.drops_known) { - packetsStr.append(QString(" " UTF8_MIDDLE_DOT " Dropped: %1")).arg(cfile.drops); + packetsStr.append(QString(QObject::tr(" %1 Dropped: %2"))).arg(UTF8_MIDDLE_DOT).arg(cfile.drops); } if(cfile.ignored_count > 0) { - packetsStr.append(QString(" " UTF8_MIDDLE_DOT " Ignored: %1").arg(cfile.ignored_count)); + packetsStr.append(QString(QObject::tr(" %1 Ignored: %2")).arg(UTF8_MIDDLE_DOT).arg(cfile.ignored_count)); } if(!cfile.is_tempfile) { /* Loading an existing file */ gulong computed_elapsed = cf_get_computed_elapsed(); - packetsStr.append(QString(" " UTF8_MIDDLE_DOT " Load time: %1:%2.%3") + packetsStr.append(QString(QObject::tr(" %1 Load time: %2:%3.%4")) + .arg(UTF8_MIDDLE_DOT) .arg(computed_elapsed/60000) .arg(computed_elapsed%60000/1000) .arg(computed_elapsed%1000)); - /*packetsStr.append(QString().sprintf(QObject::tr(" Load time: %lu:%02lu.%03lu", - computed_elapsed/60000, - computed_elapsed%60000/1000, - computed_elapsed%1000))); - */ } } else { packetsStr.append(QObject::tr("No Packets")); @@ -188,31 +184,31 @@ void MainStatusBar::hideExpert() { void MainStatusBar::expertUpdate() { QString imgText = "<img src=\":/expert/expert_"; - QString ttText = " is the highest expert info level"; + QString ttText = tr(" is the highest expert info level"); switch(expert_get_highest_severity()) { case(PI_ERROR): imgText.append("error"); - ttText.prepend("ERROR"); + ttText.prepend(tr("ERROR")); break; case(PI_WARN): imgText.append("warn"); - ttText.prepend("WARNING"); + ttText.prepend(tr("WARNING")); break; case(PI_NOTE): imgText.append("note"); - ttText.prepend("NOTE"); + ttText.prepend(tr("NOTE")); break; case(PI_CHAT): imgText.append("chat"); - ttText.prepend("CHAT"); + ttText.prepend(tr("CHAT")); break; // case(PI_COMMENT): // m_expertStatus.setText("<img src=\":/expert/expert_comment.png\"></img>"); // break; default: imgText.append("none"); - ttText = "No expert info"; + ttText = tr("No expert info"); break; } diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index c32ac375a1..b8795f3d50 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -310,7 +310,6 @@ void MainWindow::closeEvent(QCloseEvent *event) { } - void MainWindow::mergeCaptureFile() { QString file_name = ""; @@ -331,16 +330,16 @@ void MainWindow::mergeCaptureFile() /* This is a temporary capture file or has unsaved changes; ask the user whether to save the capture. */ if (cap_file_->is_tempfile) { - msg_dialog.setText("Save packets before merging?"); - msg_dialog.setInformativeText("A temporary capture file can't be merged."); + msg_dialog.setText(tr("Save packets before merging?")); + msg_dialog.setInformativeText(tr("A temporary capture file can't be merged.")); } else { /* * Format the message. */ display_basename = g_filename_display_basename(cap_file_->filename); - msg_dialog.setText(QString("Save changes in \"%1\" before merging?").arg(display_basename)); + msg_dialog.setText(QString(tr("Save changes in \"%1\" before merging?")).arg(display_basename)); g_free(display_basename); - msg_dialog.setInformativeText("Changes must be saved before the files can be merged."); + msg_dialog.setInformativeText(tr("Changes must be saved before the files can be merged.")); } msg_dialog.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel); @@ -398,10 +397,7 @@ void MainWindow::mergeCaptureFile() selection box again once they dismiss the alert. */ //bad_dfilter_alert_box(top_level, display_filter->str); QMessageBox::warning(this, tr("Invalid Display Filter"), - QString("The filter expression ") + - display_filter + - QString(" isn't a valid display filter. (") + - dfilter_error_msg + QString(")."), + QString(tr("The filter expression %1 isn't a valid display filter. (%2).").arg(display_filter, dfilter_error_msg)), QMessageBox::Ok); continue; } @@ -486,7 +482,7 @@ void MainWindow::mergeCaptureFile() void MainWindow::importCaptureFile() { ImportTextDialog import_dlg; - if (!testCaptureFileClose(FALSE, *new QString(" before importing a new capture"))) + if (!testCaptureFileClose(FALSE, *new QString(tr(" before importing a new capture")))) return; import_dlg.exec(); @@ -784,15 +780,15 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) { to save the data. */ if (cap_file_->is_tempfile) { - msg_dialog.setText("You have unsaved packets"); - msg_dialog.setInformativeText("They will be lost if you don't save them."); + msg_dialog.setText(tr("You have unsaved packets")); + msg_dialog.setInformativeText(tr("They will be lost if you don't save them.")); if (capture_in_progress) { - question.append("Do you want to stop the capture and save the captured packets"); + question.append(tr("Do you want to stop the capture and save the captured packets")); } else { - question.append("Do you want to save the captured packets"); + question.append(tr("Do you want to save the captured packets")); } - question.append(before_what).append("?"); + question.append(before_what).append(tr("?")); msg_dialog.setInformativeText(question); @@ -801,17 +797,17 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) { * Format the message. */ if (capture_in_progress) { - question.append("Do you want to stop the capture and save the captured packets"); - question.append(before_what).append("?"); - msg_dialog.setInformativeText("Your captured packets will be lost if you don't save them."); + question.append(tr("Do you want to stop the capture and save the captured packets")); + question.append(before_what).append(tr("?")); + msg_dialog.setInformativeText(tr("Your captured packets will be lost if you don't save them.")); } else { gchar *display_basename = g_filename_display_basename(cap_file_->filename); - question.append(QString("Do you want to save the changes you've made to the capture file \"%1\"%2?") + question.append(QString(tr("Do you want to save the changes you've made to the capture file \"%1\"%2?")) .arg(display_basename) .arg(before_what) ); g_free(display_basename); - msg_dialog.setInformativeText("Your changes will be lost if you don't save them."); + msg_dialog.setInformativeText(tr("Your changes will be lost if you don't save them.")); } } @@ -823,7 +819,7 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) { msg_dialog.setStandardButtons(QMessageBox::Cancel); if (capture_in_progress) { - default_button = msg_dialog.addButton("Stop and Save", QMessageBox::AcceptRole); + default_button = msg_dialog.addButton(tr("Stop and Save"), QMessageBox::AcceptRole); } else { default_button = msg_dialog.addButton(QMessageBox::Save); } @@ -831,13 +827,13 @@ bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) { if (from_quit) { if (cap_file_->state == FILE_READ_IN_PROGRESS) { - msg_dialog.addButton("Stop and Quit without Saving", QMessageBox::DestructiveRole); + msg_dialog.addButton(tr("Stop and Quit without Saving)", QMessageBox::DestructiveRole); } else { - msg_dialog.addButton("Quit without Saving", QMessageBox::DestructiveRole); + msg_dialog.addButton(tr("Quit without Saving"), QMessageBox::DestructiveRole); } } else { if (capture_in_progress) { - msg_dialog.addButton("Stop and Continue without Saving", QMessageBox::DestructiveRole); + msg_dialog.addButton(tr("Stop and Continue without Saving"), QMessageBox::DestructiveRole); } else { msg_dialog.addButton(QMessageBox::Discard); } @@ -1036,7 +1032,6 @@ void MainWindow::setForCaptureInProgress(gboolean capture_in_progress) //#endif } - /* * Editor modelines * |