Commit b33cf9b4 authored by dt's avatar dt
Browse files

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

Conflicts:
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
parents 7d4dab15 56133d4f
No preview for this file type
......@@ -69,7 +69,7 @@
\image qtcreator-breakdown.png
\seection1 The Mode Selectors
\section1 The Mode Selectors
When working in Qt Creator, you can be in one of five modes: \bold Project,
\bold Edit, \bold Debug, \bold Help, and \bold Output.
......@@ -613,7 +613,7 @@
\page creator-debugging.html
\nextpage creator-tips.html
\title Debugging With Qt Creator
\title Debugging with Qt Creator
\table
\row
......@@ -677,9 +677,9 @@
\list
\o At a particular line you want the program to stop -- click on the
left margin or press \key F9 (\key F8 for Mac Os X).
\o At the name of a function that you want the program to stop -- enter
the function's name in \gui{Set Breakpoint at Function...} under the
left margin or press \key F9 (\key F8 for Mac OS X).
\o At a function that you want the program to stop -- enter the
function's name in \gui{Set Breakpoint at Function...} under the
\gui Debug menu.
\endlist
......@@ -744,7 +744,7 @@
When the program being debugged is stopped, Qt Creator displays the nested
function calls leading to the current position as a \e call stack trace.
This stack trace is built up from \e call stack frames, each representing a
This stack trace is built up from \e{call stack frames}, each representing a
particular function. For each function, Qt Creator will try to retrieve the
file name and line number of the corresponding source files. This data is
shown in the \gui Stack view.
......@@ -765,11 +765,10 @@
\section2 Threads
The \gui Thread view displays the state of the program being debugged one
thread at a time. If a multi-threaded program is stopped, the \gui Thread
view or the combobox named \gui Thread in the debugger's status bar can
be used to switch from one thread to another. The \gui Stack view will
adjust itself accordingly.
If a multi-threaded program is stopped, the \gui Thread view or the
combobox named \gui Thread in the debugger's status bar can be used to
switch from one thread to another. The \gui Stack view will adjust itself
accordingly.
\section2 Locals and Watchers
......@@ -851,8 +850,8 @@
function, the latter the current state of the CPU registers.
Both views are mainly useful in connection with the low-level
\gui{Step single instruction} and \gui{Step over single instruction}
commands
commands.
\section1 A Walkthrough for the Debugger Frontend
......@@ -947,8 +946,9 @@
\bold{Running Qt Creator from the Command Line}
You can start Qt Creator from a command prompt with an existing session or
\c{.pro} file by giving the name as argument on the command line.
You can start Qt Creator from a command prompt with the name of an existing
session or \c{.pro} file by giving the name as argument on the command
line.
\bold{Show and Hide the Sidebar}
......
......@@ -45,7 +45,7 @@ QString CGI::encodeURL(const QString &rawText)
enc.reserve(utf.length()); // Make sure we at least have space for a normal US-ASCII URL
QByteArray::const_iterator it = utf.constBegin();
while(it != utf.constEnd()) {
while (it != utf.constEnd()) {
char ch = *it;
if (('A' <= ch && ch <= 'Z')
|| ('a' <= ch && ch <= 'z')
......@@ -54,7 +54,7 @@ QString CGI::encodeURL(const QString &rawText)
else if (ch == ' ')
enc.append('+');
else {
switch(ch) {
switch (ch) {
case '-': case '_':
case '(': case ')':
case '.': case '!':
......@@ -80,15 +80,15 @@ QString CGI::decodeURL(const QString &urlText)
{
QByteArray dec;
QString::const_iterator it = urlText.constBegin();
while(it != urlText.constEnd()) {
while (it != urlText.constEnd()) {
ushort ch = (*it).unicode();
switch(ch) {
switch (ch) {
case '%':
{
char c1 = char(0x00ff & (*(++it)).unicode());
char c2 = char(0x00ff & (*(++it)).unicode());
ushort v = 0;
if('A' <= c1 && c1 <= 'Z')
if ('A' <= c1 && c1 <= 'Z')
v = c1 - 'A' + 10;
else if ('a' <= c1 && c1 <= 'z')
v = c1 - 'a' + 10;
......@@ -97,7 +97,7 @@ QString CGI::decodeURL(const QString &urlText)
else
continue; // Malformed URL!
v <<= 4; // c1 was MSB half
if('A' <= c2 && c2 <= 'Z')
if ('A' <= c2 && c2 <= 'Z')
v |= c2 - 'A' + 10;
else if ('a' <= c2 && c2 <= 'z')
v |= c2 - 'a' + 10;
......@@ -123,7 +123,7 @@ QString CGI::decodeURL(const QString &urlText)
// -------------------------------------------------------------------------------------------------
inline const char *unicodeToHTML(ushort unicode_char)
{
switch(unicode_char) {
switch (unicode_char) {
// Latin -------------------------------
case 0x0022: return "quot"; // (34 ) quotation mark = APL quote
case 0x0026: return "amp"; // (38 ) ampersand
......
......@@ -66,10 +66,8 @@ FileDataList splitDiffToFiles(const QByteArray &data)
// The algorithm works like this:
// On the first match we only get the filename of the first patch part
// On the second match (if any) we get the diff content, and the name of the next file patch
//
while(-1 != (splitIndex = splitExpr.indexIn(strData,splitIndex))) {
while (-1 != (splitIndex = splitExpr.indexIn(strData,splitIndex))) {
if (!filename.isEmpty()) {
QString content = strData.mid(previousSplit, splitIndex - previousSplit);
ret.append(FileData(filename, content.toLatin1()));
......
......@@ -125,7 +125,7 @@ QString View::getComment()
QByteArray View::getContent()
{
QByteArray newContent;
for(int i = 0; i < m_ui.uiPatchList->count(); ++i) {
for (int i = 0; i < m_ui.uiPatchList->count(); ++i) {
QListWidgetItem *item = m_ui.uiPatchList->item(i);
if (item->checkState() != Qt::Unchecked)
newContent += m_parts.at(i).content;
......@@ -159,7 +159,7 @@ int View::show(const QString &user, const QString &description, const QString &c
QByteArray content;
m_parts = parts;
m_ui.uiPatchList->clear();
foreach(const FileData part, parts) {
foreach (const FileData part, parts) {
QListWidgetItem *itm = new QListWidgetItem(part.filename, m_ui.uiPatchList);
itm->setCheckState(Qt::Checked);
itm->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
......
......@@ -511,6 +511,12 @@ Identifier *Control::findOrInsertIdentifier(const char *chars)
return findOrInsertIdentifier(chars, length);
}
Control::IdentifierIterator Control::firstIdentifier() const
{ return d->identifiers.begin(); }
Control::IdentifierIterator Control::lastIdentifier() const
{ return d->identifiers.end(); }
StringLiteral *Control::findOrInsertStringLiteral(const char *chars, unsigned size)
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
......
......@@ -151,6 +151,11 @@ public:
Identifier *findOrInsertIdentifier(const char *chars, unsigned size);
Identifier *findOrInsertIdentifier(const char *chars);
typedef const Identifier *const *IdentifierIterator;
IdentifierIterator firstIdentifier() const;
IdentifierIterator lastIdentifier() const;
StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
StringLiteral *findOrInsertStringLiteral(const char *chars);
......
......@@ -409,7 +409,7 @@ QVariant HelpViewer::loadResource(int type, const QUrl &name)
void HelpViewer::openLinkInNewTab()
{
if(lastAnchor.isEmpty())
if (lastAnchor.isEmpty())
return;
parentWidget->setSourceInNewTab(QUrl(lastAnchor));
......
......@@ -174,7 +174,7 @@ int main(int argc, char **argv)
return 1;
}
foreach(QString fileName, fileNames)
foreach (const QString &fileName, fileNames)
if (const int rc = format(fileName))
return rc;
......
......@@ -139,7 +139,7 @@ bool ProEditor::eventFilter(QObject *, QEvent *event)
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent *k = static_cast<QKeyEvent*>(event);
if (k->modifiers() == Qt::ControlModifier) {
switch(k->key()) {
switch (k->key()) {
case Qt::Key_X:
cut(); return true;
case Qt::Key_C:
......@@ -168,11 +168,8 @@ void ProEditor::updatePasteAction()
bool pasteEnabled = false;
const QMimeData *data = QApplication::clipboard()->mimeData();
if (data) {
if (data->hasFormat(QLatin1String("application/x-problock"))) {
pasteEnabled = true;
}
}
if (data && data->hasFormat(QLatin1String("application/x-problock")))
pasteEnabled = true;
m_pasteAction->setEnabled(pasteEnabled);
}
......
......@@ -732,13 +732,10 @@ bool ProEditorModel::insertItem(ProItem *item, int row, const QModelIndex &paren
void ProEditorModel::markProFileModified(QModelIndex index)
{
while(index.isValid())
{
if( proItem(index)->kind() == ProItem::BlockKind)
{
while (index.isValid()) {
if (proItem(index)->kind() == ProItem::BlockKind) {
ProBlock * block = proBlock(index);
if(block->blockKind() == ProBlock::ProFileKind)
{
if (block->blockKind() == ProBlock::ProFileKind) {
ProFile * file = static_cast<ProFile *>(block);
file->setModified(true);
return;
......@@ -791,9 +788,9 @@ QString ProEditorModel::expressionToString(ProBlock *block, bool display) const
{
QString result;
QList<ProItem*> items = block->items();
for(int i=0; i<items.count(); ++i) {
for (int i = 0; i < items.count(); ++i) {
ProItem *item = items.at(i);
switch(item->kind()) {
switch (item->kind()) {
case ProItem::FunctionKind: {
ProFunction *v = static_cast<ProFunction*>(item);
result += v->text();
......@@ -808,14 +805,16 @@ QString ProEditorModel::expressionToString(ProBlock *block, bool display) const
} else {
result += v->text();
}
break; }
break;
}
case ProItem::OperatorKind: {
ProOperator *v = static_cast<ProOperator*>(item);
if (v->operatorKind() == ProOperator::NotOperator)
result += QLatin1Char('!');
else
result += QLatin1Char('|');
break; }
break;
}
case ProItem::ValueKind:
case ProItem::BlockKind:
break; // ### unhandled
......@@ -847,7 +846,7 @@ QList<ProItem *> ProEditorModel::stringToExpression(const QString &exp) const
bool c = false;
QString tmpstr;
for (int i=0; i<exp.length(); ++i) {
for (int i = 0; i < exp.length(); ++i) {
QChar tmpchar = exp.at(i);
if (tmpchar == '(') ++p;
else if (tmpchar == ')') --p;
......
......@@ -332,7 +332,7 @@ void ProFileEvaluator::Private::insertOperator(const char op)
updateItem();
ProOperator::OperatorKind opkind;
switch(op) {
switch (op) {
case '!':
opkind = ProOperator::NotOperator;
break;
......@@ -532,21 +532,21 @@ bool ProFileEvaluator::Private::visitEndProFile(ProFile * pro)
evaluateFile(mkspecDirectory + "/features/default_post.prf", &ok);
QStringList processed;
while(1) {
while (1) {
bool finished = true;
QStringList configs = values("CONFIG");
for(int i = configs.size()-1; i >= 0; --i) {
for (int i = configs.size()-1; i >= 0; --i) {
const QString config = configs[i].toLower();
if(!processed.contains(config)) {
if (!processed.contains(config)) {
processed.append(config);
evaluateFile(mkspecDirectory + "/features/" + config + ".prf", &ok);
if(ok) {
if (ok) {
finished = false;
break;
}
}
}
if(finished)
if (finished)
break;
}
}
......
......@@ -173,41 +173,41 @@ static QStringList split_arg_list(QString params)
const QChar *params_data = params.data();
const int params_len = params.length();
int last = 0;
while(last < params_len && ((params_data+last)->unicode() == SPACE
while (last < params_len && ((params_data+last)->unicode() == SPACE
/*|| (params_data+last)->unicode() == TAB*/))
++last;
for(int x = last, parens = 0; x <= params_len; x++) {
for (int x = last, parens = 0; x <= params_len; x++) {
unicode = (params_data+x)->unicode();
if(x == params_len) {
while(x && (params_data+(x-1))->unicode() == SPACE)
if (x == params_len) {
while (x && (params_data+(x-1))->unicode() == SPACE)
--x;
QString mid(params_data+last, x-last);
if(quote) {
if(mid[0] == quote && mid[(int)mid.length()-1] == quote)
if (quote) {
if (mid[0] == quote && mid[(int)mid.length()-1] == quote)
mid = mid.mid(1, mid.length()-2);
quote = 0;
}
args << mid;
break;
}
if(unicode == LPAREN) {
if (unicode == LPAREN) {
--parens;
} else if(unicode == RPAREN) {
} else if (unicode == RPAREN) {
++parens;
} else if(quote && unicode == quote) {
} else if (quote && unicode == quote) {
quote = 0;
} else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
} else if (!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
quote = unicode;
} else if(!parens && !quote && unicode == COMMA) {
} else if (!parens && !quote && unicode == COMMA) {
QString mid = params.mid(last, x - last).trimmed();
args << mid;
last = x+1;
while(last < params_len && ((params_data+last)->unicode() == SPACE
while (last < params_len && ((params_data+last)->unicode() == SPACE
/*|| (params_data+last)->unicode() == TAB*/))
++last;
}
}
for(int i = 0; i < args.count(); i++)
for (int i = 0; i < args.count(); i++)
unquote(&args[i]);
return args;
}
......@@ -227,22 +227,22 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false
const QChar *vals_data = vals.data();
const int vals_len = vals.length();
for(int x = 0, parens = 0; x < vals_len; x++) {
for (int x = 0, parens = 0; x < vals_len; x++) {
QChar c = vals_data[x];
if (x != vals_len-1 && c == BACKSLASH &&
vals_data[x+1].unicode() == '\'' || vals_data[x+1] == DOUBLEQUOTE) {
build += vals_data[x++]; // get that 'escape'
} else if (!quote.isEmpty() && c == quote.top()) {
quote.pop();
} else if(c == SINGLEQUOTE || c == DOUBLEQUOTE) {
} else if (c == SINGLEQUOTE || c == DOUBLEQUOTE) {
quote.push(c);
} else if(c == RPAREN) {
} else if (c == RPAREN) {
--parens;
} else if(c == LPAREN) {
} else if (c == LPAREN) {
++parens;
}
if(!parens && quote.isEmpty() && ((do_semicolon && c == SEMICOLON) ||
if (!parens && quote.isEmpty() && ((do_semicolon && c == SEMICOLON) ||
vals_data[x] == Option::field_sep)) {
ret << build;
build.clear();
......@@ -250,7 +250,7 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false
build += vals_data[x];
}
}
if(!build.isEmpty())
if (!build.isEmpty())
ret << build;
return ret;
}
......@@ -262,7 +262,7 @@ static QStringList qmake_mkspec_paths()
QByteArray qmakepath = qgetenv("QMAKEPATH");
if (!qmakepath.isEmpty()) {
const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath));
for(QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
ret << ((*it) + concat);
}
ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
......
......@@ -137,7 +137,7 @@ void ProWriter::writeBlock(ProBlock *block, const QString &indent)
if (block->blockKind() & ProBlock::VariableKind) {
ProVariable *v = static_cast<ProVariable*>(block);
m_out << v->variable();
switch(v->variableOperator()) {
switch (v->variableOperator()) {
case ProVariable::AddOperator:
m_out << QLatin1String(" += "); break;
case ProVariable::RemoveOperator:
......@@ -165,12 +165,12 @@ void ProWriter::writeBlock(ProBlock *block, const QString &indent)
}
QList<ProItem*> items = block->items();
for (int i=0; i<items.count(); ++i) {
for (int i = 0; i < items.count(); ++i) {
m_writeState &= ~LastItem;
m_writeState &= ~FirstItem;
if (i == 0)
m_writeState |= FirstItem;
if (i == (items.count()-1))
if (i == items.count() - 1)
m_writeState |= LastItem;
writeItem(items.at(i), newindent);
}
......
......@@ -104,7 +104,7 @@ QDomNode ProXmlParser::createItemNode(QDomDocument doc, ProItem *item) const
tag = doc.createElement(QLatin1String("block"));
}
foreach(ProItem *child, block->items()) {
foreach (ProItem *child, block->items()) {
QDomNode childNode = createItemNode(doc, child);
if (!childNode.isNull())
tag.appendChild(childNode);
......
......@@ -131,7 +131,7 @@ void ValueEditor::initialize()
connect(m_itemListWidget, SIGNAL(itemChanged(QListWidgetItem *)),
this, SLOT(updateItemChanges(QListWidgetItem *)));
foreach(ProVariableInfo *varinfo, m_infomanager->variables()) {
foreach (ProVariableInfo *varinfo, m_infomanager->variables()) {
m_varComboBox->addItem(varinfo->name(), varinfo->id());
}
......
......@@ -151,7 +151,7 @@ bool ResourceFile::save()
const QStringList name_list = prefixList();
foreach (QString name, name_list) {
foreach (const QString &name, name_list) {
FileList file_list;
QString lang;
foreach (Prefix *pref, m_prefix_list) {
......@@ -164,7 +164,7 @@ bool ResourceFile::save()
QDomElement relt = doc.createElement(QLatin1String("qresource"));
root.appendChild(relt);
relt.setAttribute(QLatin1String("prefix"), name);
if(!lang.isEmpty())
if (!lang.isEmpty())
relt.setAttribute(QLatin1String("lang"), lang);
foreach (const File *f, file_list) {
......@@ -622,14 +622,14 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
// Prefix node
stringRes = prefix->name;
const QString &lang = prefix->lang;
if(!lang.isEmpty())
if (!lang.isEmpty())
appendParenthesized(lang, stringRes);
} else {
// File node
Q_ASSERT(file != NULL);
stringRes = QFileInfo(file->name).fileName();
const QString alias = file->alias;
if(!alias.isEmpty())
if (!alias.isEmpty())
appendParenthesized(alias, stringRes);
}
result = stringRes;
......@@ -654,7 +654,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
QString conv_file = m_resource_file.relativePath(file->name);
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
const QString &alias_file = file->alias;
if(!alias_file.isEmpty())
if (!alias_file.isEmpty())
appendParenthesized(alias_file, stringRes);
result = stringRes;
......@@ -696,7 +696,7 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
QString ResourceModel::lang(const QModelIndex &index) const
{
if(!index.isValid())
if (!index.isValid())
return QString();
return m_resource_file.lang(index.row());
......@@ -704,14 +704,14 @@ QString ResourceModel::lang(const QModelIndex &index) const
QString ResourceModel::alias(const QModelIndex &index) const
{
if(!index.isValid() || !index.parent().isValid())
if (!index.isValid() || !index.parent().isValid())
return QString();
return m_resource_file.alias(index.parent().row(), index.row());
}
QString ResourceModel::file(const QModelIndex &index) const
{
if(!index.isValid() || !index.parent().isValid())
if (!index.isValid() || !index.parent().isValid())
return QString();
return m_resource_file.file(index.parent().row(), index.row());
}
......@@ -852,7 +852,7 @@ void ResourceModel::changePrefix(const QModelIndex &model_idx, const QString &pr
if (m_resource_file.prefix(prefix_idx) == ResourceFile::fixPrefix(prefix))
return;
if(m_resource_file.contains(prefix))
if (m_resource_file.contains(prefix))
return;
m_resource_file.replacePrefix(prefix_idx, prefix);
......@@ -880,7 +880,7 @@ void ResourceModel::changeAlias(const QModelIndex &index, const QString &alias)
if (!index.parent().isValid())
return;
if(m_resource_file.alias(index.parent().row(), index.row()) == alias)
if (m_resource_file.alias(index.parent().row(), index.row()) == alias)
return;
m_resource_file.replaceAlias(index.parent().row(), index.row(), alias);
emit dataChanged(index, index);
......
......@@ -476,7 +476,7 @@ bool ResourceView::load(QString fileName)
const QFileInfo fi(fileName);
m_qrcModel->setFileName(fi.absoluteFilePath());
if(!fi.exists())
if (!fi.exists())
return false;
const bool result = m_qrcModel->reload();
......@@ -501,9 +501,8 @@ void ResourceView::changePrefix(const QModelIndex &index)
QString const prefixAfter = QInputDialog::getText(this, tr("Change Prefix"), tr("Input Prefix:"),
QLineEdit::Normal, prefixBefore, &ok);
if (ok) {
if (ok)
addUndoCommand(preindex, PrefixProperty, prefixBefore, prefixAfter);
}
}
void ResourceView::changeLang(const QModelIndex &index)
......@@ -522,7 +521,7 @@ void ResourceView::changeLang(const QModelIndex &index)
void ResourceView::changeAlias(const QModelIndex &index)
{
if(!index.parent().isValid())
if (!index.parent().isValid())
return;
bool ok = false;
......@@ -531,9 +530,8 @@ void ResourceView::changeAlias(const QModelIndex &index)
QString const aliasAfter = QInputDialog::getText(this, tr("Change File Alias"), tr("Alias:"),
QLineEdit::Normal, aliasBefore, &ok);
if (ok) {
if (ok)
addUndoCommand(index, AliasProperty, aliasBefore, aliasAfter);
}
}
QString ResourceView::currentAlias() const
......@@ -585,15 +583,16 @@ void ResourceView::changeValue(const QModelIndex &nodeIndex, NodeProperty proper
}
}
void ResourceView::advanceMergeId() {