aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-07-25 23:49:47 +0000
committerGerald Combs <gerald@wireshark.org>2013-07-25 23:49:47 +0000
commita05f55bffc2bc7d52d3f35370a7ae1eea2b75839 (patch)
tree94644ff0a3cc6cf339a165087ddbfb0c1e553760
parent7d73903af6209ef1b013c6ed61c866291bfb3785 (diff)
Add a UAT dialog. Make UAT preferences uat_t * instead of void *.
C++-ize the UAT headers. Add an ElidedLabel widget. Use it in the File Set, Profile, and UAT dialogs. Update the Qt README. svn path=/trunk/; revision=50896
-rw-r--r--airpcap_loader.c4
-rw-r--r--doc/README.qt26
-rw-r--r--epan/prefs-int.h6
-rw-r--r--epan/prefs.c4
-rw-r--r--epan/prefs.h6
-rw-r--r--epan/uat-int.h16
-rw-r--r--epan/uat.h14
-rw-r--r--ui/qt/CMakeLists.txt5
-rw-r--r--ui/qt/Makefile.common10
-rw-r--r--ui/qt/QtShark.pro8
-rw-r--r--ui/qt/elided_label.cpp72
-rw-r--r--ui/qt/elided_label.h52
-rw-r--r--ui/qt/file_set_dialog.cpp6
-rw-r--r--ui/qt/file_set_dialog.ui9
-rw-r--r--ui/qt/module_preferences_scroll_area.cpp4
-rw-r--r--ui/qt/preferences_dialog.cpp7
-rw-r--r--ui/qt/preferences_dialog.h2
-rw-r--r--ui/qt/profile_dialog.cpp19
-rw-r--r--ui/qt/profile_dialog.ui11
-rw-r--r--ui/qt/uat_dialog.cpp524
-rw-r--r--ui/qt/uat_dialog.h93
-rw-r--r--ui/qt/uat_dialog.ui154
-rw-r--r--ui/qt/wireshark_application.h4
23 files changed, 1004 insertions, 52 deletions
diff --git a/airpcap_loader.c b/airpcap_loader.c
index fd7abdd284..14e527dd87 100644
--- a/airpcap_loader.c
+++ b/airpcap_loader.c
@@ -163,7 +163,7 @@ get_wep_key(pref_t *pref, gpointer ud)
if (g_ascii_strcasecmp(pref->name, "wep_key_table") == 0 && pref->type == PREF_UAT)
{
- uat = (uat_t *)pref->varp.uat;
+ uat = pref->varp.uat;
/* This is just a sanity check. UAT should be loaded */
if (!uat->loaded)
{
@@ -259,7 +259,7 @@ set_wep_key(pref_t *pref, gpointer ud _U_)
if (g_ascii_strcasecmp(pref->name, "wep_key_table") == 0 && pref->type == PREF_UAT)
{
- uat = (uat_t *)pref->varp.uat;
+ uat = pref->varp.uat;
if (!uat->loaded)
{
/* UAT will only be loaded if previous keys exist, so it may need
diff --git a/doc/README.qt b/doc/README.qt
index 6046b91e75..1c57c5a1d1 100644
--- a/doc/README.qt
+++ b/doc/README.qt
@@ -10,10 +10,10 @@ and let us add features more easily.
1. Getting up and running
-The Qt interface for Wireshark has been compiled and tested on Mac OS X 10.6
-(XCode gcc), Windows 7 x86 (Visual C++ 2010), and Ubuntu 10.04 (gcc).
-Compilation via Qt Creator has been tested but command-line compilation using
-QMake and make or nmake should work.
+The Qt interface for Wireshark has been compiled and tested on Mac OS X 10.8
+(XCode LLVM/clang), Windows 7 x86 (Visual C++ 2010), and Ubuntu 12.04 (gcc).
+Compilation via Qt Creator and via the command line compilation using QMake and
+make or nmake should work.
There are several ways of building qtshark:
@@ -69,10 +69,10 @@ This may or may not work for you; see
1.1.2 Windows
-The default Qt SDK libraries are built using MinGW, which isn't supported
-for Wireshark. Instead of downloading the Qt SDK all-in-one package,
-download the Qt Libraries package from http://qt.nokia.com/downloads/ that
-matches your compiler (VS 2008 or VS 2010) and Qt Creator for Windows.
+The default Qt SDK libraries are built using MinGW, which isn't supported for
+Wireshark. Instead of downloading the Qt SDK all-in-one package, download the Qt
+Libraries package from http://qt-project.org/downloads/ that matches your
+compiler (VS 2010 or VS 2012) and Qt Creator for Windows.
Settings in config.nmake are passed to the Qt environment via
ui/qt/config.pri. This file should be created automatically when you
@@ -137,11 +137,10 @@ XXX: (WMeier): I've not had too much satisfaction using the "native Windows debu
1.1.3 Linux
Install the Qt libraries and Qt Creator via your package manager or from
-http://qt.nokia.com/downloads/. On Debian and Ubuntu the "qt-sdk" meta-package
+http://qt-project.org/downloads/. On Debian and Ubuntu the "qt-sdk" meta-package
should provide everything you need. Build the top-level directory using CMake
-(see section "Using cmake" above).
-As an alternative do an in-tree build without QT and then inside ui/qt/ do
-"qtcreate QtShark.pro".
+(see section "Using cmake" above). As an alternative do an in-tree build without
+QT and then inside ui/qt/ do "qtcreate QtShark.pro".
2. Going forward
@@ -158,6 +157,9 @@ HTTP request statistics?
- "Go to packet" pops up a text entry in the main window instead of a separate dialog.
+- Preferences are complete, and are arguably more useful than the GTK+ version.
+ An "Advanced" preference pane exists, which lets you edit everything. They use
+ the proper menu placement and keyboard shortcut on OS X.
3. Translations (i18n)
For make your own translation of QtShark ! it is easy !
diff --git a/epan/prefs-int.h b/epan/prefs-int.h
index 8b9379714b..64ccfe0257 100644
--- a/epan/prefs-int.h
+++ b/epan/prefs-int.h
@@ -50,8 +50,8 @@ struct pref_module {
* GUI interface/APIs with the preference value or if its own
* independent GUI will be provided. This allows all preferences
* to have a common API for reading/writing, but not require them to
- * use simple GUI controls to change the options. In general, the "general"
- * Wireshark preferences should have this set to FALSE, while the protocol
+ * use simple GUI controls to change the options. In general, the "general"
+ * Wireshark preferences should have this set to FALSE, while the protocol
* modules will have this set to TRUE */
};
@@ -120,7 +120,7 @@ struct preference {
gint *enump;
const char **string;
range_t **range;
- void* uat;
+ uat_t* uat;
color_t *colorp;
GList** list;
} varp; /**< pointer to variable storing the value */
diff --git a/epan/prefs.c b/epan/prefs.c
index 05e69af418..cb39e50256 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -1077,7 +1077,7 @@ prefs_register_static_text_preference(module_t *module, const char *name,
extern void
prefs_register_uat_preference(module_t *module, const char *name,
const char *title, const char *description,
- void* uat)
+ uat_t* uat)
{
pref_t* preference = register_preference(module, name, title, description, PREF_UAT);
@@ -4407,7 +4407,7 @@ prefs_pref_to_str(pref_t *pref, pref_source_t source) {
case PREF_UAT:
{
- uat_t *uat = (uat_t *) pref->varp.uat;
+ uat_t *uat = pref->varp.uat;
if (uat && uat->filename)
return g_strdup_printf("[Managed in the file \"%s\"]", uat->filename);
else
diff --git a/epan/prefs.h b/epan/prefs.h
index 6d749b8b1a..6037d33bad 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -33,9 +33,11 @@ extern "C" {
#include "color.h"
+#include <epan/addr_resolv.h>
#include <epan/params.h>
#include <epan/range.h>
-#include <epan/addr_resolv.h>
+#include <epan/uat.h>
+
#include "ws_symbol_export.h"
#define PR_DEST_CMD 0
@@ -437,7 +439,7 @@ WS_DLL_PUBLIC void prefs_register_uat_preference(module_t *module,
const char *name,
const char* title,
const char *description,
- void* uat);
+ uat_t* uat);
/*
* Register a color preference. Currently does not have any "GUI Dialog" support
diff --git a/epan/uat-int.h b/epan/uat-int.h
index 6097e47d6b..f924256277 100644
--- a/epan/uat-int.h
+++ b/epan/uat-int.h
@@ -28,12 +28,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
-#ifndef _UAT_INT_H_
-#define _UAT_INT_H_
+#ifndef __UAT_INT_H__
+#define __UAT_INT_H__
#include "uat.h"
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
typedef struct _uat_fld_rep_t uat_fld_rep_t;
typedef struct _uat_rep_t uat_rep_t;
@@ -72,6 +76,7 @@ struct _uat_t {
gboolean from_global;
};
+WS_DLL_PUBLIC
gchar* uat_get_actual_filename(uat_t* uat, gboolean for_writing);
void uat_init(void);
@@ -100,7 +105,12 @@ void uat_load_all(void);
#define UAT_UPDATE(uat) do { *((uat)->user_ptr) = (void*)((uat)->user_data->data); *((uat)->nrows_p) = (uat)->user_data->len; } while(0)
#define UAT_INDEX_PTR(uat,idx) (uat->raw_data->data + (uat->record_size * (idx)))
#define UAT_USER_INDEX_PTR(uat,idx) (uat->user_data->data + (uat->record_size * (idx)))
-#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __UAT_INT_H__ */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
diff --git a/epan/uat.h b/epan/uat.h
index bd30ad1641..1c2221005c 100644
--- a/epan/uat.h
+++ b/epan/uat.h
@@ -27,11 +27,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef _UAT_H_
-#define _UAT_H_
+#ifndef __UAT_H__
+#define __UAT_H__
#include "ws_symbol_export.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
/*
* uat mantains a dynamically allocated table accessible to the user
* via a file and/or gui tables.
@@ -571,4 +575,8 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out
{#field_name, title, PT_TXTMOD_STRING,{uat_fld_chk_range,basename ## _ ## field_name ## _set_cb,basename ## _ ## field_name ## _tostr_cb},\
{0,0,0},GUINT_TO_POINTER(max),desc,FLDFILL}
-#endif
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __UAT_H__ */
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index ad50a2d7bf..b722a6d981 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -36,6 +36,7 @@ set(QTSHARK_H_SRC
column_preferences_frame.h
display_filter_combo.h
display_filter_edit.h
+ elided_label.h
export_dissection_dialog.h
export_object_dialog.h
file_set_dialog.h
@@ -67,6 +68,7 @@ set(QTSHARK_H_SRC
summary_dialog.h
syntax_line_edit.h
time_shift_dialog.h
+ uat_dialog.h
wireshark_application.h
# No Q_OBJECT:
@@ -89,6 +91,7 @@ set(CLEAN_FILES
column_preferences_frame.cpp
display_filter_combo.cpp
display_filter_edit.cpp
+ elided_label.cpp
export_dissection_dialog.cpp
export_object_dialog.cpp
file_set_dialog.cpp
@@ -125,6 +128,7 @@ set(CLEAN_FILES
splash_overlay.cpp
syntax_line_edit.cpp
time_shift_dialog.cpp
+ uat_dialog.cpp
wireshark_application.cpp
)
@@ -155,6 +159,7 @@ set(QTSHARK_UI
search_frame.ui
splash_overlay.ui
time_shift_dialog.ui
+ uat_dialog.ui
)
set(QTSHARK_QRC
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index 6a2f37f7ae..02d93e34ea 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -52,7 +52,8 @@ NODIST_GENERATED_HEADER_FILES = \
ui_search_frame.h \
ui_summary_dialog.h \
ui_splash_overlay.h \
- ui_time_shift_dialog.h
+ ui_time_shift_dialog.h \
+ ui_uat_dialog.h
# Generated C source files that we want in the distribution.
GENERATED_C_FILES =
@@ -99,6 +100,7 @@ MOC_HDRS = \
column_preferences_frame.h \
display_filter_combo.h \
display_filter_edit.h \
+ elided_label.h \
export_dissection_dialog.h \
export_object_dialog.h \
file_set_dialog.h \
@@ -132,6 +134,7 @@ MOC_HDRS = \
splash_overlay.h \
syntax_line_edit.h \
time_shift_dialog.h \
+ uat_dialog.h \
wireshark_application.h
@@ -160,7 +163,8 @@ UI_FILES = \
search_frame.ui \
summary_dialog.ui \
splash_overlay.ui \
- time_shift_dialog.ui
+ time_shift_dialog.ui \
+ uat_dialog.ui
#
# The .moc.cpp files generated from them.
@@ -218,6 +222,7 @@ WIRESHARK_QT_SRC = \
column_preferences_frame.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
+ elided_label.cpp \
export_dissection_dialog.cpp \
export_object_dialog.cpp \
file_set_dialog.cpp \
@@ -255,6 +260,7 @@ WIRESHARK_QT_SRC = \
splash_overlay.cpp \
syntax_line_edit.cpp \
time_shift_dialog.cpp \
+ uat_dialog.cpp \
wireshark_application.cpp
noinst_HEADERS = \
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index b81f335c08..35744c5750 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -215,6 +215,7 @@ FORMS += \
splash_overlay.ui \
summary_dialog.ui \
time_shift_dialog.ui \
+ uat_dialog.ui
win32 { ## These should be in config.pri ??
@@ -242,6 +243,7 @@ HEADERS += $$HEADERS_WS_C \
accordion_frame.h \
capture_preferences_frame.h \
column_preferences_frame.h \
+ elided_label.h \
export_dissection_dialog.h \
export_object_dialog.h \
filter_expressions_preferences_frame.h \
@@ -258,6 +260,8 @@ HEADERS += $$HEADERS_WS_C \
splash_overlay.h \
summary_dialog.h \
tango_colors.h \
+ uat_dialog.h \
+ elided_label.h
win32 {
@@ -483,6 +487,7 @@ SOURCES += \
column_preferences_frame.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
+ elided_label.cpp \
export_dissection_dialog.cpp \
export_object_dialog.cpp \
file_set_dialog.cpp \
@@ -520,4 +525,5 @@ SOURCES += \
summary_dialog.cpp \
syntax_line_edit.cpp \
time_shift_dialog.cpp \
- wireshark_application.cpp \
+ uat_dialog.cpp \
+ wireshark_application.cpp
diff --git a/ui/qt/elided_label.cpp b/ui/qt/elided_label.cpp
new file mode 100644
index 0000000000..3fcd7d3992
--- /dev/null
+++ b/ui/qt/elided_label.cpp
@@ -0,0 +1,72 @@
+/* elided_label.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 "elided_label.h"
+
+#include <QFontMetrics>
+
+ElidedLabel::ElidedLabel(QWidget *parent) :
+ QLabel(parent)
+{
+}
+
+void ElidedLabel::setUrl(const QString &url)
+{
+ url_ = url;
+ updateText();
+}
+
+void ElidedLabel::resizeEvent(QResizeEvent *evt)
+{
+ Q_UNUSED(evt)
+ updateText();
+}
+
+void ElidedLabel::updateText()
+{
+ QString elided_text = fontMetrics().elidedText(full_text_, Qt::ElideMiddle, width());
+ if (url_.length() > 0) {
+ QLabel::setText(QString("<i><a href=\"%1\">%2</a></i>")
+ .arg(url_)
+ .arg(elided_text)
+ );
+ } else {
+ QLabel::setText(QString("<i>%1</i>")
+ .arg(elided_text)
+ );
+ }
+}
+
+void ElidedLabel::clear()
+{
+ full_text_.clear();
+ url_.clear();
+ setToolTip("");
+ updateText();
+}
+
+void ElidedLabel::setText(const QString &text)
+{
+ full_text_ = text;
+ updateText();
+}
diff --git a/ui/qt/elided_label.h b/ui/qt/elided_label.h
new file mode 100644
index 0000000000..9821586323
--- /dev/null
+++ b/ui/qt/elided_label.h
@@ -0,0 +1,52 @@
+/* elided_label.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 ELIDED_LABEL_H
+#define ELIDED_LABEL_H
+
+#include <QLabel>
+
+class ElidedLabel : public QLabel
+{
+ Q_OBJECT
+public:
+ explicit ElidedLabel(QWidget *parent = 0);
+ void setUrl(const QString &url);
+
+protected:
+ void resizeEvent(QResizeEvent *evt);
+
+private:
+ QString full_text_;
+ QString url_;
+
+ void updateText();
+
+signals:
+
+public slots:
+ void clear();
+ void setText(const QString &text);
+};
+
+#endif // ELIDED_LABEL_H
diff --git a/ui/qt/file_set_dialog.cpp b/ui/qt/file_set_dialog.cpp
index a337829f09..837837f7df 100644
--- a/ui/qt/file_set_dialog.cpp
+++ b/ui/qt/file_set_dialog.cpp
@@ -129,10 +129,8 @@ void FileSetDialog::addFile(fileset_entry *entry) {
.arg(plurality(fs_ui_->fileSetTree->topLevelItemCount(), "", "s")));
dir_name = fileset_get_dirname();
- elided_dir_name = fs_ui_->directoryLabel->fontMetrics().elidedText(dir_name, Qt::ElideLeft, fs_ui_->directoryLabel->maximumWidth());
- fs_ui_->directoryLabel->setText(QString("<a href=\"%1\">%2</a>")
- .arg(QUrl::fromLocalFile(dir_name).toString())
- .arg(elided_dir_name));
+ fs_ui_->directoryLabel->setText(dir_name);
+ fs_ui_->directoryLabel->setUrl(QUrl::fromLocalFile(dir_name).toString());
fs_ui_->directoryLabel->setEnabled(true);
if(entry->current) {
diff --git a/ui/qt/file_set_dialog.ui b/ui/qt/file_set_dialog.ui
index 6722b98418..f017d0eb46 100644
--- a/ui/qt/file_set_dialog.ui
+++ b/ui/qt/file_set_dialog.ui
@@ -32,7 +32,7 @@
</widget>
</item>
<item>
- <widget class="QLabel" name="directoryLabel">
+ <widget class="ElidedLabel" name="directoryLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>1</horstretch>
@@ -114,6 +114,13 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>ElidedLabel</class>
+ <extends>QLabel</extends>
+ <header>elided_label.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections>
<connection>
diff --git a/ui/qt/module_preferences_scroll_area.cpp b/ui/qt/module_preferences_scroll_area.cpp
index e1fdef1f3c..7752cf4f74 100644
--- a/ui/qt/module_preferences_scroll_area.cpp
+++ b/ui/qt/module_preferences_scroll_area.cpp
@@ -25,6 +25,7 @@
#include "ui_module_preferences_scroll_area.h"
#include "syntax_line_edit.h"
#include "qt_ui_utils.h"
+#include "uat_dialog.h"
#include <epan/prefs-int.h>
@@ -433,7 +434,8 @@ void ModulePreferencesScrollArea::uatPushButtonPressed()
pref_t *pref = uat_pb->property(pref_prop_).value<pref_t *>();
if (!pref) return;
- qDebug() << "FIX Implement UATs:" << pref->title;
+ UatDialog uat_dlg(this, pref->varp.uat);
+ uat_dlg.exec();
}
void ModulePreferencesScrollArea::filenamePushButtonPressed()
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index 7f0b058af3..b4317e0fb2 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -40,6 +40,7 @@
#include "module_preferences_scroll_area.h"
#include "syntax_line_edit.h"
#include "qt_ui_utils.h"
+#include "uat_dialog.h"
#include <QColorDialog>
#include <QFileDialog>
@@ -278,7 +279,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
updateItem(*(*pref_it));
++pref_it;
}
- qDebug() << "FIX: Open UAT dialogs from prefs dialog.";
qDebug() << "FIX: Auto-size each preference pane.";
pd_ui_->splitter->setStretchFactor(0, 1);
@@ -647,8 +647,11 @@ void PreferencesDialog::on_advancedTree_itemActivated(QTreeWidgetItem *item, int
break;
}
case PREF_UAT:
- qDebug() << "FIX open uat dialog" << item->text(column);
+ {
+ UatDialog uat_dlg(this, pref->varp.uat);
+ uat_dlg.exec();
break;
+ }
default:
break;
}
diff --git a/ui/qt/preferences_dialog.h b/ui/qt/preferences_dialog.h
index 445081b196..827ea893eb 100644
--- a/ui/qt/preferences_dialog.h
+++ b/ui/qt/preferences_dialog.h
@@ -68,7 +68,6 @@ private:
private slots:
void on_prefsTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_advancedSearchLineEdit_textEdited(const QString &search_str);
- void on_advancedTree_itemActivated(QTreeWidgetItem *item, int column);
void lineEditPrefDestroyed();
void enumPrefDestroyed();
void uintPrefEditingFinished();
@@ -78,6 +77,7 @@ private slots:
void rangePrefEditingFinished();
void on_advancedTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+ void on_advancedTree_itemActivated(QTreeWidgetItem *item, int column);
void on_buttonBox_accepted();
void on_buttonBox_helpRequested();
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index 5ecdaeaa00..dfd22afe45 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -34,10 +34,11 @@
#include "wireshark_application.h"
#include "color_utils.h"
-#include <QFont>
-#include <QUrl>
#include <QBrush>
+#include <QDir>
+#include <QFont>
#include <QMessageBox>
+#include <QUrl>
Q_DECLARE_METATYPE(GList *)
@@ -149,17 +150,17 @@ void ProfileDialog::updateWidgets()
}
}
- if (current_profile && current_profile->status != PROF_STAT_DEFAULT) {
+ if (current_profile) {
QString profile_path = current_profile->is_global ? get_global_profiles_dir() : get_profiles_dir();
- QString elided_path = pd_ui_->pathLabel->fontMetrics().elidedText(profile_path, Qt::ElideMiddle, pd_ui_->pathLabel->width());
- pd_ui_->pathLabel->setText(QString("<i><a href=\"%1\">%2</a></i>")
- .arg(QUrl::fromLocalFile(profile_path).toString())
- .arg(elided_path));
+ if (current_profile->status != PROF_STAT_DEFAULT) {
+ profile_path.append(QDir::separator()).append(current_profile->name);
+ }
+ pd_ui_->pathLabel->setText(profile_path);
+ pd_ui_->pathLabel->setUrl(QUrl::fromLocalFile(profile_path).toString());
pd_ui_->pathLabel->setToolTip(tr("Go to") + profile_path);
pd_ui_->pathLabel->setEnabled(true);
- pd_ui_->pathLabel->show();
} else {
- pd_ui_->pathLabel->hide();
+ pd_ui_->pathLabel->clear();
}
if (pd_ui_->profileTreeWidget->topLevelItemCount() > 0) {
diff --git a/ui/qt/profile_dialog.ui b/ui/qt/profile_dialog.ui
index 8f336840c3..054fa8a729 100644
--- a/ui/qt/profile_dialog.ui
+++ b/ui/qt/profile_dialog.ui
@@ -42,7 +42,7 @@
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
<item>
<widget class="QToolButton" name="newToolButton">
<property name="toolTip">
@@ -96,7 +96,7 @@
</spacer>
</item>
<item>
- <widget class="QLabel" name="pathLabel">
+ <widget class="ElidedLabel" name="pathLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
@@ -128,6 +128,13 @@
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>ElidedLabel</class>
+ <extends>QLabel</extends>
+ <header>elided_label.h</header>
+ </customwidget>
+ </customwidgets>
<resources>
<include location="../../image/toolbar.qrc"/>
</resources>
diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp
new file mode 100644
index 0000000000..58c04476a2
--- /dev/null
+++ b/ui/qt/uat_dialog.cpp
@@ -0,0 +1,524 @@
+/* uat_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 "uat_dialog.h"
+#include "ui_uat_dialog.h"
+#include "wireshark_application.h"
+
+#include "epan/strutil.h"
+#include "epan/value_string.h"
+#include "ui/help_url.h"
+#include <wsutil/report_err.h>
+
+#include "qt_ui_utils.h"
+
+#include <QDesktopServices>
+#include <QFileDialog>
+#include <QFont>
+#include <QKeyEvent>
+#include <QTreeWidget>
+#include <QTreeWidgetItemIterator>
+#include <QUrl>
+
+#include <QDebug>
+
+UatDialog::UatDialog(QWidget *parent, uat_t *uat) :
+ QDialog(parent),
+ ui(new Ui::UatDialog),
+ uat_(NULL),
+ cur_line_edit_(NULL),
+ cur_combo_box_(NULL)
+{
+ ui->setupUi(this);
+
+ ui->deleteToolButton->setEnabled(false);
+ ui->copyToolButton->setEnabled(false);
+ ok_button_ = ui->buttonBox->button(QDialogButtonBox::Ok);
+ help_button_ = ui->buttonBox->button(QDialogButtonBox::Help);
+
+#ifdef Q_OS_MAC
+ ui->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
+ ui->pathLabel->setAttribute(Qt::WA_MacSmallSize, true);
+#endif
+
+ setUat(uat);
+
+ // Need to add uat_move or uat_insert to the UAT API.
+ ui->uatTreeWidget->setDragEnabled(false);
+ qDebug() << "FIX Add drag reordering to UAT dialog";
+}
+
+UatDialog::~UatDialog()
+{
+ delete ui;
+}
+
+void UatDialog::setUat(uat_t *uat)
+{
+ QString title(tr("Unknown User Accessible Table"));
+
+ uat_ = uat;
+
+ ui->uatTreeWidget->clear();
+ ui->uatTreeWidget->setColumnCount(0);
+ ui->pathLabel->clear();
+ ui->pathLabel->setEnabled(false);
+ help_button_->setEnabled(false);
+
+ if (uat_) {
+ if (uat_->name) {
+ title = uat_->name;
+ }
+
+ QString abs_path = gchar_free_to_qstring(uat_get_actual_filename(uat_, FALSE));
+ ui->pathLabel->setText(abs_path);
+ ui->pathLabel->setUrl(QUrl::fromLocalFile(abs_path).toString());
+ ui->pathLabel->setToolTip(tr("Open ") + uat->filename);
+ ui->pathLabel->setEnabled(true);
+
+ ui->uatTreeWidget->setColumnCount(uat_->ncols);
+
+ for (guint col = 0; col < uat->ncols; col++) {
+ ui->uatTreeWidget->headerItem()->setText(col, uat_->fields[col].title);
+ }
+
+ updateItems();
+
+ if (uat_->help && strlen(uat_->help) > 0) {
+ help_button_->setEnabled(true);
+ }
+ }
+
+ setWindowTitle(title);
+}
+
+void UatDialog::keyPressEvent(QKeyEvent *evt)
+{
+ if (cur_line_edit_ && cur_line_edit_->hasFocus()) {
+ switch (evt->key()) {
+ case Qt::Key_Escape:
+ cur_line_edit_->setText(saved_string_pref_);
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ stringPrefEditingFinished();
+ return;
+ default:
+ break;
+ }
+ } else if (cur_combo_box_ && cur_combo_box_->hasFocus()) {
+ switch (evt->key()) {
+ case Qt::Key_Escape:
+ cur_combo_box_->setCurrentIndex(saved_combo_idx_);
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ // XXX The combo box eats enter and return
+ enumPrefCurrentIndexChanged(cur_combo_box_->currentIndex());
+ delete cur_combo_box_;
+ return;
+ default:
+ break;
+ }
+ }
+ QDialog::keyPressEvent(evt);
+}
+
+QString UatDialog::fieldString(guint row, guint column)
+{
+ QString string_rep;
+
+ if (!uat_) return string_rep;
+
+ void *rec = UAT_INDEX_PTR(uat_, row);
+ uat_field_t *field = &uat_->fields[column];
+ guint length;
+ const char *str;
+
+ field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data);
+
+ switch(field->mode) {
+ case PT_TXTMOD_STRING:
+ case PT_TXTMOD_ENUM:
+ case PT_TXTMOD_FILENAME:
+ case PT_TXTMOD_DIRECTORYNAME:
+ string_rep = str;
+ break;
+ case PT_TXTMOD_HEXBYTES: {
+ string_rep = bytes_to_str((const guint8 *) str, length);
+ break;
+ }
+ default:
+ g_assert_not_reached();
+ break;
+ }
+
+ return string_rep;
+}
+
+void UatDialog::updateItem(QTreeWidgetItem &item)
+{
+ if (!uat_) return;
+ guint row = item.data(0, Qt::UserRole).toUInt();
+ for (guint col = 0; col < uat_->ncols; col++) {
+ item.setText(col, fieldString(row, col));
+ }
+}
+
+void UatDialog::updateItems()
+{
+ if (!uat_) return;
+
+ // Forcibly sync ui->uaTreeWidget with uat_.
+ // It would probably be more correct to create a UatModel and
+ // use it in conjunction with a QTreeView.
+ while (ui->uatTreeWidget->topLevelItemCount() > (int) uat_->raw_data->len) {
+ delete (ui->uatTreeWidget->topLevelItem(0));
+ }
+ for (guint row = 0; row < uat_->raw_data->len; row++) {
+ QTreeWidgetItem *item = ui->uatTreeWidget->topLevelItem(row);
+ if (!item) item = new QTreeWidgetItem(ui->uatTreeWidget);
+ item->setData(0, Qt::UserRole, qVariantFromValue(row));
+ updateItem(*item);
+ }
+}
+
+void UatDialog::activateLastItem()
+{
+ int last_item = ui->uatTreeWidget->topLevelItemCount() - 1;
+ if (last_item < 0) return;
+
+ QModelIndex idx = ui->uatTreeWidget->model()->index(last_item, 0);
+ ui->uatTreeWidget->clearSelection();
+ ui->uatTreeWidget->selectionModel()->select(idx, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ ui->uatTreeWidget->itemActivated(ui->uatTreeWidget->topLevelItem(last_item), 0);
+}
+
+void UatDialog::on_uatTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
+{
+ Q_UNUSED(current)
+
+ for (int col = 0; col < ui->uatTreeWidget->columnCount(); col++) {
+ if (previous && ui->uatTreeWidget->itemWidget(previous, col)) {
+ ui->uatTreeWidget->removeItemWidget(previous, col);
+ updateItem(*previous);
+ }
+ }
+}
+
+void UatDialog::on_uatTreeWidget_itemActivated(QTreeWidgetItem *item, int column)
+{
+ if (!uat_) return;
+
+ uat_field_t *field = &uat_->fields[column];
+ guint row = item->data(0, Qt::UserRole).toUInt();
+ void *rec = UAT_INDEX_PTR(uat_, row);
+ QFileDialog::Options fd_opt = QFileDialog::DontConfirmOverwrite;
+ cur_column_ = column;
+ QWidget *editor = NULL;
+
+ // Reset any active items
+ QTreeWidgetItemIterator uat_it(ui->uatTreeWidget);
+ while (*uat_it) {
+ for (int col = 0; col < ui->uatTreeWidget->columnCount(); col++) {
+ if (ui->uatTreeWidget->itemWidget((*uat_it), col)) {
+ ui->uatTreeWidget->removeItemWidget((*uat_it), col);
+ updateItem(*(*uat_it));
+ }
+ }
+ ++uat_it;
+ }
+
+ switch(field->mode) {
+ case PT_TXTMOD_DIRECTORYNAME:
+ fd_opt |= QFileDialog::ShowDirsOnly;
+ case PT_TXTMOD_FILENAME:
+ {
+ QString cur_path = fieldString(row, column);
+ QString new_path = QFileDialog::getSaveFileName(this, field->title, cur_path, QString(), NULL, fd_opt);
+ field->cb.set(rec, new_path.toUtf8().constData(), strlen(new_path.toUtf8().constData()), field->cbdata.set, field->fld_data);
+ updateItem(*item);
+ break;
+ }
+
+ case PT_TXTMOD_STRING:
+ case PT_TXTMOD_HEXBYTES: {
+ cur_line_edit_ = new SyntaxLineEdit();
+ break;
+ }
+
+ case PT_TXTMOD_ENUM: {
+ cur_combo_box_ = new QComboBox();
+// const enum_val_t *ev;
+ const value_string *enum_vals = (const value_string *)field[column].fld_data;
+ for (int i = 0; enum_vals[i].strptr != NULL; i++) {
+ cur_combo_box_->addItem(enum_vals[i].strptr, QVariant(enum_vals[i].value));
+ if (item->text(column).compare(enum_vals[i].strptr) == 0) {
+ cur_combo_box_->setCurrentIndex(cur_combo_box_->count() - 1);
+ }
+ }
+ saved_combo_idx_ = cur_combo_box_->currentIndex();
+ break;
+ }
+ default:
+ g_assert_not_reached();
+ break;
+ }
+
+ if (cur_line_edit_) {
+ editor = cur_line_edit_;
+ cur_line_edit_->setText(fieldString(row, column));
+ cur_line_edit_->selectAll();
+ connect(cur_line_edit_, SIGNAL(destroyed()), this, SLOT(lineEditPrefDestroyed()));
+ connect(cur_line_edit_, SIGNAL(textChanged(QString)), this, SLOT(stringPrefTextChanged(QString)));
+ }
+ if (cur_combo_box_) {
+ editor = cur_combo_box_;
+ connect(cur_combo_box_, SIGNAL(currentIndexChanged(int)), this, SLOT(enumPrefCurrentIndexChanged(int)));
+ connect(cur_combo_box_, SIGNAL(destroyed()), this, SLOT(enumPrefDestroyed()));
+ }
+ if (editor) {
+ QFrame *edit_frame = new QFrame();
+ QHBoxLayout *hb = new QHBoxLayout();
+ QSpacerItem *spacer = new QSpacerItem(5, 10);
+
+ hb->addWidget(editor, 0);
+ hb->addSpacerItem(spacer);
+ hb->setStretch(1, 1);
+ hb->setContentsMargins(0, 0, 0, 0);
+
+ edit_frame->setLineWidth(0);
+ edit_frame->setFrameStyle(QFrame::NoFrame);
+ // The documentation suggests setting autoFillbackground. That looks silly
+ // so we clear the item text instead.
+ saved_string_pref_ = item->text(column);
+ item->setText(column, "");
+ edit_frame->setLayout(hb);
+ ui->uatTreeWidget->setItemWidget(item, column, edit_frame);
+ editor->setFocus();
+ }
+}
+
+void UatDialog::on_uatTreeWidget_itemSelectionChanged()
+{
+ if (ui->uatTreeWidget->selectedItems().length() > 0) {
+ ui->deleteToolButton->setEnabled(true);
+ ui->copyToolButton->setEnabled(true);
+ } else {
+ ui->deleteToolButton->setEnabled(false);
+ ui->copyToolButton->setEnabled(false);
+ }
+}
+
+void UatDialog::lineEditPrefDestroyed()
+{
+ cur_line_edit_ = NULL;
+}
+
+void UatDialog::enumPrefDestroyed()
+{
+ cur_combo_box_ = NULL;
+}
+
+void UatDialog::enumPrefCurrentIndexChanged(int index)
+{
+ QTreeWidgetItem *item = ui->uatTreeWidget->currentItem();
+ if (!cur_combo_box_ || !item || index < 0) return;
+ guint row = item->data(0, Qt::UserRole).toUInt();
+ void *rec = UAT_INDEX_PTR(uat_, row);
+ uat_field_t *field = &uat_->fields[cur_column_];
+ const char *enum_txt = cur_combo_box_->itemText(index).toUtf8().constData();
+ const char *err = NULL;
+
+ if (field->cb.chk && field->cb.chk(rec, enum_txt, strlen(enum_txt), field->cbdata.chk, field->fld_data, &err)) {
+ field->cb.set(rec, enum_txt, strlen(enum_txt), field->cbdata.set, field->fld_data);
+ ok_button_->setEnabled(true);
+ } else {
+ ok_button_->setEnabled(false);
+ }
+ uat_->changed = TRUE;
+}
+
+void UatDialog::stringPrefTextChanged(const QString &text)
+{
+ QTreeWidgetItem *item = ui->uatTreeWidget->currentItem();
+ if (!cur_line_edit_ || !item) return;
+ guint row = item->data(0, Qt::UserRole).toUInt();
+ void *rec = UAT_INDEX_PTR(uat_, row);
+ uat_field_t *field = &uat_->fields[cur_column_];
+ const char *txt = text.toUtf8().constData();
+ const char *err = NULL;
+ bool enable_ok = true;
+ SyntaxLineEdit::SyntaxState ss = SyntaxLineEdit::Empty;
+
+ if (field->cb.chk) {
+ if (field->cb.chk(rec, txt, strlen(txt), field->cbdata.chk, field->fld_data, &err)) {
+ field->cb.set(rec, txt, strlen(txt), field->cbdata.set, field->fld_data);
+ saved_string_pref_ = text;
+ ss = SyntaxLineEdit::Valid;
+ } else {
+ enable_ok = false;
+ ss = SyntaxLineEdit::Invalid;
+ }
+ }
+
+ ok_button_->setEnabled(true);
+ cur_line_edit_->setSyntaxState(ss);
+ uat_->changed = TRUE;
+}
+
+void UatDialog::stringPrefEditingFinished()
+{
+ QTreeWidgetItem *item = ui->uatTreeWidget->currentItem();
+ if (!cur_line_edit_ || !item) return;
+
+ item->setText(cur_column_, saved_string_pref_);
+ ok_button_->setEnabled(true);
+
+ updateItem(*item);
+}
+
+void UatDialog::addRecord(bool copy_from_current)
+{
+ if (!uat_) return;
+
+ void *rec = g_malloc0(uat_->record_size);
+
+ if (copy_from_current) {
+ QTreeWidgetItem *item = ui->uatTreeWidget->currentItem();
+ if (!item) return;
+ guint row = item->data(0, Qt::UserRole).toUInt();
+ if (uat_->copy_cb) {
+ uat_->copy_cb(rec, UAT_INDEX_PTR(uat_, row), uat_->record_size);
+ }
+ }
+
+ uat_add_record(uat_, rec, TRUE);
+ if (uat_->free_cb) {
+ uat_->free_cb(rec);
+ }
+ g_free(rec);
+ uat_->changed = TRUE;
+ updateItems();
+ activateLastItem();
+}
+
+void UatDialog::on_newToolButton_clicked()
+{
+ addRecord();
+}
+
+void UatDialog::on_deleteToolButton_clicked()
+{
+ QTreeWidgetItem *item = ui->uatTreeWidget->currentItem();
+ if (!uat_ || !item) return;
+
+ guint row = item->data(0, Qt::UserRole).toUInt();
+
+ uat_remove_record_idx(uat_, row);
+ updateItems();
+
+ ui->deleteToolButton->setEnabled(false);
+ ui->copyToolButton->setEnabled(false);
+ uat_->changed = TRUE;
+}
+
+void UatDialog::on_copyToolButton_clicked()
+{
+ addRecord(true);
+}
+
+void UatDialog::applyChanges()
+{
+ if (!uat_) return;
+
+ if (uat_->flags & UAT_AFFECTS_FIELDS) {
+ /* Recreate list with new fields and redissect packets */
+ wsApp->emitAppSignal(WiresharkApplication::ColumnsChanged);
+ }
+ if (uat_->flags & UAT_AFFECTS_DISSECTION) {
+ /* Just redissect packets if we have any */
+ wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
+ }
+}
+
+
+void UatDialog::on_buttonBox_accepted()
+{
+ if (!uat_) return;
+
+ if (uat_->changed) {
+ const gchar *err = NULL;
+ uat_save(uat_, &err);
+
+ if (err) {
+ report_failure("Error while saving %s: %s", uat_->name, err);
+ }
+
+ if (uat_->post_update_cb) {
+ uat_->post_update_cb();
+ }
+ applyChanges();
+ }
+}
+
+void UatDialog::on_buttonBox_rejected()
+{
+ if (!uat_) return;
+
+ if (uat_->changed) {
+ const gchar *err = NULL;
+ uat_clear(uat_);
+ uat_load(uat_, &err);
+
+ if (err) {
+ report_failure("Error while loading %s: %s", uat_->name, err);
+ }
+ applyChanges();
+ }
+}
+
+void UatDialog::on_buttonBox_helpRequested()
+{
+ if (!uat_) return;
+
+ QString help_page = uat_->help, url;
+
+ help_page.append(".html");
+ url = gchar_free_to_qstring(user_guide_url(help_page.toUtf8().constData()));
+ if (!url.isNull()) {
+ QDesktopServices::openUrl(QUrl(url));
+ }
+}
+
+/* * 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/uat_dialog.h b/ui/qt/uat_dialog.h
new file mode 100644
index 0000000000..a777230bf9
--- /dev/null
+++ b/ui/qt/uat_dialog.h
@@ -0,0 +1,93 @@
+/* uat_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 UAT_DIALOG_H
+#define UAT_DIALOG_H
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "epan/uat-int.h"
+
+#include "syntax_line_edit.h"
+
+#include <QComboBox>
+#include <QDialog>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QTreeWidgetItem>
+
+namespace Ui {
+class UatDialog;
+}
+
+class UatDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit UatDialog(QWidget *parent = 0, uat_t *uat = NULL);
+ ~UatDialog();
+
+ void setUat(uat_t *uat = NULL);
+
+protected:
+ void keyPressEvent(QKeyEvent *evt);
+
+private slots:
+ void on_uatTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+ void on_uatTreeWidget_itemActivated(QTreeWidgetItem *item, int column);
+ void on_uatTreeWidget_itemSelectionChanged();
+ void lineEditPrefDestroyed();
+ void enumPrefDestroyed();
+ void enumPrefCurrentIndexChanged(int index);
+ void stringPrefTextChanged(const QString & text);
+ void stringPrefEditingFinished();
+ void on_newToolButton_clicked();
+ void on_deleteToolButton_clicked();
+ void on_copyToolButton_clicked();
+ void on_buttonBox_accepted();
+ void on_buttonBox_rejected();
+ void on_buttonBox_helpRequested();
+
+private:
+ Ui::UatDialog *ui;
+ QPushButton *ok_button_;
+ QPushButton *help_button_;
+ uat_t *uat_;
+ int cur_column_;
+ SyntaxLineEdit *cur_line_edit_;
+ QString saved_string_pref_;
+ QComboBox *cur_combo_box_;
+ int saved_combo_idx_;
+
+ QString fieldString(guint row, guint column);
+ void updateItem(QTreeWidgetItem &item);
+ void updateItems();
+ void activateLastItem();
+ void applyChanges();
+ void addRecord(bool copy_from_current = false);
+};
+
+#endif // UAT_DIALOG_H
diff --git a/ui/qt/uat_dialog.ui b/ui/qt/uat_dialog.ui
new file mode 100644
index 0000000000..7371cea8a8
--- /dev/null
+++ b/ui/qt/uat_dialog.ui
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UatDialog</class>
+ <widget class="QDialog" name="UatDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>566</width>
+ <height>403</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="uatTreeWidget">
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
+ <item>
+ <widget class="QToolButton" name="newToolButton">
+ <property name="toolTip">
+ <string>Create a new profile using default settings.</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="deleteToolButton">
+ <property name="toolTip">
+ <string>Remove this profile.</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="copyToolButton">
+ <property name="toolTip">
+ <string>Copy this profile.</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="../../image/toolbar.qrc">
+ <normaloff>:/stock/copy-8.png</normaloff>:/stock/copy-8.png</iconset>
+ </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>
+ <item>
+ <widget class="ElidedLabel" name="pathLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ElidedLabel</class>
+ <extends>QLabel</extends>
+ <header>elided_label.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources>
+ <include location="../../image/toolbar.qrc"/>
+ </resources>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>UatDialog</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>UatDialog</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>
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index b9147378da..783d0b7407 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -1,4 +1,4 @@
-/* wireshark_application.c
+/* wireshark_application.h
*
* $Id$
*
@@ -108,7 +108,7 @@ signals:
void splashUpdate(register_action_e action, const char *message);
void configurationProfileChanged(const gchar *profile_name);
- void columnsChanged();
+ void columnsChanged(); // XXX This recreates the packet list. We might want to rename it accordingly.
void filterExpressionsChanged();
void packetDissectionChanged();
void preferencesChanged();