aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-12-21 17:37:57 +0000
committerGerald Combs <gerald@wireshark.org>2012-12-21 17:37:57 +0000
commit962b4f08f76e70ca445523027c1792883ae3ea9d (patch)
treeacce5f56e16c774fd4bb80341a0ea81f138399c8 /ui/qt
parent8c9f80fccc7c1a646f30d2fd235d2bdc1f29d17e (diff)
Move common time shifting code to ui/time_shift.[ch]. Change the
shifting routines to return an error message on failure or NULL on success. Prettify and simplify the layout of the GTK+ time shift dialog. Make the cancel button work as expected. Add a time shift dialog to the Qt port. I used a Mad Lib (sentence) layout. Hopefully that won't make translation too difficult. For some reason time shifts aren't immediately shown in the packet detail. This appears to be a bug in the packet list / packet detail code. Add warning role color definitions to tango_colors.h and use them. svn path=/trunk/; revision=46680
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/QtShark.pro21
-rw-r--r--ui/qt/label_stack.cpp4
-rw-r--r--ui/qt/main_status_bar.cpp4
-rw-r--r--ui/qt/main_window.h1
-rw-r--r--ui/qt/main_window.ui47
-rw-r--r--ui/qt/main_window_slots.cpp10
-rw-r--r--ui/qt/packet_format_group_box.cpp5
-rw-r--r--ui/qt/tango_colors.h3
-rw-r--r--ui/qt/time_shift_dialog.cpp298
-rw-r--r--ui/qt/time_shift_dialog.h77
-rw-r--r--ui/qt/time_shift_dialog.ui275
11 files changed, 731 insertions, 14 deletions
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 31323766af..5381644fae 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -182,15 +182,16 @@ HEADERS_WS_C = \
../../wsutil/privileges.h
FORMS += main_window.ui \
- main_welcome.ui \
- import_text_dialog.ui \
+ export_object_dialog.ui \
file_set_dialog.ui \
- packet_range_group_box.ui \
+ import_text_dialog.ui \
+ main_welcome.ui \
packet_format_group_box.ui \
- export_object_dialog.ui \
+ packet_range_group_box.ui \
print_dialog.ui \
+ search_frame.ui \
splash_overlay.ui \
- search_frame.ui
+ time_shift_dialog.ui
win32 { ## These should be in config.pri ??
!isEmpty(PORTAUDIO_DIR) {
@@ -214,13 +215,15 @@ win32 { ## These should be in config.pri ??
}
HEADERS += $$HEADERS_WS_C \
+ accordion_frame.h \
export_dissection_dialog.h \
- packet_format_group_box.h \
export_object_dialog.h \
+ packet_format_group_box.h \
print_dialog.h \
- splash_overlay.h \
search_frame.h \
- accordion_frame.h
+ splash_overlay.h \
+ tango_colors.h \
+ time_shift_dialog.h
win32 {
OBJECTS_WS_C = $$SOURCES_WS_C
@@ -394,6 +397,7 @@ HEADERS += \
simple_dialog_qt.h \
sparkline_delegate.h \
syntax_line_edit.h \
+ time_shift_dialog.h \
wireshark_application.h
SOURCES += \
@@ -434,4 +438,5 @@ SOURCES += \
sparkline_delegate.cpp \
splash_overlay.cpp \
syntax_line_edit.cpp \
+ time_shift_dialog.cpp \
wireshark_application.cpp
diff --git a/ui/qt/label_stack.cpp b/ui/qt/label_stack.cpp
index 8480a3eb5e..d1cc1673ba 100644
--- a/ui/qt/label_stack.cpp
+++ b/ui/qt/label_stack.cpp
@@ -68,8 +68,8 @@ void LabelStack::fillLabel() {
" color: #%1;"
" background-color: #%2;"
)
- .arg(tango_aluminium_6, 6, 16, QChar('0'))
- .arg(tango_butter_2, 6, 16, QChar('0'));
+ .arg(ws_css_warn_text, 6, 16, QChar('0'))
+ .arg(ws_css_warn_background, 6, 16, QChar('0'));
}
style_sheet += "}";
diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp
index deaa1829af..4494878053 100644
--- a/ui/qt/main_status_bar.cpp
+++ b/ui/qt/main_status_bar.cpp
@@ -293,8 +293,8 @@ void MainStatusBar::toggleBackground(bool enabled)
" background-color: #%2;"
"}"
)
- .arg(tango_aluminium_6, 6, 16, QChar('0'))
- .arg(tango_butter_2, 6, 16, QChar('0')));
+ .arg(ws_css_warn_text, 6, 16, QChar('0'))
+ .arg(ws_css_warn_background, 6, 16, QChar('0')));
} else {
setStyleSheet("");
}
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 9a3ea8a619..0082616ab0 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -219,6 +219,7 @@ private slots:
void on_actionEditUnsetAllTimeReferences_triggered();
void on_actionEditNextTimeReference_triggered();
void on_actionEditPreviousTimeReference_triggered();
+ void on_actionEditTimeShift_triggered();
void on_actionGoGoToPacket_triggered();
void resetPreviousFocus();
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 28341d099e..3f0384227f 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -187,6 +187,12 @@
<addaction name="actionEditUnsetAllTimeReferences"/>
<addaction name="actionEditNextTimeReference"/>
<addaction name="actionEditPreviousTimeReference"/>
+ <addaction name="actionEditTimeShift"/>
+ <addaction name="separator"/>
+ <addaction name="actionEditPacketComment"/>
+ <addaction name="separator"/>
+ <addaction name="actionEditConfigurationProfiles"/>
+ <addaction name="actionEditPreferences"/>
</widget>
<widget class="QMenu" name="menuCapture">
<property name="title">
@@ -1114,6 +1120,47 @@
<string>Ctrl+Alt+B</string>
</property>
</action>
+ <action name="actionEditTimeShift">
+ <property name="text">
+ <string>Time Shift...</string>
+ </property>
+ <property name="toolTip">
+ <string>Shift or change packet timestamps</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+T</string>
+ </property>
+ </action>
+ <action name="actionEditPacketComment">
+ <property name="text">
+ <string>Packet Comment...</string>
+ </property>
+ <property name="toolTip">
+ <string>Add or change a packet comment</string>
+ </property>
+ </action>
+ <action name="actionEditConfigurationProfiles">
+ <property name="text">
+ <string>Configuration Profiles...</string>
+ </property>
+ <property name="toolTip">
+ <string>Manage configuration profiles</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+A</string>
+ </property>
+ </action>
+ <action name="actionEditPreferences">
+ <property name="text">
+ <string>Preferences...</string>
+ </property>
+ <property name="toolTip">
+ <string>Manage Wireshark's preferences</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Shift+P</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 3da3bf4037..8d2806d367 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -62,6 +62,7 @@
#include "capture_file_dialog.h"
#include "export_object_dialog.h"
#include "print_dialog.h"
+#include "time_shift_dialog.h"
#include <QMessageBox>
#include <QClipboard>
@@ -1261,6 +1262,15 @@ void MainWindow::on_actionEditPreviousTimeReference_triggered()
cf_find_packet_time_reference(cap_file_, SD_BACKWARD);
}
+void MainWindow::on_actionEditTimeShift_triggered()
+{
+ TimeShiftDialog ts_dialog(this, cap_file_);
+ connect(this, SIGNAL(setCaptureFile(capture_file*)),
+ &ts_dialog, SLOT(setCaptureFile(capture_file*)));
+
+ ts_dialog.exec();
+}
+
// View Menu
// Expand / collapse slots in proto_tree
diff --git a/ui/qt/packet_format_group_box.cpp b/ui/qt/packet_format_group_box.cpp
index 511a7d7b22..d28dcce0d0 100644
--- a/ui/qt/packet_format_group_box.cpp
+++ b/ui/qt/packet_format_group_box.cpp
@@ -2,7 +2,6 @@
#include "ui_packet_format_group_box.h"
#include <QStyle>
-#include <QDebug>
PacketFormatGroupBox::PacketFormatGroupBox(QWidget *parent) :
QGroupBox(parent),
@@ -10,11 +9,13 @@ PacketFormatGroupBox::PacketFormatGroupBox(QWidget *parent) :
{
pf_ui_->setupUi(this);
+ QStyleOption style_opt;
+ int cb_label_offset = pf_ui_->detailsCheckBox->style()->subElementRect(QStyle::SE_CheckBoxContents, &style_opt).left();
setStyleSheet(QString(
"QRadioButton {"
" padding-left: %1px;"
"}"
- ).arg(style()->pixelMetric(QStyle::PM_LayoutLeftMargin)));
+ ).arg(cb_label_offset));
}
PacketFormatGroupBox::~PacketFormatGroupBox()
diff --git a/ui/qt/tango_colors.h b/ui/qt/tango_colors.h
index da2cf1bf41..7a4432f190 100644
--- a/ui/qt/tango_colors.h
+++ b/ui/qt/tango_colors.h
@@ -85,4 +85,7 @@ const QRgb tango_sky_blue_4 = 0x3465a4;
const QRgb tango_sky_blue_5 = 0x204a87;
const QRgb tango_sky_blue_6 = 0x0a3050;
+const QRgb ws_css_warn_background = tango_butter_2;
+const QRgb ws_css_warn_text = tango_aluminium_6;
+
#endif // __TANGO_COLORS_H__
diff --git a/ui/qt/time_shift_dialog.cpp b/ui/qt/time_shift_dialog.cpp
new file mode 100644
index 0000000000..a662617804
--- /dev/null
+++ b/ui/qt/time_shift_dialog.cpp
@@ -0,0 +1,298 @@
+/* time_shift_dialog.cpp
+ *
+ * $Id$
+ *
+ * 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 "time_shift_dialog.h"
+#include "ui_time_shift_dialog.h"
+
+#include "wireshark_application.h"
+
+#include <ui/time_shift.h>
+#include "tango_colors.h"
+
+#include <QMessageBox>
+
+#include <QDebug>
+TimeShiftDialog::TimeShiftDialog(QWidget *parent, capture_file *cf) :
+ QDialog(parent),
+ ts_ui_(new Ui::TimeShiftDialog),
+ cap_file_(cf),
+ apply_button_(NULL)
+{
+ ts_ui_->setupUi(this);
+ apply_button_ = ts_ui_->buttonBox->button(QDialogButtonBox::Apply);
+ connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyTimeShift()));
+
+ QStyleOption style_opt;
+ int rb_label_offset = ts_ui_->shiftAllButton->style()->subElementRect(QStyle::SE_RadioButtonContents, &style_opt).left();
+ int cb_label_offset = ts_ui_->shiftAllButton->style()->subElementRect(QStyle::SE_CheckBoxContents, &style_opt).left();
+ setStyleSheet(QString(
+ "QCheckBox#setTwoCheckBox {"
+ " margin-left: %1px;"
+ "}"
+ "QLabel#extrapolateLabel {"
+ " margin-left: %2px;"
+ "}"
+ )
+ .arg(rb_label_offset)
+ .arg(rb_label_offset + cb_label_offset)
+ );
+
+ if (cap_file_) {
+ if (cap_file_->current_frame) {
+ ts_ui_->setOneFrameLineEdit->setText(QString::number(cap_file_->current_frame->num));
+ } else {
+ ts_ui_->setOneFrameLineEdit->setText(QString::number(cap_file_->first_displayed));
+ }
+ ts_ui_->setTwoFrameLineEdit->setText(QString::number(cap_file_->last_displayed));
+ }
+
+ ts_ui_->shiftAllButton->setChecked(true);
+ ts_ui_->setTwoCheckBox->setChecked(false);
+ enableWidgets();
+}
+
+TimeShiftDialog::~TimeShiftDialog()
+{
+ delete ts_ui_;
+}
+
+void TimeShiftDialog::enableWidgets()
+{
+ bool enable_two = ts_ui_->setOneButton->isChecked();
+ bool enable_ok = false;
+
+ ts_ui_->setTwoCheckBox->setEnabled(enable_two);
+ ts_ui_->setTwoFrameLineEdit->setEnabled(enable_two);
+ ts_ui_->setTwoToLabel->setEnabled(enable_two);
+ ts_ui_->setTwoTimeLineEdit->setEnabled(enable_two);
+ ts_ui_->extrapolateLabel->setEnabled(enable_two && ts_ui_->setTwoCheckBox->isChecked());
+
+ if (ts_ui_->shiftAllButton->isChecked()) {
+ if (ts_ui_->shiftAllTimeLineEdit->syntaxState() == SyntaxLineEdit::Valid)
+ enable_ok = true;
+ } else if (ts_ui_->setOneButton->isChecked()) {
+ bool set_two_valid;
+ if (ts_ui_->setTwoCheckBox->isChecked()) {
+ if (ts_ui_->setTwoFrameLineEdit->syntaxState() == SyntaxLineEdit::Valid &&
+ ts_ui_->setTwoTimeLineEdit->syntaxState() == SyntaxLineEdit::Valid) {
+ set_two_valid = true;
+ }
+ } else {
+ set_two_valid = true;
+ }
+ if (set_two_valid &&
+ ts_ui_->setOneFrameLineEdit->syntaxState() == SyntaxLineEdit::Valid &&
+ ts_ui_->setOneTimeLineEdit->syntaxState() == SyntaxLineEdit::Valid) {
+ enable_ok = true;
+ }
+ } else if (ts_ui_->unshiftAllButton->isChecked()) {
+ enable_ok = true;
+ }
+
+ if (syntax_err_.isEmpty()) {
+ ts_ui_->errorLabel->clear();
+ ts_ui_->errorLabel->setStyleSheet(" QLabel { margin-top: 0.5em; }");
+ } else {
+ ts_ui_->errorLabel->setText(syntax_err_);
+ ts_ui_->errorLabel->setStyleSheet(QString(
+ "QLabel {"
+ " margin-top: 0.5em;"
+ " color: #%1;"
+ " background-color: #%2;"
+ "}"
+ )
+ .arg(ws_css_warn_text, 6, 16, QChar('0'))
+ .arg(ws_css_warn_background, 6, 16, QChar('0'))
+ );
+ }
+ apply_button_->setEnabled(enable_ok);
+}
+
+void TimeShiftDialog::checkFrameNumber(SyntaxLineEdit &frame_le)
+{
+ bool frame_valid;
+ guint frame_num = frame_le.text().toUInt(&frame_valid);
+
+ syntax_err_.clear();
+ if (frame_le.text().isEmpty()) {
+ frame_le.setSyntaxState(SyntaxLineEdit::Empty);
+ } else if (!frame_valid || !cap_file_ || frame_num < 1 || frame_num > cap_file_->count) {
+ frame_le.setSyntaxState(SyntaxLineEdit::Invalid);
+ if (cap_file_) {
+ syntax_err_ = QString(tr("Frame numbers must be between 1 and %1.").arg(cap_file_->count));
+ } else {
+ syntax_err_ = "Invalid frame number.";
+ }
+ } else {
+ frame_le.setSyntaxState(SyntaxLineEdit::Valid);
+ }
+}
+
+void TimeShiftDialog::checkDateTime(SyntaxLineEdit &time_le)
+{
+ int Y, M, D, h, m;
+ long double s;
+ const gchar *err_str;
+
+ syntax_err_.clear();
+ if (time_le.text().isEmpty()) {
+ time_le.setSyntaxState(SyntaxLineEdit::Empty);
+ } else if ((err_str = time_string_parse(time_le.text().toUtf8().constData(),
+ &Y, &M, &D, NULL, &h, &m, &s)) != NULL) {
+ syntax_err_ = err_str;
+ time_le.setSyntaxState(SyntaxLineEdit::Invalid);
+ } else {
+ time_le.setSyntaxState(SyntaxLineEdit::Valid);
+ }
+}
+
+void TimeShiftDialog::on_shiftAllButton_toggled(bool checked)
+{
+ Q_UNUSED(checked);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_setOneButton_toggled(bool checked)
+{
+ Q_UNUSED(checked);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_unshiftAllButton_toggled(bool checked)
+{
+ Q_UNUSED(checked);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_setTwoCheckBox_toggled(bool checked)
+{
+ Q_UNUSED(checked);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_shiftAllTimeLineEdit_textChanged(const QString &sa_text)
+{
+ int h, m;
+ long double s;
+ gboolean neg;
+ const gchar *err_str;
+
+ syntax_err_.clear();
+ if (sa_text.isEmpty()) {
+ ts_ui_->shiftAllTimeLineEdit->setSyntaxState(SyntaxLineEdit::Empty);
+ } else if ((err_str = time_string_parse(sa_text.toUtf8().constData(),
+ NULL, NULL, NULL, &neg, &h, &m, &s)) != NULL) {
+ syntax_err_ = err_str;
+ ts_ui_->shiftAllTimeLineEdit->setSyntaxState(SyntaxLineEdit::Invalid);
+ } else {
+ ts_ui_->shiftAllTimeLineEdit->setSyntaxState(SyntaxLineEdit::Valid);
+ }
+ ts_ui_->shiftAllButton->setChecked(true);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_setOneFrameLineEdit_textChanged(const QString &frame_text)
+{
+ Q_UNUSED(frame_text);
+ checkFrameNumber(*ts_ui_->setOneFrameLineEdit);
+ ts_ui_->setOneButton->setChecked(true);
+ enableWidgets();
+}
+void TimeShiftDialog::on_setOneTimeLineEdit_textChanged(const QString &so_text)
+{
+ Q_UNUSED(so_text);
+ checkDateTime(*ts_ui_->setOneTimeLineEdit);
+ ts_ui_->setOneButton->setChecked(true);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_setTwoFrameLineEdit_textChanged(const QString &frame_text)
+{
+ Q_UNUSED(frame_text);
+ Q_UNUSED(frame_text);
+ checkFrameNumber(*ts_ui_->setTwoFrameLineEdit);
+ if (ts_ui_->setTwoCheckBox->isEnabled())
+ ts_ui_->setTwoCheckBox->setChecked(true);
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_setTwoTimeLineEdit_textChanged(const QString &st_text)
+{
+ Q_UNUSED(st_text);
+ checkDateTime(*ts_ui_->setTwoTimeLineEdit);
+ if (ts_ui_->setTwoCheckBox->isEnabled())
+ ts_ui_->setTwoCheckBox->setChecked(true);
+ enableWidgets();
+}
+
+void TimeShiftDialog::applyTimeShift()
+{
+ const gchar *err_str = NULL;
+
+ if (!cap_file_ || cap_file_->state == FILE_CLOSED) return;
+
+ syntax_err_.clear();
+ if (cap_file_->state == FILE_READ_IN_PROGRESS) {
+ syntax_err_ = "Time shifting is not available capturing packets.";
+ } else if (ts_ui_->shiftAllButton->isChecked()) {
+ err_str = time_shift_all(cap_file_,
+ ts_ui_->shiftAllTimeLineEdit->text().toUtf8().constData());
+ } else if (ts_ui_->setOneButton->isChecked()) {
+ if (!ts_ui_->setTwoCheckBox->isChecked()) {
+ err_str = time_shift_settime(cap_file_,
+ ts_ui_->setOneFrameLineEdit->text().toUInt(),
+ ts_ui_->setOneTimeLineEdit->text().toUtf8().constData()
+ );
+ } else {
+ err_str = time_shift_adjtime(cap_file_,
+ ts_ui_->setOneFrameLineEdit->text().toUInt(),
+ ts_ui_->setOneTimeLineEdit->text().toUtf8().constData(),
+ ts_ui_->setTwoFrameLineEdit->text().toUInt(),
+ ts_ui_->setTwoTimeLineEdit->text().toUtf8().constData()
+ );
+ }
+ } else if (ts_ui_->unshiftAllButton->isChecked()) {
+ err_str = time_shift_undo(cap_file_);
+ }
+ if (err_str) syntax_err_ = err_str;
+ enableWidgets();
+}
+
+void TimeShiftDialog::on_buttonBox_helpRequested()
+{
+ wsApp->helpTopicAction(HELP_TIME_SHIFT_DIALOG);
+}
+
+/*
+ * 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:
+ */
+
diff --git a/ui/qt/time_shift_dialog.h b/ui/qt/time_shift_dialog.h
new file mode 100644
index 0000000000..d150cbfce9
--- /dev/null
+++ b/ui/qt/time_shift_dialog.h
@@ -0,0 +1,77 @@
+/* time_shift_dialog.h
+ *
+ * $Id$
+ *
+ * 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 TIME_SHIFT_DIALOG_H
+#define TIME_SHIFT_DIALOG_H
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "cfile.h"
+
+#include "syntax_line_edit.h"
+
+#include <QDialog>
+#include <QPushButton>
+
+namespace Ui {
+class TimeShiftDialog;
+}
+
+class TimeShiftDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit TimeShiftDialog(QWidget *parent = 0, capture_file *cf = NULL);
+ ~TimeShiftDialog();
+
+public slots:
+ void setCaptureFile(capture_file *cf) { cap_file_ = cf; }
+
+private:
+ Ui::TimeShiftDialog *ts_ui_;
+ capture_file *cap_file_;
+ QPushButton *apply_button_;
+ QString syntax_err_;
+
+ void enableWidgets();
+ void checkFrameNumber(SyntaxLineEdit &frame_le);
+ void checkDateTime(SyntaxLineEdit &time_le);
+
+private slots:
+ void on_shiftAllButton_toggled(bool checked);
+ void on_setOneButton_toggled(bool checked);
+ void on_unshiftAllButton_toggled(bool checked);
+ void on_setTwoCheckBox_toggled(bool checked);
+ void on_shiftAllTimeLineEdit_textChanged(const QString &sa_text);
+ void on_setOneTimeLineEdit_textChanged(const QString &so_text);
+ void on_setOneFrameLineEdit_textChanged(const QString &frame_text);
+ void on_setTwoFrameLineEdit_textChanged(const QString &frame_text);
+ void on_setTwoTimeLineEdit_textChanged(const QString &st_text);
+ void applyTimeShift();
+ void on_buttonBox_helpRequested();
+};
+
+#endif // TIME_SHIFT_DIALOG_H
diff --git a/ui/qt/time_shift_dialog.ui b/ui/qt/time_shift_dialog.ui
new file mode 100644
index 0000000000..9c3a0e93b6
--- /dev/null
+++ b/ui/qt/time_shift_dialog.ui
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TimeShiftDialog</class>
+ <widget class="QDialog" name="TimeShiftDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>537</width>
+ <height>299</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Wireshark: Time Shift</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QRadioButton" name="shiftAllButton">
+ <property name="text">
+ <string>Shift all packets by</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SyntaxLineEdit" name="shiftAllTimeLineEdit"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:small; font-style:italic;&quot;&gt;[-][[hh:]mm:]ss[.ddd] &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="setOneButton">
+ <property name="text">
+ <string>Set the time for packet</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SyntaxLineEdit" name="setOneFrameLineEdit"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>to</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SyntaxLineEdit" name="setOneTimeLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="setTwoCheckBox">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>...then set packet</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SyntaxLineEdit" name="setTwoFrameLineEdit"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="setTwoToLabel">
+ <property name="text">
+ <string>to</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="SyntaxLineEdit" name="setTwoTimeLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>28</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="extrapolateLabel">
+ <property name="text">
+ <string>and extrapolate the time for all other packets</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;&lt;span style=&quot; font-size:small; font-style:italic;&quot;&gt;Time format: [YYYY-MM-DD] hh:mm:ss[.ddd] &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="unshiftAllButton">
+ <property name="text">
+ <string>Undo all shifts</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="errorLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Close|QDialogButtonBox::Help</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>buttonBox</zorder>
+ <zorder>unshiftAllButton</zorder>
+ <zorder>errorLabel</zorder>
+ <zorder>horizontalSpacer_5</zorder>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>SyntaxLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>syntax_line_edit.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>TimeShiftDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>TimeShiftDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>