summaryrefslogtreecommitdiffstats
path: root/quanta/HACKING
diff options
context:
space:
mode:
Diffstat (limited to 'quanta/HACKING')
-rw-r--r--quanta/HACKING55
1 files changed, 55 insertions, 0 deletions
diff --git a/quanta/HACKING b/quanta/HACKING
new file mode 100644
index 00000000..6e46dedb
--- /dev/null
+++ b/quanta/HACKING
@@ -0,0 +1,55 @@
+ Quanta's coding style is a real mess as it was written by many persons, and
+some had changed their style on-the-fly. ;-) From now on, if you add new code
+to Quanta please follow the below rules:
+
+1. Use spaces instead of tabs.
+2. Indent with 2 spaces.
+3. Do not put spaces around parentheses, except in one case (grouping multiple
+ expressions): if ( (A || B) && (C || D) )
+4. Do not put spaces around "->", use: object->methodname().
+5. No extra spaces between parameters/arguments, just after commas: method(arg1, arg2, ...)
+6. Put spaces around =, >, <, !=, +, -, /, *: a = b * c / d
+7. Name the member variables as m_variablename if they are not public. See #8.
+8. Try to avoid public member variables. Write instead set/get methods. See #9.
+9. Don't put the "get" prefix ahead of the get method. Example:
+ Variable: m_foo
+ Get method: foo()
+ Set method: setFoo()
+10. Mention the argument names also in header files. Signals may be an exception.
+11. Use 0L when setting a pointer to NULL.
+12. I prefer to put the opening { in a new line, but I'm not strongly against putting
+ it in the same line as the expression, like: if (a) {
+13. Avoid inclusions in header files. Use forward declarations instead, like:
+ Header file:
+ class Foo;
+ class Foo2{
+ Foo* m_foo;
+ }
+ Implementation file:
+ #include "foo.h"
+14. Use .h and .cpp for file extension.
+15. Use layouts when creating UI files, otherwise the UI components are not resized when you
+ resize the main widget, translated interfaces or when you use another widget style the
+ dialog might look bad. The simple way to do this is in Qt Designer: click on an empty space
+ and Ctrl-G. Do it first for every container style widget (boxes, frames, tabwidget tabs, etc.)
+ Try to resize the dialog after you preview it.
+16. Make the tab order in widgets logical. Preview it and press tabs to see in which order are the
+ components focused.
+17. 15 and 16 is valid for Kommander scripts as well.
+18. Include the moc files in the .cpp files: use
+ #include "qobject_derivated_class_file.moc"
+ at the end of the cpp files.
+19. Avoid the usage of .ui.h files (implementing the slots in Designer). The reasons behind this rule
+ are:
+ - the automake/autoconf framework won't detect if you make a change in the .ui.h file and the
+ file won't be recompiled if you modify it. Aside of being annoying can lead to unexpected
+ runtime and linking errors.
+ - it's nicer to edit the sources in KDevelop. ;-)
+ So instead of using .ui.h, create a derived class, and implement the slots/methods there. You can
+ still create and connect slots in Designer.
+20. Create a new file for each (non-trivial) class.
+21. Use forward declarations.
+22. Put the inclusion for the class's header file as the first inclusion in the implemenetation file.
+
+
+Last, but not least read the howto's and faq's on http://developer.kde.org