aboutsummaryrefslogtreecommitdiffstats
path: root/doc/README.qt
blob: 93d646bdcafd8dc34a0de699ec777cffbcaeb165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
0. Abstract

Wireshark's user interface is showing its age. While GTK+ is wonderful on
Linux and BSD its low-tier status on Windows and even-lower-tier status on OS
X makes it hard to deliver a good product to users on those platforms.

The Qt port is an attempt at an updated UI which will better serve our users
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.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:

1) Qt Creator + CMake:

   Open the top-level CMakeLists.txt within Qt Creator. It should ask you to
   choose a build location. Do so. It should then ask you to run CMake. Fill in
   any desired build arguments (e.g. "-D CMAKE_BUILD_TYPE:STRING=Debug" or
   "-D ENABLE_GTK3:BOOL=OFF") and click the "Run CMake" button. When that
   completes select "Build → Open Build and Run Kit Selector..." and make
   sure wireshark is selected.

2) CMake:

   Qt (BUILD_wireshark) is enabled by default. Use the "cmake" command to
   configure a normal out-of-tree or in-tree build, e.g.

    mkdir cmakebuild
    cd cmakebuild
    cmake
    make

   Note that CMake builds an application bundle (Wireshark.app) on Mac OS X
   by default. Use the option "-DENABLE_APPLICATION_BUNDLE=OFF" to create a
   traditional UNIX/POSIX build.

3) Autotools:

   Qt (--with-qt) is enabled by default.

4) Qt Creator + QtShark.pro:

   NOTE: The bulk of Wireshark isn't a qmake project and the ui/qt directory is
   loosely coupled with the rest of the codebase. When the CMake environment
   matures to a sufficient state QtShark.pro will probably be removed.

Work is in progress on this.)

1.1 Prerequisites

Before compiling you need the Qt SDK and Qt Creator.

1.1.1 OS X

Download the latest Qt Library + Qt Creator (currently 5.3) from
http://qt-project.org/downloads/ and install it. For a more native
look and feel you should also install Qt Mac Extras:

    git clone http://qt.gitorious.org/qt/qtmacextras.git
    cd qtmacextras
    /path/to/qt5/qmake qtmacextras.pro
    make
    make -n install
    # Make sure install output looks sensible
    make install

This may or may not work for you; see

    https://bugreports.qt-project.org/browse/QTBUG-32594

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-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
compile Wireshark in the top-level source directory. You can create it by
hand by running "nmake -f Makefile.nmake ui\qt\config.pri".

Qt Creator can be used to compile and run Wireshark.  Alternatively qmake
and nmake at the cmd line can be used.

The Windows Qt version of Wireshark will be compiled and linked with
essentially the same options as that used when building the Gtk version of
Wireshark.

1.1.2.1 Qt Creator

Before compiling in Qt Creator select "Projects" in the left toolbar,
select "Build Settings" and do the following:

- In "Edit build configuration" make sure the "Release" build is selected.
  (The "Debug" build won't work unless Wireshark is recompiled to link with a "debug"
   the "debug" C runtime library (using /MDd). See ui\qt\QtShark.pro for details).

- Make sure "Qt version" matches your version of Visual Studio.
- Make sure "Tool chain" matches your Visual C++ version.

If you require plugin support select "Run Settings" and add
"WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1" to the Run Environment.

