HACKING 2.07 KB
Newer Older
1 2
Small Hacking file for the Qt Interface

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
3
If you ever code for Qt interface, please read this before.
4

Steve Lhomme's avatar
Steve Lhomme committed
5
** Code Conventions **
6 7 8 9 10 11 12 13 14 15 16

Please respect VLC code conventions here:
 - NO trailing spaces
 - NO tab
 - Indentation is 4 spaces
 - Braces ARE indented
 - Space before and after operators
 - Case labels are on the same column as the switch

Refer to http://wiki.videolan.org/Code_Conventions it should be up to date

17 18 19 20
** Include order **

- VLC include/*.h includes
- Other VLC .h includes (gruiking :D)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
21
- Qt module includes
22 23
- Qt includes

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
** Naming **
This naming is stupid and inconsistent :D

Try to prefix with psz_, i_, b_, ui_ for the normal basic C/C++ styles.

If you have spare time, prefix QString with qs_.

Use aPointerName over a_pointer_name for long names.

** QVLCFrame vs QVLCDialog **

A QVLCFrame is just a QWidget, without any parent and used as a Qt::Windows
A QVLCDialog is a QDialog.

This mean that the QVLCDialog is centered on the parent and ABOVE it, will be destroyed by the parent automatically.
This also mean that you have to destroy the QVLCFrame and to save its position/size.

So if your dialog is a dialog you are used to keep during a playing of a video, then use a QVLCFrame, else use a QVLCDialog, if this is something you do over anything else.

QVLCFrame: extended panel, messages...
QVLCDialog: preferences, open...
45

46 47 48 49 50 51 52 53
** virtual vs Q_DECL_OVERRIDE **
Only mark functions with the virtual keyword if this is the initial virtual
declaration. Functions that override a virtual function should have the
Q_DECL_OVERRIDE macro appended (which expands to the override identifier
when compiled with Qt5 and C++11). This is a visual indicator to distinguish
virtual declarations from overriding implementations and will include a
compile-time check in C++11 language mode.

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
54
** HIG for Qt **
55 56 57 58 59 60 61 62 63 64 65 66 67
We tend to use GNOME/KDE specs over Vista ones for capitalizations:
We use Header for:
 - Menu
 - Menu items
 - GroupBox Titles
 - Windows and dialog Titles
We use Sentence for:
 - CheckBoxes
 - ComboBox list
 - ComboBox labels
 - Tooltips

We use "..." after a menu item if it opens another dialog.