forked from qt-creator/qt-creator
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:
@@ -164,7 +164,15 @@ protected:
|
|||||||
bool process_primary()
|
bool process_primary()
|
||||||
{
|
{
|
||||||
if ((*_lex)->is(T_INT_LITERAL)) {
|
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);
|
++(*_lex);
|
||||||
return true;
|
return true;
|
||||||
} else if (isTokenDefined()) {
|
} else if (isTokenDefined()) {
|
||||||
@@ -367,7 +375,7 @@ protected:
|
|||||||
{
|
{
|
||||||
process_xor();
|
process_xor();
|
||||||
|
|
||||||
while ((*_lex)->is(T_CARET)) {
|
while ((*_lex)->is(T_PIPE)) {
|
||||||
const Token op = *(*_lex);
|
const Token op = *(*_lex);
|
||||||
++(*_lex);
|
++(*_lex);
|
||||||
|
|
||||||
@@ -481,12 +489,12 @@ void pp::operator () (const QByteArray &filename,
|
|||||||
const QByteArray &source,
|
const QByteArray &source,
|
||||||
QByteArray *result)
|
QByteArray *result)
|
||||||
{
|
{
|
||||||
const QByteArray previousFile = env.current_file;
|
const QByteArray previousFile = env.currentFile;
|
||||||
env.current_file = filename;
|
env.currentFile = filename;
|
||||||
|
|
||||||
operator () (source, result);
|
operator () (source, result);
|
||||||
|
|
||||||
env.current_file = previousFile;
|
env.currentFile = previousFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp::State pp::createStateFromSource(const QByteArray &source) const
|
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(QByteArray::number(_dot->lineno));
|
||||||
result->append(' ');
|
result->append(' ');
|
||||||
result->append('"');
|
result->append('"');
|
||||||
result->append(env.current_file);
|
result->append(env.currentFile);
|
||||||
result->append('"');
|
result->append('"');
|
||||||
result->append('\n');
|
result->append('\n');
|
||||||
} else {
|
} else {
|
||||||
@@ -844,6 +852,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Macro macro;
|
Macro macro;
|
||||||
|
macro.fileName = env.currentFile;
|
||||||
|
macro.line = env.currentLine;
|
||||||
macro.name = tokenText(*tk);
|
macro.name = tokenText(*tk);
|
||||||
++tk; // skip T_IDENTIFIER
|
++tk; // skip T_IDENTIFIER
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ Macro *Environment::bind(const Macro &__macro)
|
|||||||
|
|
||||||
Macro *m = new Macro (__macro);
|
Macro *m = new Macro (__macro);
|
||||||
m->hashcode = hash_code(m->name);
|
m->hashcode = hash_code(m->name);
|
||||||
m->fileName = current_file;
|
|
||||||
m->line = currentLine;
|
|
||||||
|
|
||||||
if (++_macro_count == _allocated_macros) {
|
if (++_macro_count == _allocated_macros) {
|
||||||
if (! _allocated_macros)
|
if (! _allocated_macros)
|
||||||
@@ -127,6 +125,8 @@ Macro *Environment::remove (const QByteArray &name)
|
|||||||
Macro macro;
|
Macro macro;
|
||||||
macro.name = name;
|
macro.name = name;
|
||||||
macro.hidden = true;
|
macro.hidden = true;
|
||||||
|
macro.fileName = currentFile;
|
||||||
|
macro.line = currentLine;
|
||||||
return bind(macro);
|
return bind(macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ private:
|
|||||||
void rehash();
|
void rehash();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QByteArray current_file;
|
QByteArray currentFile;
|
||||||
unsigned currentLine;
|
unsigned currentLine;
|
||||||
bool hide_next;
|
bool hide_next;
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
|||||||
__result->append(QByteArray::number(env.currentLine));
|
__result->append(QByteArray::number(env.currentLine));
|
||||||
__result->append(' ');
|
__result->append(' ');
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
__result->append(env.current_file);
|
__result->append(env.currentFile);
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
__result->append('\n');
|
__result->append('\n');
|
||||||
++lines;
|
++lines;
|
||||||
@@ -218,7 +218,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
|||||||
else if (fast_name == "__FILE__")
|
else if (fast_name == "__FILE__")
|
||||||
{
|
{
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
__result->append(env.current_file);
|
__result->append(env.currentFile);
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (variadics)
|
if (variadics)
|
||||||
text += QLatin1String("...");
|
text += QLatin1String("...");
|
||||||
text += QLatin1Char(' ');
|
text += QLatin1Char(')');
|
||||||
}
|
}
|
||||||
text += QLatin1Char(' ');
|
text += QLatin1Char(' ');
|
||||||
text += QString::fromUtf8(definition.constData(), definition.size());
|
text += QString::fromUtf8(definition.constData(), definition.size());
|
||||||
|
|||||||
@@ -36,13 +36,11 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#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) \
|
#define QTC_ASSERT(cond, action) \
|
||||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;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
|
#endif // QTC_ASSERT_H
|
||||||
|
|
||||||
|
|||||||
@@ -520,6 +520,15 @@ void CPPEditor::jumpToDefinition()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
foreach (const Document::MacroUse use, doc->macroUses()) {
|
||||||
|
if (use.contains(endOfName - 1)) {
|
||||||
|
const Macro ¯o = 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;
|
qDebug() << "No results for expression:" << expression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
50
src/plugins/cpptools/cppfunctionsfilter.cpp
Normal file
50
src/plugins/cpptools/cppfunctionsfilter.cpp
Normal file
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
58
src/plugins/cpptools/cppfunctionsfilter.h
Normal file
58
src/plugins/cpptools/cppfunctionsfilter.h
Normal file
@@ -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
|
||||||
@@ -390,17 +390,17 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
|
|||||||
} else {
|
} else {
|
||||||
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
||||||
|
|
||||||
const QByteArray previousFile = env.current_file;
|
const QByteArray previousFile = env.currentFile;
|
||||||
const unsigned previousLine = env.currentLine;
|
const unsigned previousLine = env.currentLine;
|
||||||
|
|
||||||
env.current_file = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
env.currentFile = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
||||||
m_currentDoc->translationUnit()->fileNameLength());
|
m_currentDoc->translationUnit()->fileNameLength());
|
||||||
|
|
||||||
QByteArray preprocessedCode;
|
QByteArray preprocessedCode;
|
||||||
m_proc(contents, &preprocessedCode);
|
m_proc(contents, &preprocessedCode);
|
||||||
//qDebug() << preprocessedCode;
|
//qDebug() << preprocessedCode;
|
||||||
|
|
||||||
env.current_file = previousFile;
|
env.currentFile = previousFile;
|
||||||
env.currentLine = previousLine;
|
env.currentLine = previousLine;
|
||||||
|
|
||||||
m_currentDoc->setSource(preprocessedCode);
|
m_currentDoc->setSource(preprocessedCode);
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future)
|
|||||||
Q_UNUSED(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)
|
QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry)
|
||||||
{
|
{
|
||||||
QString entry = trimWildcards(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;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "cpptools.h"
|
#include "cpptools.h"
|
||||||
#include "cppclassesfilter.h"
|
#include "cppclassesfilter.h"
|
||||||
#include "cppcodecompletion.h"
|
#include "cppcodecompletion.h"
|
||||||
|
#include "cppfunctionsfilter.h"
|
||||||
#include "cpphoverhandler.h"
|
#include "cpphoverhandler.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "cpptoolsconstants.h"
|
#include "cpptoolsconstants.h"
|
||||||
@@ -89,6 +90,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
|||||||
m_core->editorManager());
|
m_core->editorManager());
|
||||||
addAutoReleasedObject(quickOpenFilter);
|
addAutoReleasedObject(quickOpenFilter);
|
||||||
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
|
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
|
||||||
|
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager()));
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
Core::IActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
|
Core::IActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
|
||||||
|
|||||||
@@ -10,15 +10,16 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
|||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
DEFINES += CPPTOOLS_LIBRARY
|
DEFINES += CPPTOOLS_LIBRARY
|
||||||
CONFIG += help
|
CONFIG += help
|
||||||
|
|
||||||
HEADERS += cpptools_global.h \
|
HEADERS += cpptools_global.h \
|
||||||
cppquickopenfilter.h \
|
cppquickopenfilter.h \
|
||||||
cppclassesfilter.h \
|
cppclassesfilter.h \
|
||||||
searchsymbols.h
|
searchsymbols.h \
|
||||||
|
cppfunctionsfilter.h
|
||||||
SOURCES += cppquickopenfilter.cpp \
|
SOURCES += cppquickopenfilter.cpp \
|
||||||
cpptoolseditorsupport.cpp \
|
cpptoolseditorsupport.cpp \
|
||||||
cppclassesfilter.cpp \
|
cppclassesfilter.cpp \
|
||||||
searchsymbols.cpp
|
searchsymbols.cpp \
|
||||||
|
cppfunctionsfilter.cpp
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
SOURCES += cpptools.cpp \
|
SOURCES += cpptools.cpp \
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <Literals.h>
|
#include <Literals.h>
|
||||||
#include <Scope.h>
|
#include <Scope.h>
|
||||||
|
#include <Names.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
@@ -97,12 +98,24 @@ bool SearchSymbols::visit(Function *symbol)
|
|||||||
if (!(symbolsToSearchFor & Functions))
|
if (!(symbolsToSearchFor & Functions))
|
||||||
return false;
|
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 name = symbolName(symbol);
|
||||||
QString scopedName = scopedSymbolName(name);
|
QString scopedName = scopedSymbolName(name);
|
||||||
QString type = overview.prettyType(symbol->type(),
|
QString type = overview.prettyType(symbol->type(),
|
||||||
separateScope ? symbol->name() : 0);
|
separateScope ? symbol->identity() : 0);
|
||||||
appendItem(separateScope ? type : scopedName,
|
appendItem(separateScope ? type : scopedName,
|
||||||
separateScope ? _scope : type,
|
separateScope ? fullScope : type,
|
||||||
ModelItemInfo::Method, symbol);
|
ModelItemInfo::Method, symbol);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -196,6 +209,9 @@ void SearchSymbols::appendItem(const QString &name,
|
|||||||
ModelItemInfo::ItemType type,
|
ModelItemInfo::ItemType type,
|
||||||
const Symbol *symbol)
|
const Symbol *symbol)
|
||||||
{
|
{
|
||||||
|
if (!symbol->name())
|
||||||
|
return;
|
||||||
|
|
||||||
const QIcon icon = icons.iconForSymbol(symbol);
|
const QIcon icon = icons.iconForSymbol(symbol);
|
||||||
items.append(ModelItemInfo(name, info, type,
|
items.append(ModelItemInfo(name, info, type,
|
||||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||||
|
|||||||
@@ -34,7 +34,8 @@
|
|||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
|
|
||||||
#include "imports.h" // TextEditor::BaseTextMark
|
#include "imports.h" // TextEditor::BaseTextMark
|
||||||
#include "qtcassert.h"
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ include(../../plugins/texteditor/texteditor.pri)
|
|||||||
include(../../plugins/cpptools/cpptools.pri)
|
include(../../plugins/cpptools/cpptools.pri)
|
||||||
include(../../libs/cplusplus/cplusplus.pri)
|
include(../../libs/cplusplus/cplusplus.pri)
|
||||||
|
|
||||||
INCLUDEPATH += ../../libs/utils
|
|
||||||
|
|
||||||
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
||||||
QT += gui network script
|
QT += gui network script
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
#include "gdboptionpage.h"
|
#include "gdboptionpage.h"
|
||||||
#include "gdbengine.h"
|
#include "gdbengine.h"
|
||||||
#include "mode.h"
|
#include "mode.h"
|
||||||
#include "qtcassert.h"
|
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
@@ -48,20 +47,27 @@
|
|||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
|
|
||||||
#include <cplusplus/ExpressionUnderCursor.h>
|
#include <cplusplus/ExpressionUnderCursor.h>
|
||||||
|
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <texteditor/basetextmark.h>
|
#include <texteditor/basetextmark.h>
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/qplugin.h>
|
#include <QtCore/qplugin.h>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QPoint>
|
#include <QtCore/QPoint>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
#include <QtGui/QTextCursor>
|
#include <QtGui/QTextCursor>
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
#include "procinterrupt.h"
|
#include "procinterrupt.h"
|
||||||
#include "qtcassert.h"
|
|
||||||
|
|
||||||
#include "disassemblerhandler.h"
|
#include "disassemblerhandler.h"
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
@@ -49,6 +48,8 @@
|
|||||||
#include "startexternaldialog.h"
|
#include "startexternaldialog.h"
|
||||||
#include "attachexternaldialog.h"
|
#include "attachexternaldialog.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|||||||
@@ -32,10 +32,10 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
#include "qtcassert.h"
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
#include "qtcassert.h"
|
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -48,10 +47,14 @@
|
|||||||
#include <coreplugin/outputpane.h>
|
#include <coreplugin/outputpane.h>
|
||||||
#include <coreplugin/navigationwidget.h>
|
#include <coreplugin/navigationwidget.h>
|
||||||
#include <coreplugin/rightpane.h>
|
#include <coreplugin/rightpane.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QDockWidget>
|
#include <QtGui/QDockWidget>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
|
|||||||
@@ -33,19 +33,18 @@
|
|||||||
|
|
||||||
#include "scriptengine.h"
|
#include "scriptengine.h"
|
||||||
|
|
||||||
#include "qtcassert.h"
|
#include "attachexternaldialog.h"
|
||||||
|
#include "breakhandler.h"
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
|
||||||
#include "disassemblerhandler.h"
|
#include "disassemblerhandler.h"
|
||||||
#include "breakhandler.h"
|
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
#include "registerhandler.h"
|
#include "registerhandler.h"
|
||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
|
#include "startexternaldialog.h"
|
||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
|
|
||||||
#include "startexternaldialog.h"
|
#include <utils/qtcassert.h>
|
||||||
#include "attachexternaldialog.h"
|
|
||||||
|
|
||||||
#include <QtCore/QDateTime>
|
#include <QtCore/QDateTime>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
|
|
||||||
#include "qtcassert.h"
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QAbstractTableModel>
|
#include <QtCore/QAbstractTableModel>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "modeltest.h"
|
#include "modeltest.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "qtcassert.h"
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
@@ -118,7 +118,7 @@ static QByteArray quoteUnprintable(const QByteArray &ba)
|
|||||||
QByteArray res;
|
QByteArray res;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
for (int i = 0, n = ba.size(); i != n; ++i) {
|
for (int i = 0, n = ba.size(); i != n; ++i) {
|
||||||
char c = ba.at(i);
|
unsigned char c = ba.at(i);
|
||||||
if (isprint(c)) {
|
if (isprint(c)) {
|
||||||
res += c;
|
res += c;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -314,8 +314,8 @@ void ProjectNode::addProjectNodes(const QList<ProjectNode*> &subProjects)
|
|||||||
emit watcher->foldersAboutToBeAdded(this, folderNodes);
|
emit watcher->foldersAboutToBeAdded(this, folderNodes);
|
||||||
|
|
||||||
foreach (ProjectNode *project, subProjects) {
|
foreach (ProjectNode *project, subProjects) {
|
||||||
Q_ASSERT_X(!project->parentFolderNode(), "addProjectNodes",
|
QTC_ASSERT(!project->parentFolderNode(),
|
||||||
"Project node has already a parent");
|
qDebug("Project node has already a parent"));
|
||||||
project->setParentFolderNode(this);
|
project->setParentFolderNode(this);
|
||||||
foreach (NodesWatcher *watcher, m_watchers)
|
foreach (NodesWatcher *watcher, m_watchers)
|
||||||
project->registerWatcher(watcher);
|
project->registerWatcher(watcher);
|
||||||
@@ -353,13 +353,13 @@ void ProjectNode::removeProjectNodes(const QList<ProjectNode*> &subProjects)
|
|||||||
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
||||||
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
|
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
|
||||||
++projectIter;
|
++projectIter;
|
||||||
Q_ASSERT_X(projectIter != m_subProjectNodes.end(), "removeProjectNodes",
|
QTC_ASSERT(projectIter != m_subProjectNodes.end(),
|
||||||
"Project to remove is not part of specified folder!");
|
qDebug("Project to remove is not part of specified folder!"));
|
||||||
}
|
}
|
||||||
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
|
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
|
||||||
++folderIter;
|
++folderIter;
|
||||||
Q_ASSERT_X(folderIter != m_subFolderNodes.end(), "removeProjectNodes",
|
QTC_ASSERT(folderIter != m_subFolderNodes.end(),
|
||||||
"Project to remove is not part of specified folder!");
|
qDebug("Project to remove is not part of specified folder!"));
|
||||||
}
|
}
|
||||||
delete *projectIter;
|
delete *projectIter;
|
||||||
projectIter = m_subProjectNodes.erase(projectIter);
|
projectIter = m_subProjectNodes.erase(projectIter);
|
||||||
@@ -386,15 +386,15 @@ void ProjectNode::addFolderNodes(const QList<FolderNode*> &subFolders, FolderNod
|
|||||||
watcher->foldersAboutToBeAdded(parentFolder, subFolders);
|
watcher->foldersAboutToBeAdded(parentFolder, subFolders);
|
||||||
|
|
||||||
foreach (FolderNode *folder, subFolders) {
|
foreach (FolderNode *folder, subFolders) {
|
||||||
Q_ASSERT_X(!folder->parentFolderNode(), "addFolderNodes",
|
QTC_ASSERT(!folder->parentFolderNode(),
|
||||||
"Project node has already a parent folder");
|
qDebug("Project node has already a parent folder"));
|
||||||
folder->setParentFolderNode(parentFolder);
|
folder->setParentFolderNode(parentFolder);
|
||||||
folder->setProjectNode(this);
|
folder->setProjectNode(this);
|
||||||
parentFolder->m_subFolderNodes.append(folder);
|
parentFolder->m_subFolderNodes.append(folder);
|
||||||
|
|
||||||
// project nodes have to be added via addProjectNodes
|
// project nodes have to be added via addProjectNodes
|
||||||
Q_ASSERT_X(folder->nodeType() != ProjectNodeType, "addFolderNodes",
|
QTC_ASSERT(folder->nodeType() != ProjectNodeType,
|
||||||
"project nodes have to be added via addProjectNodes");
|
qDebug("project nodes have to be added via addProjectNodes"));
|
||||||
}
|
}
|
||||||
qSort(parentFolder->m_subFolderNodes.begin(), parentFolder->m_subFolderNodes.end(),
|
qSort(parentFolder->m_subFolderNodes.begin(), parentFolder->m_subFolderNodes.end(),
|
||||||
sortNodesByPath);
|
sortNodesByPath);
|
||||||
@@ -427,12 +427,12 @@ void ProjectNode::removeFolderNodes(const QList<FolderNode*> &subFolders,
|
|||||||
QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin();
|
QList<FolderNode*>::const_iterator toRemoveIter = toRemove.constBegin();
|
||||||
QList<FolderNode*>::iterator folderIter = parentFolder->m_subFolderNodes.begin();
|
QList<FolderNode*>::iterator folderIter = parentFolder->m_subFolderNodes.begin();
|
||||||
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
||||||
Q_ASSERT_X(((*toRemoveIter)->nodeType() != ProjectNodeType), "removeFolderNodes",
|
QTC_ASSERT((*toRemoveIter)->nodeType() != ProjectNodeType,
|
||||||
"project nodes have to be removed via removeProjectNodes");
|
qDebug("project nodes have to be removed via removeProjectNodes"));
|
||||||
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
|
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
|
||||||
++folderIter;
|
++folderIter;
|
||||||
Q_ASSERT_X(folderIter != parentFolder->m_subFolderNodes.end(), "removeFileNodes",
|
QTC_ASSERT(folderIter != parentFolder->m_subFolderNodes.end(),
|
||||||
"Folder to remove is not part of specified folder!");
|
qDebug("Folder to remove is not part of specified folder!"));
|
||||||
}
|
}
|
||||||
delete *folderIter;
|
delete *folderIter;
|
||||||
folderIter = parentFolder->m_subFolderNodes.erase(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);
|
emit watcher->filesAboutToBeAdded(folder, files);
|
||||||
|
|
||||||
foreach (FileNode *file, files) {
|
foreach (FileNode *file, files) {
|
||||||
Q_ASSERT_X(!file->parentFolderNode(), "addFileNodes",
|
QTC_ASSERT(!file->parentFolderNode(),
|
||||||
"File node has already a parent folder");
|
qDebug("File node has already a parent folder"));
|
||||||
|
|
||||||
file->setParentFolderNode(folder);
|
file->setParentFolderNode(folder);
|
||||||
file->setProjectNode(this);
|
file->setProjectNode(this);
|
||||||
@@ -499,8 +499,8 @@ void ProjectNode::removeFileNodes(const QList<FileNode*> &files, FolderNode *fol
|
|||||||
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
||||||
while ((*filesIter)->path() != (*toRemoveIter)->path()) {
|
while ((*filesIter)->path() != (*toRemoveIter)->path()) {
|
||||||
++filesIter;
|
++filesIter;
|
||||||
Q_ASSERT_X(filesIter != folder->m_fileNodes.end(), "removeFileNodes",
|
QTC_ASSERT(filesIter != folder->m_fileNodes.end(),
|
||||||
"File to remove is not part of specified folder!");
|
qDebug("File to remove is not part of specified folder!"));
|
||||||
}
|
}
|
||||||
delete *filesIter;
|
delete *filesIter;
|
||||||
filesIter = folder->m_fileNodes.erase(filesIter);
|
filesIter = folder->m_fileNodes.erase(filesIter);
|
||||||
@@ -591,8 +591,8 @@ void SessionNode::addProjectNodes(const QList<ProjectNode*> &projectNodes)
|
|||||||
emit watcher->foldersAboutToBeAdded(this, folderNodes);
|
emit watcher->foldersAboutToBeAdded(this, folderNodes);
|
||||||
|
|
||||||
foreach (ProjectNode *project, projectNodes) {
|
foreach (ProjectNode *project, projectNodes) {
|
||||||
Q_ASSERT_X(!project->parentFolderNode(), "addProjectNodes",
|
QTC_ASSERT(!project->parentFolderNode(),
|
||||||
"Project node has already a parent folder");
|
qDebug("Project node has already a parent folder"));
|
||||||
project->setParentFolderNode(this);
|
project->setParentFolderNode(this);
|
||||||
foreach (NodesWatcher *watcher, m_watchers)
|
foreach (NodesWatcher *watcher, m_watchers)
|
||||||
project->registerWatcher(watcher);
|
project->registerWatcher(watcher);
|
||||||
@@ -621,13 +621,13 @@ void SessionNode::removeProjectNodes(const QList<ProjectNode*> &projectNodes)
|
|||||||
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
for (; toRemoveIter != toRemove.constEnd(); ++toRemoveIter) {
|
||||||
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
|
while ((*projectIter)->path() != (*toRemoveIter)->path()) {
|
||||||
++projectIter;
|
++projectIter;
|
||||||
Q_ASSERT_X(projectIter != m_projectNodes.end(), "removeProjectNodes",
|
QTC_ASSERT(projectIter != m_projectNodes.end(),
|
||||||
"Project to remove is not part of specified folder!");
|
qDebug("Project to remove is not part of specified folder!"));
|
||||||
}
|
}
|
||||||
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
|
while ((*folderIter)->path() != (*toRemoveIter)->path()) {
|
||||||
++folderIter;
|
++folderIter;
|
||||||
Q_ASSERT_X(folderIter != m_subFolderNodes.end(), "removeProjectNodes",
|
QTC_ASSERT(folderIter != m_subFolderNodes.end(),
|
||||||
"Project to remove is not part of specified folder!");
|
qDebug("Project to remove is not part of specified folder!"));
|
||||||
}
|
}
|
||||||
projectIter = m_projectNodes.erase(projectIter);
|
projectIter = m_projectNodes.erase(projectIter);
|
||||||
folderIter = m_subFolderNodes.erase(folderIter);
|
folderIter = m_subFolderNodes.erase(folderIter);
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ TaskWindow::TaskWindow()
|
|||||||
|
|
||||||
m_listview->setModel(m_model);
|
m_listview->setModel(m_model);
|
||||||
m_listview->setFrameStyle(QFrame::NoFrame);
|
m_listview->setFrameStyle(QFrame::NoFrame);
|
||||||
m_listview->setWindowTitle(tr("Problems"));
|
m_listview->setWindowTitle(tr("Build Issues"));
|
||||||
m_listview->setSelectionMode(QAbstractItemView::SingleSelection);
|
m_listview->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
TaskDelegate *tld = new TaskDelegate(this);
|
TaskDelegate *tld = new TaskDelegate(this);
|
||||||
m_listview->setItemDelegate(tld);
|
m_listview->setItemDelegate(tld);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
QWidget *outputWidget(QWidget *);
|
QWidget *outputWidget(QWidget *);
|
||||||
QList<QWidget*> toolBarWidgets(void) const;
|
QList<QWidget*> toolBarWidgets(void) const;
|
||||||
|
|
||||||
QString name() const { return tr("Problems"); }
|
QString name() const { return tr("Build Issues"); }
|
||||||
int priorityInStatusBar() const;
|
int priorityInStatusBar() const;
|
||||||
void clearContents();
|
void clearContents();
|
||||||
void visibilityChanged(bool visible);
|
void visibilityChanged(bool visible);
|
||||||
|
|||||||
@@ -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 Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|||||||
@@ -87,6 +87,31 @@ private:
|
|||||||
FileModificationTimeMap m_files;
|
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 Internal
|
||||||
} // namespace Qt4ProjectManager
|
} // namespace Qt4ProjectManager
|
||||||
|
|
||||||
|
|||||||
@@ -87,11 +87,20 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo
|
|||||||
m_project(project),
|
m_project(project),
|
||||||
m_qt4ProFileNode(qt4ProFileNode),
|
m_qt4ProFileNode(qt4ProFileNode),
|
||||||
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
|
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
|
||||||
m_projectDir(QFileInfo(filePath).absolutePath())
|
m_projectDir(QFileInfo(filePath).absolutePath()),
|
||||||
|
m_fileWatcher(new FileWatcher(this))
|
||||||
{
|
{
|
||||||
QTC_ASSERT(project, return);
|
QTC_ASSERT(project, return);
|
||||||
setFolderName(QFileInfo(filePath).baseName());
|
setFolderName(QFileInfo(filePath).baseName());
|
||||||
setIcon(QIcon(":/qt4projectmanager/images/qt_project.png"));
|
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)
|
void Qt4PriFileNode::update(ProFile *includeFile, ProFileReader *reader)
|
||||||
@@ -495,12 +504,17 @@ Qt4ProFileNode::Qt4ProFileNode(Qt4Project *project,
|
|||||||
if (parent)
|
if (parent)
|
||||||
setParent(parent);
|
setParent(parent);
|
||||||
|
|
||||||
|
m_updateTimer.setInterval(100);
|
||||||
|
m_updateTimer.setSingleShot(true);
|
||||||
|
|
||||||
connect(m_dirWatcher, SIGNAL(directoryChanged(const QString&)),
|
connect(m_dirWatcher, SIGNAL(directoryChanged(const QString&)),
|
||||||
this, SLOT(update()));
|
this, SLOT(updateGeneratedFiles()));
|
||||||
connect(m_dirWatcher, SIGNAL(fileChanged(const QString&)),
|
connect(m_dirWatcher, SIGNAL(fileChanged(const QString&)),
|
||||||
this, SLOT(fileChanged(const QString&)));
|
this, SLOT(fileChanged(const QString&)));
|
||||||
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
this, SLOT(update()));
|
this, SLOT(update()));
|
||||||
|
connect(&m_updateTimer, SIGNAL(timeout()),
|
||||||
|
this, SLOT(update()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4ProFileNode::~Qt4ProFileNode()
|
Qt4ProFileNode::~Qt4ProFileNode()
|
||||||
@@ -523,6 +537,11 @@ QStringList Qt4ProFileNode::variableValue(const Qt4Variable var) const
|
|||||||
return m_varValues.value(var);
|
return m_varValues.value(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Qt4ProFileNode::scheduleUpdate()
|
||||||
|
{
|
||||||
|
m_updateTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
void Qt4ProFileNode::update()
|
void Qt4ProFileNode::update()
|
||||||
{
|
{
|
||||||
ProFileReader *reader = createProFileReader();
|
ProFileReader *reader = createProFileReader();
|
||||||
@@ -681,9 +700,11 @@ void Qt4ProFileNode::update()
|
|||||||
|
|
||||||
void Qt4ProFileNode::fileChanged(const QString &filePath)
|
void Qt4ProFileNode::fileChanged(const QString &filePath)
|
||||||
{
|
{
|
||||||
|
qDebug()<<"+++++"<<filePath;
|
||||||
CppTools::CppModelManagerInterface *modelManager =
|
CppTools::CppModelManagerInterface *modelManager =
|
||||||
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||||
|
|
||||||
|
// TODO compress
|
||||||
modelManager->updateSourceFiles(QStringList() << filePath);
|
modelManager->updateSourceFiles(QStringList() << filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,11 +752,16 @@ void Qt4ProFileNode::updateGeneratedFiles()
|
|||||||
|
|
||||||
// update generated files
|
// update generated files
|
||||||
|
|
||||||
|
// Already existing FileNodes
|
||||||
QList<FileNode*> existingFileNodes;
|
QList<FileNode*> existingFileNodes;
|
||||||
foreach (FileNode *file, fileNodes()) {
|
foreach (FileNode *file, fileNodes()) {
|
||||||
if (file->isGenerated())
|
if (file->isGenerated())
|
||||||
existingFileNodes << file;
|
existingFileNodes << file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Convert uiFile to uiHeaderFilePath, find all headers that correspond
|
||||||
|
// and try to find them in uicDirs
|
||||||
QStringList newFilePaths;
|
QStringList newFilePaths;
|
||||||
foreach (const QString &uicDir, m_varValues[UiDirVar]) {
|
foreach (const QString &uicDir, m_varValues[UiDirVar]) {
|
||||||
foreach (FileNode *uiFile, uiFiles) {
|
foreach (FileNode *uiFile, uiFiles) {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ using ProjectExplorer::FileType;
|
|||||||
|
|
||||||
class ProFileReader;
|
class ProFileReader;
|
||||||
class DirectoryWatcher;
|
class DirectoryWatcher;
|
||||||
|
class FileWatcher;
|
||||||
|
|
||||||
// Type of projects
|
// Type of projects
|
||||||
enum Qt4ProjectType {
|
enum Qt4ProjectType {
|
||||||
@@ -142,6 +143,9 @@ protected:
|
|||||||
QString buildDir() const;
|
QString buildDir() const;
|
||||||
ProFileReader *createProFileReader() const;
|
ProFileReader *createProFileReader() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void scheduleUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void save(ProFile *includeFile);
|
void save(ProFile *includeFile);
|
||||||
bool priFileWritable(const QString &path);
|
bool priFileWritable(const QString &path);
|
||||||
@@ -151,7 +155,10 @@ private:
|
|||||||
Qt4ProFileNode *m_qt4ProFileNode;
|
Qt4ProFileNode *m_qt4ProFileNode;
|
||||||
QString m_projectFilePath;
|
QString m_projectFilePath;
|
||||||
QString m_projectDir;
|
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
|
// managed by Qt4ProFileNode
|
||||||
friend class Qt4ProFileNode;
|
friend class Qt4ProFileNode;
|
||||||
@@ -174,14 +181,13 @@ public:
|
|||||||
QStringList variableValue(const Qt4Variable var) const;
|
QStringList variableValue(const Qt4Variable var) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void scheduleUpdate();
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fileChanged(const QString &filePath);
|
void fileChanged(const QString &filePath);
|
||||||
|
|
||||||
private:
|
|
||||||
void updateGeneratedFiles();
|
void updateGeneratedFiles();
|
||||||
|
|
||||||
|
private:
|
||||||
Qt4ProFileNode *createSubProFileNode(const QString &path);
|
Qt4ProFileNode *createSubProFileNode(const QString &path);
|
||||||
|
|
||||||
QStringList uiDirPaths(ProFileReader *reader) const;
|
QStringList uiDirPaths(ProFileReader *reader) const;
|
||||||
@@ -197,9 +203,9 @@ private:
|
|||||||
Qt4ProjectType m_projectType;
|
Qt4ProjectType m_projectType;
|
||||||
QHash<Qt4Variable, QStringList> m_varValues;
|
QHash<Qt4Variable, QStringList> m_varValues;
|
||||||
bool m_isQBuildProject;
|
bool m_isQBuildProject;
|
||||||
|
QTimer m_updateTimer;
|
||||||
|
|
||||||
DirectoryWatcher *m_dirWatcher;
|
DirectoryWatcher *m_dirWatcher;
|
||||||
|
|
||||||
friend class Qt4NodeHierarchy;
|
friend class Qt4NodeHierarchy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ Qt4Project::~Qt4Project()
|
|||||||
void Qt4Project::defaultQtVersionChanged()
|
void Qt4Project::defaultQtVersionChanged()
|
||||||
{
|
{
|
||||||
if (qtVersionId(activeBuildConfiguration()) == 0)
|
if (qtVersionId(activeBuildConfiguration()) == 0)
|
||||||
update();
|
m_rootProjectNode->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4Project::qtVersionsChanged()
|
void Qt4Project::qtVersionsChanged()
|
||||||
@@ -274,7 +274,7 @@ void Qt4Project::qtVersionsChanged()
|
|||||||
if (!qt4ProjectManager()->versionManager()->version(qtVersionId(bc))->isValid()) {
|
if (!qt4ProjectManager()->versionManager()->version(qtVersionId(bc))->isValid()) {
|
||||||
setQtVersion(bc, 0);
|
setQtVersion(bc, 0);
|
||||||
if (bc == activeBuildConfiguration())
|
if (bc == activeBuildConfiguration())
|
||||||
update();
|
m_rootProjectNode->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -507,9 +507,9 @@ void Qt4Project::updateCodeModel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
///*!
|
||||||
Updates complete project
|
// Updates complete project
|
||||||
*/
|
// */
|
||||||
void Qt4Project::update()
|
void Qt4Project::update()
|
||||||
{
|
{
|
||||||
// TODO Maybe remove this method completely?
|
// TODO Maybe remove this method completely?
|
||||||
|
|||||||
Reference in New Issue
Block a user