XXX: (WMeier): I've not had too much satisfaction using the "native Windows debugger" (CDB ?)
     accessed via Qt Creator. (In fact, a web search turns up some fairly negative comments
     about the debugger. I've successfully (and pretty easily) been able to use the
     Visual Studio debugger; See below under "Command Line".
     ToDo: Investigate "Qt Visual Studio AddIn":
           http://developer.qt.nokia.com/wiki/QtVSAddin#6112edd2e39a1695c242723d5c764aae

1.1.2.2 Command Line

- Setup environment:
    c:\qt\4.8.0\bin\qtvars.bat [vsvars]     ;;; optional 'vsvars' to also setup VC env vars

- [Create and] Switch to a working dir to be used for .obj files, etc for Wireshark-qt compilation

- Use qmake to create Windows Makefile (based upon info in ui\qt\QtShark.pro and config.pri)
    qmake -o Makefile.nmake ..\..\ui\qt\QtShark.pro
                                  ;; (Only needs to be run once;
                                  ;; nmake -f Makefile.nmake  will redo qmake if any
                                  ;; dependendencies (e.g., QtShark.pro) change.

- Compile & Build
    nmake -f Makefile.nmake       ;; qtshark.exe + all DLL's will be in <working-dir>\wireshark-qt-debug
- Run:
    <working-dir>\wireshark-qt-debug

- Debug (with Visual Studio debugger)
    Start Visual Studio;
    File ! Open ! Project/Solution  ! .../<working-dir>/wireshark-qt-debug/qtshark.exe
    (Using  Solution Explorer ! Properties ! Environment to
     add PATH=C:\Qt\4.8.0\bin;%PATH% will pobably be required).
    ... Debug in the usual manner


1.1.3 Linux

Install the Qt libraries and Qt Creator via your package manager or from
http://qt-project.org/downloads/. On Debian and Ubuntu the "qt-sdk" (and qttools5-dev when use Qt5) 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".

1.2 Other tools

GammaRay lets you inspect the internals of a running Qt application
similar to Spy++ on Windows.

http://www.kdab.com/kdab-products/gammaray/

2. Going forward

DO NOT simply port things over. Much of the GTK+ interface reflects historical
UI conventions and API restrictions which are either no longer relevant or have
been superseded. Every feature, window, and element should be re-thought. When
porting a feature, consider the following:

- Workflow. Excessive navigation and gratuitous dialogs should be avoided or
  reduced. For example, the two GTK+ flow graph dialogs have been combined into
  one in Qt. Many alert dialogs have been replaced with status bar messages.

- Feedback. Most of the Qt dialogs provide a "hint" area near the bottom which
  shows useful information. For example, the "Follow Stream" dialog shows the
  packet corresponding to the text under the mouse. The profile management
  dialog shows a clickable path to the current profile.

2.1 Coding guidelines

2.1.1 Name conventions

Most of the code in the ui/qt directory uses three APIs: Qt (which uses
InterCapConvention), GLib (which uses underscore_convention), and the Wireshark
API (which also uses underscore_convention). As a general rule Wireshark's Qt
code uses InterCapConvention for class names and methods and
underscore_convention for variables, with a trailing underscore for member
variables.

2.1.2 Strings

If you're using GLib string functions or plain old C character array idioms in
Qt-only code you're probably doing something wrong. QStrings are generally
*much* safer and easier to use. They also make translations eaiser.

If you need to pass strings between Qt and GLib you can use qstring_strdup
gchar_free_to_qstring, which are defined in ui/qt/qt_ui_utils.h.

2.1.3 Mixing C and C++

Sometimes we have to call C++ functions from one of Wireshark's C callbacks and
pass C++ objects to or from C. The C++ FAQ describes how to do this safely:

http://www.parashift.com/c++-faq/mixing-c-and-cpp.html

2.2 Changes

- The display filter entry has been significantly reworked.

- The welcome screen has been reworked. The interface list includes sparklines

- "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.

- Some dialogs (file sets, profiles, and UATs) provide a link to filesystem paths
  where appropriate.

3. Translations (i18n)

Qt makes translating the Wireshark UI into different languages easy.

- Add your translation (ui/qt/wireshark_XX.ts) in ui/qt/Wireshark.pro, ui/qt/i18n.qrc,
    ui/qt/Makefile.common and ui/qt/CMakeLists.txt .
- Add also in epan/prefs.c, in ui/qt/main.cpp add case in switch(prefs_p->gui_qt_language)
    and in ui/qt/main_window_preferences_frame.ui (use qt-design) to add in prefs.
- Run "lupdate Wireshark.pro" to generate/update your translation file.
- Translate with Qt Linguist.
- Run "lrelease Wireshark.pro" to create/update wireshark_xx.qm file.
- Push your translation to Gerrit for review ("git push").

More information about Qt Linguist
http://qt-project.org/doc/qt-4.8/linguist-manual.html