Skip to content

Commit

Permalink
Add a UAT dialog. Make UAT preferences uat_t * instead of void *.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
geraldcombs committed Jul 25, 2013
1 parent 7d73903 commit a05f55b
Show file tree
Hide file tree
Showing 23 changed files with 1,004 additions and 52 deletions.
4 changes: 2 additions & 2 deletions airpcap_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down
26 changes: 14 additions & 12 deletions doc/README.qt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 !
Expand Down
6 changes: 3 additions & 3 deletions epan/prefs-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};

Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions epan/prefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions epan/prefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions epan/uat-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions epan/uat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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__ */
5 changes: 5 additions & 0 deletions ui/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -125,6 +128,7 @@ set(CLEAN_FILES
splash_overlay.cpp
syntax_line_edit.cpp
time_shift_dialog.cpp
uat_dialog.cpp
wireshark_application.cpp
)

Expand Down Expand Up @@ -155,6 +159,7 @@ set(QTSHARK_UI
search_frame.ui
splash_overlay.ui
time_shift_dialog.ui
uat_dialog.ui
)

set(QTSHARK_QRC
Expand Down
10 changes: 8 additions & 2 deletions ui/qt/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -132,6 +134,7 @@ MOC_HDRS = \
splash_overlay.h \
syntax_line_edit.h \
time_shift_dialog.h \
uat_dialog.h \
wireshark_application.h


Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 = \
Expand Down
8 changes: 7 additions & 1 deletion ui/qt/QtShark.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 ??
Expand Down Expand Up @@ -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 \
Expand All @@ -258,6 +260,8 @@ HEADERS += $$HEADERS_WS_C \
splash_overlay.h \
summary_dialog.h \
tango_colors.h \
uat_dialog.h \
elided_label.h


win32 {
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Loading

0 comments on commit a05f55b

Please sign in to comment.