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

This commit is contained in:
hjk
2008-12-08 18:26:32 +01:00
7 changed files with 77 additions and 67 deletions

View File

@@ -69,7 +69,7 @@
\image qtcreator-breakdown.png \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, When working in Qt Creator, you can be in one of five modes: \bold Project,
\bold Edit, \bold Debug, \bold Help, and \bold Output. \bold Edit, \bold Debug, \bold Help, and \bold Output.
@@ -613,7 +613,7 @@
\page creator-debugging.html \page creator-debugging.html
\nextpage creator-tips.html \nextpage creator-tips.html
\title Debugging With Qt Creator \title Debugging with Qt Creator
\table \table
\row \row
@@ -677,9 +677,9 @@
\list \list
\o At a particular line you want the program to stop -- click on the \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). 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 \o At a function that you want the program to stop -- enter the
the function's name in \gui{Set Breakpoint at Function...} under the function's name in \gui{Set Breakpoint at Function...} under the
\gui Debug menu. \gui Debug menu.
\endlist \endlist
@@ -744,7 +744,7 @@
When the program being debugged is stopped, Qt Creator displays the nested 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. 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 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 file name and line number of the corresponding source files. This data is
shown in the \gui Stack view. shown in the \gui Stack view.
@@ -765,11 +765,10 @@
\section2 Threads \section2 Threads
The \gui Thread view displays the state of the program being debugged one If a multi-threaded program is stopped, the \gui Thread view or the
thread at a time. If a multi-threaded program is stopped, the \gui Thread combobox named \gui Thread in the debugger's status bar can be used to
view or the combobox named \gui Thread in the debugger's status bar can switch from one thread to another. The \gui Stack view will adjust itself
be used to switch from one thread to another. The \gui Stack view will accordingly.
adjust itself accordingly.
\section2 Locals and Watchers \section2 Locals and Watchers
@@ -851,8 +850,8 @@
function, the latter the current state of the CPU registers. function, the latter the current state of the CPU registers.
Both views are mainly useful in connection with the low-level Both views are mainly useful in connection with the low-level
\gui{Step single instruction} and \gui{Step over single instruction} \gui{Step single instruction} and \gui{Step over single instruction}
commands commands.
\section1 A Walkthrough for the Debugger Frontend \section1 A Walkthrough for the Debugger Frontend
@@ -947,8 +946,9 @@
\bold{Running Qt Creator from the Command Line} \bold{Running Qt Creator from the Command Line}
You can start Qt Creator from a command prompt with an existing session or You can start Qt Creator from a command prompt with the name of an existing
\c{.pro} file by giving the name as argument on the command line. session or \c{.pro} file by giving the name as argument on the command
line.
\bold{Show and Hide the Sidebar} \bold{Show and Hide the Sidebar}

View File

