Commit e078389d authored by hjk's avatar hjk

Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta

parents a460e4bc e8d1b344
This diff is collapsed.
See the file doc/coding-style.qdoc
This diff is collapsed.
This diff is collapsed.
......@@ -39,12 +39,14 @@ that you:
\endlist
\section1 Submitting Code
Send your contributions to qt-creator@trolltech.com
It is implicitly understood that all patches contributed to The Qt Creator
Project are made under under the Gnu General Public License, version 2 or later
and
and currently we require that you sign a copyright assignment form. We are
working on a better solution.
If you have a problem with that, don't contribute code.
......@@ -54,12 +56,11 @@ ideas with the other developers on mailing list first.
When you create the patch, please use git or use "diff -up" since we find
that a lot easier to read than the other diff formats. Also please do not
send patches that implements or fixes several different things; several
patches is a much better option.
send patches that implement or fixes several different things; several
patches is a much better option. Or send as your a url to pull from.
We also require you to provide a commit message entry with every patch,
this describes in detail what the patch is doing.
that describes in detail what the patch is doing.
\section1 Code Constructs
......@@ -207,10 +208,168 @@ Only one declaration on each line.
\section2 Formatting
We are using the Qt Coding style, please follow the guidelines below.
Indentation
4 spaces, no tabs
Declaring variables
Declare each variable on a separate line
Avoid short (e.g., a,rbarr,nughdeget) names whenever possible
Single character variable names are only okay for counters and temporaries, where the purpose of the variable is obvious
Wait with declaring a variable until it is needed
Variables and functions start with a small letter. Each consecutive word in a variable's name starts with a capital letter
Avoid abbreviations
// Wrong
int a, b;
char *c, *d;
// Correct
int height;
int width;
char *nameOfThis;
char *nameOfThat;
Whitespace
Use blank lines to group statements together where suited
Always use only one blank line
Always use a single space after a keyword, and before a curly brace.
// Wrong
if(foo){
}
// Correct
if (foo) {
}
For pointers or references, always use a single space before '*' or '&', but never after.
Avoid C-style casts when possible.
// Wrong
char* blockOfMemory = (char* ) malloc(data.size());
// Correct
char *blockOfMemory = (char *)malloc(data.size());
char *blockOfMemory = reinterpret_cast<char *>(malloc(data.size()));
Braces
As a base rule, the left curly brace goes on the same line as the start of the statement:
// Wrong
if (codec)
{
}
// Correct
if (codec) {
}
Exception: Function implementations and class declarations always have the left brace on the start of a line:
static void foo(int g)
{
qDebug("foo: %i", g);
}
class Moo
{
};
Use curly braces when the body of a conditional statement contains more than one line, and also if a single line statement is somewhat complex.
// Wrong
if (address.isEmpty()) {
return false;
}
for (int i = 0; i < 10; ++i) {
qDebug("%i", i);
}
// Correct
if (address.isEmpty())
return false;
for (int i = 0; i < 10; ++i)
qDebug("%i", i);
Exception 1: Use braces also if the parent statement covers several lines / wraps
// Correct
if (address.isEmpty() || !isValid()
|| !codec) {
return false;
}
Exception 2: Use braces also in if-then-else blocks where either the if-code or the else-code covers several lines
// Wrong
if (address.isEmpty())
--it;
else {
qDebug("%s", qPrintable(address));
++it;
}
// Correct
if (address.isEmpty()) {
--it;
} else {
qDebug("%s", qPrintable(address));
++it;
}
// Wrong
if (a)
if (b)
...
else
...
// Correct
if (a) {
if (b)
...
else
...
}
Use curly braces when the body of a conditional statement is empty
// Wrong
while (a);
// Correct
while (a) {}
Parentheses
Use parentheses to group expressions:
// Wrong
if (a && b || c)
// Correct
if ((a && b) || c)
// Wrong
a + b & c
// Correct
(a + b) & c
Line breaks
Keep lines shorter than 100 characters; insert line breaks if necessary.
Commas go at the end of a broken line; operators start at the beginning of the new line. The operator is at the end of the line to avoid having to scroll if your editor is too narrow.
// Wrong
if (longExpression +
otherLongExpression +
otherOtherLongExpression) {
}
// Correct
if (longExpression
+ otherLongExpression
+ otherOtherLongExpression) {
}
Adapt the formatting of your code to the one used in the
other parts of Qt Creator. In case there is different formatting for
the same construct, use the one used more often.
\section2 Declarations
......@@ -228,6 +387,10 @@ Only one declaration on each line.
- Avoid global or static variables.
\section2 API/ABI stability
We currently do not gurantee any API nor ABI compatibility between releases.
\section2 File headers
If you create a new file, the top of the file should include a
......
doc/qtcreator-add-resource-wizard.png

