diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2015-11-12 19:48:05 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2015-11-13 06:02:52 +0000 |
commit | 1b6bf766046aca882deb7f1b9f30f25ffcb3636a (patch) | |
tree | f68fe8520cb36a2fb704b98219de0182106051a2 | |
parent | bd96244d35a44a4de99fd6a34a5f9ae6b5096394 (diff) |
Qt: Fixed signal name to avoid a warning.
Also terminate stream lines with endl.
Change-Id: Icbbe5b47695506888c03607ff0af66c59306faae
Reviewed-on: https://code.wireshark.org/review/11778
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r-- | ui/qt/io_graph_dialog.cpp | 30 | ||||
-rw-r--r-- | ui/qt/io_graph_dialog.h | 2 |
2 files changed, 16 insertions, 16 deletions
diff --git a/ui/qt/io_graph_dialog.cpp b/ui/qt/io_graph_dialog.cpp index 4512fc8067..0d51ae45b9 100644 --- a/ui/qt/io_graph_dialog.cpp +++ b/ui/qt/io_graph_dialog.cpp @@ -200,8 +200,8 @@ IOGraphDialog::IOGraphDialog(QWidget &parent, CaptureFile &cf) : QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save); save_bt->setText(tr("Save As" UTF8_HORIZONTAL_ELLIPSIS)); - QPushButton *copy_bt = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ApplyRole); - connect (copy_bt, SIGNAL(clicked()), this, SLOT(on_buttonBox_copyAsCsv_triggered())); + QPushButton *copy_bt = ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); + connect (copy_bt, SIGNAL(clicked()), this, SLOT(copyAsCsvClicked())); stat_timer_ = new QTimer(this); connect(stat_timer_, SIGNAL(timeout()), this, SLOT(updateStatistics())); @@ -1508,14 +1508,6 @@ void IOGraphDialog::on_buttonBox_helpRequested() wsApp->helpTopicAction(HELP_STATS_IO_GRAPH_DIALOG); } -void IOGraphDialog::on_buttonBox_copyAsCsv_triggered() -{ - QString csv; - QTextStream stream(&csv, QIODevice::Text); - makeCsv(stream); - wsApp->clipboard()->setText(stream.readAll()); -} - // XXX - Copied from tcp_stream_dialog. This should be common code. void IOGraphDialog::on_buttonBox_accepted() { @@ -1574,16 +1566,16 @@ void IOGraphDialog::makeCsv(QTextStream &stream) const QTreeWidgetItem *ti = ui->graphTreeWidget->topLevelItem(i); if (ti && ti->checkState(name_col_) == Qt::Checked) { IOGraph *iog = ti->data(name_col_, Qt::UserRole).value<IOGraph *>(); - QString name = iog->name().toUtf8(); - name.replace("\"", "\"\""); // RFC 4180 2.7 - stream << ",\"" << name << "\""; activeGraphs.append(iog); if (max_interval < iog->maxInterval()) { max_interval = iog->maxInterval(); } + QString name = iog->name().toUtf8(); + name = QString("\"%1\"").arg(name.replace("\"", "\"\"")); // RFC 4180 + stream << "," << name; } } - stream << "\n"; + stream << endl; for (int interval = 0; interval <= max_interval; interval++) { double interval_start = (double)interval * ((double)ui_interval / 1000.0); @@ -1595,10 +1587,18 @@ void IOGraphDialog::makeCsv(QTextStream &stream) const } stream << "," << value; } - stream << "\n"; + stream << endl; } } +void IOGraphDialog::copyAsCsvClicked() +{ + QString csv; + QTextStream stream(&csv, QIODevice::Text); + makeCsv(stream); + wsApp->clipboard()->setText(stream.readAll()); +} + bool IOGraphDialog::saveCsv(const QString &file_name) const { QFile save_file(file_name); diff --git a/ui/qt/io_graph_dialog.h b/ui/qt/io_graph_dialog.h index dae536da81..c5d36f3189 100644 --- a/ui/qt/io_graph_dialog.h +++ b/ui/qt/io_graph_dialog.h @@ -214,6 +214,7 @@ private slots: void activateLastItem(); void resetAxes(); void updateStatistics(void); + void copyAsCsvClicked(); void on_intervalComboBox_currentIndexChanged(int index); void on_todCheckBox_toggled(bool checked); @@ -249,7 +250,6 @@ private slots: void on_actionToggleTimeOrigin_triggered(); void on_actionCrosshairs_triggered(); void on_buttonBox_helpRequested(); - void on_buttonBox_copyAsCsv_triggered(); void on_buttonBox_accepted(); }; |