add parameter dcerpc_info to PIDL_dissect_ipv?address()
[wireshark-wip.git] / ui / qt / capture_file_dialog.h
blob54f9e1d341f7ac60bd69a92db4d810ba44ac47f9
1 /* capture_file_dialog.h
3 * $Id$
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifndef CAPTURE_FILE_DIALOG_H
25 #define CAPTURE_FILE_DIALOG_H
27 #ifndef Q_QS_WIN
28 #include "display_filter_edit.h"
29 #include "packet_range_group_box.h"
30 #include "ui/help_url.h"
31 #endif // Q_OS_WIN
33 #include "packet_list_record.h"
34 #include "cfile.h"
36 #include "ui/file_dialog.h"
38 #include <QFileDialog>
39 #include <QVBoxLayout>
40 #include <QLabel>
41 #include <QRadioButton>
42 #include <QCheckBox>
43 #include <QDialogButtonBox>
45 class CaptureFileDialog : public QFileDialog
47 // The GTK+ Open Capture File dialog has the following elements and features:
48 // - The ability to select a capture file from a list of known extensions
49 // - A display filter entry
50 // - Name resolution checkboxes
51 // - Capture file preview information
52 // Ideally we should provide similar functionality here.
54 // You can subclass QFileDialog (which we've done here) and add widgets as
55 // described at
56 // http://developer.qt.nokia.com/faq/answer/how_can_i_add_widgets_to_my_qfiledialog_instance
57 // However, Qt's idea of what a file dialog looks like isn't what Microsoft
58 // and Apple think a file dialog looks like.
60 // On Windows Vista and later we should probably use IFileOpenDialog. On earlier
61 // versions of Windows (including XP) we should use GetOpenFileName, which is
62 // what we do in ui/win32/file_dlg_win32.c. On OS X we should use NSOpenPanel. On
63 // other platforms we should fall back to QFileDialog.
65 // Yes, that's four implementations of the same window.
67 // If a plain native open file dialog is good enough we can just the static
68 // version of QFileDialog::getOpenFileName. (Commenting out Q_OBJECT and
69 // "explicit" below has the same effect.)
71 Q_OBJECT
72 public:
73 explicit CaptureFileDialog(QWidget *parent = NULL, capture_file *cf = NULL, QString &display_filter = *new QString());
74 static check_savability_t checkSaveAsWithComments(QWidget *
75 #if defined(Q_OS_WIN)
76 parent
77 #endif // Q_OS_WIN
78 , capture_file *cf, int file_type);
80 int mergeType();
81 int selectedFileType();
82 bool isCompressed();
84 private:
85 capture_file *cap_file_;
86 QString &display_filter_;
88 #if !defined(Q_OS_WIN)
89 void addMergeControls(QVBoxLayout &v_box);
90 void addDisplayFilterEdit();
91 void addPreview(QVBoxLayout &v_box);
92 QString fileExtensionType(int et, bool extension_globs = true);
93 QString fileType(int ft, bool extension_globs = true);
94 QStringList buildFileOpenTypeList(void);
96 QVBoxLayout left_v_box_;
97 QVBoxLayout right_v_box_;
99 DisplayFilterEdit* display_filter_edit_;
100 int last_row_;
102 QLabel preview_format_;
103 QLabel preview_size_;
104 QLabel preview_packets_;
105 QLabel preview_first_;
106 QLabel preview_elapsed_;
107 QList<QLabel *> preview_labels_;
109 QRadioButton merge_prepend_;
110 QRadioButton merge_chrono_;
111 QRadioButton merge_append_;
113 QHash<QString, int>type_hash_;
115 void addResolutionControls(QVBoxLayout &v_box);
116 void addGzipControls(QVBoxLayout &v_box);
117 void addRangeControls(QVBoxLayout &v_box, packet_range_t *range);
118 QDialogButtonBox *addHelpButton(topic_action_e help_topic);
120 QStringList buildFileSaveAsTypeList(bool must_support_comments);
122 int default_ft_;
124 QCheckBox mac_res_;
125 QCheckBox transport_res_;
126 QCheckBox network_res_;
127 QCheckBox external_res_;
129 QCheckBox compress_;
131 PacketRangeGroupBox packet_range_group_box_;
132 QPushButton *save_bt_;
133 topic_action_e help_topic_;
135 #else // Q_OS_WIN
136 int file_type_;
137 int merge_type_;
138 gboolean compressed_;
139 #endif // Q_OS_WIN
141 signals:
143 public slots:
145 int exec();
146 int open(QString &file_name);
147 check_savability_t saveAs(QString &file_name, bool must_support_comments);
148 check_savability_t exportSelectedPackets(QString &file_name, packet_range_t *range);
149 int merge(QString &file_name);
151 private slots:
152 #if !defined(Q_OS_WIN)
153 void preview(const QString & path);
154 void on_buttonBox_helpRequested();
155 #endif // Q_OS_WIN
158 #endif // CAPTURE_FILE_DIALOG_H
161 * Editor modelines
163 * Local Variables:
164 * c-basic-offset: 4
165 * tab-width: 8
166 * indent-tabs-mode: nil
167 * End:
169 * ex: set shiftwidth=4 tabstop=8 expandtab:
170 * :indentSize=4:tabSize=8:noTabs=true: