summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormae <qtc-committer@nokia.com>2008-12-10 11:50:35 +0100
committermae <qtc-committer@nokia.com>2008-12-10 11:50:35 +0100
commit39ad48c3b7dec95b5dcb867567eb053c89bb44ca (patch)
treebf80dcd077c6ebcb55e4b6bd7702e17e7a8609f3
parent1931304da1b59fcc396b3a550d0c9817ba73f8af (diff)
parent9c9308b91b116138ed5cc7753cf59eefd5a86db9 (diff)
downloadqt-creator-39ad48c3b7dec95b5dcb867567eb053c89bb44ca.tar.gz
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
-rw-r--r--src/libs/cplusplus/pp-engine.cpp22
-rw-r--r--src/libs/cplusplus/pp-environment.cpp6
-rw-r--r--src/libs/cplusplus/pp-environment.h2
-rw-r--r--src/libs/cplusplus/pp-macro-expander.cpp4
-rw-r--r--src/libs/cplusplus/pp-macro.h2
-rw-r--r--src/libs/utils/qtcassert.h8
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp9
-rw-r--r--src/plugins/cpptools/cppfunctionsfilter.cpp50
-rw-r--r--src/plugins/cpptools/cppfunctionsfilter.h58
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp8
-rw-r--r--src/plugins/cpptools/cppquickopenfilter.cpp9
-rw-r--r--src/plugins/cpptools/cpptools.cpp2
-rw-r--r--src/plugins/cpptools/cpptools.pro7
-rw-r--r--src/plugins/cpptools/searchsymbols.cpp22
-rw-r--r--src/plugins/debugger/breakhandler.cpp3
-rw-r--r--src/plugins/debugger/debugger.pro2
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp10
-rw-r--r--src/plugins/debugger/gdbengine.cpp3
-rw-r--r--src/plugins/debugger/gdbmi.cpp4
-rw-r--r--src/plugins/debugger/mode.cpp5
-rw-r--r--src/plugins/debugger/scriptengine.cpp9
-rw-r--r--src/plugins/debugger/stackhandler.cpp2
-rw-r--r--src/plugins/debugger/watchhandler.cpp4
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp48
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp2
-rw-r--r--src/plugins/projectexplorer/taskwindow.h2
-rw-r--r--src/plugins/qt4projectmanager/directorywatcher.cpp54
-rw-r--r--src/plugins/qt4projectmanager/directorywatcher.h25
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.cpp30
-rw-r--r--src/plugins/qt4projectmanager/qt4nodes.h16
-rw-r--r--src/plugins/qt4projectmanager/qt4project.cpp10
31 files changed, 355 insertions, 83 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index fd618d2706..83386e8079 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -164,7 +164,15 @@ protected:
bool process_primary()
{
if ((*_lex)->is(T_INT_LITERAL)) {
- _value.set_long(tokenSpell().toLong());
+ int base = 10;
+ const QByteArray spell = tokenSpell();
+ if (spell.at(0) == '0') {
+ if (spell.size() > 1 && (spell.at(1) == 'x' || spell.at(1) == 'X'))
+ base = 16;
+ else
+ base = 8;
+ }
+ _value.set_long(tokenSpell().toLong(0, base));
++(*_lex);
return true;
} else if (isTokenDefined()) {
@@ -367,7 +375,7 @@ protected:
{
process_xor();
- while ((*_lex)->is(T_CARET)) {
+ while ((*_lex)->is(T_PIPE)) {
const Token op = *(*_lex);
++(*_lex);
@@ -481,12 +489,12 @@ void pp::operator () (const QByteArray &filename,
const QByteArray &source,
QByteArray *result)
{
- const QByteArray previousFile = env.current_file;
- env.current_file = filename;
+ const QByteArray previousFile = env.currentFile;
+ env.currentFile = filename;
operator () (source, result);
- env.current_file = previousFile;
+ env.currentFile = previousFile;
}
pp::State pp::createStateFromSource(const QByteArray &source) const
@@ -518,7 +526,7 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
result->append(QByteArray::number(_dot->lineno));
result->append(' ');
result->append('"');
- result->append(env.current_file);
+ result->append(env.currentFile);
result->append('"');
result->append('\n');
} else {
@@ -844,6 +852,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
}
Macro macro;
+ macro.fileName = env.currentFile;
+ macro.line = env.currentLine;
macro.name = tokenText(*tk);
++tk; // skip T_IDENTIFIER
diff --git a/src/libs/cplusplus/pp-environment.cpp b/src/libs/cplusplus/pp-environment.cpp
index ff2ca77e4f..20491727a4 100644
--- a/src/libs/cplusplus/pp-environment.cpp
+++ b/src/libs/cplusplus/pp-environment.cpp
@@ -97,8 +97,6 @@ Macro *Environment::bind(const Macro &__macro)
Macro *m = new Macro (__macro);
m->hashcode = hash_code(m->name);
- m->fileName = current_file;
- m->line = currentLine;
if (++_macro_count == _allocated_macros) {
if (! _allocated_macros)
@@ -122,11 +120,13 @@ Macro *Environment::bind(const Macro &__macro)
return m;
}
-Macro *Environment::remove (const QByteArray &name)
+Macro *Environment::remove(const QByteArray &name)
{
Macro macro;
macro.name = name;
macro.hidden = true;
+ macro.fileName = currentFile;
+ macro.line = currentLine;
return bind(macro);
}
diff --git a/src/libs/cplusplus/pp-environment.h b/src/libs/cplusplus/pp-environment.h
index e2a75d29b8..4200b5ea0f 100644
--- a/src/libs/cplusplus/pp-environment.h
+++ b/src/libs/cplusplus/pp-environment.h
@@ -94,7 +94,7 @@ private:
void rehash();
public:
- QByteArray current_file;
+ QByteArray currentFile;
unsigned currentLine;
bool hide_next;
diff --git a/src/libs/cplusplus/pp-macro-expander.cpp b/src/libs/cplusplus/pp-macro-expander.cpp
index 9ae9702fe1..e17dd873db 100644
--- a/src/libs/cplusplus/pp-macro-expander.cpp
+++ b/src/libs/cplusplus/pp-macro-expander.cpp
@@ -73,7 +73,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
__result->append(QByteArray::number(env.currentLine));
__result->append(' ');
__result->append('"');
- __result->append(env.current_file);
+ __result->append(env.currentFile);
__result->append('"');
__result->append('\n');
++lines;
@@ -218,7 +218,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
else if (fast_name == "__FILE__")
{
__result->append('"');
- __result->append(env.current_file);
+ __result->append(env.currentFile);
__result->append('"');
continue;
}
diff --git a/src/libs/cplusplus/pp-macro.h b/src/libs/cplusplus/pp-macro.h
index 73cdab7e3a..887fff53b0 100644
--- a/src/libs/cplusplus/pp-macro.h
+++ b/src/libs/cplusplus/pp-macro.h
@@ -111,7 +111,7 @@ public:
}
if (variadics)
text += QLatin1String("...");
- text += QLatin1Char(' ');
+ text += QLatin1Char(')');
}
text += QLatin1Char(' ');
text += QString::fromUtf8(definition.constData(), definition.size());
diff --git a/src/libs/utils/qtcassert.h b/src/libs/utils/qtcassert.h
index d05be20df8..f75d225f6e 100644
--- a/src/libs/utils/qtcassert.h
+++ b/src/libs/utils/qtcassert.h
@@ -36,13 +36,11 @@
#include <QtCore/QDebug>
-#ifdef Q_OS_UNIX
+// we do not use the 'do {...} while (0)' idiom here to be able to use
+// 'break' and 'continue' as 'actions'.
+
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
-#else
-#define QTC_ASSERT(cond, action) \
- if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
-#endif
#endif // QTC_ASSERT_H
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index ff68bd0bac..8d4a36178c 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -520,6 +520,15 @@ void CPPEditor::jumpToDefinition()
#endif
}
} else {
+ foreach (const Document::MacroUse use, doc->macroUses()) {
+ if (use.contains(endOfName - 1)) {
+ const Macro &macro = use.macro();
+ const QString fileName = QString::fromUtf8(macro.fileName);
+ if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
+ return; // done
+ }
+ }
+
qDebug() << "No results for expression:" << expression;
}
}
diff --git a/src/plugins/cpptools/cppfunctionsfilter.cpp b/src/plugins/cpptools/cppfunctionsfilter.cpp
new file mode 100644
index 0000000000..61bb8e2d00
--- /dev/null
+++ b/src/plugins/cpptools/cppfunctionsfilter.cpp
@@ -0,0 +1,50 @@
+/***************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+**
+** Non-Open Source Usage
+**
+** Licensees may use this file in accordance with the Qt Beta Version
+** License Agreement, Agreement version 2.2 provided with the Software or,
+** alternatively, in accordance with the terms contained in a written
+** agreement between you and Nokia.
+**
+** GNU General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the packaging
+** of this file. Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+**
+** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt GPL Exception
+** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
+**
+***************************************************************************/
+
+#include "cppfunctionsfilter.h"
+
+using namespace CppTools::Internal;
+
+CppFunctionsFilter::CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager)
+ : CppQuickOpenFilter(manager, editorManager)
+{
+ setShortcutString("m");
+ setIncludedByDefault(false);
+
+ search.setSymbolsToSearchFor(SearchSymbols::Functions);
+ search.setSeparateScope(true);
+}
+
+CppFunctionsFilter::~CppFunctionsFilter()
+{
+}
diff --git a/src/plugins/cpptools/cppfunctionsfilter.h b/src/plugins/cpptools/cppfunctionsfilter.h
new file mode 100644
index 0000000000..6e48d65b26
--- /dev/null
+++ b/src/plugins/cpptools/cppfunctionsfilter.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+**
+** Non-Open Source Usage
+**
+** Licensees may use this file in accordance with the Qt Beta Version
+** License Agreement, Agreement version 2.2 provided with the Software or,
+** alternatively, in accordance with the terms contained in a written
+** agreement between you and Nokia.
+**
+** GNU General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the packaging
+** of this file. Please review the following information to ensure GNU
+** General Public Licensing requirements will be met:
+**
+** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt GPL Exception
+** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
+**
+***************************************************************************/
+
+#ifndef CPPFUNCTIONSFILTER_H
+#define CPPFUNCTIONSFILTER_H
+
+#include <cppquickopenfilter.h>
+
+namespace CppTools {
+namespace Internal {
+
+class CppFunctionsFilter : public CppQuickOpenFilter
+{
+ Q_OBJECT
+
+public:
+ CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager);
+ ~CppFunctionsFilter();
+
+ QString trName() const { return tr("Methods"); }
+ QString name() const { return QLatin1String("Methods"); }
+ Priority priority() const { return Medium; }
+};
+
+} // namespace Internal
+} // namespace CppTools
+
+#endif // CPPFUNCTIONSFILTER_H
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index 5111aa3199..40888d99f3 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -390,17 +390,17 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
} else {
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
- const QByteArray previousFile = env.current_file;
+ const QByteArray previousFile = env.currentFile;
const unsigned previousLine = env.currentLine;
- env.current_file = QByteArray(m_currentDoc->translationUnit()->fileName(),
- m_currentDoc->translationUnit()->fileNameLength());
+ env.currentFile = QByteArray(m_currentDoc->translationUnit()->fileName(),
+ m_currentDoc->translationUnit()->fileNameLength());
QByteArray preprocessedCode;
m_proc(contents, &preprocessedCode);
//qDebug() << preprocessedCode;
- env.current_file = previousFile;
+ env.currentFile = previousFile;
env.currentLine = previousLine;
m_currentDoc->setSource(preprocessedCode);
diff --git a/src/plugins/cpptools/cppquickopenfilter.cpp b/src/plugins/cpptools/cppquickopenfilter.cpp
index a1f1a9b371..ac69c9cc6d 100644
--- a/src/plugins/cpptools/cppquickopenfilter.cpp
+++ b/src/plugins/cpptools/cppquickopenfilter.cpp
@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future)
Q_UNUSED(future);
}
+static bool compareLexigraphically(const QuickOpen::FilterEntry &a,
+ const QuickOpen::FilterEntry &b)
+{
+ return a.displayName < b.displayName;
+}
+
QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry)
{
QString entry = trimWildcards(origEntry);
@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
}
}
+ if (entries.size() < 1000)
+ qSort(entries.begin(), entries.end(), compareLexigraphically);
+
return entries;
}
diff --git a/src/plugins/cpptools/cpptools.cpp b/src/plugins/cpptools/cpptools.cpp
index 957f0cae9b..5e9f6dca45 100644
--- a/src/plugins/cpptools/cpptools.cpp
+++ b/src/plugins/cpptools/cpptools.cpp
@@ -34,6 +34,7 @@
#include "cpptools.h"
#include "cppclassesfilter.h"
#include "cppcodecompletion.h"
+#include "cppfunctionsfilter.h"
#include "cpphoverhandler.h"
#include "cppmodelmanager.h"
#include "cpptoolsconstants.h"
@@ -89,6 +90,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
m_core->editorManager());
addAutoReleasedObject(quickOpenFilter);
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
+ addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager()));
// Menus
Core::IActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro
index 92905e42ef..74112379e3 100644
--- a/src/plugins/cpptools/cpptools.pro
+++ b/src/plugins/cpptools/cpptools.pro
@@ -10,15 +10,16 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
INCLUDEPATH += .
DEFINES += CPPTOOLS_LIBRARY
CONFIG += help
-
HEADERS += cpptools_global.h \
cppquickopenfilter.h \
cppclassesfilter.h \
- searchsymbols.h
+ searchsymbols.h \
+ cppfunctionsfilter.h
SOURCES += cppquickopenfilter.cpp \
cpptoolseditorsupport.cpp \
cppclassesfilter.cpp \
- searchsymbols.cpp
+ searchsymbols.cpp \
+ cppfunctionsfilter.cpp
# Input
SOURCES += cpptools.cpp \
diff --git a/src/plugins/cpptools/searchsymbols.cpp b/src/plugins/cpptools/searchsymbols.cpp
index 308449ab58..2669ea7bc7 100644
--- a/src/plugins/cpptools/searchsymbols.cpp
+++ b/src/plugins/cpptools/searchsymbols.cpp
@@ -35,6 +35,7 @@
#include <Literals.h>
#include <Scope.h>
+#include <Names.h>
using namespace CPlusPlus;
using namespace CppTools::Internal;
@@ -97,12 +98,24 @@ bool SearchSymbols::visit(Function *symbol)
if (!(symbolsToSearchFor & Functions))
return false;
+ QString extraScope;
+ if (Name *name = symbol->name()) {
+ if (QualifiedNameId *nameId = name->asQualifiedNameId()) {
+ if (nameId->nameCount() > 1) {
+ extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
+ }
+ }
+ }
+ QString fullScope = _scope;
+ if (!_scope.isEmpty() && !extraScope.isEmpty())
+ fullScope += QLatin1String("::");
+ fullScope += extraScope;
QString name = symbolName(symbol);
QString scopedName = scopedSymbolName(name);
QString type = overview.prettyType(symbol->type(),
- separateScope ? symbol->name() : 0);
+ separateScope ? symbol->identity() : 0);
appendItem(separateScope ? type : scopedName,
- separateScope ? _scope : type,
+ separateScope ? fullScope : type,
ModelItemInfo::Method, symbol);
return false;
}
@@ -153,7 +166,7 @@ bool SearchSymbols::visit(Class *symbol)
QString SearchSymbols::scopedSymbolName(const QString &symbolName) const
{
QString name = _scope;
- if (! name.isEmpty())
+ if (!name.isEmpty())
name += QLatin1String("::");
name += symbolName;
return name;
@@ -196,6 +209,9 @@ void SearchSymbols::appendItem(const QString &name,
ModelItemInfo::ItemType type,
const Symbol *symbol)
{
+ if (!symbol->name())
+ return;
+
const QIcon icon = icons.iconForSymbol(symbol);
items.append(ModelItemInfo(name, info, type,
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 926568517d..e27aa5ec41 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -34,7 +34,8 @@
#include "breakhandler.h"
#include "imports.h" // TextEditor::BaseTextMark
-#include "qtcassert.h"
+
+#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index 6b8c2e74ca..3d67e19c6a 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -10,8 +10,6 @@ include(../../plugins/texteditor/texteditor.pri)
include(../../plugins/cpptools/cpptools.pri)
include(../../libs/cplusplus/cplusplus.pri)
-INCLUDEPATH += ../../libs/utils
-
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
QT += gui network script
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 03f86bec24..37406f70cc 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -39,7 +39,6 @@
#include "gdboptionpage.h"
#include "gdbengine.h"
#include "mode.h"
-#include "qtcassert.h"
#include <coreplugin/actionmanager/actionmanagerinterface.h>
#include <coreplugin/coreconstants.h>
@@ -48,20 +47,27 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/uniqueidmanager.h>
+
#include <cplusplus/ExpressionUnderCursor.h>
+
#include <cppeditor/cppeditorconstants.h>
+
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
+
+#include <texteditor/basetexteditor.h>
#include <texteditor/basetextmark.h>
#include <texteditor/itexteditor.h>
#include <texteditor/texteditorconstants.h>
-#include <texteditor/basetexteditor.h>
+
+#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/qplugin.h>
#include <QtCore/QObject>
#include <QtCore/QPoint>
#include <QtCore/QSettings>
+
#include <QtGui/QPlainTextEdit>
#include <QtGui/QTextBlock>
#include <QtGui/QTextCursor>
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index 13af8e3075..d7ac5b1aaa 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -37,7 +37,6 @@
#include "debuggermanager.h"
#include "gdbmi.h"
#include "procinterrupt.h"
-#include "qtcassert.h"
#include "disassemblerhandler.h"
#include "breakhandler.h"
@@ -49,6 +48,8 @@
#include "startexternaldialog.h"
#include "attachexternaldialog.h"
+#include <utils/qtcassert.h>
+
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
diff --git a/src/plugins/debugger/gdbmi.cpp b/src/plugins/debugger/gdbmi.cpp
index 3beadc385f..f14bb752e3 100644
--- a/src/plugins/debugger/gdbmi.cpp
+++ b/src/plugins/debugger/gdbmi.cpp
@@ -32,10 +32,10 @@
***************************************************************************/
#include "gdbmi.h"
-#include "qtcassert.h"
+
+#include <utils/qtcassert.h>
#include <QtCore/QByteArray>
-#include <QtCore/QDebug>
#include <QtCore/QTextStream>
namespace Debugger {
diff --git a/src/plugins/debugger/mode.cpp b/src/plugins/debugger/mode.cpp
index c1bbdd550f..234f09c207 100644
--- a/src/plugins/debugger/mode.cpp
+++ b/src/plugins/debugger/mode.cpp
@@ -35,7 +35,6 @@
#include "debuggerconstants.h"
#include "debuggermanager.h"
-#include "qtcassert.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
@@ -48,10 +47,14 @@
#include <coreplugin/outputpane.h>
#include <coreplugin/navigationwidget.h>
#include <coreplugin/rightpane.h>
+
#include <projectexplorer/projectexplorerconstants.h>
+#include <utils/qtcassert.h>
+
#include <QtCore/QDebug>
#include <QtCore/QSettings>
+
#include <QtGui/QDockWidget>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
diff --git a/src/plugins/debugger/scriptengine.cpp b/src/plugins/debugger/scriptengine.cpp
index 50f9dcdf4e..e6387bfdda 100644
--- a/src/plugins/debugger/scriptengine.cpp
+++ b/src/plugins/debugger/scriptengine.cpp
@@ -33,19 +33,18 @@
#include "scriptengine.h"
-#include "qtcassert.h"
+#include "attachexternaldialog.h"
+#include "breakhandler.h"
#include "debuggerconstants.h"
#include "debuggermanager.h"
-
#include "disassemblerhandler.h"
-#include "breakhandler.h"
#include "moduleshandler.h"
#include "registerhandler.h"
#include "stackhandler.h"
+#include "startexternaldialog.h"
#include "watchhandler.h"
-#include "startexternaldialog.h"
-#include "attachexternaldialog.h"
+#include <utils/qtcassert.h>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp
index 818b6b6188..fd70e1e1ab 100644
--- a/src/plugins/debugger/stackhandler.cpp
+++ b/src/plugins/debugger/stackhandler.cpp
@@ -33,7 +33,7 @@
#include "stackhandler.h"
-#include "qtcassert.h"
+#include <utils/qtcassert.h>
#include <QtCore/QAbstractTableModel>
#include <QtCore/QDebug>
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index e03c91f710..053fcadcd1 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -37,7 +37,7 @@
#include "modeltest.h"
#endif
-#include "qtcassert.h"
+#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QEvent>
@@ -118,7 +118,7 @@ static QByteArray quoteUnprintable(const QByteArray &ba)
QByteArray res;
char buf[10];
for (int i = 0, n = ba.size(); i != n; ++i) {
- char c = ba.at(i);
+ unsigned char c = ba.at(i);
if (isprint(c)) {
res += c;
} else {
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index 1c30bbe109..7c85aae6ae 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -314,8 +314,8 @@ void ProjectNode::addProjectNodes(const QList<ProjectNode*> &subProjects)
emit watcher->foldersAboutToBeAdded(this, folderNodes);
foreach (ProjectNode *project, subProjects) {
- Q_ASSERT_X(!project->parentFolderNode(), "addProjectNodes",
- "Project node has already a parent");
+ QTC_ASSERT(!project->parentFolderNode(),
+ qDebug("Project node has already a parent"));
project->setParentFolderNode(this);
foreach (NodesWatcher *watcher, m_watchers)
project->registerWatcher(watcher);
@@ -353,13 +353,13 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects)
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
++projectIter;
- Q_ASSERT_X(projectIter != m_subProjectNodes.end(), "removeProjectNodes",
- "Project to remove is not part of specified folder!");
+ QTC_ASSERT(projectIter != m_subProjectNodes.end(),
+ qDebug("Project to remove is not part of specified folder!"));
}
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
++folderIter;
- Q_ASSERT_X(folderIter != m_subFolderNodes.end(), "removeProjectNodes",
- "Project to remove is not part of specified folder!");
+ QTC_ASSERT(folderIter != m_subFolderNodes.end(),
+ qDebug("Project to remove is not part of specified folder!"));
}
delete *projectIter;
projectIter = m_subProjectNodes.erase(projectIter);
@@ -386,15 +386,15 @@ void ProjectNode::addFolderNodes(const QList<FolderNode*> &subFolders, FolderNod
watcher->foldersAboutToBeAdded(parentFolder, subFolders);
foreach (FolderNode *folder, subFolders) {
- Q_ASSERT_X(!folder->parentFolderNode(), "addFolderNodes",
- "Project node has already a parent folder");
+ QTC_ASSERT(!folder->parentFolderNode(),
+ qDebug("Project node has already a parent folder"));
folder->setParentFolderNode(parentFolder);
folder->setProjectNode(this);
parentFolder->m_subFolderNodes.append(folder);
// project nodes have to be added via addProjectNodes
- Q_ASSERT_X(folder->nodeType() != ProjectNodeType, "addFolderNodes",
- "project nodes have to be added via addProjectNodes");
+ QTC_ASSERT(folder->nodeType() != ProjectNodeType,
+ qDebug("project nodes have to be added via addProjectNodes"));
}
qSort(parentFolder->m_subFolderNodes.begin(), parentFolder->m_subFolderNodes.end(),
sortNodesByPath);
@@ -427,12 +427,12 @@ void ProjectNode::removeFolderNodes(const QList<FolderNode*> &subFolders,
QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin();
QList<FolderNode*>::iterator folderIter = parentFolder->m_subFolderNodes.begin();
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
- Q_ASSERT_X(((*toRemoveIter)->nodeType() != ProjectNodeType), "removeFolderNodes",
- "project nodes have to be removed via removeProjectNodes");
+ QTC_ASSERT((*toRemoveIter)->nodeType() != ProjectNodeType,
+ qDebug("project nodes have to be removed via removeProjectNodes"));
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
++folderIter;
- Q_ASSERT_X(folderIter != parentFolder->m_subFolderNodes.end(), "removeFileNodes",
- "Folder to remove is not part of specified folder!");
+ QTC_ASSERT(folderIter != parentFolder->m_subFolderNodes.end(),
+ qDebug("Folder to remove is not part of specified folder!"));
}
delete *folderIter;
folderIter = parentFolder->m_subFolderNodes.erase(folderIter);
@@ -460,8 +460,8 @@ void ProjectNode::addFileNodes(const QList<FileNode*> &files, FolderNode *folder
emit watcher->filesAboutToBeAdded(folder, files);
foreach (FileNode *file, files) {
- Q_ASSERT_X(!file->parentFolderNode(), "addFileNodes",
- "File node has already a parent folder");
+ QTC_ASSERT(!file->parentFolderNode(),
+ qDebug("File node has already a parent folder"));
file->setParentFolderNode(folder);
file->setProjectNode(this);
@@ -499,8 +499,8 @@ void ProjectNode::removeFileNodes(const QList<FileNode*> &files, FolderNode *fol
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
while ((*filesIter)->path() != (*toRemoveIter)->path()) {
++filesIter;
- Q_ASSERT_X(filesIter != folder->m_fileNodes.end(), "removeFileNodes",
- "File to remove is not part of specified folder!");
+ QTC_ASSERT(filesIter != folder->m_fileNodes.end(),
+ qDebug("File to remove is not part of specified folder!"));
}
delete *filesIter;
filesIter = folder->m_fileNodes.erase(filesIter);
@@ -591,8 +591,8 @@ void SessionNode::addProjectNodes(const QList<ProjectNode*> &projectNodes)
emit watcher->foldersAboutToBeAdded(this, folderNodes);
foreach (ProjectNode *project, projectNodes) {
- Q_ASSERT_X(!project->parentFolderNode(), "addProjectNodes",
- "Project node has already a parent folder");
+ QTC_ASSERT(!project->parentFolderNode(),
+ qDebug("Project node has already a parent folder"));
project->setParentFolderNode(this);
foreach (NodesWatcher *watcher, m_watchers)
project->registerWatcher(watcher);
@@ -621,13 +621,13 @@ void SessionNode::removeProjectNodes(const QList<ProjectNode*> &projectNodes)
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
++projectIter;
- Q_ASSERT_X(projectIter != m_projectNodes.end(), "removeProjectNodes",
- "Project to remove is not part of specified folder!");
+ QTC_ASSERT(projectIter != m_projectNodes.end(),
+ qDebug("Project to remove is not part of specified folder!"));
}
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
++folderIter;
- Q_ASSERT_X(folderIter != m_subFolderNodes.end(), "removeProjectNodes",
- "Project to remove is not part of specified folder!");
+ QTC_ASSERT(folderIter != m_subFolderNodes.end(),
+ qDebug("Project to remove is not part of specified folder!"));
}
projectIter = m_projectNodes.erase(projectIter);
folderIter = m_subFolderNodes.erase(folderIter);
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index 236b2069ae..2e3131e36f 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -257,7 +257,7 @@ TaskWindow::TaskWindow()
m_listview->setModel(m_model);
m_listview->setFrameStyle(QFrame::NoFrame);
- m_listview->setWindowTitle(tr("Problems"));
+ m_listview->setWindowTitle(tr("Build Issues"));
m_listview->setSelectionMode(QAbstractItemView::SingleSelection);
TaskDelegate *tld = new TaskDelegate(this);
m_listview->setItemDelegate(tld);
diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h
index 7025341153..a3bdf47621 100644
--- a/src/plugins/projectexplorer/taskwindow.h
+++ b/src/plugins/projectexplorer/taskwindow.h
@@ -63,7 +63,7 @@ public:
QWidget *outputWidget(QWidget *);
QList<QWidget*> toolBarWidgets(void) const;
- QString name() const { return tr("Problems"); }
+ QString name() const { return tr("Build Issues"); }
int priorityInStatusBar() const;
void clearContents();
void visibilityChanged(bool visible);
diff --git a/src/plugins/qt4projectmanager/directorywatcher.cpp b/src/plugins/qt4projectmanager/directorywatcher.cpp
index 689cd0dfd0..daf4783483 100644
--- a/src/plugins/qt4projectmanager/directorywatcher.cpp
+++ b/src/plugins/qt4projectmanager/directorywatcher.cpp
@@ -203,5 +203,59 @@ void DirectoryWatcher::updateFileList(const QString &dir)
}
}
+int FileWatcher::m_objectCount = 0;
+QHash<QString,int> FileWatcher::m_fileCount;
+QFileSystemWatcher *FileWatcher::m_watcher = 0;
+
+FileWatcher::FileWatcher(QObject *parent)
+{
+ if (!m_watcher)
+ m_watcher = new QFileSystemWatcher();
+ ++m_objectCount;
+ connect(m_watcher, SIGNAL(fileChanged(QString)),
+ this, SLOT(slotFileChanged(QString)));
+}
+
+FileWatcher::~FileWatcher()
+{
+ foreach (const QString &file, m_files)
+ removeFile(file);
+ if (--m_objectCount == 0) {
+ delete m_watcher;
+ m_watcher = 0;
+ }
+}
+
+void FileWatcher::slotFileChanged(const QString &file)
+{
+ if (m_files.contains(file))
+ emit fileChanged(file);
+}
+
+QStringList FileWatcher::files()
+{
+ return m_files;
+}
+
+void FileWatcher::addFile(const QString &file)
+{
+ if (m_files.contains(file))
+ return;
+ m_files += file;
+ if (m_fileCount[file] == 0)
+ m_watcher->addPath(file);
+ m_fileCount[file] += 1;
+}
+
+void FileWatcher::removeFile(const QString &file)
+{
+ m_files.removeOne(file);
+ m_fileCount[file] -= 1;
+ if (m_fileCount[file] == 0)
+ m_watcher->removePath(file);
+}
+
+
+
} // namespace Internal
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/directorywatcher.h b/src/plugins/qt4projectmanager/directorywatcher.h
index 3f5f5a846f..b529ec07e7 100644
--- a/src/plugins/qt4projectmanager/directorywatcher.h
+++ b/src/plugins/qt4projectmanager/directorywatcher.h
@@ -87,6 +87,31 @@ private:
FileModificationTimeMap m_files;
};
+class FileWatcher : public QObject
+{
+ Q_DISABLE_COPY(FileWatcher)
+ Q_OBJECT
+public:
+ explicit FileWatcher(QObject *parent = 0);
+ virtual ~FileWatcher();
+
+ QStringList files();
+ void addFile(const QString &file);
+ void removeFile(const QString &file);
+signals:
+ void fileChanged(const QString &path);
+ void debugOutout(const QString &path);
+
+private slots:
+ void slotFileChanged(const QString&);
+
+private:
+ static int m_objectCount;
+ static QHash<QString, int> m_fileCount;
+ static QFileSystemWatcher *m_watcher;
+ QStringList m_files;
+};
+
} // namespace Internal
} // namespace Qt4ProjectManager
diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp
index 58486fd9a1..dc004580b2 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.cpp
+++ b/src/plugins/qt4projectmanager/qt4nodes.cpp
@@ -87,11 +87,20 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo
m_project(project),
m_qt4ProFileNode(qt4ProFileNode),
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
- m_projectDir(QFileInfo(filePath).absolutePath())
+ m_projectDir(QFileInfo(filePath).absolutePath()),
+ m_fileWatcher(new FileWatcher(this))
{
QTC_ASSERT(project, return);
setFolderName(QFileInfo(filePath).baseName());
setIcon(QIcon(":/qt4projectmanager/images/qt_project.png"));
+ m_fileWatcher->addFile(filePath);
+ connect(m_fileWatcher, SIGNAL(fileChanged(QString)),
+ this, SLOT(scheduleUpdate()));
+}
+
+void Qt4PriFileNode::scheduleUpdate()
+{
+ m_qt4ProFileNode->scheduleUpdate();
}
void Qt4PriFileNode::update(ProFile *includeFile, ProFileReader *reader)
@@ -495,12 +504,17 @@ Qt4ProFileNode::Qt4ProFileNode(Qt4Project *project,
if (parent)
setParent(parent);
+ m_updateTimer.setInterval(100);
+ m_updateTimer.setSingleShot(true);
+
connect(m_dirWatcher, SIGNAL(directoryChanged(const QString&)),
- this, SLOT(update()));
+ this, SLOT(updateGeneratedFiles()));
connect(m_dirWatcher, SIGNAL(fileChanged(const QString&)),
this, SLOT(fileChanged(const QString&)));
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
this, SLOT(update()));
+ connect(&m_updateTimer, SIGNAL(timeout()),
+ this, SLOT(update()));
}
Qt4ProFileNode::~Qt4ProFileNode()
@@ -523,6 +537,11 @@ QStringList Qt4ProFileNode::variableValue(const Qt4Variable var) const
return m_varValues.value(var);
}
+void Qt4ProFileNode::scheduleUpdate()
+{
+ m_updateTimer.start();
+}
+
void Qt4ProFileNode::update()
{
ProFileReader *reader = createProFileReader();
@@ -681,9 +700,11 @@ void Qt4ProFileNode::update()
void Qt4ProFileNode::fileChanged(const QString &filePath)
{
+ qDebug()<<"+++++"<<filePath;
CppTools::CppModelManagerInterface *modelManager =
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
+ // TODO compress
modelManager->updateSourceFiles(QStringList() << filePath);
}
@@ -731,11 +752,16 @@ void Qt4ProFileNode::updateGeneratedFiles()
// update generated files
+ // Already existing FileNodes
QList<FileNode*> existingFileNodes;
foreach (FileNode *file, fileNodes()) {
if (file->isGenerated())
existingFileNodes << file;
}
+
+
+ // Convert uiFile to uiHeaderFilePath, find all headers that correspond
+ // and try to find them in uicDirs
QStringList newFilePaths;
foreach (const QString &uicDir, m_varValues[UiDirVar]) {
foreach (FileNode *uiFile, uiFiles) {
diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h
index 97bc06a08f..6b858bc525 100644
--- a/src/plugins/qt4projectmanager/qt4nodes.h
+++ b/src/plugins/qt4projectmanager/qt4nodes.h
@@ -75,6 +75,7 @@ using ProjectExplorer::FileType;
class ProFileReader;
class DirectoryWatcher;
+class FileWatcher;
// Type of projects
enum Qt4ProjectType {
@@ -142,6 +143,9 @@ protected:
QString buildDir() const;
ProFileReader *createProFileReader() const;
+private slots:
+ void scheduleUpdate();
+
private:
void save(ProFile *includeFile);
bool priFileWritable(const QString &path);
@@ -151,7 +155,10 @@ private:
Qt4ProFileNode *m_qt4ProFileNode;
QString m_projectFilePath;
QString m_projectDir;
- QTimer *m_saveTimer;
+
+ // TODO we might be better off using an IFile* and the FileManager for
+ // watching changes to the .pro and .pri files on disk
+ FileWatcher *m_fileWatcher;
// managed by Qt4ProFileNode
friend class Qt4ProFileNode;
@@ -174,14 +181,13 @@ public:
QStringList variableValue(const Qt4Variable var) const;
public slots:
+ void scheduleUpdate();
void update();
-
private slots:
void fileChanged(const QString &filePath);
-
-private:
void updateGeneratedFiles();
+private:
Qt4ProFileNode *createSubProFileNode(const QString &path);
QStringList uiDirPaths(ProFileReader *reader) const;
@@ -197,9 +203,9 @@ private:
Qt4ProjectType m_projectType;
QHash<Qt4Variable, QStringList> m_varValues;
bool m_isQBuildProject;
+ QTimer m_updateTimer;
DirectoryWatcher *m_dirWatcher;
-
friend class Qt4NodeHierarchy;
};
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index edaabdf154..c926320193 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -265,7 +265,7 @@ Qt4Project::~Qt4Project()
void Qt4Project::defaultQtVersionChanged()
{
if (qtVersionId(activeBuildConfiguration()) == 0)
- update();
+ m_rootProjectNode->update();
}
void Qt4Project::qtVersionsChanged()
@@ -274,7 +274,7 @@ void Qt4Project::qtVersionsChanged()
if (!qt4ProjectManager()->versionManager()->version(qtVersionId(bc))->isValid()) {
setQtVersion(bc, 0);
if (bc == activeBuildConfiguration())
- update();
+ m_rootProjectNode->update();
}
}
}
@@ -507,9 +507,9 @@ void Qt4Project::updateCodeModel()
}
-/*!
- Updates complete project
- */
+///*!
+// Updates complete project
+// */
void Qt4Project::update()
{
// TODO Maybe remove this method completely?