41.7 KB | W: | H:

doc/qtcreator-add-resource-wizard.png

87.3 KB | W: | H:

doc/qtcreator-add-resource-wizard.png
doc/qtcreator-add-resource-wizard.png
doc/qtcreator-add-resource-wizard.png
doc/qtcreator-add-resource-wizard.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-add-resource.png

29 KB | W: | H:

doc/qtcreator-add-resource.png

40.6 KB | W: | H:

doc/qtcreator-add-resource.png
doc/qtcreator-add-resource.png
doc/qtcreator-add-resource.png
doc/qtcreator-add-resource.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-breakdown.png

122 KB | W: | H:

doc/qtcreator-breakdown.png

113 KB | W: | H:

doc/qtcreator-breakdown.png
doc/qtcreator-breakdown.png
doc/qtcreator-breakdown.png
doc/qtcreator-breakdown.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-buildenvironment.png

96.1 KB | W: | H:

doc/qtcreator-buildenvironment.png

270 KB | W: | H:

doc/qtcreator-buildenvironment.png
doc/qtcreator-buildenvironment.png
doc/qtcreator-buildenvironment.png
doc/qtcreator-buildenvironment.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-buildsettingstab.png

71.7 KB | W: | H:

doc/qtcreator-buildsettingstab.png

205 KB | W: | H:

doc/qtcreator-buildsettingstab.png
doc/qtcreator-buildsettingstab.png
doc/qtcreator-buildsettingstab.png
doc/qtcreator-buildsettingstab.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-buildsteps.png

79.4 KB | W: | H:

doc/qtcreator-buildsteps.png

218 KB | W: | H:

doc/qtcreator-buildsteps.png
doc/qtcreator-buildsteps.png
doc/qtcreator-buildsteps.png
doc/qtcreator-buildsteps.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-class-info.png

34.4 KB | W: | H:

doc/qtcreator-class-info.png

47.8 KB | W: | H:

doc/qtcreator-class-info.png
doc/qtcreator-class-info.png
doc/qtcreator-class-info.png
doc/qtcreator-class-info.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-intro-and-location.png

31.7 KB | W: | H:

doc/qtcreator-intro-and-location.png

43.4 KB | W: | H:

doc/qtcreator-intro-and-location.png
doc/qtcreator-intro-and-location.png
doc/qtcreator-intro-and-location.png
doc/qtcreator-intro-and-location.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-locator-methods.png

85.4 KB | W: | H:

doc/qtcreator-locator-methods.png

86.4 KB | W: | H:

doc/qtcreator-locator-methods.png
doc/qtcreator-locator-methods.png
doc/qtcreator-locator-methods.png
doc/qtcreator-locator-methods.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-new-project.png

13.7 KB | W: | H:

doc/qtcreator-new-project.png

31.4 KB | W: | H:

doc/qtcreator-new-project.png
doc/qtcreator-new-project.png
doc/qtcreator-new-project.png
doc/qtcreator-new-project.png
  • 2-up
  • Swipe
  • Onion skin
doc/qtcreator-select-modules.png

44.1 KB | W: | H:

doc/qtcreator-select-modules.png

58 KB | W: | H:

