diff options
author | Roland Knall <roland.knall@br-automation.com> | 2017-12-22 13:58:02 +0100 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2017-12-23 09:41:46 +0000 |
commit | d5d815189d98745e3b33a6caadd4c2dc5648a114 (patch) | |
tree | 18e0c90a8f3bc0289d8e12dfa7e63c7368fe9844 /ui/qt/capture_file.h | |
parent | d41d0f71485fdad56b27eac08c06cd3d0235013d (diff) |
Qt: Redesign signal/slot concept of capture_file
This is in preparation to make it easier for other classes
to get the right signals from the capture file. Also the decision
on what signals to listen to now resides with the final classes,
not main window, and it no longer needs to be changed if the
statusbar or wsapp needs additional signals.
Change-Id: If366d42b07dc822636404ac44ba2306ec4418b4e
Reviewed-on: https://code.wireshark.org/review/24941
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui/qt/capture_file.h')
-rw-r--r-- | ui/qt/capture_file.h | 78 |
1 files changed, 49 insertions, 29 deletions
diff --git a/ui/qt/capture_file.h b/ui/qt/capture_file.h index d8cdf75a90..9f48638ec3 100644 --- a/ui/qt/capture_file.h +++ b/ui/qt/capture_file.h @@ -23,6 +23,7 @@ #define CAPTURE_FILE_H #include <QObject> +#include <QEvent> #include <config.h> @@ -34,6 +35,52 @@ typedef struct _capture_session capture_session; struct _packet_info; +class CaptureEvent : public QObject +{ + Q_OBJECT +public: + enum Context { + Capture = 0x0001, + Update = 0x0100 | Capture, + Fixed = 0x0200 | Capture, + File = 0x0002, + Reload = 0x0100 | File, + Rescan = 0x0200 | File, + Save = 0x0400 | File, + Retap = 0x0800 | File, + Merge = 0x1000 | File, + }; + + enum EventType { + Opened = 0x0001, + Started = 0x0002, + Finished = 0x0004, + Closing = 0x0008, + Closed = 0x0010, + Failed = 0x0020, + Stopped = 0x0040, + Flushed = 0x0080, + Prepared = 0x0100, + Continued = 0x0200, + Stopping = 0x0400 + }; + + CaptureEvent(Context ctx, EventType evt); + CaptureEvent(Context ctx, EventType evt, QString file); + CaptureEvent(Context ctx, EventType evt, capture_session * session); + + Context captureContext() const; + EventType eventType() const; + QString filePath() const; + capture_session * capSession() const; + +private: + Context _ctx; + EventType _evt; + QString _filePath; + capture_session * _session; +}; + class CaptureFile : public QObject { Q_OBJECT @@ -93,34 +140,7 @@ public: gpointer window(); signals: - void captureFileOpened() const; - void captureFileReadStarted() const; - void captureFileReadFinished() const; - void captureFileReloadStarted() const; - void captureFileReloadFinished() const; - void captureFileRescanStarted() const; - 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; - void captureFileSaveFinished() const; - void captureFileSaveFailed() const; - void captureFileSaveStopped() const; - void captureFileFlushTapsData() const; - - void captureCapturePrepared(capture_session *cap_session); - void captureCaptureUpdateStarted(capture_session *cap_session); - void captureCaptureUpdateContinue(capture_session *cap_session); - void captureCaptureUpdateFinished(capture_session *cap_session); - void captureCaptureFixedStarted(capture_session *cap_session); - void captureCaptureFixedContinue(capture_session *cap_session); - void captureCaptureFixedFinished(capture_session *cap_session); - void captureCaptureStopping(capture_session *cap_session); - void captureCaptureFailed(capture_session *cap_session); + void captureEvent(CaptureEvent *); public slots: /** Retap the capture file. Convenience wrapper for cf_retap_packets. @@ -152,7 +172,7 @@ private: #endif void captureFileEvent(int event, gpointer data); - void captureEvent(int event, capture_session *cap_session); + void captureSessionEvent(int event, capture_session *cap_session); const QString &getFileBasename(); static QString no_capture_file_; |