Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
capture_file_dialog.h
Go to the documentation of this file.
1
10#ifndef CAPTURE_FILE_DIALOG_H
11#define CAPTURE_FILE_DIALOG_H
12
14
18#include "ui/help_url.h"
19
20#include <ui/packet_range.h>
21
23#include "cfile.h"
24
25#include "ui/file_dialog.h"
26
27#include <QVBoxLayout>
28#include <QLabel>
29#include <QRadioButton>
30#include <QCheckBox>
31#include <QDialogButtonBox>
32#include <QComboBox>
33
35{
36 // The GTK+ Open Capture File dialog has the following elements and features:
37 // - The ability to select a capture file from a list of known extensions
38 // - A display filter entry
39 // - Name resolution checkboxes
40 // - Capture file preview information
41 // Ideally we should provide similar functionality here.
42 //
43 // You can subclass QFileDialog (which we've done here) and add widgets as
44 // described at
45 //
46 // https://web.archive.org/web/20100528190736/http://developer.qt.nokia.com/faq/answer/how_can_i_add_widgets_to_my_qfiledialog_instance
47 //
48 // However, Qt's idea of what a file dialog looks like isn't what Microsoft
49 // and Apple think a file dialog looks like.
50 //
51 // On Windows, we should probably use the Common Item Dialog:
52 //
53 // https://learn.microsoft.com/en-us/windows/win32/shell/common-file-dialog
54 //
55 // We currently use GetOpenFileNam in ui/win32/file_dlg_win32.c.
56 //
57 // On macOS we should use NSOpenPanel and NSSavePanel:
58 //
59 // https://developer.apple.com/documentation/appkit/nsopenpanel?language=objc
60 // https://developer.apple.com/documentation/appkit/nssavepanel?language=objc
61 //
62 // On other platforms we should fall back to QFileDialog (or maybe
63 // KDE's or GTK+/GNOME's file dialog, as appropriate for the desktop
64 // environment being used, if QFileDialog doesn't do so with various
65 // platform plugins).
66 //
67 // Yes, that's four implementations of the same window.
68 //
69 // If a plain native open file dialog is good enough we can just the static
70 // version of QFileDialog::getOpenFileName. (Commenting out Q_OBJECT and
71 // "explicit" below has the same effect.)
72
73 Q_OBJECT
74public:
75 explicit CaptureFileDialog(QWidget *parent = NULL, capture_file *cf = NULL);
76 static check_savability_t checkSaveAsWithComments(QWidget *
77 , capture_file *cf, int file_type);
78
79 int mergeType();
80 int selectedFileType();
81 wtap_compression_type compressionType();
82
83private:
84 capture_file *cap_file_;
85
86 void addMergeControls(QVBoxLayout &v_box);
87 void addFormatTypeSelector(QVBoxLayout &v_box);
88 void addDisplayFilterEdit(QString &display_filter);
89 void addPreview(QVBoxLayout &v_box);
90 QString fileExtensionType(int et, bool extension_globs = true);
91 QString fileType(int ft, QStringList &suffixes);
92 QStringList buildFileOpenTypeList(void);
93
94 QVBoxLayout left_v_box_;
95 QVBoxLayout right_v_box_;
96
97 DisplayFilterEdit* display_filter_edit_;
98 int last_row_;
99
100 QLabel preview_format_;
101 QLabel preview_size_;
102 QLabel preview_first_elapsed_;
103 QList<QLabel *> preview_labels_;
104
105 QRadioButton merge_prepend_;
106 QRadioButton merge_chrono_;
107 QRadioButton merge_append_;
108
109 QComboBox format_type_;
110 QHash<QString, int> type_hash_;
111 QHash<QString, QStringList> type_suffixes_;
112
113 void addGzipControls(QVBoxLayout &v_box);
114 void addRangeControls(QVBoxLayout &v_box, packet_range_t *range, QString selRange = QString());
115 QDialogButtonBox *addHelpButton(topic_action_e help_topic);
116
117 QStringList buildFileSaveAsTypeList(bool must_support_comments);
118
119 int default_ft_;
120
121 CompressionGroupBox compress_group_box_;
122
123 PacketRangeGroupBox packet_range_group_box_;
124 QPushButton *save_bt_;
125 topic_action_e help_topic_;
126
127signals:
128
129public slots:
130
131 void accept() Q_DECL_OVERRIDE;
132 int exec() Q_DECL_OVERRIDE;
133 int open(QString &file_name, unsigned int &type, QString &display_filter);
134 check_savability_t saveAs(QString &file_name, bool must_support_comments);
135 check_savability_t exportSelectedPackets(QString &file_name, packet_range_t *range, QString selRange = QString());
136 int merge(QString &file_name, QString &display_filter);
137
138private slots:
139 void fixFilenameExtension();
140 void preview(const QString & path);
141 void on_buttonBox_helpRequested();
142};
143
144#endif // CAPTURE_FILE_DIALOG_H
Definition capture_file_dialog.h:35
Definition compression_group_box.h:25
Definition display_filter_edit.h:30
Definition packet_range_group_box.h:29
The WiresharkFileDialog class.
Definition wireshark_file_dialog.h:36
Definition cfile.h:67
Definition packet_range.h:39