aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJirka Novak <j.novak@netsystem.cz>2021-08-17 21:42:17 +0200
committerj.novak@netsystem.cz <j.novak@netsystem.cz>2021-08-18 19:27:10 +0000
commitaf059913b37b49667b2b98f21c4dde98699f9154 (patch)
tree5ca6973de42e9c1e9a0e91bcddb26074baee8a06 /ui
parente5062a224982dd64197dc5e922c1da45b7002d92 (diff)
RTP Analysis: CSV export has header line
Export to CSV from RTP Analysis has header now. Header is on top of the export so for export of multiple tabs it is just once in the export.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/rtp_analysis_dialog.cpp27
-rw-r--r--ui/qt/rtp_analysis_dialog.h1
2 files changed, 28 insertions, 0 deletions
diff --git a/ui/qt/rtp_analysis_dialog.cpp b/ui/qt/rtp_analysis_dialog.cpp
index adb2e46004..a6dac14d30 100644
--- a/ui/qt/rtp_analysis_dialog.cpp
+++ b/ui/qt/rtp_analysis_dialog.cpp
@@ -840,6 +840,27 @@ void RtpAnalysisDialog::rtpPlayerRemove()
emit rtpPlayerDialogRemoveRtpStreams(getSelectedRtpIds());
}
+void RtpAnalysisDialog::saveCsvHeader(QFile *save_file, QTreeWidget *tree)
+{
+ QList<QVariant> row_data;
+ QStringList values;
+
+ for (int col = 0; col < tree->columnCount(); col++) {
+ row_data << tree->headerItem()->text(col);
+ }
+ foreach (QVariant v, row_data) {
+ if (!v.isValid()) {
+ values << "\"\"";
+ } else if ((int) v.type() == (int) QMetaType::QString) {
+ values << QString("\"%1\"").arg(v.toString());
+ } else {
+ values << v.toString();
+ }
+ }
+ save_file->write(values.join(",").toUtf8());
+ save_file->write("\n");
+}
+
void RtpAnalysisDialog::saveCsvData(QFile *save_file, QTreeWidget *tree)
{
for (int row = 0; row < tree->topLevelItemCount(); row++) {
@@ -891,6 +912,8 @@ void RtpAnalysisDialog::saveCsv(RtpAnalysisDialog::StreamDirection direction)
tab_info_t *tab_data = getTabInfoForCurrentTab();
if (tab_data) {
+ saveCsvHeader(&save_file, tab_data->tree_widget);
+
QString n = QString(*tab_data->tab_name);
n.replace("\n"," ");
save_file.write("\"");
@@ -902,6 +925,10 @@ void RtpAnalysisDialog::saveCsv(RtpAnalysisDialog::StreamDirection direction)
break;
case dir_all_:
default:
+ if (tabs_.count() > 0) {
+ saveCsvHeader(&save_file, tabs_[0]->tree_widget);
+ }
+
for(int i=0; i<tabs_.count(); i++) {
QString n = QString(*tabs_[i]->tab_name);
n.replace("\n"," ");
diff --git a/ui/qt/rtp_analysis_dialog.h b/ui/qt/rtp_analysis_dialog.h
index 66d54d7c57..97d1ebfe27 100644
--- a/ui/qt/rtp_analysis_dialog.h
+++ b/ui/qt/rtp_analysis_dialog.h
@@ -156,6 +156,7 @@ private:
void updateStatistics();
void updateGraph();
+ void saveCsvHeader(QFile *save_file, QTreeWidget *tree);
void saveCsvData(QFile *save_file, QTreeWidget *tree);
void saveCsv(StreamDirection direction);