@@ -74,10 +74,10 @@ Symbol *OverviewModel::globalSymbolAt(unsigned index) const
QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent) const QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent) const
{ {
if (! hasDocument()) { if (!parent.isValid()) {
return QModelIndex(); if (row == 0) // account for no symbol item
} else if (! parent.isValid()) { return createIndex(row, column);
Symbol *symbol = globalSymbolAt(row); Symbol *symbol = globalSymbolAt(row-1); // account for no symbol item
return createIndex(row, column, symbol); return createIndex(row, column, symbol);
} else { } else {
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer()); Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
@@ -96,12 +96,20 @@ QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent)
QModelIndex OverviewModel::parent(const QModelIndex &child) const QModelIndex OverviewModel::parent(const QModelIndex &child) const
{ {
Symbol *symbol = static_cast<Symbol *>(child.internalPointer()); Symbol *symbol = static_cast<Symbol *>(child.internalPointer());
Q_ASSERT(symbol != 0); if (!symbol) // account for no symbol item
return QModelIndex();
if (Scope *scope = symbol->scope()) { if (Scope *scope = symbol->scope()) {
Symbol *parentSymbol = scope->owner(); Symbol *parentSymbol = scope->owner();
if (parentSymbol && parentSymbol->scope()) if (parentSymbol && parentSymbol->scope()) {
return createIndex(parentSymbol->index(), 0, parentSymbol); QModelIndex index;
if (parentSymbol->scope() && parentSymbol->scope()->owner()
&& parentSymbol->scope()->owner()->scope()) // the parent doesn't have a parent
index = createIndex(parentSymbol->index(), 0, parentSymbol);
else //+1 to account for no symbol item
index = createIndex(parentSymbol->index() + 1, 0, parentSymbol);
return index;
}
} }
return QModelIndex(); return QModelIndex();
@@ -110,22 +118,27 @@ QModelIndex OverviewModel::parent(const QModelIndex &child) const
int OverviewModel::rowCount(const QModelIndex &parent) const int OverviewModel::rowCount(const QModelIndex &parent) const
{ {
if (hasDocument()) { if (hasDocument()) {
if (! parent.isValid()) { if (!parent.isValid()) {
return globalSymbolCount(); return globalSymbolCount()+1; // account for no symbol item
} else { } else {
if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item
return 0;
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer()); Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
Q_ASSERT(parentSymbol != 0); Q_ASSERT(parentSymbol != 0);
if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) { if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) {
if (! scopedSymbol->isFunction()) { if (!scopedSymbol->isFunction()) {
Scope *parentScope = scopedSymbol->members(); Scope *parentScope = scopedSymbol->members();
Q_ASSERT(parentScope != 0); Q_ASSERT(parentScope != 0);
return parentScope->symbolCount(); return parentScope->symbolCount();
} }
} }
return 0;
} }
} }
if (!parent.isValid())
return 1; // account for no symbol item
return 0; return 0;
} }
@@ -136,6 +149,19 @@ int OverviewModel::columnCount(const QModelIndex &) const
QVariant OverviewModel::data(const QModelIndex &index, int role) const QVariant OverviewModel::data(const QModelIndex &index, int role) const
{ {
// account for no symbol item
if (!index.parent().isValid() && index.row() == 0) {
switch (role) {
case Qt::DisplayRole:
if (rowCount() > 1)
return tr("<Select Symbol>");
else
return tr("<No Symbols>");
default:
return QVariant();
} //switch
}
switch (role) { switch (role) {
case Qt::DisplayRole: { case Qt::DisplayRole: {
Symbol *symbol = static_cast<Symbol *>(index.internalPointer()); Symbol *symbol = static_cast<Symbol *>(index.internalPointer());

View File

@@ -203,9 +203,7 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
m_methodCombo->setMaxVisibleItems(20); m_methodCombo->setMaxVisibleItems(20);
m_overviewModel = new OverviewModel(this); m_overviewModel = new OverviewModel(this);
m_noSymbolsModel = new QStringListModel(this); m_methodCombo->setModel(m_overviewModel);
m_noSymbolsModel->setStringList(QStringList() << tr("<no symbols>"));
m_methodCombo->setModel(m_noSymbolsModel);
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int))); connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex())); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
@@ -318,16 +316,9 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc)
return; return;
m_overviewModel->rebuild(doc); m_overviewModel->rebuild(doc);
if (m_overviewModel->rowCount() > 0) { OverviewTreeView *treeView = static_cast<OverviewTreeView *>(m_methodCombo->view());
if (m_methodCombo->model() != m_overviewModel) treeView->sync();
m_methodCombo->setModel(m_overviewModel); updateMethodBoxIndex();
OverviewTreeView *treeView = static_cast<OverviewTreeView *>(m_methodCombo->view());
treeView->sync();
updateMethodBoxIndex();
} else {
if (m_methodCombo->model() != m_noSymbolsModel)
m_methodCombo->setModel(m_noSymbolsModel);
}
} }
void CPPEditor::updateFileName() void CPPEditor::updateFileName()
@@ -335,8 +326,6 @@ void CPPEditor::updateFileName()
void CPPEditor::jumpToMethod(int) void CPPEditor::jumpToMethod(int)
{ {
if (m_methodCombo->model() != m_overviewModel)
return;
QModelIndex index = m_methodCombo->view()->currentIndex(); QModelIndex index = m_methodCombo->view()->currentIndex();
Symbol *symbol = m_overviewModel->symbolFromIndex(index); Symbol *symbol = m_overviewModel->symbolFromIndex(index);
if (! symbol) if (! symbol)
@@ -351,8 +340,6 @@ void CPPEditor::jumpToMethod(int)
void CPPEditor::updateMethodBoxIndex() void CPPEditor::updateMethodBoxIndex()
{ {
if (m_methodCombo->model() != m_overviewModel)
return;
int line = 0, column = 0; int line = 0, column = 0;
convertPosition(position(), &line, &column); convertPosition(position(), &line, &column);
@@ -362,7 +349,7 @@ void CPPEditor::updateMethodBoxIndex()
for (int row = 0; row < rc; ++row) { for (int row = 0; row < rc; ++row) {
const QModelIndex index = m_overviewModel->index(row, 0, QModelIndex()); const QModelIndex index = m_overviewModel->index(row, 0, QModelIndex());
Symbol *symbol = m_overviewModel->symbolFromIndex(index); Symbol *symbol = m_overviewModel->symbolFromIndex(index);
if (symbol->line() > unsigned(line)) if (symbol && symbol->line() > unsigned(line))
break; break;
lastIndex = index; lastIndex = index;
} }

View File

@@ -139,7 +139,6 @@ private:
QList<int> m_contexts; QList<int> m_contexts;
QComboBox *m_methodCombo; QComboBox *m_methodCombo;
CPlusPlus::OverviewModel *m_overviewModel; CPlusPlus::OverviewModel *m_overviewModel;
QStringListModel *m_noSymbolsModel;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -115,7 +115,6 @@ public:
void setWorkingCopy(const QMap<QString, QByteArray> &workingCopy); void setWorkingCopy(const QMap<QString, QByteArray> &workingCopy);
void setIncludePaths(const QStringList &includePaths); void setIncludePaths(const QStringList &includePaths);
void setFrameworkPaths(const QStringList &frameworkPaths); void setFrameworkPaths(const QStringList &frameworkPaths);
void addIncludePath(const QString &path);
void setProjectFiles(const QStringList &files); void setProjectFiles(const QStringList &files);
void run(QString &fileName); void run(QString &fileName);
void operator()(QString &fileName); void operator()(QString &fileName);
@@ -170,9 +169,6 @@ void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
void CppPreprocessor::setFrameworkPaths(const QStringList &frameworkPaths) void CppPreprocessor::setFrameworkPaths(const QStringList &frameworkPaths)
{ m_frameworkPaths = frameworkPaths; } { m_frameworkPaths = frameworkPaths; }
void CppPreprocessor::addIncludePath(const QString &path)
{ m_includePaths.append(path); }
void CppPreprocessor::setProjectFiles(const QStringList &files) void CppPreprocessor::setProjectFiles(const QStringList &files)
{ m_projectFiles = files; } { m_projectFiles = files; }
@@ -488,14 +484,14 @@ void CppModelManager::ensureUpdated()
if (! m_dirty) if (! m_dirty)
return; return;
m_projectFiles = updateProjectFiles(); m_projectFiles = internalProjectFiles();
m_includePaths = updateIncludePaths(); m_includePaths = internalIncludePaths();
m_frameworkPaths = updateFrameworkPaths(); m_frameworkPaths = internalFrameworkPaths();
m_definedMacros = updateDefinedMacros(); m_definedMacros = internalDefinedMacros();
m_dirty = false; m_dirty = false;
} }
QStringList CppModelManager::updateProjectFiles() const QStringList CppModelManager::internalProjectFiles() const
{ {
QStringList files; QStringList files;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects); QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
@@ -504,10 +500,11 @@ QStringList CppModelManager::updateProjectFiles() const
ProjectInfo pinfo = it.value(); ProjectInfo pinfo = it.value();
files += pinfo.sourceFiles; files += pinfo.sourceFiles;
} }
files.removeDuplicates();
return files; return files;
} }
QStringList CppModelManager::updateIncludePaths() const QStringList CppModelManager::internalIncludePaths() const
{ {
QStringList includePaths; QStringList includePaths;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects); QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
@@ -516,10 +513,11 @@ QStringList CppModelManager::updateIncludePaths() const
ProjectInfo pinfo = it.value(); ProjectInfo pinfo = it.value();
includePaths += pinfo.includePaths; includePaths += pinfo.includePaths;
} }
includePaths.removeDuplicates();
return includePaths; return includePaths;
} }
QStringList CppModelManager::updateFrameworkPaths() const QStringList CppModelManager::internalFrameworkPaths() const
{ {
QStringList frameworkPaths; QStringList frameworkPaths;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects); QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
@@ -528,10 +526,11 @@ QStringList CppModelManager::updateFrameworkPaths() const
ProjectInfo pinfo = it.value(); ProjectInfo pinfo = it.value();
frameworkPaths += pinfo.frameworkPaths; frameworkPaths += pinfo.frameworkPaths;
} }
frameworkPaths.removeDuplicates();
return frameworkPaths; return frameworkPaths;
} }
QByteArray CppModelManager::updateDefinedMacros() const QByteArray CppModelManager::internalDefinedMacros() const
{ {
QByteArray macros; QByteArray macros;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects); QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
@@ -588,6 +587,7 @@ void CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
return; return;
m_projects.insert(pinfo.project, pinfo); m_projects.insert(pinfo.project, pinfo);
m_dirty = true;
} }
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles) QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)

