2012-01-04 22:13:01 +00:00
|
|
|
/* capture_file_dialog.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-01-04 22:13:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CAPTURE_FILE_DIALOG_H
|
|
|
|
#define CAPTURE_FILE_DIALOG_H
|
|
|
|
|
2014-02-25 22:43:04 +00:00
|
|
|
#ifndef Q_OS_WIN
|
2012-07-21 01:21:41 +00:00
|
|
|
#include "display_filter_edit.h"
|
2012-10-08 20:01:59 +00:00
|
|
|
#include "packet_range_group_box.h"
|
2012-10-15 18:32:51 +00:00
|
|
|
#include "ui/help_url.h"
|
2013-04-24 11:07:25 +00:00
|
|
|
#endif // Q_OS_WIN
|
2012-07-21 01:21:41 +00:00
|
|
|
|
2012-09-06 22:58:39 +00:00
|
|
|
#include "packet_list_record.h"
|
|
|
|
#include "cfile.h"
|
|
|
|
|
2012-09-26 19:52:53 +00:00
|
|
|
#include "ui/file_dialog.h"
|
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
#include <QFileDialog>
|
2012-12-05 20:33:40 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QDialogButtonBox>
|
2014-01-18 14:20:02 +00:00
|
|
|
#include <QComboBox>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
|
|
|
class CaptureFileDialog : public QFileDialog
|
|
|
|
{
|
2012-01-25 01:13:04 +00:00
|
|
|
// The GTK+ Open Capture File dialog has the following elements and features:
|
|
|
|
// - The ability to select a capture file from a list of known extensions
|
|
|
|
// - A display filter entry
|
|
|
|
// - Name resolution checkboxes
|
|
|
|
// - Capture file preview information
|
|
|
|
// Ideally we should provide similar functionality here.
|
|
|
|
//
|
|
|
|
// You can subclass QFileDialog (which we've done here) and add widgets as
|
|
|
|
// described at
|
|
|
|
// http://developer.qt.nokia.com/faq/answer/how_can_i_add_widgets_to_my_qfiledialog_instance
|
|
|
|
// However, Qt's idea of what a file dialog looks like isn't what Microsoft
|
|
|
|
// and Apple think a file dialog looks like.
|
|
|
|
//
|
|
|
|
// On Windows Vista and later we should probably use IFileOpenDialog. On earlier
|
|
|
|
// versions of Windows (including XP) we should use GetOpenFileName, which is
|
|
|
|
// what we do in ui/win32/file_dlg_win32.c. On OS X we should use NSOpenPanel. On
|
|
|
|
// other platforms we should fall back to QFileDialog.
|
|
|
|
//
|
|
|
|
// Yes, that's four implementations of the same window.
|
|
|
|
//
|
|
|
|
// If a plain native open file dialog is good enough we can just the static
|
2012-01-25 01:16:36 +00:00
|
|
|
// version of QFileDialog::getOpenFileName. (Commenting out Q_OBJECT and
|
|
|
|
// "explicit" below has the same effect.)
|
2012-01-25 01:13:04 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-10-08 20:01:59 +00:00
|
|
|
explicit CaptureFileDialog(QWidget *parent = NULL, capture_file *cf = NULL, QString &display_filter = *new QString());
|
2012-09-27 02:43:09 +00:00
|
|
|
static check_savability_t checkSaveAsWithComments(QWidget *
|
2013-04-24 11:07:25 +00:00
|
|
|
#if defined(Q_OS_WIN)
|
2012-09-27 02:43:09 +00:00
|
|
|
parent
|
2013-04-24 11:07:25 +00:00
|
|
|
#endif // Q_OS_WIN
|
2012-09-27 02:43:09 +00:00
|
|
|
, capture_file *cf, int file_type);
|
2012-09-26 21:16:59 +00:00
|
|
|
|
2012-09-26 19:52:53 +00:00
|
|
|
int mergeType();
|
|
|
|
int selectedFileType();
|
|
|
|
bool isCompressed();
|
2012-07-18 16:40:34 +00:00
|
|
|
|
|
|
|
private:
|
2012-10-13 00:18:46 +00:00
|
|
|
capture_file *cap_file_;
|
|
|
|
QString &display_filter_;
|
|
|
|
|
2013-04-24 11:07:25 +00:00
|
|
|
#if !defined(Q_OS_WIN)
|
2012-09-06 22:58:39 +00:00
|
|
|
void addMergeControls(QVBoxLayout &v_box);
|
2014-01-18 14:20:02 +00:00
|
|
|
void addFormatTypeSelector(QVBoxLayout &v_box);
|
2012-09-06 23:41:34 +00:00
|
|
|
void addDisplayFilterEdit();
|
2012-09-06 22:58:39 +00:00
|
|
|
void addPreview(QVBoxLayout &v_box);
|
2013-11-08 01:08:42 +00:00
|
|
|
QString fileExtensionType(int et, bool extension_globs = true);
|
2012-09-06 22:58:39 +00:00
|
|
|
QString fileType(int ft, bool extension_globs = true);
|
|
|
|
QStringList buildFileOpenTypeList(void);
|
2012-07-19 23:07:17 +00:00
|
|
|
|
2012-09-06 22:58:39 +00:00
|
|
|
QVBoxLayout left_v_box_;
|
|
|
|
QVBoxLayout right_v_box_;
|
|
|
|
|
2012-09-06 23:41:34 +00:00
|
|
|
DisplayFilterEdit* display_filter_edit_;
|
2012-10-08 20:01:59 +00:00
|
|
|
int last_row_;
|
2012-09-06 22:58:39 +00:00
|
|
|
|
|
|
|
QLabel preview_format_;
|
|
|
|
QLabel preview_size_;
|
|
|
|
QLabel preview_packets_;
|
|
|
|
QLabel preview_first_;
|
|
|
|
QLabel preview_elapsed_;
|
|
|
|
QList<QLabel *> preview_labels_;
|
2012-07-21 01:21:41 +00:00
|
|
|
|
2012-09-06 22:58:39 +00:00
|
|
|
QRadioButton merge_prepend_;
|
|
|
|
QRadioButton merge_chrono_;
|
|
|
|
QRadioButton merge_append_;
|
2012-07-27 21:43:02 +00:00
|
|
|
|
2014-01-18 14:20:02 +00:00
|
|
|
QComboBox format_type_;
|
2012-09-06 22:58:39 +00:00
|
|
|
QHash<QString, int>type_hash_;
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2012-09-06 23:41:34 +00:00
|
|
|
void addResolutionControls(QVBoxLayout &v_box);
|
2012-10-08 20:01:59 +00:00
|
|
|
void addGzipControls(QVBoxLayout &v_box);
|
2012-10-12 23:40:29 +00:00
|
|
|
void addRangeControls(QVBoxLayout &v_box, packet_range_t *range);
|
2012-10-15 18:32:51 +00:00
|
|
|
QDialogButtonBox *addHelpButton(topic_action_e help_topic);
|
2012-09-06 23:41:34 +00:00
|
|
|
|
2012-10-08 20:01:59 +00:00
|
|
|
QStringList buildFileSaveAsTypeList(bool must_support_comments);
|
2012-09-06 23:41:34 +00:00
|
|
|
|
2012-09-26 19:52:53 +00:00
|
|
|
int default_ft_;
|
|
|
|
|
2012-09-06 23:41:34 +00:00
|
|
|
QCheckBox mac_res_;
|
|
|
|
QCheckBox transport_res_;
|
|
|
|
QCheckBox network_res_;
|
|
|
|
QCheckBox external_res_;
|
2012-09-26 19:52:53 +00:00
|
|
|
|
|
|
|
QCheckBox compress_;
|
2012-10-08 20:01:59 +00:00
|
|
|
|
|
|
|
PacketRangeGroupBox packet_range_group_box_;
|
|
|
|
QPushButton *save_bt_;
|
2012-10-15 18:32:51 +00:00
|
|
|
topic_action_e help_topic_;
|
2012-10-08 20:01:59 +00:00
|
|
|
|
2013-04-24 11:07:25 +00:00
|
|
|
#else // Q_OS_WIN
|
2012-09-26 19:52:53 +00:00
|
|
|
int file_type_;
|
2012-09-10 23:03:22 +00:00
|
|
|
int merge_type_;
|
2012-09-26 21:16:59 +00:00
|
|
|
gboolean compressed_;
|
2013-04-24 11:07:25 +00:00
|
|
|
#endif // Q_OS_WIN
|
2012-09-06 23:41:34 +00:00
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2012-07-12 00:04:53 +00:00
|
|
|
int exec();
|
2014-01-18 14:20:02 +00:00
|
|
|
int open(QString &file_name, unsigned int &type);
|
2012-10-08 20:01:59 +00:00
|
|
|
check_savability_t saveAs(QString &file_name, bool must_support_comments);
|
|
|
|
check_savability_t exportSelectedPackets(QString &file_name, packet_range_t *range);
|
2012-09-06 22:58:39 +00:00
|
|
|
int merge(QString &file_name);
|
2012-07-27 21:43:02 +00:00
|
|
|
|
|
|
|
private slots:
|
2013-04-24 11:07:25 +00:00
|
|
|
#if !defined(Q_OS_WIN)
|
2012-07-27 21:43:02 +00:00
|
|
|
void preview(const QString & path);
|
2012-10-15 18:32:51 +00:00
|
|
|
void on_buttonBox_helpRequested();
|
2013-04-24 11:07:25 +00:00
|
|
|
#endif // Q_OS_WIN
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CAPTURE_FILE_DIALOG_H
|
2012-09-04 08:18:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|