Kerberos: add kerberos_inject_longterm_key() helper function
[wireshark-sm.git] / ui / qt / capture_file_dialog.h
blob2c48100abb0fb9f499b7744797007f9ba4cfaeb0
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef CAPTURE_FILE_DIALOG_H
11 #define CAPTURE_FILE_DIALOG_H
13 #include <ui/qt/widgets/wireshark_file_dialog.h>
15 #include <ui/qt/widgets/display_filter_edit.h>
16 #include <ui/qt/widgets/compression_group_box.h>
17 #include "packet_range_group_box.h"
18 #include "ui/help_url.h"
20 #include <ui/packet_range.h>
22 #include <ui/qt/models/packet_list_record.h>
23 #include "cfile.h"
25 #include "ui/file_dialog.h"
27 #include <QVBoxLayout>
28 #include <QLabel>
29 #include <QRadioButton>
30 #include <QCheckBox>
31 #include <QDialogButtonBox>
32 #include <QComboBox>
34 class CaptureFileDialog : public WiresharkFileDialog
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.
43 // You can subclass QFileDialog (which we've done here) and add widgets as
44 // described at
46 // https://web.archive.org/web/20100528190736/http://developer.qt.nokia.com/faq/answer/how_can_i_add_widgets_to_my_qfiledialog_instance
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.
51 // On Windows, we should probably use the Common Item Dialog:
53 // https://learn.microsoft.com/en-us/windows/win32/shell/common-file-dialog
55 // We currently use GetOpenFileNam in ui/win32/file_dlg_win32.c.
57 // On macOS we should use NSOpenPanel and NSSavePanel:
59 // https://developer.apple.com/documentation/appkit/nsopenpanel?language=objc
60 // https://developer.apple.com/documentation/appkit/nssavepanel?language=objc
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).
67 // Yes, that's four implementations of the same window.
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.)
73 Q_OBJECT
74 public:
75 explicit CaptureFileDialog(QWidget *parent = NULL, capture_file *cf = NULL);
76 static check_savability_t checkSaveAsWithComments(QWidget *
77 , capture_file *cf, int file_type);
79 int mergeType();
80 int selectedFileType();
81 wtap_compression_type compressionType();
83 private:
84 capture_file *cap_file_;
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);
94 QVBoxLayout left_v_box_;
95 QVBoxLayout right_v_box_;
97 DisplayFilterEdit* display_filter_edit_;
98 int last_row_;
100 QLabel preview_format_;
101 QLabel preview_size_;
102 QLabel preview_first_elapsed_;
103 QList<QLabel *> preview_labels_;
105 QRadioButton merge_prepend_;
106 QRadioButton merge_chrono_;
107 QRadioButton merge_append_;
109 QComboBox format_type_;
110 QHash<QString, int> type_hash_;
111 QHash<QString, QStringList> type_suffixes_;
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);
117 QStringList buildFileSaveAsTypeList(bool must_support_comments);
119 int default_ft_;
121 CompressionGroupBox compress_group_box_;
123 PacketRangeGroupBox packet_range_group_box_;
124 QPushButton *save_bt_;
125 topic_action_e help_topic_;
127 signals:
129 public slots:
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);
138 private slots:
139 void fixFilenameExtension();
140 void preview(const QString & path);
141 void on_buttonBox_helpRequested();
144 #endif // CAPTURE_FILE_DIALOG_H