doc/qtcreator-select-modules.png
doc/qtcreator-select-modules.png
doc/qtcreator-select-modules.png
doc/qtcreator-select-modules.png
  • 2-up
  • Swipe
  • Onion skin
No preview for this file type
This diff is collapsed.
......@@ -13,12 +13,15 @@ win32 {
}
linux-* {
LIBS *= -lExtensionSystem -lAggregation
QT += svg dbus
}
TEMPLATE = app
TARGET = $$IDE_APP_TARGET
DESTDIR = ../../bin
SOURCES += main.cpp
macx {
......
......@@ -283,3 +283,4 @@ int main(int argc, char **argv)
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
return app.exec();
}
......@@ -749,7 +749,7 @@ void BaseTextEditor::moveLineUpDown(bool up)
void BaseTextEditor::cleanWhitespace()
{
d->m_document->cleanWhitespace();
d->m_document->cleanWhitespace();
}
void BaseTextEditor::keyPressEvent(QKeyEvent *e)
......@@ -1286,7 +1286,7 @@ void BaseTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
void BaseTextEditor::setStorageSettings(const StorageSettings &storageSettings)
{
d->m_document->setStorageSettings(storageSettings);
d->m_document->setStorageSettings(storageSettings);
}
//--------- BaseTextEditorPrivate -----------
......@@ -2477,17 +2477,22 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
extraAreaWidth(&markWidth);
if (e->type() == QEvent::MouseMove && e->buttons() == 0) { // mouse tracking
int highlightBlockNumber = d->extraAreaHighlightCollapseBlockNumber;
// Update which folder marker is highlighted
const int highlightBlockNumber = d->extraAreaHighlightCollapseBlockNumber;
d->extraAreaHighlightCollapseBlockNumber = -1;
if (TextBlockUserData::canCollapse(cursor.block())
if (d->m_codeFoldingVisible
&& TextBlockUserData::canCollapse(cursor.block())
&& !TextBlockUserData::hasClosingCollapseInside(cursor.block().next())
&& collapseBox(cursor.block()).contains(e->pos()))
d->extraAreaHighlightCollapseBlockNumber = cursor.blockNumber();
// Set whether the mouse cursor is a hand or normal arrow
bool hand = (e->pos().x() <= markWidth || d->extraAreaHighlightCollapseBlockNumber >= 0);
if (hand != (d->m_extraArea->cursor().shape() == Qt::PointingHandCursor))
d->m_extraArea->setCursor(hand ? Qt::PointingHandCursor : Qt::ArrowCursor);
// Start fading in or out the highlighted folding marker
if (highlightBlockNumber != d->extraAreaHighlightCollapseBlockNumber) {
d->extraAreaTimeLine->stop();
d->extraAreaTimeLine->setDirection(d->extraAreaHighlightCollapseBlockNumber >= 0?
......@@ -2504,12 +2509,12 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
if (e->button() == Qt::LeftButton) {
if (TextBlockUserData::canCollapse(cursor.block())
if (d->m_codeFoldingVisible && TextBlockUserData::canCollapse(cursor.block())
&& !TextBlockUserData::hasClosingCollapseInside(cursor.block().next())
&& collapseBox(cursor.block()).contains(e->pos())) {
setTextCursor(cursor);
toggleBlockVisible(cursor.block());
} else if (e->pos().x() > markWidth) {
} else if (d->m_marksVisible && e->pos().x() > markWidth) {
QTextCursor selection = cursor;
selection.setVisualNavigation(true);
d->extraAreaSelectionAnchorBlockNumber = selection.blockNumber();
......@@ -2519,7 +2524,7 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
} else {
d->extraAreaToggleMarkBlockNumber = cursor.blockNumber();
}
} else if (e->button() == Qt::RightButton) {
} else if (d->m_marksVisible && e->button() == Qt::RightButton) {
QMenu * contextMenu = new QMenu(this);
emit d->m_editable->markContextMenuRequested(editableInterface(), cursor.blockNumber() + 1, contextMenu);
if (!contextMenu->isEmpty())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment