summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-01-20 16:05:56 -0800
committerAnders Broman <a.broman58@gmail.com>2017-01-21 06:50:30 +0000
commit05fbb4826bcb182cc3895874a15585a96703ce1f (patch)
tree448763b393a9ba79c49df7d98c94a77a9e05849d /ui
parent317649f94984cf3d17f2a57badebb78d7703cdb5 (diff)
downloadwireshark-05fbb4826bcb182cc3895874a15585a96703ce1f.tar.gz
Qt: Show merge progress.
Add "file merge" callback plumbing. Use it to display "Merging files" in the main statusbar. Make sure we have a usable window pointer when we merge files. Change-Id: I236b6edb30685f0b06703ab8304bc88ae592f83c Reviewed-on: https://code.wireshark.org/review/19716 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/capture_file_dlg.c6
-rw-r--r--ui/gtk/drag_and_drop.c2
-rw-r--r--ui/gtk/main_statusbar.c4
-rw-r--r--ui/qt/capture_file.cpp8
-rw-r--r--ui/qt/capture_file.h2
-rw-r--r--ui/qt/main_window.cpp10
-rw-r--r--ui/qt/main_window.h2
-rw-r--r--ui/qt/main_window_slots.cpp13
8 files changed, 40 insertions, 7 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index 56267d761e..3e1faa92b4 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -916,17 +916,17 @@ file_merge_cmd(GtkWidget *w _U_)
/* chronological order */
in_filenames[0] = cfile.filename;
in_filenames[1] = file_name->str;
- merge_status = cf_merge_files_to_tempfile(&tmpname, 2, in_filenames, file_type, FALSE);
+ merge_status = cf_merge_files_to_tempfile(top_level, &tmpname, 2, in_filenames, file_type, FALSE);
} else if (merge_type < 0) {
/* prepend file */
in_filenames[0] = file_name->str;
in_filenames[1] = cfile.filename;
- merge_status = cf_merge_files_to_tempfile(&tmpname, 2, in_filenames, file_type, TRUE);
+ merge_status = cf_merge_files_to_tempfile(top_level, &tmpname, 2, in_filenames, file_type, TRUE);
} else {
/* append file */
in_filenames[0] = cfile.filename;
in_filenames[1] = file_name->str;
- merge_status = cf_merge_files_to_tempfile(&tmpname, 2, in_filenames, file_type, TRUE);
+ merge_status = cf_merge_files_to_tempfile(top_level, &tmpname, 2, in_filenames, file_type, TRUE);
}
if (merge_status != CF_OK) {
diff --git a/ui/gtk/drag_and_drop.c b/ui/gtk/drag_and_drop.c
index 4c34d29258..84479d0908 100644
--- a/ui/gtk/drag_and_drop.c
+++ b/ui/gtk/drag_and_drop.c
@@ -208,7 +208,7 @@ dnd_open_file_cmd(gchar *cf_names_freeme)
}
} else {
/* merge the files in chronological order */
- if (cf_merge_files_to_tempfile(&tmpname, in_file_count, in_filenames,
+ if (cf_merge_files_to_tempfile(top_level, &tmpname, in_file_count, in_filenames,
WTAP_FILE_TYPE_SUBTYPE_PCAPNG, FALSE) == CF_OK) {
/* Merge succeeded; close the currently-open file and try
to open the merged capture file. */
diff --git a/ui/gtk/main_statusbar.c b/ui/gtk/main_statusbar.c
index 1cb241a294..53a36c7a16 100644
--- a/ui/gtk/main_statusbar.c
+++ b/ui/gtk/main_statusbar.c
@@ -1038,6 +1038,10 @@ statusbar_cf_callback(gint event, gpointer data, gpointer user_data _U_)
break;
case(cf_cb_file_retap_finished):
break;
+ case(cf_cb_file_merge_started):
+ break;
+ case(cf_cb_file_merge_finished):
+ break;
case(cf_cb_file_fast_save_finished):
break;
case(cf_cb_packet_selected):
diff --git a/ui/qt/capture_file.cpp b/ui/qt/capture_file.cpp
index 2c04a35261..791e875ca1 100644
--- a/ui/qt/capture_file.cpp
+++ b/ui/qt/capture_file.cpp
@@ -221,6 +221,14 @@ void CaptureFile::captureFileEvent(int event, gpointer data)
emit captureFileFlushTapsData();
emit captureFileRetapFinished();
break;
+ case(cf_cb_file_merge_started):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Merge started");
+ emit captureFileMergeStarted();
+ break;
+ case(cf_cb_file_merge_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Merge finished");
+ emit captureFileMergeFinished();
+ break;
case(cf_cb_file_fast_save_finished):
// gtk/main.c calls main_cf_cb_file_rescan_finished. Should we do
diff --git a/ui/qt/capture_file.h b/ui/qt/capture_file.h
index 61487032c0..14215acaf1 100644
--- a/ui/qt/capture_file.h
+++ b/ui/qt/capture_file.h
@@ -101,6 +101,8 @@ signals:
void captureFileRescanFinished() const;
void captureFileRetapStarted() const;
void captureFileRetapFinished() const;
+ void captureFileMergeStarted() const;
+ void captureFileMergeFinished() const;
void captureFileClosing() const;
void captureFileClosed() const;
void captureFileSaveStarted(const QString &file_path) const;
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 01a6e3dd2a..588353cd91 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -542,6 +542,10 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(captureFileRetapStarted()));
connect(&capture_file_, SIGNAL(captureFileRetapFinished()),
this, SLOT(captureFileRetapFinished()));
+ connect(&capture_file_, SIGNAL(captureFileMergeStarted()),
+ this, SLOT(captureFileMergeStarted()));
+ connect(&capture_file_, SIGNAL(captureFileMergeFinished()),
+ this, SLOT(captureFileMergeFinished()));
connect(&capture_file_, SIGNAL(captureFileFlushTapsData()),
this, SLOT(captureFileFlushTapsData()));
connect(&capture_file_, SIGNAL(captureFileClosing()),
@@ -1088,17 +1092,17 @@ void MainWindow::mergeCaptureFile()
/* chronological order */
in_filenames[0] = g_strdup(capture_file_.capFile()->filename);
in_filenames[1] = qstring_strdup(file_name);
- merge_status = cf_merge_files_to_tempfile(&tmpname, 2, in_filenames, file_type, FALSE);
+ merge_status = cf_merge_files_to_tempfile(this, &tmpname, 2, in_filenames, file_type, FALSE);
} else if (merge_dlg.mergeType() <= 0) {
/* prepend file */
in_filenames[0] = qstring_strdup(file_name);
in_filenames[1] = g_strdup(capture_file_.capFile()->filename);
- merge_status = cf_merge_files_to_tempfile(&tmpname, 2, in_filenames, file_type, TRUE);
+ merge_status = cf_merge_files_to_tempfile(this, &tmpname, 2, in_filenames, file_type, TRUE);
} else {
/* append file */
in_filenames[0] = g_strdup(capture_file_.capFile()->filename);
in_filenames[1] = qstring_strdup(file_name);
- merge_status = cf_merge_files_to_tempfile(&tmpname, 2, in_filenames, file_type, TRUE);
+ merge_status = cf_merge_files_to_tempfile(this, &tmpname, 2, in_filenames, file_type, TRUE);
}
g_free(in_filenames[0]);
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 440476a85e..ffbd8a3cf9 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -282,6 +282,8 @@ public slots:
void captureFileRescanStarted() { setMenusForCaptureFile(true); captureFileReadStarted(tr("Rescanning")); }
void captureFileRetapStarted();
void captureFileRetapFinished();
+ void captureFileMergeStarted();
+ void captureFileMergeFinished();
void captureFileFlushTapsData();
void captureFileClosing();
void captureFileClosed();
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 4ae7dbe88c..083eb5fd43 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -756,6 +756,19 @@ void MainWindow::captureFileRetapFinished()
thaw();
}
+void MainWindow::captureFileMergeStarted()
+{
+ main_ui_->statusBar->popFileStatus();
+ QString msg = tr("Merging files");
+ QString msgtip = QString();
+ main_ui_->statusBar->pushFileStatus(msg, msgtip);
+}
+
+void MainWindow::captureFileMergeFinished()
+{
+ main_ui_->statusBar->popFileStatus();
+}
+
void MainWindow::captureFileFlushTapsData()
{
draw_tap_listeners(FALSE);