summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-10-08 20:01:59 +0000
committerGerald Combs <gerald@wireshark.org>2012-10-08 20:01:59 +0000
commit445148ac0e6eddf177c30e81811da90b7e2267aa (patch)
treef87bcf0a462aa11e92a3d1f697c197589a12c7d6
parent693ed306d3ac7e606f9e977c824b79f7a5ec4614 (diff)
downloadwireshark-445148ac0e6eddf177c30e81811da90b7e2267aa.tar.gz
Add a PacketRangeGroupBox widget. Use it to implement "Export Selected
Packets". Not yet tested on Windows. "Ignore Packet" hasn't been implemented so we can't test that either. Create a SyntaxLineEdit widget from the QLineEdit code in DisplayFilterEdit. Use it in the file import and export dialogs and the PacketRangeGroupBox widget. This lets us provide instant feedback instead of popping up an error dialog. Expand the Tango color list based on http://emilis.info/other/extended_tango . Rearrange QtShark.pro to (hopefully) work better with Qt Creator. svn path=/trunk/; revision=45405
-rw-r--r--ui/gtk/range_utils.c14
-rw-r--r--ui/qt/CMakeLists.txt4
-rw-r--r--ui/qt/Makefile.common8
-rw-r--r--ui/qt/QtShark.pro135
-rw-r--r--ui/qt/capture_file_dialog.cpp119
-rw-r--r--ui/qt/capture_file_dialog.h23
-rw-r--r--ui/qt/display_filter_edit.cpp55
-rw-r--r--ui/qt/display_filter_edit.h11
-rw-r--r--ui/qt/import_text_dialog.cpp208
-rw-r--r--ui/qt/import_text_dialog.h5
-rw-r--r--ui/qt/import_text_dialog.ui24
-rw-r--r--ui/qt/main_welcome.cpp2
-rw-r--r--ui/qt/main_window.cpp250
-rw-r--r--ui/qt/main_window.h4
-rw-r--r--ui/qt/main_window_slots.cpp7
-rw-r--r--ui/qt/packet_range_group_box.cpp331
-rw-r--r--ui/qt/packet_range_group_box.h78
-rw-r--r--ui/qt/packet_range_group_box.ui261
-rw-r--r--ui/qt/syntax_line_edit.cpp49
-rw-r--r--ui/qt/syntax_line_edit.h30
-rw-r--r--ui/qt/tango_colors.h72
-rw-r--r--ui/win32/file_dlg_win32.c2
22 files changed, 1333 insertions, 359 deletions
diff --git a/ui/gtk/range_utils.c b/ui/gtk/range_utils.c
index 2ee1ccdab0..47e993fc3d 100644
--- a/ui/gtk/range_utils.c
+++ b/ui/gtk/range_utils.c
@@ -86,6 +86,7 @@ range_check_validity(packet_range_t *range)
}
}
+#include <stdio.h>
gboolean
range_check_validity_modal(GtkWidget *parent, packet_range_t *range)
{
@@ -153,6 +154,7 @@ range_update_dynamics(gpointer data)
gtk_widget_set_sensitive(range_displayed_bt, FALSE);
}
+ /* All / Captured */
gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(data), RANGE_SELECT_ALL_C_KEY), !filtered_active);
if (range->remove_ignored) {
g_snprintf(label_text, sizeof(label_text), "%u", cfile.count - range->ignored_cnt);
@@ -160,6 +162,8 @@ range_update_dynamics(gpointer data)
g_snprintf(label_text, sizeof(label_text), "%u", cfile.count);
}
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_SELECT_ALL_C_KEY)), label_text);
+
+ /* All / Displayed */
gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(data), RANGE_SELECT_ALL_D_KEY), filtered_active);
if (range->include_dependents)
displayed_cnt = range->displayed_plus_dependents_cnt;
@@ -172,6 +176,7 @@ range_update_dynamics(gpointer data)
}
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_SELECT_ALL_D_KEY)), label_text);
+ /* Selected / Captured + Displayed */
/* Enable saving the currently-selected packet only if there *is* a
currently-selected packet. */
selected_num = (cfile.current_frame) ? cfile.current_frame->num : 0;
@@ -206,6 +211,7 @@ range_update_dynamics(gpointer data)
}
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_SELECT_CURR_D_KEY)), label_text);
+ /* Marked / Captured + Displayed */
/* Enable the buttons for saving marked packets only if there *are*
marked packets. */
if (filtered_active)
@@ -240,6 +246,8 @@ range_update_dynamics(gpointer data)
}
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_SELECT_MARKED_D_KEY)), label_text);
+ /* First to last marked / Captured + Displayed */
+
/* Enable the buttons for saving the range of marked packets only if
there *is* a range of marked packets. */
if (filtered_active)
@@ -275,6 +283,8 @@ range_update_dynamics(gpointer data)
}
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_SELECT_MARKED_RANGE_D_KEY)), label_text);
+ /* User specified / Captured + Displayed */
+
gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(data), RANGE_SELECT_USER_KEY), TRUE);
gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(data), RANGE_SELECT_USER_C_KEY), !filtered_active);
gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(data), RANGE_SELECT_USER_D_KEY), filtered_active);
@@ -291,6 +301,7 @@ range_update_dynamics(gpointer data)
}
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_SELECT_USER_D_KEY)), label_text);
+ /* Ignored */
switch(range->process) {
case(range_process_all):
ignored_cnt = range->ignored_cnt;
@@ -332,7 +343,8 @@ range_update_dynamics(gpointer data)
}
g_snprintf(label_text, sizeof(label_text), "%u", ignored_cnt);
- gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_IGNORED_C_KEY)), label_text); g_snprintf(label_text, sizeof(label_text), "%u", displayed_ignored_cnt);
+ gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_IGNORED_C_KEY)), label_text);
+ g_snprintf(label_text, sizeof(label_text), "%u", displayed_ignored_cnt);
gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(data), RANGE_IGNORED_D_KEY)), label_text);
}
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index a943a8bf65..9594538611 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -43,6 +43,7 @@ set(QTSHARK_H_SRC
monospace_font.h
packet_list.h
packet_list_model.h
+ packet_range_group_box.h
progress_bar.h
proto_tree.h
recent_file_status.h
@@ -77,12 +78,14 @@ set(QTSHARK_CPP_SRC
packet_list.cpp
packet_list_model.cpp
packet_list_record.cpp
+ packet_range_group_box.cpp
progress_bar.cpp
proto_tree.cpp
qt_ui_utils.cpp
recent_file_status.cpp
simple_dialog_qt.cpp
sparkline_delegate.cpp
+ syntax_line_edit.cpp
wireshark_application.cpp
)
@@ -95,6 +98,7 @@ set(QTSHARK_UI
import_text_dialog.ui
main_welcome.ui
main_window.ui
+ packet_range_group_box.ui
)
set(QTSHARK_QRC
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index 77d0d61ff7..428871a9b5 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -31,8 +31,10 @@ GENERATED_HEADER_FILES =
# Generated header files that we don't want in the distribution.
GENERATED_NODIST_HEADER_FILES = \
+ ui_file_set_dialog.h \
ui_main_welcome.h \
- ui_main_window.h
+ ui_main_window.h \
+ ui_packet_range_group_box.h
# Generated C source files that we want in the distribution.
GENERATED_C_FILES =
@@ -85,11 +87,13 @@ MOC_HDRS = \
monospace_font.h \
packet_list.h \
packet_list_model.h \
+ packet_range_group_box.h \
progress_bar.h \
proto_tree.h \
recent_file_status.h \
simple_dialog_qt.h \
sparkline_delegate.h \
+ syntax_line_edit.h \
wireshark_application.h
#
@@ -140,12 +144,14 @@ WIRESHARK_QT_SRC = \
packet_list.cpp \
packet_list_model.cpp \
packet_list_record.cpp \
+ packet_range_group_box.cpp \
progress_bar.cpp \
proto_tree.cpp \
qt_ui_utils.cpp \
recent_file_status.cpp \
simple_dialog_qt.cpp \
sparkline_delegate.cpp \
+ syntax_line_edit.cpp \
wireshark_application.cpp
noinst_HEADERS = \
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 38a23c0c70..42301d4f97 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -172,74 +172,14 @@ win32:SOURCES_WS_C += \
../../capture_wpcap_packet.c \
../../ui/win32/file_dlg_win32.c
-
-SOURCES_QT_CPP = \
- byte_view_tab.cpp \
- byte_view_text.cpp \
- capture_file_dialog.cpp \
- capture_info_dialog.cpp \
- capture_interface_dialog.cpp \
- color_dialog.cpp \
- color_utils.cpp \
- display_filter_combo.cpp \
- display_filter_edit.cpp \
- file_set_dialog.cpp \
- interface_tree.cpp \
- label_stack.cpp \
- main.cpp \
- main_status_bar.cpp \
- main_welcome.cpp \
- main_window.cpp \
- main_window_slots.cpp \
- monospace_font.cpp \
- packet_list.cpp \
- packet_list_model.cpp \
- packet_list_record.cpp \
- progress_bar.cpp \
- proto_tree.cpp \
- qt_ui_utils.cpp \
- recent_file_status.cpp \
- simple_dialog_qt.cpp \
- sparkline_delegate.cpp \
- wireshark_application.cpp
-
-
HEADERS_WS_C = \
../../wsutil/privileges.h
-HEADERS_QT_CPP = \
- byte_view_tab.h \
- byte_view_text.h \
- capture_file_dialog.h \
- capture_info_dialog.h \
- capture_interface_dialog.h \
- color_dialog.h \
- color_utils.h \
- display_filter_combo.h \
- display_filter_edit.h \
- file_set_dialog.h \
- interface_tree.h \
- label_stack.h \
- main_status_bar.h \
- main_welcome.h \
- main_window.h \
- monospace_font.h \
- packet_list.h \
- packet_list_model.h \
- packet_list_record.h \
- progress_bar.h \
- proto_tree.h \
- qt_ui_utils.h \
- qt_ui_utils.h \
- recent_file_status.h \
- simple_dialog_qt.h \
- sparkline_delegate.h \
- wireshark_application.h
-
FORMS += main_window.ui \
main_welcome.ui \
import_text_dialog.ui \
- file_set_dialog.ui
+ file_set_dialog.ui \
+ packet_range_group_box.ui
win32 { ## These should be in config.pri ??
!isEmpty(PORTAUDIO_DIR) {
@@ -262,10 +202,9 @@ win32 { ## These should be in config.pri ??
}
}
+HEADERS += $$HEADERS_WS_C
+
win32 {
- SOURCES += $$SOURCES_QT_CPP
- HEADERS += $$HEADERS_WS_C
- HEADERS += $$HEADERS_QT_CPP
OBJECTS_WS_C = $$SOURCES_WS_C
OBJECTS_WS_C ~= s/[.]c/.obj/g
OBJECTS_WS_C ~= s,/,\\,g
@@ -273,9 +212,6 @@ win32 {
} else {
## XXX: Shouldn't need to (re)compile WS_C sources ??
SOURCES += $$SOURCES_WS_C
- SOURCES += $$SOURCES_QT_CPP
- HEADERS += $$HEADERS_WS_C
- HEADERS += $$HEADERS_QT_CPP
}
DEFINES += INET6 REENTRANT
@@ -409,7 +345,66 @@ RC_FILE = qtshark.rc
win32: QMAKE_CLEAN += *.pdb
HEADERS += \
- import_text_dialog.h
+ byte_view_tab.h \
+ byte_view_text.h \
+ capture_file_dialog.h \
+ capture_info_dialog.h \
+ capture_interface_dialog.h \
+ color_dialog.h \
+ color_utils.h \
+ display_filter_combo.h \
+ display_filter_edit.h \
+ file_set_dialog.h \
+ import_text_dialog.h \
+ interface_tree.h \
+ label_stack.h \
+ main_status_bar.h \
+ main_welcome.h \
+ main_window.h \
+ monospace_font.h \
+ packet_list.h \
+ packet_list_model.h \
+ packet_list_record.h \
+ packet_range_group_box.h \
+ progress_bar.h \
+ proto_tree.h \
+ qt_ui_utils.h \
+ qt_ui_utils.h \
+ recent_file_status.h \
+ simple_dialog_qt.h \
+ sparkline_delegate.h \
+ syntax_line_edit.h \
+ wireshark_application.h
SOURCES += \
- import_text_dialog.cpp
+ byte_view_tab.cpp \
+ byte_view_text.cpp \
+ capture_file_dialog.cpp \
+ capture_info_dialog.cpp \
+ capture_interface_dialog.cpp \
+ color_dialog.cpp \
+ color_utils.cpp \
+ display_filter_combo.cpp \
+ display_filter_edit.cpp \
+ file_set_dialog.cpp \
+ import_text_dialog.cpp \
+ interface_tree.cpp \
+ label_stack.cpp \
+ main.cpp \
+ main_status_bar.cpp \
+ main_welcome.cpp \
+ main_window.cpp \
+ main_window_slots.cpp \
+ monospace_font.cpp \
+ packet_list.cpp \
+ packet_list_model.cpp \
+ packet_list_record.cpp \
+ packet_range_group_box.cpp \
+ progress_bar.cpp \
+ proto_tree.cpp \
+ qt_ui_utils.cpp \
+ recent_file_status.cpp \
+ simple_dialog_qt.cpp \
+ sparkline_delegate.cpp \
+ syntax_line_edit.cpp \
+ wireshark_application.cpp
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 1bd67cc298..5378830128 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -21,12 +21,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
-#include <glib.h>
-
#include <wiretap/wtap.h>
+#include "packet_range_group_box.h"
#include "capture_file_dialog.h"
#ifdef Q_WS_WIN
@@ -49,6 +46,7 @@
#include <QCheckBox>
#include <QFileInfo>
#include <QMessageBox>
+#include <QSpacerItem>
#include <QDebug>
@@ -120,12 +118,15 @@ extern void topic_cb(gpointer *widget, int topic) {
// End stub routines
#endif // Q_WS_WIN
-CaptureFileDialog::CaptureFileDialog(QWidget *parent, QString &display_filter) :
- QFileDialog(parent), display_filter_(display_filter)
+CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString &display_filter) :
+ QFileDialog(parent),
+ display_filter_(display_filter),
+ cap_file_(cf),
#if !defined(Q_WS_WIN)
- , default_ft_(-1)
+ default_ft_(-1),
+ save_bt_(NULL)
#else
- , file_type_(-1)
+ file_type_(-1)
#endif
{
#if !defined(Q_WS_WIN)
@@ -135,15 +136,15 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, QString &display_filter) :
QGridLayout *fd_grid = qobject_cast<QGridLayout*>(layout());
QHBoxLayout *h_box = new QHBoxLayout();
- df_row_ = fd_grid->rowCount();
+ last_row_ = fd_grid->rowCount();
- fd_grid->addLayout(h_box, fd_grid->rowCount(), 1, 1, -1);
+ fd_grid->addItem(new QSpacerItem(1, 1), last_row_, 0);
+ fd_grid->addLayout(h_box, last_row_, 1);
+ last_row_++;
// Left and right boxes for controls and preview
h_box->addLayout(&left_v_box_);
h_box->addLayout(&right_v_box_);
-
-
#else // Q_WS_WIN
merge_type_ = 0;
#endif // Q_WS_WIN
@@ -157,7 +158,7 @@ check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *
#if defined(Q_WS_WIN)
if (!parent || !cf)
return CANCELLED;
- return win32_check_save_as_with_comments(parent->effectiveWinId(), cf, file_type);
+ return win32_check_save_as_with_comments(parent->effectiveWinId(), cap_file_, file_type);
#else // Q_WS_WIN
QMessageBox msg_dialog;
int response;
@@ -385,17 +386,33 @@ int CaptureFileDialog::open(QString &file_name) {
return (int) wof_status;
}
-check_savability_t CaptureFileDialog::saveAs(capture_file *cf, QString &file_name, bool must_support_comments) {
+check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_support_comments) {
GString *fname = g_string_new(file_name.toUtf8().constData());
gboolean wsf_status;
- wsf_status = win32_save_as_file(parentWidget()->effectiveWinId(), cf, fname, &file_type_, &compressed_, must_support_comments);
+ wsf_status = win32_save_as_file(parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compressed_, must_support_comments);
file_name = fname->str;
g_string_free(fname, TRUE);
if (wsf_status) {
- return win32_check_save_as_with_comments(parentWidget()->effectiveWinId(), cf, file_type_);
+ return win32_check_save_as_with_comments(parentWidget()->effectiveWinId(), cap_file_, file_type_);
+ }
+
+ return CANCELLED;
+}
+
+check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name) {
+ GString *fname = g_string_new(file_name.toUtf8().constData());
+ gboolean wespf_status;
+
+ wespf_status = win32_export_specified_packets_file(parentWidget()->effectiveWinId(), fname, &file_type_, &compressed_, &range_);
+ file_name = fname->str;
+
+ g_string_free(fname, TRUE);
+
+ if (wespf_status) {
+ return win32_check_save_as_with_comments(parentWidget()->effectiveWinId(), cap_file_, file_type_);
}
return CANCELLED;
@@ -432,12 +449,12 @@ bool CaptureFileDialog::isCompressed() {
void CaptureFileDialog::addDisplayFilterEdit() {
QGridLayout *fd_grid = qobject_cast<QGridLayout*>(layout());
- fd_grid->addWidget(new QLabel(tr("Display Filter:")), df_row_, 0, 1, 1);
+ fd_grid->addWidget(new QLabel(tr("Display Filter:")), last_row_, 0);
display_filter_edit_ = new DisplayFilterEdit(this, true);
display_filter_edit_->setText(display_filter_);
- fd_grid->addWidget(display_filter_edit_, df_row_, 1, 1, 1);
-
+ fd_grid->addWidget(display_filter_edit_, last_row_, 1);
+ last_row_++;
}
void CaptureFileDialog::addResolutionControls(QVBoxLayout &v_box) {
@@ -458,9 +475,9 @@ void CaptureFileDialog::addResolutionControls(QVBoxLayout &v_box) {
v_box.addWidget(&external_res_);
}
-void CaptureFileDialog::addGzipControls(QVBoxLayout &v_box, capture_file *cf) {
+void CaptureFileDialog::addGzipControls(QVBoxLayout &v_box) {
compress_.setText(tr("Compress with g&zip"));
- if (cf->iscompressed && wtap_dump_can_compress(default_ft_)) {
+ if (cap_file_->iscompressed && wtap_dump_can_compress(default_ft_)) {
compress_.setChecked(true);
} else {
compress_.setChecked(false);
@@ -469,6 +486,15 @@ void CaptureFileDialog::addGzipControls(QVBoxLayout &v_box, capture_file *cf) {
}
+void CaptureFileDialog::addRangeControls(packet_range_t *range) {
+ QGridLayout *fd_grid = qobject_cast<QGridLayout*>(layout());
+
+ packet_range_group_box_.initRange(range);
+
+ fd_grid->addWidget(&packet_range_group_box_, last_row_, 1, 1, -1);
+ last_row_++;
+}
+
int CaptureFileDialog::open(QString &file_name) {
setWindowTitle(tr("Wireshark: Open Capture File"));
setNameFilters(buildFileOpenTypeList());
@@ -502,16 +528,16 @@ int CaptureFileDialog::open(QString &file_name) {
}
}
-check_savability_t CaptureFileDialog::saveAs(capture_file *cf, QString &file_name, bool must_support_comments) {
+check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_support_comments) {
setWindowTitle(tr("Wireshark: Save Capture File As"));
// XXX There doesn't appear to be a way to use setNameFilters without restricting
// what the user can select. We might want to use our own combobox instead and
// let the user select anything.
- setNameFilters(buildFileSaveAsTypeList(cf, must_support_comments));
+ setNameFilters(buildFileSaveAsTypeList(must_support_comments));
setAcceptMode(QFileDialog::AcceptSave);
setLabelText(FileType, "Save as:");
- addGzipControls(left_v_box_, cf);
+ addGzipControls(left_v_box_);
// Grow the dialog to account for the extra widgets.
resize(width(), height() + left_v_box_.minimumSize().height());
@@ -522,7 +548,40 @@ check_savability_t CaptureFileDialog::saveAs(capture_file *cf, QString &file_nam
if (QFileDialog::exec() && selectedFiles().length() > 0) {
file_name = selectedFiles()[0];
- return checkSaveAsWithComments(this, cf, selectedFileType());
+ return checkSaveAsWithComments(this, cap_file_, selectedFileType());
+ }
+ return CANCELLED;
+}
+
+check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_t *range) {
+ QDialogButtonBox *button_box = findChild<QDialogButtonBox *>();
+
+ setWindowTitle(tr("Wireshark: Export Specified Packets"));
+ // XXX See comment in ::saveAs regarding setNameFilters
+ setNameFilters(buildFileSaveAsTypeList(false));
+ setAcceptMode(QFileDialog::AcceptSave);
+ setLabelText(FileType, "Export as:");
+
+ addGzipControls(left_v_box_);
+ addRangeControls(range);
+
+ if (button_box) {
+ save_bt_ = button_box->button(QDialogButtonBox::Save);
+ }
+
+ connect(&packet_range_group_box_, SIGNAL(validityChanged(bool)),
+ this, SLOT(rangeValidityChanged(bool)));
+
+ // Grow the dialog to account for the extra widgets.
+ resize(width(), height() + (packet_range_group_box_.height() * 2 / 3) + left_v_box_.minimumSize().height());
+
+ if (!file_name.isEmpty()) {
+ selectFile(file_name);
+ }
+
+ if (QFileDialog::exec() && selectedFiles().length() > 0) {
+ file_name = selectedFiles()[0];
+ return checkSaveAsWithComments(this, cap_file_, selectedFileType());
}
return CANCELLED;
}
@@ -552,14 +611,14 @@ int CaptureFileDialog::merge(QString &file_name) {
}
}
-QStringList CaptureFileDialog::buildFileSaveAsTypeList(capture_file *cf, bool must_support_comments) {
+QStringList CaptureFileDialog::buildFileSaveAsTypeList(bool must_support_comments) {
QStringList filters;
GArray *savable_file_types;
guint i;
int ft;
type_hash_.clear();
- savable_file_types = wtap_get_savable_file_types(cf->cd_t, cf->linktypes);
+ savable_file_types = wtap_get_savable_file_types(cap_file_->cd_t, cap_file_->linktypes);
if (savable_file_types != NULL) {
QString file_type;
@@ -594,6 +653,12 @@ int CaptureFileDialog::mergeType() {
}
#endif // Q_WS_WINDOWS
+// Slots
+
+void CaptureFileDialog::rangeValidityChanged(bool is_valid) {
+ if (save_bt_) save_bt_->setEnabled(is_valid);
+}
+
/* do a preview run on the currently selected capture file */
void CaptureFileDialog::preview(const QString & path)
diff --git a/ui/qt/capture_file_dialog.h b/ui/qt/capture_file_dialog.h
index 7f9db56b31..0b228162bc 100644
--- a/ui/qt/capture_file_dialog.h
+++ b/ui/qt/capture_file_dialog.h
@@ -25,6 +25,7 @@
#define CAPTURE_FILE_DIALOG_H
#include "display_filter_edit.h"
+#include "packet_range_group_box.h"
#include "packet_list_record.h"
#include "cfile.h"
@@ -61,11 +62,11 @@ class CaptureFileDialog : public QFileDialog
Q_OBJECT
public:
- explicit CaptureFileDialog(QWidget *parent = NULL, QString &display_filter = *new QString());
+ explicit CaptureFileDialog(QWidget *parent = NULL, capture_file *cf = NULL, QString &display_filter = *new QString());
static check_savability_t checkSaveAsWithComments(QWidget *
#if defined(Q_WS_WIN)
parent
-#endif
+#endif // Q_WS_WIN
, capture_file *cf, int file_type);
int mergeType();
@@ -83,8 +84,9 @@ private:
QVBoxLayout right_v_box_;
QString &display_filter_;
+ capture_file *cap_file_;
DisplayFilterEdit* display_filter_edit_;
- int df_row_;
+ int last_row_;
QLabel preview_format_;
QLabel preview_size_;
@@ -101,9 +103,10 @@ private:
#if !defined(Q_WS_WIN)
void addResolutionControls(QVBoxLayout &v_box);
- void addGzipControls(QVBoxLayout &v_box, capture_file *cf);
+ void addGzipControls(QVBoxLayout &v_box);
+ void addRangeControls(packet_range_t *range);
- QStringList buildFileSaveAsTypeList(capture_file *cf, bool must_support_comments);
+ QStringList buildFileSaveAsTypeList(bool must_support_comments);
int default_ft_;
@@ -113,6 +116,10 @@ private:
QCheckBox external_res_;
QCheckBox compress_;
+
+ PacketRangeGroupBox packet_range_group_box_;
+ QPushButton *save_bt_;
+
#else // Q_WS_WIN
int file_type_;
int merge_type_;
@@ -125,8 +132,12 @@ public slots:
int exec();
int open(QString &file_name);
- check_savability_t saveAs(capture_file *cf, QString &file_name, bool must_support_comments);
+ check_savability_t saveAs(QString &file_name, bool must_support_comments);
+ check_savability_t exportSelectedPackets(QString &file_name, packet_range_t *range);
int merge(QString &file_name);
+#if !defined(Q_WS_WIN)
+ void rangeValidityChanged(bool is_valid);
+#endif // Q_WS_WIN
private slots:
void preview(const QString & path);
diff --git a/ui/qt/display_filter_edit.cpp b/ui/qt/display_filter_edit.cpp
index c5fb90834d..6dd6072152 100644
--- a/ui/qt/display_filter_edit.cpp
+++ b/ui/qt/display_filter_edit.cpp
@@ -30,7 +30,7 @@
#include <epan/proto.h>
#include "display_filter_edit.h"
-#include "tango_colors.h"
+#include "syntax_line_edit.h"
#include "ui/utf8_entities.h"
@@ -83,11 +83,10 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
// XXX - We need simplified (button- and dropdown-free) versions for use in dialogs and field-only checking.
DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
- QLineEdit(parent), plain_(plain)
+ SyntaxLineEdit(parent),
+ plain_(plain),
+ field_name_only_(false)
{
- field_name_only_ = false;
- syntax_state_ = Empty;
-
setAccessibleName(tr("Display filter entry"));
if (plain_) {
@@ -189,46 +188,21 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
} else {
apsz.setHeight(0); apsz.setWidth(0);
}
- syntax_style_sheet_ = QString(
+ setStyleSheet(QString(
"DisplayFilterEdit {"
" padding-left: %1px;"
" margin-left: %2px;"
" margin-right: %3px;"
-// " background: transparent;"
- "}"
-
- // Should the backgrounds fade away on the right?
- "DisplayFilterEdit[syntaxState=\"%4\"] {"
- " color: white;"
- " background-color: #%7;"
- "}"
-
- "DisplayFilterEdit[syntaxState=\"%5\"] {"
- " color: #%8;"
- " background-color: #%9;"
- "}"
-
- "DisplayFilterEdit[syntaxState=\"%6\"] {"
- " color: #%8;"
- " background-color: #%10;"
"}"
)
.arg(frameWidth + 1)
.arg(bksz.width())
.arg(cbsz.width() + apsz.width() + frameWidth + 1)
- .arg(Invalid)
- .arg(Deprecated)
- .arg(Valid)
- .arg(tango_scarlet_red_1, 6, 16, QChar('0')) // Invalid
- .arg(tango_aluminium_6, 6, 16, QChar('0')) // Deprecated/valid foreground
- .arg(tango_butter_1, 6, 16, QChar('0')) // Deprecated
- .arg(tango_chameleon_1, 6, 16, QChar('0')) // Valid
- ;
- setStyleSheet(syntax_style_sheet_);
+ );
}
void DisplayFilterEdit::paintEvent(QPaintEvent *evt) {
- QLineEdit::paintEvent(evt);
+ SyntaxLineEdit::paintEvent(evt);
// http://wiki.forum.nokia.com/index.php/Custom_QLineEdit
if (text().isEmpty() && ! this->hasFocus()) {
@@ -282,17 +256,17 @@ void DisplayFilterEdit::checkFilter(const QString& text)
popFilterSyntaxStatus();
if (field_name_only_ && (c = proto_check_field_name(text.toUtf8().constData()))) {
- syntax_state_ = Invalid;
+ setSyntaxState(Invalid);
emit pushFilterSyntaxStatus(QString().sprintf("Illegal character in field name: '%c'", c));
} else if (dfilter_compile(text.toUtf8().constData(), &dfp)) {
if (dfp != NULL) {
depr = dfilter_deprecated_tokens(dfp);
}
if (text.length() < 1) {
- syntax_state_ = Empty;
+ setSyntaxState(Empty);
} else if (depr) {
/* You keep using that word. I do not think it means what you think it means. */
- syntax_state_ = Deprecated;
+ setSyntaxState(Deprecated);
/*
* We're being lazy and only printing the first "problem" token.
* Would it be better to print all of them?
@@ -300,11 +274,11 @@ void DisplayFilterEdit::checkFilter(const QString& text)
emit pushFilterSyntaxWarning(QString().sprintf("\"%s\" may have unexpected results (see the User's Guide)",
(const char *) g_ptr_array_index(depr, 0)));
} else {
- syntax_state_ = Valid;
+ setSyntaxState(Valid);
}
dfilter_free(dfp);
} else {
- syntax_state_ = Invalid;
+ setSyntaxState(Invalid);
QString invalidMsg(tr("Invalid filter"));
if (dfilter_error_msg) {
invalidMsg.append(QString().sprintf(": %s", dfilter_error_msg));
@@ -312,9 +286,8 @@ void DisplayFilterEdit::checkFilter(const QString& text)
emit pushFilterSyntaxStatus(invalidMsg);
}
- setStyleSheet(syntax_style_sheet_);
if (apply_button_) {
- apply_button_->setEnabled(syntax_state_ == Empty || syntax_state_ == Valid);
+ apply_button_->setEnabled(SyntaxState() == Empty || syntaxState() == Valid);
}
}
@@ -329,7 +302,7 @@ void DisplayFilterEdit::applyDisplayFilter()
gchar *dftext = NULL;
cf_status_t cf_status;
- if (syntax_state_ != Valid && syntax_state_ != Empty) {
+ if (syntaxState() != Valid && syntaxState() != Empty) {
return;
}
diff --git a/ui/qt/display_filter_edit.h b/ui/qt/display_filter_edit.h
index 41204c8ad5..caa5e498cd 100644
--- a/ui/qt/display_filter_edit.h
+++ b/ui/qt/display_filter_edit.h
@@ -25,18 +25,13 @@
#define DISPLAYFILTEREDIT_H
#include <QtGui>
+#include "syntax_line_edit.h"
-class DisplayFilterEdit : public QLineEdit
+class DisplayFilterEdit : public SyntaxLineEdit
{
Q_OBJECT
- Q_PROPERTY(SyntaxState syntaxState READ syntaxState)
- Q_ENUMS(SyntaxState)
public:
explicit DisplayFilterEdit(QWidget *parent = 0, bool plain = false);
- enum SyntaxState { Empty, Invalid, Deprecated, Valid };
- SyntaxState syntaxState() const
- { return syntax_state_; }
-
protected:
void paintEvent(QPaintEvent *evt);
@@ -52,9 +47,7 @@ private slots:
private:
bool plain_;
bool field_name_only_;
- SyntaxState syntax_state_;
QString empty_filter_message_;
- QString syntax_style_sheet_;
QToolButton *bookmark_button_;
QToolButton *clear_button_;
QToolButton *apply_button_;
diff --git a/ui/qt/import_text_dialog.cpp b/ui/qt/import_text_dialog.cpp
index 21e0c94ac1..1acbcb1558 100644
--- a/ui/qt/import_text_dialog.cpp
+++ b/ui/qt/import_text_dialog.cpp
@@ -52,33 +52,33 @@
ImportTextDialog::ImportTextDialog(QWidget *parent) :
QDialog(parent),
- ui(new Ui::ImportTextDialog),
+ ti_ui_(new Ui::ImportTextDialog),
import_info_()
{
int encap;
int i;
- ui->setupUi(this);
+ ti_ui_->setupUi(this);
memset(&import_info_, 0, sizeof(import_info_));
- ok_button_ = ui->buttonBox->button(QDialogButtonBox::Ok);
+ ok_button_ = ti_ui_->buttonBox->button(QDialogButtonBox::Ok);
ok_button_->setEnabled(false);
#ifdef Q_WS_MAC
// The grid layout squishes each line edit otherwise.
- int le_height = ui->textFileLineEdit->sizeHint().height();
- ui->ethertypeLineEdit->setMinimumHeight(le_height);
- ui->protocolLineEdit->setMinimumHeight(le_height);
- ui->sourcePortLineEdit->setMinimumHeight(le_height);
- ui->destinationPortLineEdit->setMinimumHeight(le_height);
- ui->tagLineEdit->setMinimumHeight(le_height);
- ui->ppiLineEdit->setMinimumHeight(le_height);
+ int le_height = ti_ui_->textFileLineEdit->sizeHint().height();
+ ti_ui_->ethertypeLineEdit->setMinimumHeight(le_height);
+ ti_ui_->protocolLineEdit->setMinimumHeight(le_height);
+ ti_ui_->sourcePortLineEdit->setMinimumHeight(le_height);
+ ti_ui_->destinationPortLineEdit->setMinimumHeight(le_height);
+ ti_ui_->tagLineEdit->setMinimumHeight(le_height);
+ ti_ui_->ppiLineEdit->setMinimumHeight(le_height);
#endif
- on_dateTimeLineEdit_textChanged(ui->dateTimeLineEdit->text());
+ on_dateTimeLineEdit_textChanged(ti_ui_->dateTimeLineEdit->text());
- for (i = 0; i < ui->headerGridLayout->count(); i++) {
- QRadioButton *rb = qobject_cast<QRadioButton *>(ui->headerGridLayout->itemAt(i)->widget());
+ for (i = 0; i < ti_ui_->headerGridLayout->count(); i++) {
+ QRadioButton *rb = qobject_cast<QRadioButton *>(ti_ui_->headerGridLayout->itemAt(i)->widget());
if (rb) encap_buttons_.append(rb);
}
@@ -98,7 +98,7 @@ ImportTextDialog::ImportTextDialog(QWidget *parent) :
/* If it has got a name */
if ((name = wtap_encap_string(encap)))
{
- ui->encapComboBox->addItem(name, QVariant(encap));
+ ti_ui_->encapComboBox->addItem(name, QVariant(encap));
}
}
}
@@ -106,7 +106,7 @@ ImportTextDialog::ImportTextDialog(QWidget *parent) :
ImportTextDialog::~ImportTextDialog()
{
- delete ui;
+ delete ti_ui_;
}
QString &ImportTextDialog::capfileName() {
@@ -160,29 +160,29 @@ void ImportTextDialog::enableHeaderWidgets(bool enable_buttons) {
bool sctp_ppi = false;
if (enable_buttons) {
- if (ui->ethernetButton->isChecked()) {
+ if (ti_ui_->ethernetButton->isChecked()) {
ethertype = true;
- on_ethertypeLineEdit_textChanged(ui->ethertypeLabel->text());
- } else if (ui->ipv4Button->isChecked()) {
+ on_ethertypeLineEdit_textChanged(ti_ui_->ethertypeLineEdit->text());
+ } else if (ti_ui_->ipv4Button->isChecked()) {
ipv4_proto = true;
- on_protocolLineEdit_textChanged(ui->protocolLineEdit->text());
- } else if (ui->udpButton->isChecked() || ui->tcpButton->isChecked()) {
+ on_protocolLineEdit_textChanged(ti_ui_->protocolLineEdit->text());
+ } else if (ti_ui_->udpButton->isChecked() || ti_ui_->tcpButton->isChecked()) {
port = true;
- on_sourcePortLineEdit_textChanged(ui->sourcePortLineEdit->text());
- on_destinationPortLineEdit_textChanged(ui->destinationPortLineEdit->text());
- } else if (ui->sctpButton->isChecked()) {
+ on_sourcePortLineEdit_textChanged(ti_ui_->sourcePortLineEdit->text());
+ on_destinationPortLineEdit_textChanged(ti_ui_->destinationPortLineEdit->text());
+ } else if (ti_ui_->sctpButton->isChecked()) {
port = true;
sctp_tag = true;
- on_sourcePortLineEdit_textChanged(ui->sourcePortLineEdit->text());
- on_destinationPortLineEdit_textChanged(ui->destinationPortLineEdit->text());
- on_tagLineEdit_textChanged(ui->tagLineEdit->text());
+ on_sourcePortLineEdit_textChanged(ti_ui_->sourcePortLineEdit->text());
+ on_destinationPortLineEdit_textChanged(ti_ui_->destinationPortLineEdit->text());
+ on_tagLineEdit_textChanged(ti_ui_->tagLineEdit->text());
}
- if (ui->sctpDataButton->isChecked()) {
+ if (ti_ui_->sctpDataButton->isChecked()) {
port = true;
sctp_ppi = true;
- on_sourcePortLineEdit_textChanged(ui->sourcePortLineEdit->text());
- on_destinationPortLineEdit_textChanged(ui->destinationPortLineEdit->text());
- on_ppiLineEdit_textChanged(ui->ppiLineEdit->text());
+ on_sourcePortLineEdit_textChanged(ti_ui_->sourcePortLineEdit->text());
+ on_destinationPortLineEdit_textChanged(ti_ui_->destinationPortLineEdit->text());
+ on_ppiLineEdit_textChanged(ti_ui_->ppiLineEdit->text());
}
}
@@ -190,18 +190,18 @@ void ImportTextDialog::enableHeaderWidgets(bool enable_buttons) {
rb->setEnabled(enable_buttons);
}
- ui->ethertypeLabel->setEnabled(ethertype);
- ui->ethertypeLineEdit->setEnabled(ethertype);
- ui->protocolLabel->setEnabled(ipv4_proto);
- ui->protocolLineEdit->setEnabled(ipv4_proto);
- ui->sourcePortLabel->setEnabled(port);
- ui->sourcePortLineEdit->setEnabled(port);
- ui->destinationPortLabel->setEnabled(port);
- ui->destinationPortLineEdit->setEnabled(port);
- ui->tagLabel->setEnabled(sctp_tag);
- ui->tagLineEdit->setEnabled(sctp_tag);
- ui->ppiLabel->setEnabled(sctp_ppi);
- ui->ppiLineEdit->setEnabled(sctp_ppi);
+ ti_ui_->ethertypeLabel->setEnabled(ethertype);
+ ti_ui_->ethertypeLineEdit->setEnabled(ethertype);
+ ti_ui_->protocolLabel->setEnabled(ipv4_proto);
+ ti_ui_->protocolLineEdit->setEnabled(ipv4_proto);
+ ti_ui_->sourcePortLabel->setEnabled(port);
+ ti_ui_->sourcePortLineEdit->setEnabled(port);
+ ti_ui_->destinationPortLabel->setEnabled(port);
+ ti_ui_->destinationPortLineEdit->setEnabled(port);
+ ti_ui_->tagLabel->setEnabled(sctp_tag);
+ ti_ui_->tagLineEdit->setEnabled(sctp_tag);
+ ti_ui_->ppiLabel->setEnabled(sctp_ppi);
+ ti_ui_->ppiLineEdit->setEnabled(sctp_ppi);
}
void ImportTextDialog::exec() {
@@ -213,7 +213,7 @@ void ImportTextDialog::exec() {
return;
}
- import_info_.import_text_filename = ui->textFileLineEdit->text().toUtf8().data();
+ import_info_.import_text_filename = ti_ui_->textFileLineEdit->text().toUtf8().data();
import_info_.import_text_file = ws_fopen(import_info_.import_text_filename, "rb");
if (!import_info_.import_text_file) {
open_failure_alert_box(import_info_.import_text_filename, errno, FALSE);
@@ -222,28 +222,28 @@ void ImportTextDialog::exec() {
}
import_info_.offset_type =
- ui->hexOffsetButton->isChecked() ? OFFSET_HEX :
- ui->decimalOffsetButton->isChecked() ? OFFSET_DEC :
- ui->octalOffsetButton->isChecked() ? OFFSET_OCT :
+ ti_ui_->hexOffsetButton->isChecked() ? OFFSET_HEX :
+ ti_ui_->decimalOffsetButton->isChecked() ? OFFSET_DEC :
+ ti_ui_->octalOffsetButton->isChecked() ? OFFSET_OCT :
OFFSET_NONE;
- import_info_.date_timestamp = ui->dateTimeLineEdit->text().length() > 0;
- import_info_.date_timestamp_format = ui->dateTimeLineEdit->text().toUtf8().data();
+ import_info_.date_timestamp = ti_ui_->dateTimeLineEdit->text().length() > 0;
+ import_info_.date_timestamp_format = ti_ui_->dateTimeLineEdit->text().toUtf8().data();
- encap_val = ui->encapComboBox->itemData(ui->encapComboBox->currentIndex());
+ encap_val = ti_ui_->encapComboBox->itemData(ti_ui_->encapComboBox->currentIndex());
import_info_.dummy_header_type = HEADER_NONE;
- if (encap_val.isValid() && encap_val.toUInt() == WTAP_ENCAP_ETHERNET && !ui->noDummyButton->isChecked()) {
+ if (encap_val.isValid() && encap_val.toUInt() == WTAP_ENCAP_ETHERNET && !ti_ui_->noDummyButton->isChecked()) {
// Inputs were validated in the on_xxx_textChanged slots.
- if (ui->ethernetButton->isChecked()) {
+ if (ti_ui_->ethernetButton->isChecked()) {
import_info_.dummy_header_type = HEADER_ETH;
- } else if (ui->ipv4Button->isChecked()) {
+ } else if (ti_ui_->ipv4Button->isChecked()) {
import_info_.dummy_header_type = HEADER_IPV4;
- } else if(ui->udpButton->isChecked()) {
+ } else if(ti_ui_->udpButton->isChecked()) {
import_info_.dummy_header_type = HEADER_UDP;
- } else if(ui->tcpButton->isChecked()) {
+ } else if(ti_ui_->tcpButton->isChecked()) {
import_info_.dummy_header_type = HEADER_TCP;
- } else if(ui->sctpButton->isChecked()) {
+ } else if(ti_ui_->sctpButton->isChecked()) {
import_info_.dummy_header_type = HEADER_SCTP;
- } else if(ui->sctpDataButton->isChecked()) {
+ } else if(ti_ui_->sctpDataButton->isChecked()) {
import_info_.dummy_header_type = HEADER_SCTP_DATA;
}
}
@@ -280,7 +280,7 @@ void ImportTextDialog::on_textFileBrowseButton_clicked()
}
QString file_name = QFileDialog::getOpenFileName(this, tr("Wireshark: Import text file"), open_dir);
- ui->textFileLineEdit->setText(file_name);
+ ti_ui_->textFileLineEdit->setText(file_name);
}
void ImportTextDialog::on_textFileLineEdit_textChanged(const QString &file_name)
@@ -298,7 +298,7 @@ void ImportTextDialog::on_textFileLineEdit_textChanged(const QString &file_name)
void ImportTextDialog::on_encapComboBox_currentIndexChanged(int index)
{
- QVariant val = ui->encapComboBox->itemData(index);
+ QVariant val = ti_ui_->encapComboBox->itemData(index);
bool enabled = false;
if (val != QVariant::Invalid) {
@@ -319,10 +319,10 @@ void ImportTextDialog::on_dateTimeLineEdit_textChanged(const QString &time_forma
time(&cur_time);
cur_tm = localtime(&cur_time);
- strftime(time_str, 100, ui->dateTimeLineEdit->text().toUtf8().constData(), cur_tm);
- ui->timestampExampleLabel->setText(QString(tr("Example: %1")).arg(time_str));
+ strftime(time_str, 100, ti_ui_->dateTimeLineEdit->text().toUtf8().constData(), cur_tm);
+ ti_ui_->timestampExampleLabel->setText(QString(tr("Example: %1")).arg(time_str));
} else {
- ui->timestampExampleLabel->setText(tr("<i>(No format will be applied)</i>"));
+ ti_ui_->timestampExampleLabel->setText(tr("<i>(No format will be applied)</i>"));
}
}
@@ -361,88 +361,66 @@ void ImportTextDialog::on_sctpDataButton_toggled(bool checked)
on_noDummyButton_toggled(checked);
}
-void ImportTextDialog::on_ethertypeLineEdit_textChanged(const QString &ethertype_str)
-{
+void ImportTextDialog::check_line_edit(SyntaxLineEdit *le, const QString &num_str, int base, guint max_val, bool is_short, guint *val_ptr) {
bool conv_ok;
+ SyntaxLineEdit::SyntaxState syntax_state = SyntaxLineEdit::Empty;
+ bool ok_enabled = true;
- import_info_.pid = ethertype_str.toUShort(&conv_ok, 16);
- if (conv_ok && import_info_.pid <= 0xffff) {
- ok_button_->setEnabled(true);
+ if (!le || !val_ptr)
+ return;
+
+ if (num_str.length() < 1) {
+ *val_ptr = 0;
} else {
- ok_button_->setEnabled(false);
+ if (is_short) {
+ *val_ptr = num_str.toUShort(&conv_ok, base);
+ } else {
+ *val_ptr = num_str.toULong(&conv_ok, base);
+ }
+ if (conv_ok && *val_ptr <= max_val) {
+ syntax_state = SyntaxLineEdit::Valid;
+ } else {
+ syntax_state = SyntaxLineEdit::Invalid;
+ ok_enabled = false;
+ }
}
+ le->setSyntaxState(syntax_state);
+ ok_button_->setEnabled(ok_enabled);
}
-void ImportTextDialog::on_protocolLineEdit_textChanged(const QString &protocol_str)
+void ImportTextDialog::on_ethertypeLineEdit_textChanged(const QString &ethertype_str)
{
- bool conv_ok;
+ check_line_edit(ti_ui_->ethertypeLineEdit, ethertype_str, 16, 0xffff, true, &import_info_.pid);
+}
- import_info_.protocol = protocol_str.toUShort(&conv_ok, 10);
- if (conv_ok && import_info_.protocol <= 0xff) {
- ok_button_->setEnabled(true);
- } else {
- ok_button_->setEnabled(false);
- }
+void ImportTextDialog::on_protocolLineEdit_textChanged(const QString &protocol_str)
+{
+ check_line_edit(ti_ui_->protocolLineEdit, protocol_str, 10, 0xff, true, &import_info_.protocol);
}
void ImportTextDialog::on_sourcePortLineEdit_textChanged(const QString &source_port_str)
{
- bool conv_ok;
-
- import_info_.src_port = source_port_str.toUShort(&conv_ok, 10);
- if (conv_ok && import_info_.src_port <= 0xffff) {
- ok_button_->setEnabled(true);
- } else {
- ok_button_->setEnabled(false);
- }
+ check_line_edit(ti_ui_->sourcePortLineEdit, source_port_str, 10, 0xffff, true, &import_info_.src_port);
}
void ImportTextDialog::on_destinationPortLineEdit_textChanged(const QString &destination_port_str)
{
- bool conv_ok;
-
- import_info_.dst_port = destination_port_str.toUShort(&conv_ok, 10);
- if (conv_ok && import_info_.dst_port <= 0xffff) {
- ok_button_->setEnabled(true);
- } else {
- ok_button_->setEnabled(false);
- }
+ check_line_edit(ti_ui_->destinationPortLineEdit, destination_port_str, 10, 0xffff, true, &import_info_.dst_port);
}
void ImportTextDialog::on_tagLineEdit_textChanged(const QString &tag_str)
{
- bool conv_ok;
-
- import_info_.tag = tag_str.toULong(&conv_ok, 10);
- if (conv_ok && import_info_.tag <= 0xffffffff) {
- ok_button_->setEnabled(true);
- } else {
- ok_button_->setEnabled(false);
- }
+ check_line_edit(ti_ui_->tagLineEdit, tag_str, 10, 0xffffffff, false, &import_info_.tag);
}
void ImportTextDialog::on_ppiLineEdit_textChanged(const QString &ppi_str)
{
- bool conv_ok;
-
- import_info_.ppi = ppi_str.toULong(&conv_ok, 10);
- if (conv_ok && import_info_.ppi <= 0xffffffff) {
- ok_button_->setEnabled(true);
- } else {
- ok_button_->setEnabled(false);
- }
+ check_line_edit(ti_ui_->ppiLineEdit, ppi_str, 10, 0xffffffff, false, &import_info_.ppi);
}
void ImportTextDialog::on_maxLengthLineEdit_textChanged(const QString &max_frame_len_str)
{
- bool conv_ok;
-
- import_info_.max_frame_length = max_frame_len_str.toUShort(&conv_ok, 10);
- if (conv_ok && import_info_.max_frame_length <= IMPORT_MAX_PACKET) {
- ok_button_->setEnabled(true);
- } else {
- ok_button_->setEnabled(false);
- }
+ check_line_edit(ti_ui_->maxLengthLineEdit, max_frame_len_str, 10, IMPORT_MAX_PACKET, true, &import_info_.max_frame_length);
}
void ImportTextDialog::on_buttonBox_helpRequested()
diff --git a/ui/qt/import_text_dialog.h b/ui/qt/import_text_dialog.h
index a7869ee444..d9f41167e3 100644
--- a/ui/qt/import_text_dialog.h
+++ b/ui/qt/import_text_dialog.h
@@ -32,6 +32,8 @@
#include "ui/text_import.h"
+#include <syntax_line_edit.h>
+
#include <QDialog>
#include <QPushButton>
#include <QRadioButton>
@@ -52,8 +54,9 @@ public:
private:
void convertTextFile();
void enableHeaderWidgets(bool enable_buttons = true);
+ void check_line_edit(SyntaxLineEdit *le, const QString &num_str, int base, guint max_val, bool is_short, guint *val_ptr);
- Ui::ImportTextDialog *ui;
+ Ui::ImportTextDialog *ti_ui_;
QPushButton *ok_button_;
QList<QRadioButton *>encap_buttons_;
diff --git a/ui/qt/import_text_dialog.ui b/ui/qt/import_text_dialog.ui
index f65bf06531..823b522600 100644
--- a/ui/qt/import_text_dialog.ui
+++ b/ui/qt/import_text_dialog.ui
@@ -186,13 +186,10 @@
</widget>
</item>
<item>
- <widget class="QLineEdit" name="maxLengthLineEdit">
+ <widget class="SyntaxLineEdit" name="maxLengthLineEdit">
<property name="toolTip">
<string>The maximum size of the frames to write to the import capture file (max 64000)</string>
</property>
- <property name="inputMask">
- <string>90000; </string>
- </property>
</widget>
</item>
</layout>
@@ -250,21 +247,21 @@
<item row="1" column="0" colspan="2">
<layout class="QGridLayout" name="headerGridLayout">
<item row="3" column="2">
- <widget class="QLineEdit" name="sourcePortLineEdit">
+ <widget class="SyntaxLineEdit" name="sourcePortLineEdit">
<property name="toolTip">
<string>The UDP, TCP or SCTP source port for each frame</string>
</property>
</widget>
</item>
<item row="6" column="2">
- <widget class="QLineEdit" name="ppiLineEdit">
+ <widget class="SyntaxLineEdit" name="ppiLineEdit">
<property name="toolTip">
<string>The SCTP DATA payload protocol identifier for each frame</string>
</property>
</widget>
</item>
<item row="4" column="2">
- <widget class="QLineEdit" name="destinationPortLineEdit">
+ <widget class="SyntaxLineEdit" name="destinationPortLineEdit">
<property name="toolTip">
<string>The UDP, TCP or SCTP destination port for each frame</string>
</property>
@@ -355,7 +352,7 @@
</widget>
</item>
<item row="1" column="2">
- <widget class="QLineEdit" name="ethertypeLineEdit">
+ <widget class="SyntaxLineEdit" name="ethertypeLineEdit">
<property name="toolTip">
<string>The Ethertype value of each frame</string>
</property>
@@ -375,7 +372,7 @@
</widget>
</item>
<item row="5" column="2">
- <widget class="QLineEdit" name="tagLineEdit">
+ <widget class="SyntaxLineEdit" name="tagLineEdit">
<property name="toolTip">
<string>The SCTP verification tag for each frame</string>
</property>
@@ -396,7 +393,7 @@
</widget>
</item>
<item row="2" column="2">
- <widget class="QLineEdit" name="protocolLineEdit">
+ <widget class="SyntaxLineEdit" name="protocolLineEdit">
<property name="toolTip">
<string>The IPv4 protocol ID for each frame</string>
</property>
@@ -429,6 +426,13 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>SyntaxLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>syntax_line_edit.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections>
<connection>
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index 2879ab47d8..19f526a007 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -119,7 +119,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
// "}"
)
.arg(tango_aluminium_6, 6, 16, QChar('0')) // Text color
- .arg(tango_sky_blue_2, 6, 16, QChar('0')) // Selected background
+ .arg(tango_sky_blue_4, 6, 16, QChar('0')) // Selected background
.arg(tango_aluminium_2, 6, 16, QChar('0')) // Hover background
.arg(tango_aluminium_6, 6, 16, QChar('0')) // Hover foreground
);
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 8f5dbd5e09..c639042c3a 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -363,7 +363,7 @@ void MainWindow::mergeCaptureFile()
}
for (;;) {
- CaptureFileDialog merge_dlg(this, display_filter);
+ CaptureFileDialog merge_dlg(this, cap_file_, display_filter);
int file_type;
cf_status_t merge_status;
char *in_filenames[2];
@@ -593,10 +593,6 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
int file_type;
gboolean compressed;
cf_write_status_t status;
- QString file_name_lower;
- QString file_suffix;
- GSList *extensions_list, *extension;
- gboolean add_extension;
gchar *dirname;
gboolean discard_comments = FALSE;
@@ -605,7 +601,7 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
}
for (;;) {
- CaptureFileDialog save_as_dlg(this);
+ CaptureFileDialog save_as_dlg(this, cf);
switch (prefs.gui_fileopen_style) {
@@ -630,7 +626,7 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
/* If the file has comments, does the format the user selected
support them? If not, ask the user whether they want to
discard the comments or choose a different format. */
- switch(save_as_dlg.saveAs(cf, file_name, must_support_comments)) {
+ switch(save_as_dlg.saveAs(file_name, must_support_comments)) {
case SAVE:
/* The file can be saved in the specified format as is;
@@ -665,53 +661,146 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
file_type = save_as_dlg.selectedFileType();
compressed = save_as_dlg.isCompressed();
+ fileAddExtension(file_name, file_type, compressed);
+
+//#ifndef _WIN32
+// /* If the file exists and it's user-immutable or not writable,
+// ask the user whether they want to override that. */
+// if (!file_target_unwritable_ui(top_level, file_name.toUtf8().constData())) {
+// /* They don't. Let them try another file name or cancel. */
+// continue;
+// }
+//#endif
+
+ /* Attempt to save the file */
+ status = cf_save_packets(cf, file_name.toUtf8().constData(), file_type, compressed,
+ discard_comments, stay_closed);
+ switch (status) {
+
+ case CF_WRITE_OK:
+ /* The save succeeded; we're done. */
+ /* Save the directory name for future file dialogs. */
+ dirname = get_dirname(file_name.toUtf8().data()); /* Overwrites cf_name */
+ set_last_open_dir(dirname);
+ /* If we discarded comments, redraw the packet list to reflect
+ any packets that no longer have comments. */
+ if (discard_comments)
+ packet_list_queue_draw();
+ return;
+
+ case CF_WRITE_ERROR:
+ /* The save failed; let the user try again. */
+ continue;
+
+ case CF_WRITE_ABORTED:
+ /* The user aborted the save; just return. */
+ return;
+ }
+ }
+ return;
+}
+
+void MainWindow::exportSelectedPackets() {
+ QString file_name = "";
+ int file_type;
+ gboolean compressed;
+ packet_range_t range;
+ cf_write_status_t status;
+ gchar *dirname;
+ gboolean discard_comments = FALSE;
+
+ if (!cap_file_)
+ return;
+
+ /* init the packet range */
+ packet_range_init(&range, cap_file_);
+ range.process_filtered = TRUE;
+ range.include_dependents = TRUE;
+
+ for (;;) {
+ CaptureFileDialog esp_dlg(this, cap_file_);
+
+ switch (prefs.gui_fileopen_style) {
+
+ case FO_STYLE_LAST_OPENED:
+ /* The user has specified that we should start out in the last directory
+ we looked in. If we've already opened a file, use its containing
+ directory, if we could determine it, as the directory, otherwise
+ use the "last opened" directory saved in the preferences file if
+ there was one. */
+ /* This is now the default behaviour in file_selection_new() */
+ break;
+
+ case FO_STYLE_SPECIFIED:
+ /* The user has specified that we should always start out in a
+ specified directory; if they've specified that directory,
+ start out by showing the files in that dir. */
+ if (prefs.gui_fileopen_dir[0] != '\0')
+ esp_dlg.setDirectory(prefs.gui_fileopen_dir);
+ break;
+ }
+
+ /* If the file has comments, does the format the user selected
+ support them? If not, ask the user whether they want to
+ discard the comments or choose a different format. */
+ switch(esp_dlg.exportSelectedPackets(file_name, &range)) {
+
+ case SAVE:
+ /* The file can be saved in the specified format as is;
+ just drive on and save in the format they selected. */
+ discard_comments = FALSE;
+ break;
+
+ case SAVE_WITHOUT_COMMENTS:
+ /* The file can't be saved in the specified format as is,
+ but it can be saved without the comments, and the user
+ said "OK, discard the comments", so save it in the
+ format they specified without the comments. */
+ discard_comments = TRUE;
+ break;
+
+ case SAVE_IN_ANOTHER_FORMAT:
+ /* There are file formats in which we can save this that
+ support comments, and the user said not to delete the
+ comments. The combo box of file formats has had the
+ formats that don't support comments trimmed from it,
+ so run the dialog again, to let the user decide
+ whether to save in one of those formats or give up. */
+ discard_comments = FALSE;
+ continue;
+
+ case CANCELLED:
+ /* The user said "forget it". Just get rid of the dialog box
+ and return. */
+ return;
+ }
+
/*
- * Append the default file extension if there's none given by
- * the user or if they gave one that's not one of the valid
- * extensions for the file type.
+ * Check that we're not going to save on top of the current
+ * capture file.
+ * We do it here so we catch all cases ...
+ * Unfortunately, the file requester gives us an absolute file
+ * name and the read file name may be relative (if supplied on
+ * the command line). From Joerg Mayer.
*/
- file_name_lower = file_name.toLower();
- extensions_list = wtap_get_file_extensions_list(file_type, FALSE);
- if (extensions_list != NULL) {
- /* We have one or more extensions for this file type.
- Start out assuming we need to add the default one. */
- add_extension = TRUE;
-
- /* OK, see if the file has one of those extensions. */
- for (extension = extensions_list; extension != NULL;
- extension = g_slist_next(extension)) {
- file_suffix += tr(".") + (char *)extension->data;
- if (file_name_lower.endsWith(file_suffix)) {
- /*
- * The file name has one of the extensions for
- * this file type.
- */
- add_extension = FALSE;
- break;
- }
- file_suffix += ".gz";
- if (file_name_lower.endsWith(file_suffix)) {
- /*
- * The file name has one of the extensions for
- * this file type.
- */
- add_extension = FALSE;
- break;
- }
- }
- } else {
- /* We have no extensions for this file type. Don't add one. */
- add_extension = FALSE;
- }
- if (add_extension) {
- if (wtap_default_file_extension(file_type) != NULL) {
- file_name += tr(".") + wtap_default_file_extension(file_type);
- if (compressed) {
- file_name += ".gz";
- }
- }
+ if (files_identical(cap_file_->filename, file_name.toUtf8().constData())) {
+ QMessageBox msg_box;
+ gchar *display_basename = g_filename_display_basename(file_name.toUtf8().constData());
+
+ msg_box.setIcon(QMessageBox::Critical);
+ msg_box.setText(QString(tr("Unable to export to \"%1\".").arg(display_basename)));
+ msg_box.setInformativeText(tr("You cannot export packets to the current capture file."));
+ msg_box.setStandardButtons(QMessageBox::Ok);
+ msg_box.setDefaultButton(QMessageBox::Ok);
+ msg_box.exec();
+ g_free(display_basename);
+ continue;
}
+ file_type = esp_dlg.selectedFileType();
+ compressed = esp_dlg.isCompressed();
+ fileAddExtension(file_name, file_type, compressed);
+
//#ifndef _WIN32
// /* If the file exists and it's user-immutable or not writable,
// ask the user whether they want to override that. */
@@ -722,8 +811,7 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
//#endif
/* Attempt to save the file */
- status = cf_save_packets(cf, file_name.toUtf8().constData(), file_type, compressed,
- discard_comments, stay_closed);
+ status = cf_export_specified_packets(cap_file_, file_name.toUtf8().constData(), &range, file_type, compressed);
switch (status) {
case CF_WRITE_OK:
@@ -749,6 +837,60 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments,
return;
}
+void MainWindow::fileAddExtension(QString &file_name, int file_type, bool compressed) {
+ QString file_name_lower;
+ QString file_suffix;
+ GSList *extensions_list, *extension;
+ gboolean add_extension;
+
+ /*
+ * Append the default file extension if there's none given by
+ * the user or if they gave one that's not one of the valid
+ * extensions for the file type.
+ */
+ file_name_lower = file_name.toLower();
+ extensions_list = wtap_get_file_extensions_list(file_type, FALSE);
+ if (extensions_list != NULL) {
+ /* We have one or more extensions for this file type.
+ Start out assuming we need to add the default one. */
+ add_extension = TRUE;
+
+ /* OK, see if the file has one of those extensions. */
+ for (extension = extensions_list; extension != NULL;
+ extension = g_slist_next(extension)) {
+ file_suffix += tr(".") + (char *)extension->data;
+ if (file_name_lower.endsWith(file_suffix)) {
+ /*
+ * The file name has one of the extensions for
+ * this file type.
+ */
+ add_extension = FALSE;
+ break;
+ }
+ file_suffix += ".gz";
+ if (file_name_lower.endsWith(file_suffix)) {
+ /*
+ * The file name has one of the extensions for
+ * this file type.
+ */
+ add_extension = FALSE;
+ break;
+ }
+ }
+ } else {
+ /* We have no extensions for this file type. Don't add one. */
+ add_extension = FALSE;
+ }
+ if (add_extension) {
+ if (wtap_default_file_extension(file_type) != NULL) {
+ file_name += tr(".") + wtap_default_file_extension(file_type);
+ if (compressed) {
+ file_name += ".gz";
+ }
+ }
+ }
+}
+
bool MainWindow::testCaptureFileClose(bool from_quit, QString &before_what) {
bool capture_in_progress = FALSE;
@@ -955,8 +1097,7 @@ void MainWindow::setMenusForCaptureFile(bool force_disable)
* "Export Specified Packets..." should be available only if
* we can write the file out in at least one format.
*/
-// set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/ExportSpecifiedPackets",
-// cf_can_write_with_wiretap(cf));
+ main_ui_->actionFileExportPackets->setEnabled(cf_can_write_with_wiretap(cap_file_));
main_ui_->actionFileExportPacketDissections->setEnabled(true);
main_ui_->actionFileExportPacketBytes->setEnabled(true);
main_ui_->actionFileExportSSLSessionKeys->setEnabled(true);
@@ -978,6 +1119,7 @@ void MainWindow::setMenusForCaptureInProgress(bool capture_in_progress) {
main_ui_->menuFileSet->setEnabled(!capture_in_progress);
main_ui_->actionFileQuit->setEnabled(true);
+ qDebug() << "FIX: packet list heading menu sensitivity";
// set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortAscending",
// !capture_in_progress);
// set_menu_sensitivity(ui_manager_packet_list_heading, "/PacketListHeadingPopup/SortDescending",
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index a7afdfa769..7f69ed98e6 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -100,6 +100,9 @@ private:
void importCaptureFile();
void saveCaptureFile(capture_file *cf, bool stay_closed);
void saveAsCaptureFile(capture_file *cf, bool must_support_comments, bool stay_closed);
+ void exportSelectedPackets();
+
+ void fileAddExtension(QString &file_name, int file_type, bool compressed);
bool testCaptureFileClose(bool from_quit = false, QString& before_what = *new QString());
void captureStop();
@@ -155,6 +158,7 @@ private slots:
void on_actionFileSetListFiles_triggered();
void on_actionFileSetNextFile_triggered();
void on_actionFileSetPreviousFile_triggered();
+ void on_actionFileExportPackets_triggered();
void on_actionGoGoToPacket_triggered();
void resetPreviousFocus();
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 528905db52..f6e00f0ad3 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -78,7 +78,7 @@ void MainWindow::openCaptureFile(QString &cf_path)
for (;;) {
if (cf_path.isEmpty()) {
- CaptureFileDialog open_dlg(this, display_filter);
+ CaptureFileDialog open_dlg(this, cap_file_, display_filter);
switch (prefs.gui_fileopen_style) {
@@ -537,6 +537,11 @@ void MainWindow::on_actionFileSaveAs_triggered()
saveAsCaptureFile(cap_file_, FALSE, TRUE);
}
+void MainWindow::on_actionFileExportPackets_triggered()
+{
+ exportSelectedPackets();
+}
+
void MainWindow::on_actionFileSetListFiles_triggered()
{
file_set_dialog_.exec();
diff --git a/ui/qt/packet_range_group_box.cpp b/ui/qt/packet_range_group_box.cpp
new file mode 100644
index 0000000000..9d8198eaee
--- /dev/null
+++ b/ui/qt/packet_range_group_box.cpp
@@ -0,0 +1,331 @@
+/* packet_range_group_box.cpp
+ *
+ * $Id: capture_file_dialog.h 45164 2012-09-27 02:43:09Z eapache $
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "packet_range_group_box.h"
+#include "ui_packet_range_group_box.h"
+
+#include <QDebug>
+PacketRangeGroupBox::PacketRangeGroupBox(QWidget *parent) :
+ QGroupBox(parent),
+ pr_ui_(new Ui::PacketRangeGroupBox),
+ range_(NULL),
+ syntax_state_(SyntaxLineEdit::Empty)
+{
+ pr_ui_->setupUi(this);
+
+ pr_ui_->displayedButton->setChecked(true);
+ pr_ui_->allButton->setChecked(true);
+}
+
+PacketRangeGroupBox::~PacketRangeGroupBox()
+{
+ delete pr_ui_;
+}
+
+void PacketRangeGroupBox::initRange(packet_range_t *range) {
+ if (!range) return;
+
+ range_ = range;
+
+ if (range_->process_filtered) {
+ pr_ui_->displayedButton->setChecked(true);
+ } else {
+ pr_ui_->capturedButton->setChecked(true);
+ }
+
+ if (range_->user_range) {
+ pr_ui_->rangeLineEdit->setText(range_convert_range(range_->user_range));
+ }
+ updateCounts();
+}
+
+bool PacketRangeGroupBox::isValid() {
+ if (pr_ui_->rangeButton->isChecked() && syntax_state_ != SyntaxLineEdit::Empty) {
+ return false;
+ }
+ return true;
+}
+
+void PacketRangeGroupBox::updateCounts() {
+ SyntaxLineEdit::SyntaxState orig_ss = syntax_state_;
+ bool displayed_checked = pr_ui_->displayedButton->isChecked();
+ int selected_num;
+ bool can_select;
+ bool selected_packets;
+ int ignored_cnt = 0, displayed_ignored_cnt = 0;
+ int label_count;
+
+ if (!range_ || !range_->cf) return;
+
+ if (range_->displayed_cnt != 0) {
+ pr_ui_->displayedButton->setEnabled(true);
+ } else {
+ displayed_checked = false;
+ pr_ui_->capturedButton->setChecked(true);
+ pr_ui_->displayedButton->setEnabled(false);
+ }
+
+ // All / Captured
+ pr_ui_->allCapturedLabel->setEnabled(!displayed_checked);
+ label_count = range_->cf->count;
+ if (range_->remove_ignored) {
+ label_count -= range_->ignored_cnt;
+ }
+ pr_ui_->allCapturedLabel->setText(QString("%1").arg(label_count));
+
+ // All / Displayed
+ pr_ui_->allDisplayedLabel->setEnabled(displayed_checked);
+ if (range_->include_dependents) {
+ label_count = range_->displayed_plus_dependents_cnt;
+ } else {
+ label_count = range_->displayed_cnt;
+ }
+ if (range_->remove_ignored) {
+ label_count -= range_->displayed_ignored_cnt;
+ }
+ pr_ui_->allDisplayedLabel->setText(QString("%1").arg(label_count));
+
+ // Selected / Captured + Displayed
+ selected_num = (range_->cf->current_frame) ? range_->cf->current_frame->num : 0;
+ can_select = (selected_num != 0);
+ if (can_select) {
+ pr_ui_->selectedButton->setEnabled(true);
+ pr_ui_->selectedCapturedLabel->setEnabled(!displayed_checked);
+ pr_ui_->selectedDisplayedLabel->setEnabled(displayed_checked);
+ } else {
+ if (range_->process == range_process_selected) {
+ pr_ui_->allButton->setChecked(true);
+ }
+ pr_ui_->selectedButton->setEnabled(false);
+ pr_ui_->selectedCapturedLabel->setEnabled(false);
+ pr_ui_->selectedDisplayedLabel->setEnabled(false);
+ }
+ if ((range_->remove_ignored && can_select && range_->cf->current_frame->flags.ignored) || selected_num < 1) {
+ pr_ui_->selectedCapturedLabel->setText("0");
+ pr_ui_->selectedDisplayedLabel->setText("0");
+ } else {
+ pr_ui_->selectedCapturedLabel->setText("1");
+ pr_ui_->selectedDisplayedLabel->setText("1");
+ }
+
+ // Marked / Captured + Displayed
+ if (displayed_checked) {
+ selected_packets = (range_->displayed_marked_cnt != 0);
+ } else {
+ selected_packets = (range_->cf->marked_count > 0);
+ }
+ if (selected_packets) {
+ pr_ui_->markedButton->setEnabled(true);
+ pr_ui_->markedCapturedLabel->setEnabled(!displayed_checked);
+ pr_ui_->markedDisplayedLabel->setEnabled(displayed_checked);
+ } else {
+ if (range_->process == range_process_marked) {
+ pr_ui_->allButton->setChecked(true);
+ }
+ pr_ui_->markedButton->setEnabled(false);
+ pr_ui_->markedCapturedLabel->setEnabled(false);
+ pr_ui_->markedDisplayedLabel->setEnabled(false);
+ }
+ label_count = range_->cf->marked_count;
+ if (range_->remove_ignored) {
+ label_count -= range_->ignored_marked_cnt;
+ }
+ pr_ui_->markedCapturedLabel->setText(QString("%1").arg(label_count));
+ label_count = range_->cf->marked_count;
+ if (range_->remove_ignored) {
+ label_count -= range_->displayed_ignored_marked_cnt;
+ }
+ pr_ui_->markedDisplayedLabel->setText(QString("%1").arg(label_count));
+
+ // First to last marked / Captured + Displayed
+ if (displayed_checked) {
+ selected_packets = (range_->displayed_mark_range_cnt != 0);
+ } else {
+ selected_packets = (range_->mark_range_cnt != 0);
+ }
+ if (selected_packets) {
+ pr_ui_->ftlMarkedButton->setEnabled(true);
+ pr_ui_->ftlCapturedLabel->setEnabled(!displayed_checked);
+ pr_ui_->ftlDisplayedLabel->setEnabled(displayed_checked);
+ } else {
+ if (range_->process == range_process_marked_range) {
+ pr_ui_->allButton->setChecked(true);
+ }
+ pr_ui_->ftlMarkedButton->setEnabled(false);
+ pr_ui_->ftlCapturedLabel->setEnabled(false);
+ pr_ui_->ftlDisplayedLabel->setEnabled(false);
+ }
+ label_count = range_->mark_range_cnt;
+ if (range_->remove_ignored) {
+ label_count -= range_->ignored_mark_range_cnt;
+ }
+ pr_ui_->ftlCapturedLabel->setText(QString("%1").arg(label_count));
+ label_count = range_->displayed_mark_range_cnt;
+ if (range_->remove_ignored) {
+ label_count -= range_->displayed_ignored_mark_range_cnt;
+ }
+ pr_ui_->ftlDisplayedLabel->setText(QString("%1").arg(label_count));
+
+ // User specified / Captured + Displayed
+
+ pr_ui_->rangeButton->setEnabled(true);
+ pr_ui_->rangeCapturedLabel->setEnabled(!displayed_checked);
+ pr_ui_->rangeDisplayedLabel->setEnabled(displayed_checked);
+
+ packet_range_convert_str(range_, pr_ui_->rangeLineEdit->text().toUtf8().constData());
+
+ switch (packet_range_check(range_)) {
+
+ case CVT_NO_ERROR:
+ label_count = range_->user_range_cnt;
+ if (range_->remove_ignored) {
+ label_count -= range_->ignored_user_range_cnt;
+ }
+ pr_ui_->rangeCapturedLabel->setText(QString("%1").arg(label_count));
+ label_count = range_->displayed_user_range_cnt;
+ if (range_->remove_ignored) {
+ label_count -= range_->displayed_ignored_user_range_cnt;
+ }
+ pr_ui_->rangeDisplayedLabel->setText(QString("%1").arg(label_count));
+ syntax_state_ = SyntaxLineEdit::Empty;
+ break;
+
+ case CVT_SYNTAX_ERROR:
+ pr_ui_->rangeCapturedLabel->setText("<small><i>Bad range</i></small>");
+ pr_ui_->rangeDisplayedLabel->setText("-");
+ syntax_state_ = SyntaxLineEdit::Invalid;
+ break;
+
+ case CVT_NUMBER_TOO_BIG:
+ pr_ui_->rangeCapturedLabel->setText("<small><i>Number too large</i></small>");
+ pr_ui_->rangeDisplayedLabel->setText("-");
+ syntax_state_ = SyntaxLineEdit::Invalid;
+ break;
+
+ default:
+ g_assert_not_reached();
+ return;
+ }
+
+ // Ignored
+ switch(range_->process) {
+ case(range_process_all):
+ ignored_cnt = range_->ignored_cnt;
+ displayed_ignored_cnt = range_->displayed_ignored_cnt;
+ break;
+ case(range_process_selected):
+ ignored_cnt = (can_select && range_->cf->current_frame->flags.ignored) ? 1 : 0;
+ displayed_ignored_cnt = ignored_cnt;
+ break;
+ case(range_process_marked):
+ ignored_cnt = range_->ignored_marked_cnt;
+ displayed_ignored_cnt = range_->displayed_ignored_marked_cnt;
+ break;
+ case(range_process_marked_range):
+ ignored_cnt = range_->ignored_mark_range_cnt;
+ displayed_ignored_cnt = range_->displayed_ignored_mark_range_cnt;
+ break;
+ case(range_process_user_range):
+ ignored_cnt = range_->ignored_user_range_cnt;
+ displayed_ignored_cnt = range_->displayed_ignored_user_range_cnt;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ if (displayed_checked)
+ selected_packets = (displayed_ignored_cnt != 0);
+ else
+ selected_packets = (ignored_cnt != 0);
+
+ if (selected_packets) {
+ pr_ui_->ignoredCheckBox->setEnabled(true);
+ pr_ui_->ignoredCapturedLabel->setEnabled(!displayed_checked);
+ pr_ui_->ignoredDisplayedLabel->setEnabled(displayed_checked);
+ } else {
+ pr_ui_->ignoredCheckBox->setEnabled(false);
+ pr_ui_->ignoredCapturedLabel->setEnabled(false);
+ pr_ui_->ignoredDisplayedLabel->setEnabled(false);
+ }
+ pr_ui_->ignoredCapturedLabel->setText(QString("%1").arg(ignored_cnt));
+ pr_ui_->ignoredDisplayedLabel->setText(QString("%1").arg(displayed_ignored_cnt));
+
+ if (orig_ss != syntax_state_) {
+ pr_ui_->rangeLineEdit->setSyntaxState(syntax_state_);
+ emit validityChanged(isValid());
+ }
+}
+
+// Slots
+
+void PacketRangeGroupBox::on_rangeLineEdit_textChanged(const QString &range_str)
+{
+ Q_UNUSED(range_str)
+ if (!pr_ui_->rangeButton->isChecked()) {
+ pr_ui_->rangeButton->setChecked(true);
+ } else {
+ updateCounts();
+ }
+}
+
+void PacketRangeGroupBox::processButtonToggled(bool checked, packet_range_e process) {
+ if (checked && range_) {
+ range_->process = process;
+ }
+ updateCounts();
+}
+
+void PacketRangeGroupBox::on_allButton_toggled(bool checked)
+{
+ processButtonToggled(checked, range_process_all);
+}
+
+void PacketRangeGroupBox::on_selectedButton_toggled(bool checked)
+{
+ processButtonToggled(checked, range_process_selected);
+}
+
+void PacketRangeGroupBox::on_markedButton_toggled(bool checked)
+{
+ processButtonToggled(checked, range_process_marked);
+}
+
+void PacketRangeGroupBox::on_ftlMarkedButton_toggled(bool checked)
+{
+ processButtonToggled(checked, range_process_marked_range);
+}
+
+void PacketRangeGroupBox::on_rangeButton_toggled(bool checked)
+{
+ processButtonToggled(checked, range_process_user_range);
+}
+
+void PacketRangeGroupBox::on_capturedButton_toggled(bool checked)
+{
+ if (checked) updateCounts();
+}
+
+void PacketRangeGroupBox::on_displayedButton_toggled(bool checked)
+{
+ if (checked) updateCounts();
+}
diff --git a/ui/qt/packet_range_group_box.h b/ui/qt/packet_range_group_box.h
new file mode 100644
index 0000000000..863ccf6053
--- /dev/null
+++ b/ui/qt/packet_range_group_box.h
@@ -0,0 +1,78 @@
+/* packet_range_group_box.h
+ *
+ * $Id: capture_file_dialog.h 45164 2012-09-27 02:43:09Z eapache $
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PACKET_RANGE_GROUP_BOX_H
+#define PACKET_RANGE_GROUP_BOX_H
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "packet-range.h"
+
+#include "syntax_line_edit.h"
+#include <QGroupBox>
+
+namespace Ui {
+class PacketRangeGroupBox;
+}
+
+class PacketRangeGroupBox : public QGroupBox
+{
+ Q_OBJECT
+
+public:
+ explicit PacketRangeGroupBox(QWidget *parent = 0);
+ ~PacketRangeGroupBox();
+ void initRange(packet_range_t *range);
+ bool isValid();
+
+signals:
+ void validityChanged(bool is_valid);
+
+private:
+ void updateCounts();
+ void processButtonToggled(bool checked, packet_range_e process);
+
+ Ui::PacketRangeGroupBox *pr_ui_;
+ packet_range_t *range_;
+ SyntaxLineEdit::SyntaxState syntax_state_;
+
+private slots:
+ void on_rangeLineEdit_textChanged(const QString &range_str);
+
+ void on_allButton_toggled(bool checked);
+
+ void on_selectedButton_toggled(bool checked);
+
+ void on_markedButton_toggled(bool checked);
+
+ void on_ftlMarkedButton_toggled(bool checked);
+
+ void on_rangeButton_toggled(bool checked);
+
+ void on_capturedButton_toggled(bool checked);
+ void on_displayedButton_toggled(bool checked);
+};
+
+#endif // PACKET_RANGE_GROUP_BOX_H
diff --git a/ui/qt/packet_range_group_box.ui b/ui/qt/packet_range_group_box.ui
new file mode 100644
index 0000000000..b1b10aa5b9
--- /dev/null
+++ b/ui/qt/packet_range_group_box.ui
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PacketRangeGroupBox</class>
+ <widget class="QGroupBox" name="PacketRangeGroupBox">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>454</width>
+ <height>241</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="title">
+ <string>Packet Range</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="3">
+ <widget class="QLabel" name="selectedDisplayedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QRadioButton" name="displayedButton">
+ <property name="text">
+ <string>Displayed</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">capturedDisplayedButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="allCapturedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QRadioButton" name="markedButton">
+ <property name="text">
+ <string>&amp;Marked packets only</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">packetSelectionButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QRadioButton" name="rangeButton">
+ <property name="text">
+ <string>&amp;Range:</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">packetSelectionButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="5" column="3">
+ <widget class="QLabel" name="rangeDisplayedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QCheckBox" name="ignoredCheckBox">
+ <property name="text">
+ <string>Remove &amp;ignored packets</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QLabel" name="markedDisplayedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QRadioButton" name="ftlMarkedButton">
+ <property name="text">
+ <string>First &amp;to last marked</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">packetSelectionButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="selectedCapturedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QRadioButton" name="allButton">
+ <property name="text">
+ <string>&amp;All packets</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">packetSelectionButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="ftlCapturedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="allDisplayedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QLabel" name="rangeCapturedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QRadioButton" name="selectedButton">
+ <property name="text">
+ <string>&amp;Selected packets only</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">packetSelectionButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QRadioButton" name="capturedButton">
+ <property name="text">
+ <string>Captured</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">capturedDisplayedButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QLabel" name="markedCapturedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>63</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1">
+ <widget class="SyntaxLineEdit" name="rangeLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3">
+ <widget class="QLabel" name="ftlDisplayedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <widget class="QLabel" name="ignoredCapturedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="3">
+ <widget class="QLabel" name="ignoredDisplayedLabel">
+ <property name="text">
+ <string>-</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>SyntaxLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>syntax_line_edit.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="packetSelectionButtonGroup"/>
+ <buttongroup name="capturedDisplayedButtonGroup"/>
+ </buttongroups>
+</ui>
diff --git a/ui/qt/syntax_line_edit.cpp b/ui/qt/syntax_line_edit.cpp
new file mode 100644
index 0000000000..24e59ff617
--- /dev/null
+++ b/ui/qt/syntax_line_edit.cpp
@@ -0,0 +1,49 @@
+#include "syntax_line_edit.h"
+
+#include "tango_colors.h"
+#include <QDebug>
+
+SyntaxLineEdit::SyntaxLineEdit(QWidget *parent) :
+ QLineEdit(parent)
+{
+ state_style_sheet_ = QString(
+ "SyntaxLineEdit[syntaxState=\"%1\"] {"
+ " color: #%4;"
+ " background-color: #%5;"
+ "}"
+
+ "SyntaxLineEdit[syntaxState=\"%2\"] {"
+ " color: #%4;"
+ " background-color: #%6;"
+ "}"
+
+ "SyntaxLineEdit[syntaxState=\"%3\"] {"
+ " color: #%4;"
+ " background-color: #%7;"
+ "}"
+ )
+ .arg(Invalid)
+ .arg(Deprecated)
+ .arg(Valid)
+ .arg(tango_aluminium_6, 6, 16, QChar('0')) // Foreground
+ .arg(tango_scarlet_red_1, 6, 16, QChar('0')) // Invalid
+ .arg(tango_butter_1, 6, 16, QChar('0')) // Deprecated
+ .arg(tango_chameleon_1, 6, 16, QChar('0')) // Valid
+ ;
+ setStyleSheet(tr(""));
+ setSyntaxState();
+}
+
+void SyntaxLineEdit::setSyntaxState(SyntaxState state) {
+ syntax_state_ = state;
+ setStyleSheet(style_sheet_);
+}
+
+QString SyntaxLineEdit::styleSheet() const {
+ return style_sheet_;
+}
+
+void SyntaxLineEdit::setStyleSheet(const QString &style_sheet) {
+ style_sheet_ = style_sheet;
+ QLineEdit::setStyleSheet(style_sheet_ + state_style_sheet_);
+}
diff --git a/ui/qt/syntax_line_edit.h b/ui/qt/syntax_line_edit.h
new file mode 100644
index 0000000000..d41164ef0f
--- /dev/null
+++ b/ui/qt/syntax_line_edit.h
@@ -0,0 +1,30 @@
+#ifndef SYNTAX_LINE_EDIT_H
+#define SYNTAX_LINE_EDIT_H
+
+#include <QLineEdit>
+
+class SyntaxLineEdit : public QLineEdit
+{
+ Q_OBJECT
+ Q_PROPERTY(SyntaxState syntaxState READ syntaxState)
+ Q_ENUMS(SyntaxState)
+public:
+ explicit SyntaxLineEdit(QWidget *parent = 0);
+ enum SyntaxState { Empty, Invalid, Deprecated, Valid };
+
+ SyntaxState syntaxState() const { return syntax_state_; }
+ void setSyntaxState(SyntaxState state = Empty);
+ QString styleSheet() const;
+
+private:
+ SyntaxState syntax_state_;
+ QString style_sheet_;
+ QString state_style_sheet_;
+
+signals:
+
+public slots:
+ void setStyleSheet(const QString &style_sheet);
+};
+
+#endif // SYNTAX_LINE_EDIT_H
diff --git a/ui/qt/tango_colors.h b/ui/qt/tango_colors.h
index df57fd3a4e..da2cf1bf41 100644
--- a/ui/qt/tango_colors.h
+++ b/ui/qt/tango_colors.h
@@ -26,28 +26,9 @@
#define __TANGO_COLORS_H__
// http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines
+// with added hues from http://emilis.info/other/extended_tango/
+// (all colors except aluminium)
-const QRgb tango_butter_1 = 0xfce94f;
-const QRgb tango_butter_2 = 0xedd400;
-const QRgb tango_butter_3 = 0xc4a000;
-const QRgb tango_chameleon_1 = 0x8ae234;
-const QRgb tango_chameleon_2 = 0x73d216;
-const QRgb tango_chameleon_3 = 0x4e9a06;
-const QRgb tango_orange_1 = 0xfcaf3e;
-const QRgb tango_orange_2 = 0xf57900;
-const QRgb tango_orange_3 = 0xce5c00;
-const QRgb tango_sky_blue_1 = 0x729fcf;
-const QRgb tango_sky_blue_2 = 0x3465a4;
-const QRgb tango_sky_blue_3 = 0x204a87;
-const QRgb tango_plum_1 = 0xad7fa8;
-const QRgb tango_plum_2 = 0x75507b;
-const QRgb tango_plum_3 = 0x5c3566;
-const QRgb tango_chocolate_1 = 0xe9b96e;
-const QRgb tango_chocolate_2 = 0xc17d11;
-const QRgb tango_chocolate_3 = 0x8f5902;
-const QRgb tango_scarlet_red_1 = 0xef2929;
-const QRgb tango_scarlet_red_2 = 0xcc0000;
-const QRgb tango_scarlet_red_3 = 0xa40000;
const QRgb tango_aluminium_1 = 0xeeeeec;
const QRgb tango_aluminium_2 = 0xd3d7cf;
const QRgb tango_aluminium_3 = 0xbabdb6;
@@ -55,4 +36,53 @@ const QRgb tango_aluminium_4 = 0x888a85;
const QRgb tango_aluminium_5 = 0x555753;
const QRgb tango_aluminium_6 = 0x2e3436;
+const QRgb tango_butter_1 = 0xfeffd0;
+const QRgb tango_butter_2 = 0xfffc9c;
+const QRgb tango_butter_3 = 0xfce94f;
+const QRgb tango_butter_4 = 0xedd400;
+const QRgb tango_butter_5 = 0xc4a000;
+const QRgb tango_butter_6 = 0x725000;
+
+const QRgb tango_chameleon_1 = 0xe4ffc7;
+const QRgb tango_chameleon_2 = 0xb7f774;
+const QRgb tango_chameleon_3 = 0x8ae234;
+const QRgb tango_chameleon_4 = 0x73d216;
+const QRgb tango_chameleon_5 = 0x4e9a06;
+const QRgb tango_chameleon_6 = 0x2a5703;
+
+const QRgb tango_chocolate_1 = 0xfaf0d7;
+const QRgb tango_chocolate_2 = 0xefd0a7;
+const QRgb tango_chocolate_3 = 0xe9b96e;
+const QRgb tango_chocolate_4 = 0xc17d11;
+const QRgb tango_chocolate_5 = 0x8f5902;
+const QRgb tango_chocolate_6 = 0x503000;
+
+const QRgb tango_orange_1 = 0xfff0d7;
+const QRgb tango_orange_2 = 0xffd797;
+const QRgb tango_orange_3 = 0xfcaf3e;
+const QRgb tango_orange_4 = 0xf57900;
+const QRgb tango_orange_5 = 0xce5c00;
+const QRgb tango_orange_6 = 0x8c3700;
+
+const QRgb tango_plum_1 = 0xfce0ff;
+const QRgb tango_plum_2 = 0xe0c0e4;
+const QRgb tango_plum_3 = 0xad7fa8;
+const QRgb tango_plum_4 = 0x75507b;
+const QRgb tango_plum_5 = 0x5c3566;
+const QRgb tango_plum_6 = 0x371740;
+
+const QRgb tango_scarlet_red_1 = 0xffcccc;
+const QRgb tango_scarlet_red_2 = 0xf78787;
+const QRgb tango_scarlet_red_3 = 0xef2929;
+const QRgb tango_scarlet_red_4 = 0xcc0000;
+const QRgb tango_scarlet_red_5 = 0xa40000;
+const QRgb tango_scarlet_red_6 = 0x600000;
+
+const QRgb tango_sky_blue_1 = 0xdaeeff;
+const QRgb tango_sky_blue_2 = 0x97c4f0;
+const QRgb tango_sky_blue_3 = 0x729fcf;
+const QRgb tango_sky_blue_4 = 0x3465a4;
+const QRgb tango_sky_blue_5 = 0x204a87;
+const QRgb tango_sky_blue_6 = 0x0a3050;
+
#endif // __TANGO_COLORS_H__
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 2afbd86b1e..a553bea00f 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -1795,7 +1795,7 @@ export_specified_packets_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param,
if (files_identical(cfile.filename, file_name8_selected)) {
/* XXX: Is MessageBox the best way to pop up an error ? How to make text bold ? */
gchar *str = g_strdup_printf(
- "Capture File \"%s\" identical to loaded file !!\n\n"
+ "Capture File \"%s\" identical to loaded file.\n\n"
"Please choose a different filename.",
file_name8_selected);
MessageBox( parent, utf_8to16(str), _T("Error"), MB_ICONERROR | MB_APPLMODAL | MB_OK);