View File

@@ -133,10 +133,10 @@ private:
} }
void ensureUpdated(); void ensureUpdated();
QStringList updateProjectFiles() const; QStringList internalProjectFiles() const;
QStringList updateIncludePaths() const; QStringList internalIncludePaths() const;
QStringList updateFrameworkPaths() const; QStringList internalFrameworkPaths() const;
QByteArray updateDefinedMacros() const; QByteArray internalDefinedMacros() const;
static void parse(QFutureInterface<void> &future, static void parse(QFutureInterface<void> &future,
CppPreprocessor *preproc, CppPreprocessor *preproc,

View File

@@ -1,16 +1,14 @@
IDE_SOURCE_TREE = $$PWD/../ IDE_SOURCE_TREE = $$PWD/../
isEmpty(TEST) { isEmpty(TEST):CONFIG(debug, debug|release) {
CONFIG(debug, debug|release) { !debug_and_release|build_pass {
TEST = 1 TEST = 1
} }
} }
!isEmpty(TEST) { equals(TEST, 1) {
equals(TEST, 1) { QT +=testlib
QT +=testlib DEFINES += WITH_TESTS
DEFINES+=WITH_TESTS
}
} }
isEmpty(IDE_BUILD_TREE) { isEmpty(IDE_BUILD_TREE) {