Skip to content
kehugter edited this page Mar 2, 2016 · 21 revisions

Guidelines for code and contributing it.

C++11

Coding style

function()
{
    1st_line;
    2nd_line;
}

// if / while / for / switch
if ()
    1_line;
else if ()
    just_one_line;
else
    each_condition;

// ↑ note space between last line of conditional code, and code outside of condition
if ()
{
    1_line;
}
else if ()
{
    what_if;
    i_told_you;
}
else
{
    that_there_are;
    more_lines;
}

QObject* asterisksGoWithTheType;
uint8_t* array = new uint8_t[count];

QObject notToMentionThatWeUseCamelCase;
// “// camelCase for variables, CamelCase for classes”

E.g. https://github.com/tux3/qTox/blob/master/src/misc/flowlayout.cpp

No translatable HTML tags

Do not put HTML in UI files, or inside tr(). Instead, you can put put it in C++ code in the following way, to make only user-facing text translatable:

someWidget->setTooltip(
    QStringLiteral("<html><!-- some HTML text -->") + tr("Translatable text…") + QStringLiteral("</html>");

general tips

Limitations

Filesystem

Windows' unbeaten beauty and clarity:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx

Symbols that should be forbidden for filenames under Windows:

< > : " / \ | ? *

Clone this wiki locally