forked from qt-creator/qt-creator
Merge branch '1.0.0' of git@scm.dev.nokia.troll.no:creator/mainline into 1.0.0
This commit is contained in:
@@ -70,10 +70,6 @@ int qtGhVersion = QT_VERSION;
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
# include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QDumper
|
\class QDumper
|
||||||
\brief Helper class for producing "nice" output in Qt Creator's debugger.
|
\brief Helper class for producing "nice" output in Qt Creator's debugger.
|
||||||
|
Binary file not shown.
@@ -176,7 +176,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
|
|||||||
scopes.clear();
|
scopes.clear();
|
||||||
foreach (Symbol *candidate, candidates) {
|
foreach (Symbol *candidate, candidates) {
|
||||||
if (ScopedSymbol *scoped = candidate->asScopedSymbol()) {
|
if (ScopedSymbol *scoped = candidate->asScopedSymbol()) {
|
||||||
expand(scoped->members(), visibleScopes, &scopes);
|
scopes.append(scoped->members());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,11 @@ bool Overview::showReturnTypes() const
|
|||||||
return _showReturnTypes;
|
return _showReturnTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned Overview::markArgument() const
|
||||||
|
{
|
||||||
|
return _markArgument;
|
||||||
|
}
|
||||||
|
|
||||||
void Overview::setMarkArgument(unsigned position)
|
void Overview::setMarkArgument(unsigned position)
|
||||||
{
|
{
|
||||||
_markArgument = position;
|
_markArgument = position;
|
||||||
@@ -98,9 +103,5 @@ QString Overview::prettyType(const FullySpecifiedType &ty,
|
|||||||
const QString &name) const
|
const QString &name) const
|
||||||
{
|
{
|
||||||
TypePrettyPrinter pp(this);
|
TypePrettyPrinter pp(this);
|
||||||
pp.setMarkArgument(_markArgument);
|
|
||||||
pp.setShowArgumentNames(_showArgumentNames);
|
|
||||||
pp.setShowReturnTypes(_showReturnTypes);
|
|
||||||
pp.setShowFunctionSignatures(_showFunctionSignatures);
|
|
||||||
return pp(ty, name);
|
return pp(ty, name);
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,10 @@ public:
|
|||||||
bool showFunctionSignatures() const;
|
bool showFunctionSignatures() const;
|
||||||
void setShowFunctionSignatures(bool showFunctionSignatures);
|
void setShowFunctionSignatures(bool showFunctionSignatures);
|
||||||
|
|
||||||
void setMarkArgument(unsigned position); // 1-based
|
// 1-based
|
||||||
|
// ### rename
|
||||||
|
unsigned markArgument() const;
|
||||||
|
void setMarkArgument(unsigned position);
|
||||||
|
|
||||||
QString operator()(Name *name) const
|
QString operator()(Name *name) const
|
||||||
{ return prettyName(name); }
|
{ return prettyName(name); }
|
||||||
|
@@ -42,37 +42,12 @@ using namespace CPlusPlus;
|
|||||||
|
|
||||||
TypePrettyPrinter::TypePrettyPrinter(const Overview *overview)
|
TypePrettyPrinter::TypePrettyPrinter(const Overview *overview)
|
||||||
: _overview(overview),
|
: _overview(overview),
|
||||||
_name(0),
|
_name(0)
|
||||||
_markArgument(0),
|
|
||||||
_showArgumentNames(false),
|
|
||||||
_showReturnTypes(false),
|
|
||||||
_showFunctionSignatures(true)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TypePrettyPrinter::~TypePrettyPrinter()
|
TypePrettyPrinter::~TypePrettyPrinter()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool TypePrettyPrinter::showArgumentNames() const
|
|
||||||
{ return _showArgumentNames; }
|
|
||||||
|
|
||||||
void TypePrettyPrinter::setShowArgumentNames(bool showArgumentNames)
|
|
||||||
{ _showArgumentNames = showArgumentNames; }
|
|
||||||
|
|
||||||
bool TypePrettyPrinter::showReturnTypes() const
|
|
||||||
{ return _showReturnTypes; }
|
|
||||||
|
|
||||||
void TypePrettyPrinter::setShowReturnTypes(bool showReturnTypes)
|
|
||||||
{ _showReturnTypes = showReturnTypes; }
|
|
||||||
|
|
||||||
bool TypePrettyPrinter::showFunctionSignatures() const
|
|
||||||
{ return _showFunctionSignatures; }
|
|
||||||
|
|
||||||
void TypePrettyPrinter::setShowFunctionSignatures(bool showFunctionSignatures)
|
|
||||||
{ _showFunctionSignatures = showFunctionSignatures; }
|
|
||||||
|
|
||||||
void TypePrettyPrinter::setMarkArgument(unsigned position)
|
|
||||||
{ _markArgument = position; }
|
|
||||||
|
|
||||||
const Overview *TypePrettyPrinter::overview() const
|
const Overview *TypePrettyPrinter::overview() const
|
||||||
{ return _overview; }
|
{ return _overview; }
|
||||||
|
|
||||||
@@ -102,15 +77,16 @@ QString TypePrettyPrinter::operator()(const FullySpecifiedType &type, const QStr
|
|||||||
|
|
||||||
void TypePrettyPrinter::acceptType(const FullySpecifiedType &ty)
|
void TypePrettyPrinter::acceptType(const FullySpecifiedType &ty)
|
||||||
{
|
{
|
||||||
if (ty.isConst())
|
|
||||||
_text += QLatin1String("const ");
|
|
||||||
if (ty.isVolatile())
|
|
||||||
_text += QLatin1String("volatile ");
|
|
||||||
if (ty.isSigned())
|
if (ty.isSigned())
|
||||||
_text += QLatin1String("signed ");
|
out(QLatin1String("signed "));
|
||||||
if (ty.isUnsigned())
|
|
||||||
_text += QLatin1String("unsigned ");
|
else if (ty.isUnsigned())
|
||||||
|
out(QLatin1String("unsigned "));
|
||||||
|
|
||||||
|
const FullySpecifiedType previousFullySpecifiedType = _fullySpecifiedType;
|
||||||
|
_fullySpecifiedType = ty;
|
||||||
accept(ty.type());
|
accept(ty.type());
|
||||||
|
_fullySpecifiedType = previousFullySpecifiedType;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TypePrettyPrinter::switchName(const QString &name)
|
QString TypePrettyPrinter::switchName(const QString &name)
|
||||||
@@ -127,9 +103,9 @@ QString TypePrettyPrinter::switchText(const QString &name)
|
|||||||
return previousName;
|
return previousName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Type *> TypePrettyPrinter::switchPtrOperators(const QList<Type *> &ptrOperators)
|
QList<FullySpecifiedType> TypePrettyPrinter::switchPtrOperators(const QList<FullySpecifiedType> &ptrOperators)
|
||||||
{
|
{
|
||||||
QList<Type *> previousPtrOperators = _ptrOperators;
|
QList<FullySpecifiedType> previousPtrOperators = _ptrOperators;
|
||||||
_ptrOperators = ptrOperators;
|
_ptrOperators = ptrOperators;
|
||||||
return previousPtrOperators;
|
return previousPtrOperators;
|
||||||
}
|
}
|
||||||
@@ -137,31 +113,53 @@ QList<Type *> TypePrettyPrinter::switchPtrOperators(const QList<Type *> &ptrOper
|
|||||||
void TypePrettyPrinter::applyPtrOperators(bool wantSpace)
|
void TypePrettyPrinter::applyPtrOperators(bool wantSpace)
|
||||||
{
|
{
|
||||||
for (int i = _ptrOperators.size() - 1; i != -1; --i) {
|
for (int i = _ptrOperators.size() - 1; i != -1; --i) {
|
||||||
Type *op = _ptrOperators.at(i);
|
const FullySpecifiedType op = _ptrOperators.at(i);
|
||||||
|
|
||||||
if (i == 0 && wantSpace)
|
if (i == 0 && wantSpace)
|
||||||
_text += QLatin1Char(' ');
|
space();
|
||||||
|
|
||||||
if (PointerType *ptrTy = op->asPointerType()) {
|
if (op->isPointerType()) {
|
||||||
_text += QLatin1Char('*');
|
out(QLatin1Char('*'));
|
||||||
if (ptrTy->elementType().isConst())
|
outCV(op);
|
||||||
_text += " const";
|
|
||||||
if (ptrTy->elementType().isVolatile())
|
|
||||||
_text += " volatile";
|
|
||||||
} else if (op->isReferenceType()) {
|
} else if (op->isReferenceType()) {
|
||||||
_text += QLatin1Char('&');
|
out(QLatin1Char('&'));
|
||||||
} else if (PointerToMemberType *memPtrTy = op->asPointerToMemberType()) {
|
} else if (const PointerToMemberType *memPtrTy = op->asPointerToMemberType()) {
|
||||||
_text += QLatin1Char(' ');
|
space();
|
||||||
_text += _overview->prettyName(memPtrTy->memberName());
|
out(_overview->prettyName(memPtrTy->memberName()));
|
||||||
_text += QLatin1Char('*');
|
out(QLatin1Char('*'));
|
||||||
|
outCV(op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(VoidType *)
|
void TypePrettyPrinter::visit(VoidType *)
|
||||||
{
|
{
|
||||||
_text += QLatin1String("void");
|
out(QLatin1String("void"));
|
||||||
|
applyPtrOperators();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TypePrettyPrinter::visit(NamedType *type)
|
||||||
|
{
|
||||||
|
out(overview()->prettyName(type->name()));
|
||||||
|
applyPtrOperators();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TypePrettyPrinter::visit(Namespace *type)
|
||||||
|
{
|
||||||
|
_text += overview()->prettyName(type->name());
|
||||||
|
applyPtrOperators();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TypePrettyPrinter::visit(Class *type)
|
||||||
|
{
|
||||||
|
_text += overview()->prettyName(type->name());
|
||||||
|
applyPtrOperators();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TypePrettyPrinter::visit(Enum *type)
|
||||||
|
{
|
||||||
|
_text += overview()->prettyName(type->name());
|
||||||
applyPtrOperators();
|
applyPtrOperators();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,25 +167,25 @@ void TypePrettyPrinter::visit(IntegerType *type)
|
|||||||
{
|
{
|
||||||
switch (type->kind()) {
|
switch (type->kind()) {
|
||||||
case IntegerType::Char:
|
case IntegerType::Char:
|
||||||
_text += QLatin1String("char");
|
out(QLatin1String("char"));
|
||||||
break;
|
break;
|
||||||
case IntegerType::WideChar:
|
case IntegerType::WideChar:
|
||||||
_text += QLatin1String("wchar_t");
|
out(QLatin1String("wchar_t"));
|
||||||
break;
|
break;
|
||||||
case IntegerType::Bool:
|
case IntegerType::Bool:
|
||||||
_text += QLatin1String("bool");
|
out(QLatin1String("bool"));
|
||||||
break;
|
break;
|
||||||
case IntegerType::Short:
|
case IntegerType::Short:
|
||||||
_text += QLatin1String("short");
|
out(QLatin1String("short"));
|
||||||
break;
|
break;
|
||||||
case IntegerType::Int:
|
case IntegerType::Int:
|
||||||
_text += QLatin1String("int");
|
out(QLatin1String("int"));
|
||||||
break;
|
break;
|
||||||
case IntegerType::Long:
|
case IntegerType::Long:
|
||||||
_text += QLatin1String("long");
|
out(QLatin1String("long"));
|
||||||
break;
|
break;
|
||||||
case IntegerType::LongLong:
|
case IntegerType::LongLong:
|
||||||
_text += QLatin1String("long long");
|
out(QLatin1String("long long"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,13 +196,13 @@ void TypePrettyPrinter::visit(FloatType *type)
|
|||||||
{
|
{
|
||||||
switch (type->kind()) {
|
switch (type->kind()) {
|
||||||
case FloatType::Float:
|
case FloatType::Float:
|
||||||
_text += QLatin1String("float");
|
out(QLatin1String("float"));
|
||||||
break;
|
break;
|
||||||
case FloatType::Double:
|
case FloatType::Double:
|
||||||
_text += QLatin1String("double");
|
out(QLatin1String("double"));
|
||||||
break;
|
break;
|
||||||
case FloatType::LongDouble:
|
case FloatType::LongDouble:
|
||||||
_text += QLatin1String("long double");
|
out(QLatin1String("long double"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,99 +211,135 @@ void TypePrettyPrinter::visit(FloatType *type)
|
|||||||
|
|
||||||
void TypePrettyPrinter::visit(PointerToMemberType *type)
|
void TypePrettyPrinter::visit(PointerToMemberType *type)
|
||||||
{
|
{
|
||||||
_ptrOperators.append(type);
|
outCV(type->elementType());
|
||||||
|
space();
|
||||||
|
|
||||||
|
_ptrOperators.append(_fullySpecifiedType);
|
||||||
acceptType(type->elementType());
|
acceptType(type->elementType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(PointerType *type)
|
void TypePrettyPrinter::visit(PointerType *type)
|
||||||
{
|
{
|
||||||
_ptrOperators.append(type);
|
outCV(type->elementType());
|
||||||
|
space();
|
||||||
|
|
||||||
|
_ptrOperators.append(_fullySpecifiedType);
|
||||||
acceptType(type->elementType());
|
acceptType(type->elementType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(ReferenceType *type)
|
void TypePrettyPrinter::visit(ReferenceType *type)
|
||||||
{
|
{
|
||||||
_ptrOperators.append(type);
|
outCV(type->elementType());
|
||||||
|
space();
|
||||||
|
|
||||||
|
_ptrOperators.append(_fullySpecifiedType);
|
||||||
acceptType(type->elementType());
|
acceptType(type->elementType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(ArrayType *type)
|
void TypePrettyPrinter::visit(ArrayType *type)
|
||||||
{
|
{
|
||||||
_text += overview()->prettyType(type->elementType());
|
out(overview()->prettyType(type->elementType()));
|
||||||
if (! _ptrOperators.isEmpty()) {
|
if (! _ptrOperators.isEmpty()) {
|
||||||
_text += QLatin1Char('(');
|
out(QLatin1Char('('));
|
||||||
applyPtrOperators(false);
|
applyPtrOperators(false);
|
||||||
if (! _name.isEmpty()) {
|
if (! _name.isEmpty()) {
|
||||||
_text += _name;
|
out(_name);
|
||||||
_name.clear();
|
_name.clear();
|
||||||
}
|
}
|
||||||
_text += QLatin1Char(')');
|
out(QLatin1Char(')'));
|
||||||
}
|
}
|
||||||
_text += QLatin1String("[]");
|
out(QLatin1String("[]"));
|
||||||
}
|
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(NamedType *type)
|
|
||||||
{
|
|
||||||
_text += overview()->prettyName(type->name());
|
|
||||||
applyPtrOperators();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(Function *type)
|
void TypePrettyPrinter::visit(Function *type)
|
||||||
{
|
{
|
||||||
if (_showReturnTypes)
|
if (_overview->showReturnTypes())
|
||||||
_text += _overview->prettyType(type->returnType());
|
out(_overview->prettyType(type->returnType()));
|
||||||
|
|
||||||
if (! _ptrOperators.isEmpty()) {
|
if (! _ptrOperators.isEmpty()) {
|
||||||
_text += QLatin1Char('(');
|
out(QLatin1Char('('));
|
||||||
applyPtrOperators(false);
|
applyPtrOperators(false);
|
||||||
if (! _name.isEmpty()) {
|
if (! _name.isEmpty()) {
|
||||||
_text += _name;
|
_text += _name;
|
||||||
_name.clear();
|
_name.clear();
|
||||||
}
|
}
|
||||||
_text += QLatin1Char(')');
|
out(QLatin1Char(')'));
|
||||||
} else if (! _name.isEmpty() && _showFunctionSignatures) {
|
} else if (! _name.isEmpty() && _overview->showFunctionSignatures()) {
|
||||||
_text += QLatin1Char(' '); // ### fixme
|
space();
|
||||||
_text += _name;
|
out(_name);
|
||||||
_name.clear();
|
_name.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_showFunctionSignatures) {
|
if (_overview->showFunctionSignatures()) {
|
||||||
Overview argumentText;
|
Overview argumentText;
|
||||||
_text += QLatin1Char('(');
|
argumentText.setShowReturnTypes(true);
|
||||||
|
argumentText.setShowArgumentNames(false);
|
||||||
|
argumentText.setShowFunctionSignatures(true);
|
||||||
|
|
||||||
|
out(QLatin1Char('('));
|
||||||
|
|
||||||
for (unsigned index = 0; index < type->argumentCount(); ++index) {
|
for (unsigned index = 0; index < type->argumentCount(); ++index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
_text += QLatin1String(", ");
|
out(QLatin1String(", "));
|
||||||
|
|
||||||
if (Argument *arg = type->argumentAt(index)->asArgument()) {
|
if (Argument *arg = type->argumentAt(index)->asArgument()) {
|
||||||
if (index + 1 == _markArgument)
|
if (index + 1 == _overview->markArgument())
|
||||||
_text += QLatin1String("<b>");
|
out(QLatin1String("<b>"));
|
||||||
|
|
||||||
Name *name = 0;
|
Name *name = 0;
|
||||||
if (_showArgumentNames)
|
|
||||||
|
if (_overview->showArgumentNames())
|
||||||
name = arg->name();
|
name = arg->name();
|
||||||
_text += argumentText(arg->type(), name);
|
|
||||||
if (index + 1 == _markArgument)
|
out(argumentText(arg->type(), name));
|
||||||
_text += QLatin1String("</b>");
|
|
||||||
|
if (index + 1 == _overview->markArgument())
|
||||||
|
out(QLatin1String("</b>"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type->isVariadic())
|
if (type->isVariadic())
|
||||||
_text += QLatin1String("...");
|
out(QLatin1String("..."));
|
||||||
|
|
||||||
_text += QLatin1Char(')');
|
out(QLatin1Char(')'));
|
||||||
|
if (type->isConst() && type->isVolatile()) {
|
||||||
if (type->isConst())
|
space();
|
||||||
_text += QLatin1String(" const");
|
out("const volatile");
|
||||||
|
} else if (type->isConst()) {
|
||||||
if (type->isVolatile())
|
space();
|
||||||
_text += QLatin1String(" volatile");
|
out("const");
|
||||||
|
} else if (type->isVolatile()) {
|
||||||
|
space();
|
||||||
|
out("volatile");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(Namespace *type)
|
void TypePrettyPrinter::space()
|
||||||
{ _text += overview()->prettyName(type->name()); }
|
{
|
||||||
|
if (_text.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(Class *type)
|
const QChar ch = _text.at(_text.length() - 1);
|
||||||
{ _text += overview()->prettyName(type->name()); }
|
|
||||||
|
|
||||||
void TypePrettyPrinter::visit(Enum *type)
|
if (ch.isLetterOrNumber() || ch == QLatin1Char('_') || ch == QLatin1Char(')'))
|
||||||
{ _text += overview()->prettyName(type->name()); }
|
_text += QLatin1Char(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
void TypePrettyPrinter::out(const QString &text)
|
||||||
|
{ _text += text; }
|
||||||
|
|
||||||
|
void TypePrettyPrinter::out(const QChar &ch)
|
||||||
|
{ _text += ch; }
|
||||||
|
|
||||||
|
void TypePrettyPrinter::outCV(const FullySpecifiedType &ty)
|
||||||
|
{
|
||||||
|
if (ty.isConst() && ty.isVolatile())
|
||||||
|
out(QLatin1String("const volatile"));
|
||||||
|
|
||||||
|
else if (ty.isConst())
|
||||||
|
out(QLatin1String("const"));
|
||||||
|
|
||||||
|
else if (ty.isVolatile())
|
||||||
|
out(QLatin1String("volatile"));
|
||||||
|
}
|
||||||
|
@@ -33,7 +33,8 @@
|
|||||||
#ifndef TYPEPRETTYPRINTER_H
|
#ifndef TYPEPRETTYPRINTER_H
|
||||||
#define TYPEPRETTYPRINTER_H
|
#define TYPEPRETTYPRINTER_H
|
||||||
|
|
||||||
#include "TypeVisitor.h"
|
#include <TypeVisitor.h>
|
||||||
|
#include <FullySpecifiedType.h>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
@@ -50,23 +51,12 @@ public:
|
|||||||
|
|
||||||
const Overview *overview() const;
|
const Overview *overview() const;
|
||||||
|
|
||||||
bool showArgumentNames() const;
|
|
||||||
void setShowArgumentNames(bool showArgumentNames);
|
|
||||||
|
|
||||||
bool showReturnTypes() const;
|
|
||||||
void setShowReturnTypes(bool showReturnTypes);
|
|
||||||
|
|
||||||
bool showFunctionSignatures() const;
|
|
||||||
void setShowFunctionSignatures(bool showFunctionSignatures);
|
|
||||||
|
|
||||||
void setMarkArgument(unsigned position); // 1-based
|
|
||||||
|
|
||||||
QString operator()(const FullySpecifiedType &type);
|
QString operator()(const FullySpecifiedType &type);
|
||||||
QString operator()(const FullySpecifiedType &type, const QString &name);
|
QString operator()(const FullySpecifiedType &type, const QString &name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString switchText(const QString &text = QString());
|
QString switchText(const QString &text = QString());
|
||||||
QList<Type *> switchPtrOperators(const QList<Type *> &ptrOperators);
|
QList<FullySpecifiedType> switchPtrOperators(const QList<FullySpecifiedType> &ptrOperators);
|
||||||
QString switchName(const QString &name);
|
QString switchName(const QString &name);
|
||||||
|
|
||||||
void applyPtrOperators(bool wantSpace = true);
|
void applyPtrOperators(bool wantSpace = true);
|
||||||
@@ -85,15 +75,17 @@ protected:
|
|||||||
virtual void visit(Class *type);
|
virtual void visit(Class *type);
|
||||||
virtual void visit(Enum *type);
|
virtual void visit(Enum *type);
|
||||||
|
|
||||||
|
void space();
|
||||||
|
void out(const QString &text);
|
||||||
|
void out(const QChar &ch);
|
||||||
|
void outCV(const FullySpecifiedType &ty);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Overview *_overview;
|
const Overview *_overview;
|
||||||
QString _name;
|
QString _name;
|
||||||
QString _text;
|
QString _text;
|
||||||
QList<Type *> _ptrOperators;
|
FullySpecifiedType _fullySpecifiedType;
|
||||||
unsigned _markArgument;
|
QList<FullySpecifiedType> _ptrOperators;
|
||||||
bool _showArgumentNames: 1;
|
|
||||||
bool _showReturnTypes: 1;
|
|
||||||
bool _showFunctionSignatures: 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace CPlusPlus
|
} // end of namespace CPlusPlus
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
#include "iplugin.h"
|
#include "iplugin.h"
|
||||||
|
|
||||||
#include <QtCore/QMetaProperty>
|
#include <QtCore/QMetaProperty>
|
||||||
#include <QtCore/QPluginLoader>
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <QtCore/QWriteLocker>
|
#include <QtCore/QWriteLocker>
|
||||||
|
@@ -71,14 +71,14 @@ class CMakeRunner
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMakeRunner();
|
CMakeRunner();
|
||||||
void run(QFutureInterface<void> &fi);
|
|
||||||
void setExecutable(const QString &executable);
|
void setExecutable(const QString &executable);
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
QString version() const;
|
QString version() const;
|
||||||
bool supportsQtCreator() const;
|
bool supportsQtCreator() const;
|
||||||
void waitForUpToDate() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void run(QFutureInterface<void> &fi);
|
||||||
|
void waitForUpToDate() const;
|
||||||
QString m_executable;
|
QString m_executable;
|
||||||
QString m_version;
|
QString m_version;
|
||||||
bool m_supportsQtCreator;
|
bool m_supportsQtCreator;
|
||||||
|
@@ -329,8 +329,8 @@ void StackedEditorGroup::updateToolBar(IEditor *editor)
|
|||||||
toolBar = m_defaultToolBar;
|
toolBar = m_defaultToolBar;
|
||||||
if (m_activeToolBar == toolBar)
|
if (m_activeToolBar == toolBar)
|
||||||
return;
|
return;
|
||||||
toolBar->setVisible(true);
|
|
||||||
m_activeToolBar->setVisible(false);
|
m_activeToolBar->setVisible(false);
|
||||||
|
toolBar->setVisible(true);
|
||||||
m_activeToolBar = toolBar;
|
m_activeToolBar = toolBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -185,7 +185,9 @@ void CodepasterPlugin::post()
|
|||||||
|
|
||||||
// Submit to codepaster
|
// Submit to codepaster
|
||||||
|
|
||||||
m_poster = new CustomPoster(serverUrl());
|
m_poster = new CustomPoster(serverUrl(),
|
||||||
|
m_settingsPage->copyToClipBoard(),
|
||||||
|
m_settingsPage->displayOutput());
|
||||||
|
|
||||||
// Copied from cpaster. Otherwise lineendings will screw up
|
// Copied from cpaster. Otherwise lineendings will screw up
|
||||||
if (!data.contains("\r\n")) {
|
if (!data.contains("\r\n")) {
|
||||||
|
@@ -65,8 +65,8 @@ public:
|
|||||||
QString username() const;
|
QString username() const;
|
||||||
QUrl serverUrl() const;
|
QUrl serverUrl() const;
|
||||||
|
|
||||||
bool copyToClipBoard() const;
|
inline bool copyToClipBoard() const { return m_copy; }
|
||||||
bool displayOutput() const;
|
inline bool displayOutput() const { return m_output; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_SettingsPage m_ui;
|
Ui_SettingsPage m_ui;
|
||||||
|
@@ -78,7 +78,7 @@ class FunctionArgumentWidget : public QLabel
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FunctionArgumentWidget();
|
FunctionArgumentWidget();
|
||||||
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
void showFunctionHint(Function *functionSymbol, const LookupContext &context);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *e);
|
bool eventFilter(QObject *obj, QEvent *e);
|
||||||
@@ -95,7 +95,7 @@ private:
|
|||||||
|
|
||||||
QFrame *m_popupFrame;
|
QFrame *m_popupFrame;
|
||||||
Function *m_item;
|
Function *m_item;
|
||||||
Snapshot m_snapshot;
|
LookupContext m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConvertToCompletionItem: protected NameVisitor
|
class ConvertToCompletionItem: protected NameVisitor
|
||||||
@@ -187,10 +187,10 @@ using namespace CppTools::Internal;
|
|||||||
FunctionArgumentWidget::FunctionArgumentWidget()
|
FunctionArgumentWidget::FunctionArgumentWidget()
|
||||||
: m_item(0)
|
: m_item(0)
|
||||||
{
|
{
|
||||||
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
|
QObject *editorObject = Core::EditorManager::instance()->currentEditor();
|
||||||
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
||||||
|
|
||||||
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
|
m_popupFrame = new QFrame(0, Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
m_popupFrame->setFocusPolicy(Qt::NoFocus);
|
m_popupFrame->setFocusPolicy(Qt::NoFocus);
|
||||||
m_popupFrame->setAttribute(Qt::WA_DeleteOnClose);
|
m_popupFrame->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
@@ -215,10 +215,12 @@ FunctionArgumentWidget::FunctionArgumentWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol,
|
void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol,
|
||||||
const Snapshot &snapshot)
|
const LookupContext &context)
|
||||||
{
|
{
|
||||||
|
m_popupFrame->hide();
|
||||||
|
|
||||||
m_item = functionSymbol;
|
m_item = functionSymbol;
|
||||||
m_snapshot = snapshot;
|
m_context = context;
|
||||||
m_startpos = m_editor->position();
|
m_startpos = m_editor->position();
|
||||||
|
|
||||||
// update the text
|
// update the text
|
||||||
@@ -230,7 +232,7 @@ void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol,
|
|||||||
m_popupFrame->move(pos);
|
m_popupFrame->move(pos);
|
||||||
m_popupFrame->show();
|
m_popupFrame->show();
|
||||||
|
|
||||||
QCoreApplication::instance()->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionArgumentWidget::update()
|
void FunctionArgumentWidget::update()
|
||||||
@@ -432,7 +434,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
m_editor = editor;
|
m_editor = editor;
|
||||||
m_startPosition = findStartOfName(editor);
|
m_startPosition = findStartOfName();
|
||||||
m_completionOperator = T_EOF_SYMBOL;
|
m_completionOperator = T_EOF_SYMBOL;
|
||||||
|
|
||||||
int endOfOperator = m_startPosition;
|
int endOfOperator = m_startPosition;
|
||||||
@@ -518,9 +520,9 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
if (exprTy->isReferenceType())
|
if (exprTy->isReferenceType())
|
||||||
exprTy = exprTy->asReferenceType()->elementType();
|
exprTy = exprTy->asReferenceType()->elementType();
|
||||||
|
|
||||||
if (m_completionOperator == T_LPAREN && completeFunction(exprTy, resolvedTypes, context)) {
|
if (m_completionOperator == T_LPAREN && completeConstructorOrFunction(exprTy, resolvedTypes)) {
|
||||||
return m_startPosition;
|
return m_startPosition;
|
||||||
} if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) &&
|
} else if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) &&
|
||||||
completeMember(resolvedTypes, context)) {
|
completeMember(resolvedTypes, context)) {
|
||||||
return m_startPosition;
|
return m_startPosition;
|
||||||
} else if (m_completionOperator == T_COLON_COLON && completeScope(resolvedTypes, context)) {
|
} else if (m_completionOperator == T_COLON_COLON && completeScope(resolvedTypes, context)) {
|
||||||
@@ -531,15 +533,40 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
return m_startPosition;
|
return m_startPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_completionOperator == T_LPAREN) {
|
||||||
|
// Find the expression that precedes the current name
|
||||||
|
int index = endOfExpression;
|
||||||
|
while (m_editor->characterAt(index - 1).isSpace())
|
||||||
|
--index;
|
||||||
|
index = findStartOfName(index);
|
||||||
|
|
||||||
|
QTextCursor tc(edit->document());
|
||||||
|
tc.setPosition(index);
|
||||||
|
QString baseExpression = expressionUnderCursor(tc);
|
||||||
|
|
||||||
|
// Resolve the type of this expression
|
||||||
|
QList<TypeOfExpression::Result> results =
|
||||||
|
typeOfExpression(baseExpression, thisDocument, symbol, TypeOfExpression::Preprocess);
|
||||||
|
|
||||||
|
// If it's a class, add completions for the constructors
|
||||||
|
foreach (const TypeOfExpression::Result &result, results) {
|
||||||
|
if (result.first->isClass()) {
|
||||||
|
FullySpecifiedType exprTy = result.first;
|
||||||
|
if (completeConstructorOrFunction(exprTy, QList<TypeOfExpression::Result>()))
|
||||||
|
return m_startPosition;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// nothing to do.
|
// nothing to do.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy,
|
bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType exprTy,
|
||||||
const QList<TypeOfExpression::Result> &resolvedTypes,
|
const QList<TypeOfExpression::Result> &resolvedTypes)
|
||||||
const LookupContext &)
|
|
||||||
{
|
{
|
||||||
ConvertToCompletionItem toCompletionItem(this);
|
ConvertToCompletionItem toCompletionItem(this);
|
||||||
Overview o;
|
Overview o;
|
||||||
@@ -580,6 +607,10 @@ bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is only one item, show the function argument widget immediately
|
||||||
|
if (m_completions.size() == 1)
|
||||||
|
complete(m_completions.takeFirst());
|
||||||
|
|
||||||
return ! m_completions.isEmpty();
|
return ! m_completions.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,33 +821,45 @@ void CppCodeCompletion::addKeywords()
|
|||||||
|
|
||||||
void CppCodeCompletion::addMacros(const LookupContext &context)
|
void CppCodeCompletion::addMacros(const LookupContext &context)
|
||||||
{
|
{
|
||||||
// macro completion items.
|
|
||||||
QSet<QByteArray> macroNames;
|
|
||||||
QSet<QString> processed;
|
QSet<QString> processed;
|
||||||
QList<QString> todo;
|
QSet<QString> definedMacros;
|
||||||
todo.append(context.thisDocument()->fileName());
|
|
||||||
while (! todo.isEmpty()) {
|
|
||||||
QString fn = todo.last();
|
|
||||||
todo.removeLast();
|
|
||||||
if (processed.contains(fn))
|
|
||||||
continue;
|
|
||||||
processed.insert(fn);
|
|
||||||
if (Document::Ptr doc = context.document(fn)) {
|
|
||||||
foreach (const Macro ¯o, doc->definedMacros()) {
|
|
||||||
macroNames.insert(macro.name());
|
|
||||||
}
|
|
||||||
todo += doc->includedFiles();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const QByteArray ¯oName, macroNames) {
|
addMacros_helper(context, context.thisDocument()->fileName(),
|
||||||
|
&processed, &definedMacros);
|
||||||
|
|
||||||
|
foreach (const QString ¯oName, definedMacros) {
|
||||||
TextEditor::CompletionItem item(this);
|
TextEditor::CompletionItem item(this);
|
||||||
item.m_text = QString::fromUtf8(macroName.constData(), macroName.length());
|
item.m_text = macroName;
|
||||||
item.m_icon = m_icons.macroIcon();
|
item.m_icon = m_icons.macroIcon();
|
||||||
m_completions.append(item);
|
m_completions.append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppCodeCompletion::addMacros_helper(const LookupContext &context,
|
||||||
|
const QString &fileName,
|
||||||
|
QSet<QString> *processed,
|
||||||
|
QSet<QString> *definedMacros)
|
||||||
|
{
|
||||||
|
Document::Ptr doc = context.document(fileName);
|
||||||
|
|
||||||
|
if (! doc || processed->contains(doc->fileName()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
processed->insert(doc->fileName());
|
||||||
|
|
||||||
|
foreach (const Document::Include &i, doc->includes()) {
|
||||||
|
addMacros_helper(context, i.fileName(), processed, definedMacros);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const Macro ¯o, doc->definedMacros()) {
|
||||||
|
const QString macroName = QString::fromUtf8(macro.name().constData(), macro.name().length());
|
||||||
|
if (! macro.isHidden())
|
||||||
|
definedMacros->insert(macroName);
|
||||||
|
else
|
||||||
|
definedMacros->remove(macroName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CppCodeCompletion::addCompletionItem(Symbol *symbol)
|
void CppCodeCompletion::addCompletionItem(Symbol *symbol)
|
||||||
{
|
{
|
||||||
ConvertToCompletionItem toCompletionItem(this);
|
ConvertToCompletionItem toCompletionItem(this);
|
||||||
@@ -1040,8 +1083,11 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
Function *function = symbol->type()->asFunction();
|
Function *function = symbol->type()->asFunction();
|
||||||
QTC_ASSERT(function, return);
|
QTC_ASSERT(function, return);
|
||||||
|
|
||||||
m_functionArgumentWidget = new FunctionArgumentWidget();
|
// Recreate if necessary
|
||||||
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
if (!m_functionArgumentWidget)
|
||||||
|
m_functionArgumentWidget = new FunctionArgumentWidget;
|
||||||
|
|
||||||
|
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.lookupContext());
|
||||||
}
|
}
|
||||||
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
||||||
QString toInsert = item.m_text;
|
QString toInsert = item.m_text;
|
||||||
@@ -1052,11 +1098,14 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
m_editor->replace(length, toInsert);
|
m_editor->replace(length, toInsert);
|
||||||
} else {
|
} else {
|
||||||
QString toInsert = item.m_text;
|
QString toInsert = item.m_text;
|
||||||
|
int extraLength = 0;
|
||||||
|
|
||||||
//qDebug() << "current symbol:" << overview.prettyName(symbol->name())
|
//qDebug() << "current symbol:" << overview.prettyName(symbol->name())
|
||||||
//<< overview.prettyType(symbol->type());
|
//<< overview.prettyType(symbol->type());
|
||||||
|
|
||||||
if (m_autoInsertBraces && symbol) {
|
if (m_autoInsertBraces && symbol) {
|
||||||
|
QString extraChars;
|
||||||
|
|
||||||
if (Function *function = symbol->type()->asFunction()) {
|
if (Function *function = symbol->type()->asFunction()) {
|
||||||
// If the member is a function, automatically place the opening parenthesis,
|
// If the member is a function, automatically place the opening parenthesis,
|
||||||
// except when it might take template parameters.
|
// except when it might take template parameters.
|
||||||
@@ -1069,28 +1118,40 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
} else if (function->templateParameterCount() != 0) {
|
} else if (function->templateParameterCount() != 0) {
|
||||||
// If there are no arguments, then we need the template specification
|
// If there are no arguments, then we need the template specification
|
||||||
if (function->argumentCount() == 0) {
|
if (function->argumentCount() == 0) {
|
||||||
toInsert.append(QLatin1Char('<'));
|
extraChars += QLatin1Char('<');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toInsert.append(QLatin1Char('('));
|
extraChars += QLatin1Char('(');
|
||||||
|
|
||||||
// If the function takes no arguments, automatically place the closing parenthesis
|
// If the function takes no arguments, automatically place the closing parenthesis
|
||||||
if (function->argumentCount() == 0 || (function->argumentCount() == 1 &&
|
if (function->argumentCount() == 0 || (function->argumentCount() == 1 &&
|
||||||
function->argumentAt(0)->type()->isVoidType())) {
|
function->argumentAt(0)->type()->isVoidType())) {
|
||||||
toInsert.append(QLatin1Char(')'));
|
extraChars += QLatin1Char(')');
|
||||||
|
|
||||||
// If the function doesn't return anything, automatically place the semicolon,
|
// If the function doesn't return anything, automatically place the semicolon,
|
||||||
// unless we're doing a scope completion (then it might be function definition).
|
// unless we're doing a scope completion (then it might be function definition).
|
||||||
if (function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON) {
|
if (function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON) {
|
||||||
toInsert.append(QLatin1Char(';'));
|
extraChars += QLatin1Char(';');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid inserting characters that are already there
|
||||||
|
for (int i = 0; i < extraChars.length(); ++i) {
|
||||||
|
const QChar a = extraChars.at(i);
|
||||||
|
const QChar b = m_editor->characterAt(m_editor->position() + i);
|
||||||
|
if (a == b)
|
||||||
|
++extraLength;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
toInsert += extraChars;
|
||||||
|
}
|
||||||
|
|
||||||
// Insert the remainder of the name
|
// Insert the remainder of the name
|
||||||
int length = m_editor->position() - m_startPosition;
|
int length = m_editor->position() - m_startPosition + extraLength;
|
||||||
m_editor->setCurPos(m_startPosition);
|
m_editor->setCurPos(m_startPosition);
|
||||||
m_editor->replace(length, toInsert);
|
m_editor->replace(length, toInsert);
|
||||||
}
|
}
|
||||||
@@ -1135,14 +1196,15 @@ void CppCodeCompletion::cleanup()
|
|||||||
typeOfExpression.setSnapshot(Snapshot());
|
typeOfExpression.setSnapshot(Snapshot());
|
||||||
}
|
}
|
||||||
|
|
||||||
int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor)
|
int CppCodeCompletion::findStartOfName(int pos) const
|
||||||
{
|
{
|
||||||
int pos = editor->position();
|
if (pos == -1)
|
||||||
|
pos = m_editor->position();
|
||||||
QChar chr;
|
QChar chr;
|
||||||
|
|
||||||
// Skip to the start of a name
|
// Skip to the start of a name
|
||||||
do {
|
do {
|
||||||
chr = editor->characterAt(--pos);
|
chr = m_editor->characterAt(--pos);
|
||||||
} while (chr.isLetterOrNumber() || chr == QLatin1Char('_'));
|
} while (chr.isLetterOrNumber() || chr == QLatin1Char('_'));
|
||||||
|
|
||||||
return pos + 1;
|
return pos + 1;
|
||||||
|
@@ -84,11 +84,14 @@ public:
|
|||||||
private:
|
private:
|
||||||
void addKeywords();
|
void addKeywords();
|
||||||
void addMacros(const CPlusPlus::LookupContext &context);
|
void addMacros(const CPlusPlus::LookupContext &context);
|
||||||
|
void addMacros_helper(const CPlusPlus::LookupContext &context,
|
||||||
|
const QString &fileName,
|
||||||
|
QSet<QString> *processed,
|
||||||
|
QSet<QString> *definedMacros);
|
||||||
void addCompletionItem(CPlusPlus::Symbol *symbol);
|
void addCompletionItem(CPlusPlus::Symbol *symbol);
|
||||||
|
|
||||||
bool completeFunction(CPlusPlus::FullySpecifiedType exprTy,
|
bool completeConstructorOrFunction(CPlusPlus::FullySpecifiedType exprTy,
|
||||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
const QList<CPlusPlus::TypeOfExpression::Result> &);
|
||||||
const CPlusPlus::LookupContext &context);
|
|
||||||
|
|
||||||
bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &,
|
bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||||
const CPlusPlus::LookupContext &context);
|
const CPlusPlus::LookupContext &context);
|
||||||
@@ -103,6 +106,8 @@ private:
|
|||||||
const CPlusPlus::LookupContext &context,
|
const CPlusPlus::LookupContext &context,
|
||||||
bool staticLookup = true);
|
bool staticLookup = true);
|
||||||
|
|
||||||
|
bool completeConstructors(CPlusPlus::Class *klass);
|
||||||
|
|
||||||
bool completeQtMethod(CPlusPlus::FullySpecifiedType exprTy,
|
bool completeQtMethod(CPlusPlus::FullySpecifiedType exprTy,
|
||||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||||
const CPlusPlus::LookupContext &context,
|
const CPlusPlus::LookupContext &context,
|
||||||
@@ -118,7 +123,7 @@ private:
|
|||||||
const CPlusPlus::LookupContext &context)
|
const CPlusPlus::LookupContext &context)
|
||||||
{ return completeQtMethod(exprTy, results, context, false); }
|
{ return completeQtMethod(exprTy, results, context, false); }
|
||||||
|
|
||||||
static int findStartOfName(const TextEditor::ITextEditor *editor);
|
int findStartOfName(int pos = -1) const;
|
||||||
|
|
||||||
QList<TextEditor::CompletionItem> m_completions;
|
QList<TextEditor::CompletionItem> m_completions;
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ HEADERS += attachexternaldialog.h \
|
|||||||
scriptengine.h \
|
scriptengine.h \
|
||||||
stackhandler.h \
|
stackhandler.h \
|
||||||
stackwindow.h \
|
stackwindow.h \
|
||||||
|
sourcefileswindow.h \
|
||||||
startexternaldialog.h \
|
startexternaldialog.h \
|
||||||
threadswindow.h \
|
threadswindow.h \
|
||||||
watchhandler.h \
|
watchhandler.h \
|
||||||
@@ -64,6 +65,7 @@ SOURCES += attachexternaldialog.cpp \
|
|||||||
scriptengine.cpp \
|
scriptengine.cpp \
|
||||||
stackhandler.cpp \
|
stackhandler.cpp \
|
||||||
stackwindow.cpp \
|
stackwindow.cpp \
|
||||||
|
sourcefileswindow.cpp \
|
||||||
startexternaldialog.cpp \
|
startexternaldialog.cpp \
|
||||||
threadswindow.cpp \
|
threadswindow.cpp \
|
||||||
watchhandler.cpp \
|
watchhandler.cpp \
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "idebuggerengine.h"
|
#include "idebuggerengine.h"
|
||||||
|
|
||||||
@@ -43,6 +42,7 @@
|
|||||||
#include "moduleswindow.h"
|
#include "moduleswindow.h"
|
||||||
#include "registerwindow.h"
|
#include "registerwindow.h"
|
||||||
#include "stackwindow.h"
|
#include "stackwindow.h"
|
||||||
|
#include "sourcefileswindow.h"
|
||||||
#include "threadswindow.h"
|
#include "threadswindow.h"
|
||||||
#include "watchwindow.h"
|
#include "watchwindow.h"
|
||||||
|
|
||||||
@@ -58,6 +58,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>
|
||||||
@@ -151,7 +153,7 @@ void DebuggerManager::init()
|
|||||||
m_busy = false;
|
m_busy = false;
|
||||||
|
|
||||||
m_attachedPID = 0;
|
m_attachedPID = 0;
|
||||||
m_startMode = startInternal;
|
m_startMode = StartInternal;
|
||||||
|
|
||||||
m_disassemblerHandler = 0;
|
m_disassemblerHandler = 0;
|
||||||
m_modulesHandler = 0;
|
m_modulesHandler = 0;
|
||||||
@@ -164,6 +166,7 @@ void DebuggerManager::init()
|
|||||||
m_outputWindow = new DebuggerOutputWindow;
|
m_outputWindow = new DebuggerOutputWindow;
|
||||||
m_registerWindow = new RegisterWindow;
|
m_registerWindow = new RegisterWindow;
|
||||||
m_stackWindow = new StackWindow;
|
m_stackWindow = new StackWindow;
|
||||||
|
m_sourceFilesWindow = new SourceFilesWindow;
|
||||||
m_threadsWindow = new ThreadsWindow;
|
m_threadsWindow = new ThreadsWindow;
|
||||||
m_localsWindow = new WatchWindow(WatchWindow::LocalsType);
|
m_localsWindow = new WatchWindow(WatchWindow::LocalsType);
|
||||||
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
||||||
@@ -226,6 +229,13 @@ void DebuggerManager::init()
|
|||||||
connect(modulesView, SIGNAL(loadAllSymbolsRequested()),
|
connect(modulesView, SIGNAL(loadAllSymbolsRequested()),
|
||||||
this, SLOT(loadAllSymbols()));
|
this, SLOT(loadAllSymbols()));
|
||||||
|
|
||||||
|
// Source Files
|
||||||
|
//m_sourceFilesHandler = new SourceFilesHandler;
|
||||||
|
QAbstractItemView *sourceFilesView =
|
||||||
|
qobject_cast<QAbstractItemView *>(m_sourceFilesWindow);
|
||||||
|
//sourceFileView->setModel(m_stackHandler->stackModel());
|
||||||
|
connect(sourceFilesView, SIGNAL(reloadSourceFilesRequested()),
|
||||||
|
this, SLOT(reloadSourceFiles()));
|
||||||
|
|
||||||
// Registers
|
// Registers
|
||||||
QAbstractItemView *registerView =
|
QAbstractItemView *registerView =
|
||||||
@@ -402,6 +412,10 @@ void DebuggerManager::init()
|
|||||||
|
|
||||||
m_stackDock = createDockForWidget(m_stackWindow);
|
m_stackDock = createDockForWidget(m_stackWindow);
|
||||||
|
|
||||||
|
m_sourceFilesDock = createDockForWidget(m_sourceFilesWindow);
|
||||||
|
connect(m_sourceFilesDock->toggleViewAction(), SIGNAL(toggled(bool)),
|
||||||
|
this, SLOT(reloadSourceFiles()), Qt::QueuedConnection);
|
||||||
|
|
||||||
m_threadsDock = createDockForWidget(m_threadsWindow);
|
m_threadsDock = createDockForWidget(m_threadsWindow);
|
||||||
|
|
||||||
setStatus(DebuggerProcessNotReady);
|
setStatus(DebuggerProcessNotReady);
|
||||||
@@ -451,10 +465,7 @@ QDockWidget *DebuggerManager::createDockForWidget(QWidget *widget)
|
|||||||
{
|
{
|
||||||
QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), m_mainWindow);
|
QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), m_mainWindow);
|
||||||
dockWidget->setObjectName(widget->windowTitle());
|
dockWidget->setObjectName(widget->windowTitle());
|
||||||
//dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea);
|
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
|
||||||
dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas); // that space is needed.
|
|
||||||
//dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
|
||||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
|
||||||
dockWidget->setTitleBarWidget(new QWidget(dockWidget));
|
dockWidget->setTitleBarWidget(new QWidget(dockWidget));
|
||||||
dockWidget->setWidget(widget);
|
dockWidget->setWidget(widget);
|
||||||
connect(dockWidget->toggleViewAction(), SIGNAL(toggled(bool)),
|
connect(dockWidget->toggleViewAction(), SIGNAL(toggled(bool)),
|
||||||
@@ -479,9 +490,11 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
|
|||||||
m_mainWindow->tabifyDockWidget(m_watchDock, m_outputDock);
|
m_mainWindow->tabifyDockWidget(m_watchDock, m_outputDock);
|
||||||
m_mainWindow->tabifyDockWidget(m_watchDock, m_registerDock);
|
m_mainWindow->tabifyDockWidget(m_watchDock, m_registerDock);
|
||||||
m_mainWindow->tabifyDockWidget(m_watchDock, m_threadsDock);
|
m_mainWindow->tabifyDockWidget(m_watchDock, m_threadsDock);
|
||||||
|
m_mainWindow->tabifyDockWidget(m_watchDock, m_sourceFilesDock);
|
||||||
|
|
||||||
// They are rarely used even in ordinary debugging. Hiding them also saves
|
// They are rarely used even in ordinary debugging. Hiding them also saves
|
||||||
// cycles since the corresponding information won't be retrieved.
|
// cycles since the corresponding information won't be retrieved.
|
||||||
|
m_sourceFilesDock->hide();
|
||||||
m_registerDock->hide();
|
m_registerDock->hide();
|
||||||
m_disassemblerDock->hide();
|
m_disassemblerDock->hide();
|
||||||
m_modulesDock->hide();
|
m_modulesDock->hide();
|
||||||
@@ -491,7 +504,7 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
|
|||||||
void DebuggerManager::setLocked(bool locked)
|
void DebuggerManager::setLocked(bool locked)
|
||||||
{
|
{
|
||||||
const QDockWidget::DockWidgetFeatures features =
|
const QDockWidget::DockWidgetFeatures features =
|
||||||
(locked) ? QDockWidget::NoDockWidgetFeatures :
|
(locked) ? QDockWidget::DockWidgetClosable :
|
||||||
QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable;
|
QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable;
|
||||||
|
|
||||||
foreach (QDockWidget *dockWidget, m_dockWidgets) {
|
foreach (QDockWidget *dockWidget, m_dockWidgets) {
|
||||||
@@ -539,16 +552,10 @@ void DebuggerManager::showStatusMessage(const QString &msg, int timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::notifyStartupFinished()
|
void DebuggerManager::notifyInferiorStopRequested()
|
||||||
{
|
{
|
||||||
setStatus(DebuggerProcessReady);
|
setStatus(DebuggerInferiorStopRequested);
|
||||||
showStatusMessage(tr("Startup finished. Debugger ready."), -1);
|
showStatusMessage(tr("Stop requested..."), 5000);
|
||||||
if (m_startMode == attachExternal) {
|
|
||||||
// we continue the execution
|
|
||||||
engine()->continueInferior();
|
|
||||||
} else {
|
|
||||||
engine()->runInferior();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::notifyInferiorStopped()
|
void DebuggerManager::notifyInferiorStopped()
|
||||||
@@ -558,16 +565,10 @@ void DebuggerManager::notifyInferiorStopped()
|
|||||||
showStatusMessage(tr("Stopped."), 5000);
|
showStatusMessage(tr("Stopped."), 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::notifyInferiorUpdateFinished()
|
|
||||||
{
|
|
||||||
setStatus(DebuggerInferiorReady);
|
|
||||||
showStatusMessage(tr("Stopped."), 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerManager::notifyInferiorRunningRequested()
|
void DebuggerManager::notifyInferiorRunningRequested()
|
||||||
{
|
{
|
||||||
setStatus(DebuggerInferiorRunningRequested);
|
setStatus(DebuggerInferiorRunningRequested);
|
||||||
showStatusMessage(tr("Running..."), 5000);
|
showStatusMessage(tr("Running requested..."), 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::notifyInferiorRunning()
|
void DebuggerManager::notifyInferiorRunning()
|
||||||
@@ -578,7 +579,7 @@ void DebuggerManager::notifyInferiorRunning()
|
|||||||
|
|
||||||
void DebuggerManager::notifyInferiorExited()
|
void DebuggerManager::notifyInferiorExited()
|
||||||
{
|
{
|
||||||
setStatus(DebuggerProcessReady);
|
setStatus(DebuggerProcessNotReady);
|
||||||
showStatusMessage(tr("Stopped."), 5000);
|
showStatusMessage(tr("Stopped."), 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,7 +598,19 @@ void DebuggerManager::showApplicationOutput(const QString &str)
|
|||||||
void DebuggerManager::shutdown()
|
void DebuggerManager::shutdown()
|
||||||
{
|
{
|
||||||
//qDebug() << "DEBUGGER_MANAGER SHUTDOWN START";
|
//qDebug() << "DEBUGGER_MANAGER SHUTDOWN START";
|
||||||
engine()->shutdown();
|
if (m_engine) {
|
||||||
|
//qDebug() << "SHUTTING DOWN ENGINE" << m_engine;
|
||||||
|
m_engine->shutdown();
|
||||||
|
}
|
||||||
|
m_engine = 0;
|
||||||
|
|
||||||
|
delete scriptEngine;
|
||||||
|
scriptEngine = 0;
|
||||||
|
delete gdbEngine;
|
||||||
|
gdbEngine = 0;
|
||||||
|
delete winEngine;
|
||||||
|
winEngine = 0;
|
||||||
|
|
||||||
// Delete these manually before deleting the manager
|
// Delete these manually before deleting the manager
|
||||||
// (who will delete the models for most views)
|
// (who will delete the models for most views)
|
||||||
delete m_breakWindow;
|
delete m_breakWindow;
|
||||||
@@ -651,41 +664,57 @@ void DebuggerManager::toggleBreakpoint()
|
|||||||
|
|
||||||
void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber)
|
void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
|
QTC_ASSERT(m_breakHandler, return);
|
||||||
|
if (status() != DebuggerInferiorRunning
|
||||||
|
&& status() != DebuggerInferiorStopped
|
||||||
|
&& status() != DebuggerProcessNotReady) {
|
||||||
|
showStatusMessage(tr("Changing breakpoint state requires either a "
|
||||||
|
"fully running or fully stopped application."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = m_breakHandler->indexOf(fileName, lineNumber);
|
int index = m_breakHandler->indexOf(fileName, lineNumber);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
breakHandler()->setBreakpoint(fileName, lineNumber);
|
m_breakHandler->setBreakpoint(fileName, lineNumber);
|
||||||
else
|
else
|
||||||
breakHandler()->removeBreakpoint(index);
|
m_breakHandler->removeBreakpoint(index);
|
||||||
engine()->attemptBreakpointSynchronization();
|
m_engine->attemptBreakpointSynchronization();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setToolTipExpression(const QPoint &pos, const QString &exp)
|
void DebuggerManager::setToolTipExpression(const QPoint &pos, const QString &exp)
|
||||||
{
|
{
|
||||||
engine()->setToolTipExpression(pos, exp);
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->setToolTipExpression(pos, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::updateWatchModel()
|
void DebuggerManager::updateWatchModel()
|
||||||
{
|
{
|
||||||
engine()->updateWatchModel();
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->updateWatchModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::expandChildren(const QModelIndex &idx)
|
void DebuggerManager::expandChildren(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
watchHandler()->expandChildren(idx);
|
QTC_ASSERT(m_watchHandler, return);
|
||||||
|
m_watchHandler->expandChildren(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::collapseChildren(const QModelIndex &idx)
|
void DebuggerManager::collapseChildren(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
watchHandler()->collapseChildren(idx);
|
QTC_ASSERT(m_watchHandler, return);
|
||||||
|
m_watchHandler->collapseChildren(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::removeWatchExpression(const QString &exp)
|
void DebuggerManager::removeWatchExpression(const QString &exp)
|
||||||
{
|
{
|
||||||
watchHandler()->removeWatchExpression(exp);
|
QTC_ASSERT(m_watchHandler, return);
|
||||||
|
m_watchHandler->removeWatchExpression(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DebuggerManager::sessionValue(const QString &name)
|
QVariant DebuggerManager::sessionValue(const QString &name)
|
||||||
{
|
{
|
||||||
|
// this is answered by the plugin
|
||||||
QVariant value;
|
QVariant value;
|
||||||
emit sessionValueRequested(name, &value);
|
emit sessionValueRequested(name, &value);
|
||||||
return value;
|
return value;
|
||||||
@@ -693,16 +722,19 @@ QVariant DebuggerManager::sessionValue(const QString &name)
|
|||||||
|
|
||||||
void DebuggerManager::querySessionValue(const QString &name, QVariant *value)
|
void DebuggerManager::querySessionValue(const QString &name, QVariant *value)
|
||||||
{
|
{
|
||||||
|
// this is answered by the plugin
|
||||||
emit sessionValueRequested(name, value);
|
emit sessionValueRequested(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setSessionValue(const QString &name, const QVariant &value)
|
void DebuggerManager::setSessionValue(const QString &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
|
// this is answered by the plugin
|
||||||
emit setSessionValueRequested(name, value);
|
emit setSessionValueRequested(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DebuggerManager::configValue(const QString &name)
|
QVariant DebuggerManager::configValue(const QString &name)
|
||||||
{
|
{
|
||||||
|
// this is answered by the plugin
|
||||||
QVariant value;
|
QVariant value;
|
||||||
emit configValueRequested(name, &value);
|
emit configValueRequested(name, &value);
|
||||||
return value;
|
return value;
|
||||||
@@ -710,23 +742,25 @@ QVariant DebuggerManager::configValue(const QString &name)
|
|||||||
|
|
||||||
void DebuggerManager::queryConfigValue(const QString &name, QVariant *value)
|
void DebuggerManager::queryConfigValue(const QString &name, QVariant *value)
|
||||||
{
|
{
|
||||||
|
// this is answered by the plugin
|
||||||
emit configValueRequested(name, value);
|
emit configValueRequested(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setConfigValue(const QString &name, const QVariant &value)
|
void DebuggerManager::setConfigValue(const QString &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
|
// this is answered by the plugin
|
||||||
emit setConfigValueRequested(name, value);
|
emit setConfigValueRequested(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::startExternalApplication()
|
void DebuggerManager::startExternalApplication()
|
||||||
{
|
{
|
||||||
if (!startNewDebugger(startExternal))
|
if (!startNewDebugger(StartExternal))
|
||||||
emit debuggingFinished();
|
emit debuggingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::attachExternalApplication()
|
void DebuggerManager::attachExternalApplication()
|
||||||
{
|
{
|
||||||
if (!startNewDebugger(attachExternal))
|
if (!startNewDebugger(AttachExternal))
|
||||||
emit debuggingFinished();
|
emit debuggingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,7 +769,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
|||||||
m_startMode = mode;
|
m_startMode = mode;
|
||||||
// FIXME: Clean up
|
// FIXME: Clean up
|
||||||
|
|
||||||
if (startMode() == startExternal) {
|
if (startMode() == StartExternal) {
|
||||||
StartExternalDialog dlg(mainWindow());
|
StartExternalDialog dlg(mainWindow());
|
||||||
dlg.setExecutableFile(
|
dlg.setExecutableFile(
|
||||||
configValue(QLatin1String("LastExternalExecutableFile")).toString());
|
configValue(QLatin1String("LastExternalExecutableFile")).toString());
|
||||||
@@ -751,7 +785,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
|||||||
m_processArgs = dlg.executableArguments().split(' ');
|
m_processArgs = dlg.executableArguments().split(' ');
|
||||||
m_workingDir = QString();
|
m_workingDir = QString();
|
||||||
m_attachedPID = -1;
|
m_attachedPID = -1;
|
||||||
} else if (startMode() == attachExternal) {
|
} else if (startMode() == AttachExternal) {
|
||||||
AttachExternalDialog dlg(mainWindow());
|
AttachExternalDialog dlg(mainWindow());
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return false;
|
return false;
|
||||||
@@ -764,7 +798,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
|||||||
tr("Cannot attach to PID 0"));
|
tr("Cannot attach to PID 0"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (startMode() == startInternal) {
|
} else if (startMode() == StartInternal) {
|
||||||
if (m_executable.isEmpty()) {
|
if (m_executable.isEmpty()) {
|
||||||
QString startDirectory = m_executable;
|
QString startDirectory = m_executable;
|
||||||
if (m_executable.isEmpty()) {
|
if (m_executable.isEmpty()) {
|
||||||
@@ -797,11 +831,13 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
|||||||
else
|
else
|
||||||
setDebuggerType(GdbDebugger);
|
setDebuggerType(GdbDebugger);
|
||||||
|
|
||||||
if (!engine()->startDebugger())
|
setStatus(DebuggerProcessStartingUp);
|
||||||
|
if (!m_engine->startDebugger()) {
|
||||||
|
setStatus(DebuggerProcessNotReady);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_busy = false;
|
m_busy = false;
|
||||||
setStatus(DebuggerProcessStartingUp);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +854,9 @@ void DebuggerManager::cleanupViews()
|
|||||||
|
|
||||||
void DebuggerManager::exitDebugger()
|
void DebuggerManager::exitDebugger()
|
||||||
{
|
{
|
||||||
engine()->exitDebugger();
|
//qDebug() << "DebuggerManager::exitDebugger";
|
||||||
|
if (m_engine)
|
||||||
|
m_engine->exitDebugger();
|
||||||
cleanupViews();
|
cleanupViews();
|
||||||
setStatus(DebuggerProcessNotReady);
|
setStatus(DebuggerProcessNotReady);
|
||||||
setBusyCursor(false);
|
setBusyCursor(false);
|
||||||
@@ -827,62 +865,73 @@ void DebuggerManager::exitDebugger()
|
|||||||
|
|
||||||
void DebuggerManager::assignValueInDebugger(const QString &expr, const QString &value)
|
void DebuggerManager::assignValueInDebugger(const QString &expr, const QString &value)
|
||||||
{
|
{
|
||||||
engine()->assignValueInDebugger(expr, value);
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->assignValueInDebugger(expr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::activateFrame(int index)
|
void DebuggerManager::activateFrame(int index)
|
||||||
{
|
{
|
||||||
engine()->activateFrame(index);
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->activateFrame(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::selectThread(int index)
|
void DebuggerManager::selectThread(int index)
|
||||||
{
|
{
|
||||||
engine()->selectThread(index);
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->selectThread(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::loadAllSymbols()
|
void DebuggerManager::loadAllSymbols()
|
||||||
{
|
{
|
||||||
engine()->loadAllSymbols();
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->loadAllSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::loadSymbols(const QString &module)
|
void DebuggerManager::loadSymbols(const QString &module)
|
||||||
{
|
{
|
||||||
engine()->loadSymbols(module);
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->loadSymbols(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::stepExec()
|
void DebuggerManager::stepExec()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
resetLocation();
|
resetLocation();
|
||||||
engine()->stepExec();
|
m_engine->stepExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::stepOutExec()
|
void DebuggerManager::stepOutExec()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
resetLocation();
|
resetLocation();
|
||||||
engine()->stepOutExec();
|
m_engine->stepOutExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::nextExec()
|
void DebuggerManager::nextExec()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
resetLocation();
|
resetLocation();
|
||||||
engine()->nextExec();
|
m_engine->nextExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::stepIExec()
|
void DebuggerManager::stepIExec()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
resetLocation();
|
resetLocation();
|
||||||
engine()->stepIExec();
|
m_engine->stepIExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::nextIExec()
|
void DebuggerManager::nextIExec()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
resetLocation();
|
resetLocation();
|
||||||
engine()->nextIExec();
|
m_engine->nextIExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::executeDebuggerCommand(const QString &command)
|
void DebuggerManager::executeDebuggerCommand(const QString &command)
|
||||||
{
|
{
|
||||||
engine()->executeDebuggerCommand(command);
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_engine->executeDebuggerCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::sessionLoaded()
|
void DebuggerManager::sessionLoaded()
|
||||||
@@ -900,16 +949,18 @@ void DebuggerManager::aboutToSaveSession()
|
|||||||
|
|
||||||
void DebuggerManager::loadSessionData()
|
void DebuggerManager::loadSessionData()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
m_breakHandler->loadSessionData();
|
m_breakHandler->loadSessionData();
|
||||||
m_watchHandler->loadSessionData();
|
m_watchHandler->loadSessionData();
|
||||||
engine()->loadSessionData();
|
m_engine->loadSessionData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::saveSessionData()
|
void DebuggerManager::saveSessionData()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
m_breakHandler->saveSessionData();
|
m_breakHandler->saveSessionData();
|
||||||
m_watchHandler->saveSessionData();
|
m_watchHandler->saveSessionData();
|
||||||
engine()->saveSessionData();
|
m_engine->saveSessionData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::dumpLog()
|
void DebuggerManager::dumpLog()
|
||||||
@@ -927,33 +978,6 @@ void DebuggerManager::dumpLog()
|
|||||||
ts << m_outputWindow->combinedContents();
|
ts << m_outputWindow->combinedContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// call after m_gdbProc exited.
|
|
||||||
void GdbEngine::procFinished()
|
|
||||||
{
|
|
||||||
//qDebug() << "GDB PROCESS FINISHED";
|
|
||||||
setStatus(DebuggerProcessNotReady);
|
|
||||||
showStatusMessage(tr("Done"), 5000);
|
|
||||||
q->m_breakHandler->procFinished();
|
|
||||||
q->m_watchHandler->cleanup();
|
|
||||||
m_stackHandler->m_stackFrames.clear();
|
|
||||||
m_stackHandler->resetModel();
|
|
||||||
m_threadsHandler->resetModel();
|
|
||||||
if (q->m_modulesHandler)
|
|
||||||
q->m_modulesHandler->procFinished();
|
|
||||||
q->resetLocation();
|
|
||||||
setStatus(DebuggerProcessNotReady);
|
|
||||||
emit q->previousModeRequested();
|
|
||||||
emit q->debuggingFinished();
|
|
||||||
//exitDebugger();
|
|
||||||
//showStatusMessage("Gdb killed");
|
|
||||||
m_shortToFullName.clear();
|
|
||||||
m_fullToShortName.clear();
|
|
||||||
m_shared = 0;
|
|
||||||
q->m_busy = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DebuggerManager::addToWatchWindow()
|
void DebuggerManager::addToWatchWindow()
|
||||||
{
|
{
|
||||||
// requires a selection, but that's the only case we want...
|
// requires a selection, but that's the only case we want...
|
||||||
@@ -968,19 +992,24 @@ void DebuggerManager::addToWatchWindow()
|
|||||||
|
|
||||||
void DebuggerManager::watchExpression(const QString &expression)
|
void DebuggerManager::watchExpression(const QString &expression)
|
||||||
{
|
{
|
||||||
watchHandler()->watchExpression(expression);
|
QTC_ASSERT(m_watchHandler, return);
|
||||||
|
m_watchHandler->watchExpression(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber)
|
void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber)
|
||||||
{
|
{
|
||||||
breakHandler()->setBreakpoint(fileName, lineNumber);
|
QTC_ASSERT(m_breakHandler, return);
|
||||||
engine()->attemptBreakpointSynchronization();
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_breakHandler->setBreakpoint(fileName, lineNumber);
|
||||||
|
m_engine->attemptBreakpointSynchronization();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::breakByFunction(const QString &functionName)
|
void DebuggerManager::breakByFunction(const QString &functionName)
|
||||||
{
|
{
|
||||||
breakHandler()->breakByFunction(functionName);
|
QTC_ASSERT(m_breakHandler, return);
|
||||||
engine()->attemptBreakpointSynchronization();
|
QTC_ASSERT(m_engine, return);
|
||||||
|
m_breakHandler->breakByFunction(functionName);
|
||||||
|
m_engine->attemptBreakpointSynchronization();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::breakByFunction()
|
void DebuggerManager::breakByFunction()
|
||||||
@@ -1011,16 +1040,11 @@ void DebuggerManager::setStatus(int status)
|
|||||||
const bool started = status == DebuggerInferiorRunning
|
const bool started = status == DebuggerInferiorRunning
|
||||||
|| status == DebuggerInferiorRunningRequested
|
|| status == DebuggerInferiorRunningRequested
|
||||||
|| status == DebuggerInferiorStopRequested
|
|| status == DebuggerInferiorStopRequested
|
||||||
|| status == DebuggerInferiorStopped
|
|| status == DebuggerInferiorStopped;
|
||||||
|| status == DebuggerInferiorUpdating
|
|
||||||
|| status == DebuggerInferiorUpdateFinishing
|
|
||||||
|| status == DebuggerInferiorReady;
|
|
||||||
|
|
||||||
const bool starting = status == DebuggerProcessStartingUp;
|
const bool starting = status == DebuggerProcessStartingUp;
|
||||||
const bool running = status == DebuggerInferiorRunning;
|
const bool running = status == DebuggerInferiorRunning;
|
||||||
const bool ready = status == DebuggerInferiorStopped
|
const bool ready = status == DebuggerInferiorStopped;
|
||||||
|| status == DebuggerInferiorReady
|
|
||||||
|| status == DebuggerProcessReady;
|
|
||||||
|
|
||||||
m_startExternalAction->setEnabled(!started && !starting);
|
m_startExternalAction->setEnabled(!started && !starting);
|
||||||
m_attachExternalAction->setEnabled(!started && !starting);
|
m_attachExternalAction->setEnabled(!started && !starting);
|
||||||
@@ -1088,26 +1112,18 @@ bool DebuggerManager::useCustomDumpers() const
|
|||||||
return m_settings.m_useCustomDumpers;
|
return m_settings.m_useCustomDumpers;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerManager::useFastStart() const
|
|
||||||
{
|
|
||||||
return 0; // && m_settings.m_useFastStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerManager::setUseCustomDumpers(bool on)
|
void DebuggerManager::setUseCustomDumpers(bool on)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
m_settings.m_useCustomDumpers = on;
|
m_settings.m_useCustomDumpers = on;
|
||||||
engine()->setUseCustomDumpers(on);
|
m_engine->setUseCustomDumpers(on);
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerManager::setUseFastStart(bool on)
|
|
||||||
{
|
|
||||||
m_settings.m_useFastStart = on;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setDebugDumpers(bool on)
|
void DebuggerManager::setDebugDumpers(bool on)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
m_settings.m_debugDumpers = on;
|
m_settings.m_debugDumpers = on;
|
||||||
engine()->setDebugDumpers(on);
|
m_engine->setDebugDumpers(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::setSkipKnownFrames(bool on)
|
void DebuggerManager::setSkipKnownFrames(bool on)
|
||||||
@@ -1123,29 +1139,31 @@ void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,
|
|||||||
|
|
||||||
void DebuggerManager::continueExec()
|
void DebuggerManager::continueExec()
|
||||||
{
|
{
|
||||||
engine()->continueInferior();
|
m_engine->continueInferior();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::interruptDebuggingRequest()
|
void DebuggerManager::interruptDebuggingRequest()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
//qDebug() << "INTERRUPTING AT" << status();
|
//qDebug() << "INTERRUPTING AT" << status();
|
||||||
bool interruptIsExit = (status() != DebuggerInferiorRunning);
|
bool interruptIsExit = (status() != DebuggerInferiorRunning);
|
||||||
if (interruptIsExit)
|
if (interruptIsExit)
|
||||||
exitDebugger();
|
exitDebugger();
|
||||||
else {
|
else {
|
||||||
setStatus(DebuggerInferiorStopRequested);
|
setStatus(DebuggerInferiorStopRequested);
|
||||||
engine()->interruptInferior();
|
m_engine->interruptInferior();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DebuggerManager::runToLineExec()
|
void DebuggerManager::runToLineExec()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
QString fileName;
|
QString fileName;
|
||||||
int lineNumber = -1;
|
int lineNumber = -1;
|
||||||
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
|
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
engine()->runToLineExec(fileName, lineNumber);
|
m_engine->runToLineExec(fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::runToFunctionExec()
|
void DebuggerManager::runToFunctionExec()
|
||||||
@@ -1177,7 +1195,7 @@ void DebuggerManager::runToFunctionExec()
|
|||||||
}
|
}
|
||||||
//qDebug() << "RUN TO FUNCTION " << functionName;
|
//qDebug() << "RUN TO FUNCTION " << functionName;
|
||||||
if (!functionName.isEmpty())
|
if (!functionName.isEmpty())
|
||||||
engine()->runToFunctionExec(functionName);
|
m_engine->runToFunctionExec(functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::jumpToLineExec()
|
void DebuggerManager::jumpToLineExec()
|
||||||
@@ -1186,20 +1204,20 @@ void DebuggerManager::jumpToLineExec()
|
|||||||
int lineNumber = -1;
|
int lineNumber = -1;
|
||||||
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
|
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
engine()->jumpToLineExec(fileName, lineNumber);
|
m_engine->jumpToLineExec(fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::resetLocation()
|
void DebuggerManager::resetLocation()
|
||||||
{
|
{
|
||||||
//m_watchHandler->removeMouseMoveCatcher(editor->widget());
|
// connected to the plugin
|
||||||
emit resetLocationRequested();
|
emit resetLocationRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::gotoLocation(const QString &fileName, int line,
|
void DebuggerManager::gotoLocation(const QString &fileName, int line,
|
||||||
bool setMarker)
|
bool setMarker)
|
||||||
{
|
{
|
||||||
|
// connected to the plugin
|
||||||
emit gotoLocationRequested(fileName, line, setMarker);
|
emit gotoLocationRequested(fileName, line, setMarker);
|
||||||
//m_watchHandler->installMouseMoveCatcher(editor->widget());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1211,9 +1229,10 @@ void DebuggerManager::gotoLocation(const QString &fileName, int line,
|
|||||||
|
|
||||||
void DebuggerManager::reloadDisassembler()
|
void DebuggerManager::reloadDisassembler()
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_engine, return);
|
||||||
if (!m_disassemblerDock || !m_disassemblerDock->isVisible())
|
if (!m_disassemblerDock || !m_disassemblerDock->isVisible())
|
||||||
return;
|
return;
|
||||||
engine()->reloadDisassembler();
|
m_engine->reloadDisassembler();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::disassemblerDockToggled(bool on)
|
void DebuggerManager::disassemblerDockToggled(bool on)
|
||||||
@@ -1223,6 +1242,26 @@ void DebuggerManager::disassemblerDockToggled(bool on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Sourec files specific stuff
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void DebuggerManager::reloadSourceFiles()
|
||||||
|
{
|
||||||
|
if (!m_sourceFilesDock || !m_sourceFilesDock->isVisible())
|
||||||
|
return;
|
||||||
|
m_engine->reloadSourceFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerManager::sourceFilesDockToggled(bool on)
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
reloadSourceFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Modules specific stuff
|
// Modules specific stuff
|
||||||
@@ -1233,7 +1272,7 @@ void DebuggerManager::reloadModules()
|
|||||||
{
|
{
|
||||||
if (!m_modulesDock || !m_modulesDock->isVisible())
|
if (!m_modulesDock || !m_modulesDock->isVisible())
|
||||||
return;
|
return;
|
||||||
engine()->reloadModules();
|
m_engine->reloadModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::modulesDockToggled(bool on)
|
void DebuggerManager::modulesDockToggled(bool on)
|
||||||
@@ -1251,11 +1290,13 @@ void DebuggerManager::modulesDockToggled(bool on)
|
|||||||
|
|
||||||
void DebuggerManager::showDebuggerOutput(const QString &prefix, const QString &msg)
|
void DebuggerManager::showDebuggerOutput(const QString &prefix, const QString &msg)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_outputWindow, return);
|
||||||
m_outputWindow->showOutput(prefix, msg);
|
m_outputWindow->showOutput(prefix, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerManager::showDebuggerInput(const QString &prefix, const QString &msg)
|
void DebuggerManager::showDebuggerInput(const QString &prefix, const QString &msg)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(m_outputWindow, return);
|
||||||
m_outputWindow->showInput(prefix, msg);
|
m_outputWindow->showInput(prefix, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1276,7 +1317,7 @@ void DebuggerManager::reloadRegisters()
|
|||||||
{
|
{
|
||||||
if (!m_registerDock || !m_registerDock->isVisible())
|
if (!m_registerDock || !m_registerDock->isVisible())
|
||||||
return;
|
return;
|
||||||
engine()->reloadRegisters();
|
m_engine->reloadRegisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ class RegisterHandler;
|
|||||||
class StackHandler;
|
class StackHandler;
|
||||||
class ThreadsHandler;
|
class ThreadsHandler;
|
||||||
class WatchHandler;
|
class WatchHandler;
|
||||||
|
class SourceFilesWindow;
|
||||||
class WatchData;
|
class WatchData;
|
||||||
class BreakpointData;
|
class BreakpointData;
|
||||||
|
|
||||||
@@ -76,8 +77,6 @@ class BreakpointData;
|
|||||||
// DebuggerProcessNotReady
|
// DebuggerProcessNotReady
|
||||||
// |
|
// |
|
||||||
// DebuggerProcessStartingUp
|
// DebuggerProcessStartingUp
|
||||||
// |
|
|
||||||
// DebuggerReady [R] [N]
|
|
||||||
// | <-------------------------------------.
|
// | <-------------------------------------.
|
||||||
// DebuggerInferiorRunningRequested |
|
// DebuggerInferiorRunningRequested |
|
||||||
// | |
|
// | |
|
||||||
@@ -87,12 +86,6 @@ class BreakpointData;
|
|||||||
// | |
|
// | |
|
||||||
// DebuggerInferiorStopped |
|
// DebuggerInferiorStopped |
|
||||||
// | |
|
// | |
|
||||||
// DebuggerInferiorUpdating |
|
|
||||||
// | |
|
|
||||||
// DebuggerInferiorUpdateFinishing |
|
|
||||||
// | |
|
|
||||||
// DebuggerInferiorReady [C] [N] |
|
|
||||||
// | |
|
|
||||||
// `---------------------------------------'
|
// `---------------------------------------'
|
||||||
//
|
//
|
||||||
// Allowed actions:
|
// Allowed actions:
|
||||||
@@ -106,17 +99,11 @@ enum DebuggerStatus
|
|||||||
{
|
{
|
||||||
DebuggerProcessNotReady, // Debugger not started
|
DebuggerProcessNotReady, // Debugger not started
|
||||||
DebuggerProcessStartingUp, // Debugger starting up
|
DebuggerProcessStartingUp, // Debugger starting up
|
||||||
DebuggerProcessReady, // Debugger started, Inferior not yet
|
|
||||||
// running or already finished
|
|
||||||
|
|
||||||
DebuggerInferiorRunningRequested, // Debuggee requested to run
|
DebuggerInferiorRunningRequested, // Debuggee requested to run
|
||||||
DebuggerInferiorRunning, // Debuggee running
|
DebuggerInferiorRunning, // Debuggee running
|
||||||
DebuggerInferiorStopRequested, // Debuggee running, stop requested
|
DebuggerInferiorStopRequested, // Debuggee running, stop requested
|
||||||
DebuggerInferiorStopped, // Debuggee stopped
|
DebuggerInferiorStopped, // Debuggee stopped
|
||||||
|
|
||||||
DebuggerInferiorUpdating, // Debuggee updating data views
|
|
||||||
DebuggerInferiorUpdateFinishing, // Debuggee updating data views aborting
|
|
||||||
DebuggerInferiorReady,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -150,9 +137,8 @@ private:
|
|||||||
friend class WinEngine;
|
friend class WinEngine;
|
||||||
|
|
||||||
// called from the engines after successful startup
|
// called from the engines after successful startup
|
||||||
virtual void notifyStartupFinished() = 0;
|
virtual void notifyInferiorStopRequested() = 0;
|
||||||
virtual void notifyInferiorStopped() = 0;
|
virtual void notifyInferiorStopped() = 0;
|
||||||
virtual void notifyInferiorUpdateFinished() = 0;
|
|
||||||
virtual void notifyInferiorRunningRequested() = 0;
|
virtual void notifyInferiorRunningRequested() = 0;
|
||||||
virtual void notifyInferiorRunning() = 0;
|
virtual void notifyInferiorRunning() = 0;
|
||||||
virtual void notifyInferiorExited() = 0;
|
virtual void notifyInferiorExited() = 0;
|
||||||
@@ -165,15 +151,21 @@ private:
|
|||||||
virtual StackHandler *stackHandler() = 0;
|
virtual StackHandler *stackHandler() = 0;
|
||||||
virtual ThreadsHandler *threadsHandler() = 0;
|
virtual ThreadsHandler *threadsHandler() = 0;
|
||||||
virtual WatchHandler *watchHandler() = 0;
|
virtual WatchHandler *watchHandler() = 0;
|
||||||
|
virtual SourceFilesWindow *sourceFileWindow() = 0;
|
||||||
|
|
||||||
virtual void showApplicationOutput(const QString &data) = 0;
|
virtual void showApplicationOutput(const QString &data) = 0;
|
||||||
virtual bool skipKnownFrames() const = 0;
|
virtual bool skipKnownFrames() const = 0;
|
||||||
virtual bool debugDumpers() const = 0;
|
virtual bool debugDumpers() const = 0;
|
||||||
virtual bool useCustomDumpers() const = 0;
|
virtual bool useCustomDumpers() const = 0;
|
||||||
virtual bool useFastStart() const = 0;
|
|
||||||
|
virtual bool wantsAllPluginBreakpoints() const = 0;
|
||||||
|
virtual bool wantsSelectedPluginBreakpoints() const = 0;
|
||||||
|
virtual bool wantsNoPluginBreakpoints() const = 0;
|
||||||
|
virtual QString selectedPluginBreakpointsPattern() const = 0;
|
||||||
|
|
||||||
virtual void reloadDisassembler() = 0;
|
virtual void reloadDisassembler() = 0;
|
||||||
virtual void reloadModules() = 0;
|
virtual void reloadModules() = 0;
|
||||||
|
virtual void reloadSourceFiles() = 0;
|
||||||
virtual void reloadRegisters() = 0;
|
virtual void reloadRegisters() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -200,6 +192,11 @@ public:
|
|||||||
bool m_useToolTips;
|
bool m_useToolTips;
|
||||||
|
|
||||||
QString m_scriptFile;
|
QString m_scriptFile;
|
||||||
|
|
||||||
|
bool m_pluginAllBreakpoints;
|
||||||
|
bool m_pluginSelectedBreakpoints;
|
||||||
|
bool m_pluginNoBreakpoints;
|
||||||
|
QString m_pluginSelectedBreakpointsPattern;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -220,7 +217,7 @@ public:
|
|||||||
QLabel *statusLabel() const { return m_statusLabel; }
|
QLabel *statusLabel() const { return m_statusLabel; }
|
||||||
DebuggerSettings *settings() { return &m_settings; }
|
DebuggerSettings *settings() { return &m_settings; }
|
||||||
|
|
||||||
enum StartMode { startInternal, startExternal, attachExternal };
|
enum StartMode { StartInternal, StartExternal, AttachExternal };
|
||||||
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
|
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -283,7 +280,6 @@ public slots:
|
|||||||
void setUseCustomDumpers(bool on);
|
void setUseCustomDumpers(bool on);
|
||||||
void setDebugDumpers(bool on);
|
void setDebugDumpers(bool on);
|
||||||
void setSkipKnownFrames(bool on);
|
void setSkipKnownFrames(bool on);
|
||||||
void setUseFastStart(bool on);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
||||||
@@ -293,6 +289,9 @@ private slots:
|
|||||||
void reloadDisassembler();
|
void reloadDisassembler();
|
||||||
void disassemblerDockToggled(bool on);
|
void disassemblerDockToggled(bool on);
|
||||||
|
|
||||||
|
void reloadSourceFiles();
|
||||||
|
void sourceFilesDockToggled(bool on);
|
||||||
|
|
||||||
void reloadModules();
|
void reloadModules();
|
||||||
void modulesDockToggled(bool on);
|
void modulesDockToggled(bool on);
|
||||||
void loadSymbols(const QString &moduleName);
|
void loadSymbols(const QString &moduleName);
|
||||||
@@ -314,16 +313,23 @@ private:
|
|||||||
StackHandler *stackHandler() { return m_stackHandler; }
|
StackHandler *stackHandler() { return m_stackHandler; }
|
||||||
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
||||||
WatchHandler *watchHandler() { return m_watchHandler; }
|
WatchHandler *watchHandler() { return m_watchHandler; }
|
||||||
|
SourceFilesWindow *sourceFileWindow() { return m_sourceFilesWindow; }
|
||||||
|
|
||||||
bool skipKnownFrames() const;
|
bool skipKnownFrames() const;
|
||||||
bool debugDumpers() const;
|
bool debugDumpers() const;
|
||||||
bool useCustomDumpers() const;
|
bool useCustomDumpers() const;
|
||||||
bool useFastStart() const;
|
bool wantsAllPluginBreakpoints() const
|
||||||
|
{ return m_settings.m_pluginAllBreakpoints; }
|
||||||
|
bool wantsSelectedPluginBreakpoints() const
|
||||||
|
{ return m_settings.m_pluginSelectedBreakpoints; }
|
||||||
|
bool wantsNoPluginBreakpoints() const
|
||||||
|
{ return m_settings.m_pluginNoBreakpoints; }
|
||||||
|
QString selectedPluginBreakpointsPattern() const
|
||||||
|
{ return m_settings.m_pluginSelectedBreakpointsPattern; }
|
||||||
|
|
||||||
void notifyStartupFinished();
|
|
||||||
void notifyInferiorStopped();
|
void notifyInferiorStopped();
|
||||||
void notifyInferiorUpdateFinished();
|
|
||||||
void notifyInferiorRunningRequested();
|
void notifyInferiorRunningRequested();
|
||||||
|
void notifyInferiorStopRequested();
|
||||||
void notifyInferiorRunning();
|
void notifyInferiorRunning();
|
||||||
void notifyInferiorExited();
|
void notifyInferiorExited();
|
||||||
void notifyInferiorPidChanged(int);
|
void notifyInferiorPidChanged(int);
|
||||||
@@ -399,6 +405,7 @@ private:
|
|||||||
QDockWidget *m_outputDock;
|
QDockWidget *m_outputDock;
|
||||||
QDockWidget *m_registerDock;
|
QDockWidget *m_registerDock;
|
||||||
QDockWidget *m_stackDock;
|
QDockWidget *m_stackDock;
|
||||||
|
QDockWidget *m_sourceFilesDock;
|
||||||
QDockWidget *m_threadsDock;
|
QDockWidget *m_threadsDock;
|
||||||
QDockWidget *m_watchDock;
|
QDockWidget *m_watchDock;
|
||||||
QList<QDockWidget*> m_dockWidgets;
|
QList<QDockWidget*> m_dockWidgets;
|
||||||
@@ -410,6 +417,7 @@ private:
|
|||||||
StackHandler *m_stackHandler;
|
StackHandler *m_stackHandler;
|
||||||
ThreadsHandler *m_threadsHandler;
|
ThreadsHandler *m_threadsHandler;
|
||||||
WatchHandler *m_watchHandler;
|
WatchHandler *m_watchHandler;
|
||||||
|
SourceFilesWindow *m_sourceFilesWindow;
|
||||||
|
|
||||||
/// Actions
|
/// Actions
|
||||||
friend class DebuggerPlugin;
|
friend class DebuggerPlugin;
|
||||||
|
@@ -274,15 +274,26 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
|
|||||||
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
|
m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
|
||||||
m_ui.scriptFileChooser->setPath(m_settings.m_scriptFile);
|
m_ui.scriptFileChooser->setPath(m_settings.m_scriptFile);
|
||||||
m_ui.environmentEdit->setText(m_settings.m_gdbEnv);
|
m_ui.environmentEdit->setText(m_settings.m_gdbEnv);
|
||||||
m_ui.autoStartBox->setChecked(m_settings.m_autoRun);
|
|
||||||
m_ui.autoQuitBox->setChecked(m_settings.m_autoQuit);
|
m_ui.radioButtonAllPluginBreakpoints->
|
||||||
|
setChecked(m_settings.m_pluginAllBreakpoints);
|
||||||
|
m_ui.radioButtonSelectedPluginBreakpoints->
|
||||||
|
setChecked(m_settings.m_pluginSelectedBreakpoints);
|
||||||
|
m_ui.radioButtonNoPluginBreakpoints->
|
||||||
|
setChecked(m_settings.m_pluginNoBreakpoints);
|
||||||
|
m_ui.lineEditSelectedPluginBreakpointsPattern->
|
||||||
|
setText(m_settings.m_pluginSelectedBreakpointsPattern);
|
||||||
|
m_ui.lineEditSelectedPluginBreakpointsPattern->
|
||||||
|
setEnabled(m_settings.m_pluginSelectedBreakpoints);
|
||||||
|
|
||||||
m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames);
|
m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames);
|
||||||
m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers);
|
m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers);
|
||||||
m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers);
|
m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers);
|
||||||
m_ui.checkBoxFastStart->setChecked(m_settings.m_useFastStart);
|
|
||||||
m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips);
|
m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips);
|
||||||
|
|
||||||
|
connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
|
||||||
|
m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
#ifndef QT_DEBUG
|
#ifndef QT_DEBUG
|
||||||
#if 0
|
#if 0
|
||||||
cmd = am->registerAction(m_manager->m_dumpLogAction,
|
cmd = am->registerAction(m_manager->m_dumpLogAction,
|
||||||
@@ -294,14 +305,9 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
m_ui.autoStartBox->hide();
|
|
||||||
m_ui.autoQuitBox->hide();
|
|
||||||
m_ui.environmentEdit->hide();
|
m_ui.environmentEdit->hide();
|
||||||
m_ui.labelEnvironment->hide();
|
m_ui.labelEnvironment->hide();
|
||||||
|
|
||||||
m_ui.checkBoxFastStart->setChecked(false);
|
|
||||||
m_ui.checkBoxFastStart->hide();
|
|
||||||
|
|
||||||
//m_dumpLogAction = new QAction(this);
|
//m_dumpLogAction = new QAction(this);
|
||||||
//m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
|
//m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
|
||||||
//
|
//
|
||||||
@@ -315,16 +321,22 @@ void GdbOptionPage::apply()
|
|||||||
{
|
{
|
||||||
m_settings.m_gdbCmd = m_ui.gdbLocationChooser->path();
|
m_settings.m_gdbCmd = m_ui.gdbLocationChooser->path();
|
||||||
m_settings.m_gdbEnv = m_ui.environmentEdit->text();
|
m_settings.m_gdbEnv = m_ui.environmentEdit->text();
|
||||||
m_settings.m_autoRun = m_ui.autoStartBox->isChecked();
|
|
||||||
m_settings.m_autoQuit = m_ui.autoQuitBox->isChecked();
|
|
||||||
m_settings.m_scriptFile = m_ui.scriptFileChooser->path();
|
m_settings.m_scriptFile = m_ui.scriptFileChooser->path();
|
||||||
|
|
||||||
m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked();
|
m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked();
|
||||||
m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked();
|
m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked();
|
||||||
m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked();
|
m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked();
|
||||||
m_settings.m_useFastStart = m_ui.checkBoxFastStart->isChecked();
|
|
||||||
m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked();
|
m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked();
|
||||||
|
|
||||||
|
m_settings.m_pluginAllBreakpoints =
|
||||||
|
m_ui.radioButtonAllPluginBreakpoints->isChecked();
|
||||||
|
m_settings.m_pluginSelectedBreakpoints =
|
||||||
|
m_ui.radioButtonSelectedPluginBreakpoints->isChecked();
|
||||||
|
m_settings.m_pluginNoBreakpoints =
|
||||||
|
m_ui.radioButtonNoPluginBreakpoints->isChecked();
|
||||||
|
m_settings.m_pluginSelectedBreakpointsPattern =
|
||||||
|
m_ui.lineEditSelectedPluginBreakpointsPattern->text();
|
||||||
|
|
||||||
*m_plugin->m_manager->settings() = m_settings;
|
*m_plugin->m_manager->settings() = m_settings;
|
||||||
m_plugin->writeSettings();
|
m_plugin->writeSettings();
|
||||||
}
|
}
|
||||||
@@ -441,7 +453,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmd = am->registerAction(m_manager->m_continueAction,
|
cmd = am->registerAction(m_manager->m_continueAction,
|
||||||
ProjectExplorer::Constants::DEBUG, QList<int>()<< m_gdbRunningContext);
|
ProjectExplorer::Constants::DEBUG, QList<int>() << m_gdbRunningContext);
|
||||||
|
|
||||||
cmd = am->registerAction(m_manager->m_stopAction,
|
cmd = am->registerAction(m_manager->m_stopAction,
|
||||||
Constants::INTERRUPT, globalcontext);
|
Constants::INTERRUPT, globalcontext);
|
||||||
@@ -889,11 +901,16 @@ void DebuggerPlugin::writeSettings() const
|
|||||||
s->setValue("AutoRun", m->m_autoRun);
|
s->setValue("AutoRun", m->m_autoRun);
|
||||||
s->setValue("AutoQuit", m->m_autoQuit);
|
s->setValue("AutoQuit", m->m_autoQuit);
|
||||||
|
|
||||||
s->setValue("UseFastStart", m->m_useFastStart);
|
|
||||||
s->setValue("UseToolTips", m->m_useToolTips);
|
s->setValue("UseToolTips", m->m_useToolTips);
|
||||||
s->setValue("UseCustomDumpers", m->m_useCustomDumpers);
|
s->setValue("UseCustomDumpers", m->m_useCustomDumpers);
|
||||||
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
|
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
|
||||||
s->setValue("DebugDumpers", m->m_debugDumpers);
|
s->setValue("DebugDumpers", m->m_debugDumpers);
|
||||||
|
|
||||||
|
s->setValue("AllPluginBreakpoints", m->m_pluginAllBreakpoints);
|
||||||
|
s->setValue("SelectedPluginBreakpoints", m->m_pluginSelectedBreakpoints);
|
||||||
|
s->setValue("NoPluginBreakpoints", m->m_pluginNoBreakpoints);
|
||||||
|
s->setValue("SelectedPluginBreakpointsPattern", m->m_pluginSelectedBreakpointsPattern);
|
||||||
|
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -911,6 +928,7 @@ void DebuggerPlugin::readSettings()
|
|||||||
QString defaultScript;
|
QString defaultScript;
|
||||||
|
|
||||||
s->beginGroup(QLatin1String("DebugMode"));
|
s->beginGroup(QLatin1String("DebugMode"));
|
||||||
|
|
||||||
QByteArray ba = s->value("State", QByteArray()).toByteArray();
|
QByteArray ba = s->value("State", QByteArray()).toByteArray();
|
||||||
m_toggleLockedAction->setChecked(s->value("Locked", true).toBool());
|
m_toggleLockedAction->setChecked(s->value("Locked", true).toBool());
|
||||||
m->m_gdbCmd = s->value("Location", defaultCommand).toString();
|
m->m_gdbCmd = s->value("Location", defaultCommand).toString();
|
||||||
@@ -922,8 +940,17 @@ void DebuggerPlugin::readSettings()
|
|||||||
m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool();
|
m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool();
|
||||||
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
|
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
|
||||||
m->m_useCustomDumpers = s->value("UseCustomDumpers", true).toBool();
|
m->m_useCustomDumpers = s->value("UseCustomDumpers", true).toBool();
|
||||||
m->m_useFastStart = s->value("UseFastStart", false).toBool();
|
|
||||||
m->m_useToolTips = s->value("UseToolTips", false).toBool();
|
m->m_useToolTips = s->value("UseToolTips", false).toBool();
|
||||||
|
|
||||||
|
m->m_pluginAllBreakpoints =
|
||||||
|
s->value("AllPluginBreakpoints", true).toBool();
|
||||||
|
m->m_pluginSelectedBreakpoints =
|
||||||
|
s->value("SelectedPluginBreakpoints", false).toBool();
|
||||||
|
m->m_pluginNoBreakpoints =
|
||||||
|
s->value("NoPluginBreakpoints", false).toBool();
|
||||||
|
m->m_pluginSelectedBreakpointsPattern =
|
||||||
|
s->value("SelectedPluginBreakpointsPattern").toString();
|
||||||
|
|
||||||
s->endGroup();
|
s->endGroup();
|
||||||
|
|
||||||
m_manager->mainWindow()->restoreState(ba);
|
m_manager->mainWindow()->restoreState(ba);
|
||||||
|
@@ -107,11 +107,16 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
|||||||
: RunControl(runConfiguration), m_manager(manager), m_running(false)
|
: RunControl(runConfiguration), m_manager(manager), m_running(false)
|
||||||
{
|
{
|
||||||
connect(m_manager, SIGNAL(debuggingFinished()),
|
connect(m_manager, SIGNAL(debuggingFinished()),
|
||||||
this, SLOT(debuggingFinished()));
|
this, SLOT(debuggingFinished()),
|
||||||
|
Qt::QueuedConnection);
|
||||||
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
|
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
|
||||||
this, SLOT(slotAddToOutputWindowInline(QString)));
|
this, SLOT(slotAddToOutputWindowInline(QString)),
|
||||||
|
Qt::QueuedConnection);
|
||||||
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
connect(m_manager, SIGNAL(inferiorPidChanged(qint64)),
|
||||||
this, SLOT(bringApplicationToForeground(qint64)));
|
this, SLOT(bringApplicationToForeground(qint64)),
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(this, SIGNAL(stopRequested()),
|
||||||
|
m_manager, SLOT(exitDebugger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::start()
|
void DebuggerRunControl::start()
|
||||||
@@ -132,7 +137,7 @@ void DebuggerRunControl::start()
|
|||||||
//<daniel> andre: + "\qtc-gdbmacros\"
|
//<daniel> andre: + "\qtc-gdbmacros\"
|
||||||
|
|
||||||
//emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
|
//emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
|
||||||
if (m_manager->startNewDebugger(DebuggerManager::startInternal))
|
if (m_manager->startNewDebugger(DebuggerManager::StartInternal))
|
||||||
emit started();
|
emit started();
|
||||||
else
|
else
|
||||||
debuggingFinished();
|
debuggingFinished();
|
||||||
@@ -145,17 +150,21 @@ void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
|
|||||||
|
|
||||||
void DebuggerRunControl::stop()
|
void DebuggerRunControl::stop()
|
||||||
{
|
{
|
||||||
m_manager->exitDebugger();
|
//qDebug() << "DebuggerRunControl::stop";
|
||||||
|
m_running = false;
|
||||||
|
emit stopRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::debuggingFinished()
|
void DebuggerRunControl::debuggingFinished()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
//qDebug() << "DebuggerRunControl::finished";
|
||||||
//emit addToOutputWindow(this, tr("Debugging %1 finished").arg(m_executable));
|
//emit addToOutputWindow(this, tr("Debugging %1 finished").arg(m_executable));
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerRunControl::isRunning() const
|
bool DebuggerRunControl::isRunning() const
|
||||||
{
|
{
|
||||||
|
//qDebug() << "DebuggerRunControl::isRunning" << m_running;
|
||||||
return m_running;
|
return m_running;
|
||||||
}
|
}
|
||||||
|
@@ -82,6 +82,9 @@ public:
|
|||||||
virtual void stop();
|
virtual void stop();
|
||||||
virtual bool isRunning() const;
|
virtual bool isRunning() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void stopRequested();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void debuggingFinished();
|
void debuggingFinished();
|
||||||
void slotAddToOutputWindowInline(const QString &output);
|
void slotAddToOutputWindowInline(const QString &output);
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "disassemblerhandler.h"
|
#include "disassemblerhandler.h"
|
||||||
|
|
||||||
#include "assert.h"
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QAbstractTableModel>
|
#include <QtCore/QAbstractTableModel>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -113,7 +113,6 @@ private:
|
|||||||
void exitDebugger();
|
void exitDebugger();
|
||||||
|
|
||||||
void continueInferior();
|
void continueInferior();
|
||||||
void runInferior();
|
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
|
|
||||||
void runToLineExec(const QString &fileName, int lineNumber);
|
void runToLineExec(const QString &fileName, int lineNumber);
|
||||||
@@ -145,7 +144,8 @@ private:
|
|||||||
|
|
||||||
bool supportsThreads() const;
|
bool supportsThreads() const;
|
||||||
|
|
||||||
void init(); // called by destructor
|
void initializeConnections();
|
||||||
|
void initializeVariables();
|
||||||
void queryFullName(const QString &fileName, QString *fullName);
|
void queryFullName(const QString &fileName, QString *fullName);
|
||||||
QString fullName(const QString &fileName);
|
QString fullName(const QString &fileName);
|
||||||
QString shortName(const QString &fullName);
|
QString shortName(const QString &fullName);
|
||||||
@@ -158,12 +158,15 @@ private:
|
|||||||
// queue". resultNeeded == true increments m_pendingResults on
|
// queue". resultNeeded == true increments m_pendingResults on
|
||||||
// send and decrements on receipt, effectively preventing
|
// send and decrements on receipt, effectively preventing
|
||||||
// watch model updates before everything is finished.
|
// watch model updates before everything is finished.
|
||||||
void sendCommand(const QString & command,
|
enum StopNeeded { DoesNotNeedStop, NeedsStop };
|
||||||
|
enum Synchronization { NotSynchronized, Synchronized };
|
||||||
|
void sendCommand(const QString &command,
|
||||||
int type = 0, const QVariant &cookie = QVariant(),
|
int type = 0, const QVariant &cookie = QVariant(),
|
||||||
bool needStop = false, bool synchronized = false);
|
StopNeeded needStop = DoesNotNeedStop,
|
||||||
|
Synchronization synchronized = NotSynchronized);
|
||||||
void sendSynchronizedCommand(const QString & command,
|
void sendSynchronizedCommand(const QString & command,
|
||||||
int type = 0, const QVariant &cookie = QVariant(),
|
int type = 0, const QVariant &cookie = QVariant(),
|
||||||
bool needStop = false);
|
StopNeeded needStop = DoesNotNeedStop);
|
||||||
|
|
||||||
void setTokenBarrier();
|
void setTokenBarrier();
|
||||||
|
|
||||||
@@ -179,7 +182,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int terminationIndex(const QByteArray &buffer, int &length);
|
int terminationIndex(const QByteArray &buffer, int &length);
|
||||||
void handleStreamOutput(const QString &output, char code);
|
void handleStart(const GdbResultRecord &response);
|
||||||
void handleAsyncOutput2(const GdbMi &data);
|
void handleAsyncOutput2(const GdbMi &data);
|
||||||
void handleAsyncOutput(const GdbMi &data);
|
void handleAsyncOutput(const GdbMi &data);
|
||||||
void handleResultRecord(const GdbResultRecord &response);
|
void handleResultRecord(const GdbResultRecord &response);
|
||||||
@@ -189,9 +192,11 @@ private:
|
|||||||
void handleExecRunToFunction(const GdbResultRecord &response);
|
void handleExecRunToFunction(const GdbResultRecord &response);
|
||||||
void handleInfoShared(const GdbResultRecord &response);
|
void handleInfoShared(const GdbResultRecord &response);
|
||||||
void handleInfoProc(const GdbResultRecord &response);
|
void handleInfoProc(const GdbResultRecord &response);
|
||||||
|
void handleInfoThreads(const GdbResultRecord &response);
|
||||||
void handleShowVersion(const GdbResultRecord &response);
|
void handleShowVersion(const GdbResultRecord &response);
|
||||||
void handleQueryPwd(const GdbResultRecord &response);
|
void handleQueryPwd(const GdbResultRecord &response);
|
||||||
void handleQuerySources(const GdbResultRecord &response);
|
void handleQuerySources(const GdbResultRecord &response);
|
||||||
|
void debugMessage(const QString &msg);
|
||||||
|
|
||||||
OutputCollector m_outputCollector;
|
OutputCollector m_outputCollector;
|
||||||
QTextCodec *m_outputCodec;
|
QTextCodec *m_outputCodec;
|
||||||
@@ -215,11 +220,10 @@ private:
|
|||||||
int m_oldestAcceptableToken;
|
int m_oldestAcceptableToken;
|
||||||
|
|
||||||
int m_gdbVersion; // 6.8.0 is 680
|
int m_gdbVersion; // 6.8.0 is 680
|
||||||
int m_shared;
|
|
||||||
|
|
||||||
// awful hack to keep track of used files
|
// awful hack to keep track of used files
|
||||||
QHash<QString, QString> m_shortToFullName;
|
QMap<QString, QString> m_shortToFullName;
|
||||||
QHash<QString, QString> m_fullToShortName;
|
QMap<QString, QString> m_fullToShortName;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Breakpoint specific stuff
|
// Breakpoint specific stuff
|
||||||
@@ -259,6 +263,10 @@ private:
|
|||||||
void handleRegisterListNames(const GdbResultRecord &record);
|
void handleRegisterListNames(const GdbResultRecord &record);
|
||||||
void handleRegisterListValues(const GdbResultRecord &record);
|
void handleRegisterListValues(const GdbResultRecord &record);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Source file specific stuff
|
||||||
|
//
|
||||||
|
void reloadSourceFiles();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Stack specific stuff
|
// Stack specific stuff
|
||||||
@@ -330,6 +338,12 @@ private:
|
|||||||
QString m_currentFrame;
|
QString m_currentFrame;
|
||||||
QMap<QString, QString> m_varToType;
|
QMap<QString, QString> m_varToType;
|
||||||
|
|
||||||
|
bool m_waitingForBreakpointSynchronizationToContinue;
|
||||||
|
bool m_waitingForFirstBreakpointToBeHit;
|
||||||
|
bool m_modulesListOutdated;
|
||||||
|
|
||||||
|
QList<GdbCookie> m_commandsToRunOnTemporaryBreak;
|
||||||
|
|
||||||
DebuggerManager *q;
|
DebuggerManager *q;
|
||||||
IDebuggerManagerAccessForEngines *qq;
|
IDebuggerManagerAccessForEngines *qq;
|
||||||
};
|
};
|
||||||
|
@@ -6,26 +6,20 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>465</width>
|
<width>398</width>
|
||||||
<height>372</height>
|
<height>385</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="spacing">
|
<item row="0" column="0">
|
||||||
<number>6</number>
|
<widget class="QGroupBox" name="groupBoxLocations">
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Locations</string>
|
<string>Locations</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -74,7 +68,70 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QGroupBox" name="groupBoxPluginDebugging">
|
||||||
|
<property name="title">
|
||||||
|
<string>Behaviour of breakpoint setting in plugins</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QRadioButton" name="radioButtonAllPluginBreakpoints">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>This is the slowest but safest option.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Try to set breakpoints in plugins always automatically.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QRadioButton" name="radioButtonSelectedPluginBreakpoints">
|
||||||
|
<property name="text">
|
||||||
|
<string>Try to set breakpoints in selected plugins</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelSelectedPluginBreakpoints">
|
||||||
|
<property name="text">
|
||||||
|
<string>Matching regular expression: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditSelectedPluginBreakpointsPattern"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QRadioButton" name="radioButtonNoPluginBreakpoints">
|
||||||
|
<property name="text">
|
||||||
|
<string>Never set breakpoints in plugins automatically</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="checkBoxUseCustomDumpers">
|
<widget class="QCheckBox" name="checkBoxUseCustomDumpers">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Checking this will make the debugger try to use code to format certain data (QObject, QString, std::string etc.) nicely.</string>
|
<string>Checking this will make the debugger try to use code to format certain data (QObject, QString, std::string etc.) nicely.</string>
|
||||||
@@ -84,17 +141,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="checkBoxFastStart">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Checking this will make the debugger start fast by loading only very few debug symbols on start up. This might lead to situations where breakpoints can not be set properly. So uncheck this option if you experience breakpoint related problems.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Fast debugger start</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
|
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
|
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
|
||||||
@@ -105,7 +152,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="4" column="0">
|
||||||
<widget class="QCheckBox" name="checkBoxUseToolTips">
|
<widget class="QCheckBox" name="checkBoxUseToolTips">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
|
<string>Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
|
||||||
@@ -115,7 +162,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="5" column="0">
|
||||||
<widget class="QCheckBox" name="checkBoxDebugDumpers">
|
<widget class="QCheckBox" name="checkBoxDebugDumpers">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string notr="true">This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself.</string>
|
<string notr="true">This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself.</string>
|
||||||
@@ -125,29 +172,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="6" column="0">
|
||||||
<widget class="QCheckBox" name="autoStartBox">
|
<spacer name="verticalSpacer">
|
||||||
<property name="text">
|
|
||||||
<string>Auto run executable on debugger startup</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="autoQuitBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Quit debugger when the executable exits</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>415</width>
|
<width>10</width>
|
||||||
<height>41</height>
|
<height>1</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
@@ -62,7 +62,6 @@ public:
|
|||||||
virtual void nextIExec() = 0;
|
virtual void nextIExec() = 0;
|
||||||
|
|
||||||
virtual void continueInferior() = 0;
|
virtual void continueInferior() = 0;
|
||||||
virtual void runInferior() = 0;
|
|
||||||
virtual void interruptInferior() = 0;
|
virtual void interruptInferior() = 0;
|
||||||
|
|
||||||
virtual void runToLineExec(const QString &fileName, int lineNumber) = 0;
|
virtual void runToLineExec(const QString &fileName, int lineNumber) = 0;
|
||||||
@@ -88,6 +87,8 @@ public:
|
|||||||
virtual void reloadRegisters() = 0;
|
virtual void reloadRegisters() = 0;
|
||||||
virtual void setDebugDumpers(bool on) = 0;
|
virtual void setDebugDumpers(bool on) = 0;
|
||||||
virtual void setUseCustomDumpers(bool on) = 0;
|
virtual void setUseCustomDumpers(bool on) = 0;
|
||||||
|
|
||||||
|
virtual void reloadSourceFiles() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "moduleshandler.h"
|
#include "moduleshandler.h"
|
||||||
|
|
||||||
#include "assert.h"
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
@@ -80,7 +80,7 @@ bool OutputCollector::listen()
|
|||||||
return m_server->isListening();
|
return m_server->isListening();
|
||||||
m_server = new QLocalServer(this);
|
m_server = new QLocalServer(this);
|
||||||
connect(m_server, SIGNAL(newConnection()), SLOT(newConnectionAvailable()));
|
connect(m_server, SIGNAL(newConnection()), SLOT(newConnectionAvailable()));
|
||||||
return m_server->listen(QLatin1String("creator-") + QCoreApplication::applicationPid()); // XXX how to make that secure?
|
return m_server->listen(QString::fromLatin1("creator-%1").arg(QCoreApplication::applicationPid())); // XXX how to make that secure?
|
||||||
#else
|
#else
|
||||||
if (!m_serverPath.isEmpty())
|
if (!m_serverPath.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
|
@@ -33,9 +33,10 @@
|
|||||||
|
|
||||||
#include "registerhandler.h"
|
#include "registerhandler.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QAbstractTableModel>
|
#include <QtCore/QAbstractTableModel>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
|
@@ -216,7 +216,6 @@ bool ScriptEngine::startDebugger()
|
|||||||
m_scriptContents = stream.readAll();
|
m_scriptContents = stream.readAll();
|
||||||
scriptFile.close();
|
scriptFile.close();
|
||||||
attemptBreakpointSynchronization();
|
attemptBreakpointSynchronization();
|
||||||
QTimer::singleShot(0, q, SLOT(notifyStartupFinished()));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -112,6 +112,7 @@ private:
|
|||||||
void reloadDisassembler();
|
void reloadDisassembler();
|
||||||
void reloadModules();
|
void reloadModules();
|
||||||
void reloadRegisters() {}
|
void reloadRegisters() {}
|
||||||
|
void reloadSourceFiles() {}
|
||||||
|
|
||||||
bool supportsThreads() const { return true; }
|
bool supportsThreads() const { return true; }
|
||||||
void maybeBreakNow(bool byFunction);
|
void maybeBreakNow(bool byFunction);
|
||||||
|
213
src/plugins/debugger/sourcefileswindow.cpp
Normal file
213
src/plugins/debugger/sourcefileswindow.cpp
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "sourcefileswindow.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
#include <QTreeView>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
using Debugger::Internal::SourceFilesWindow;
|
||||||
|
using Debugger::Internal::SourceFilesModel;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SourceFilesModel
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class Debugger::Internal::SourceFilesModel : public QAbstractItemModel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SourceFilesModel(QObject *parent = 0) : QAbstractItemModel(parent) {}
|
||||||
|
|
||||||
|
// QAbstractItemModel
|
||||||
|
int columnCount(const QModelIndex &parent) const
|
||||||
|
{ return parent.isValid() ? 0 : 2; }
|
||||||
|
int rowCount(const QModelIndex &parent) const
|
||||||
|
{ return parent.isValid() ? 0 : m_shortNames.size(); }
|
||||||
|
QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
|
||||||
|
QModelIndex index(int row, int column, const QModelIndex &) const
|
||||||
|
{ return createIndex(row, column); }
|
||||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||||
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
void clearModel();
|
||||||
|
void update() { reset(); }
|
||||||
|
void setSourceFiles(const QMap<QString, QString> &sourceFiles);
|
||||||
|
|
||||||
|
public:
|
||||||
|
QStringList m_shortNames;
|
||||||
|
QStringList m_fullNames;
|
||||||
|
};
|
||||||
|
|
||||||
|
void SourceFilesModel::clearModel()
|
||||||
|
{
|
||||||
|
if (m_shortNames.isEmpty())
|
||||||
|
return;
|
||||||
|
m_shortNames.clear();
|
||||||
|
m_fullNames.clear();
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant SourceFilesModel::headerData(int section,
|
||||||
|
Qt::Orientation orientation, int role) const
|
||||||
|
{
|
||||||
|
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||||
|
static QString headers[] = {
|
||||||
|
tr("Internal name") + " ",
|
||||||
|
tr("Full name") + " ",
|
||||||
|
};
|
||||||
|
return headers[section];
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::ItemFlags SourceFilesModel::flags(const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
if (index.row() >= m_fullNames.size())
|
||||||
|
return 0;
|
||||||
|
QFileInfo fi(m_fullNames.at(index.row()));
|
||||||
|
return fi.isReadable() ? QAbstractItemModel::flags(index) : Qt::ItemFlags(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant SourceFilesModel::data(const QModelIndex &index, int role) const
|
||||||
|
{
|
||||||
|
//static const QIcon icon(":/gdbdebugger/images/breakpoint.svg");
|
||||||
|
//static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg");
|
||||||
|
|
||||||
|
int row = index.row();
|
||||||
|
if (row < 0 || row >= m_shortNames.size())
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
switch (index.column()) {
|
||||||
|
case 0:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
|
return m_shortNames.at(row);
|
||||||
|
// FIXME: add icons
|
||||||
|
//if (role == Qt::DecorationRole)
|
||||||
|
// return module.symbolsRead ? icon2 : icon;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (role == Qt::DisplayRole)
|
||||||
|
return m_fullNames.at(row);
|
||||||
|
//if (role == Qt::DecorationRole)
|
||||||
|
// return module.symbolsRead ? icon2 : icon;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SourceFilesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
|
{
|
||||||
|
return QAbstractItemModel::setData(index, value, role);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceFilesModel::setSourceFiles(const QMap<QString, QString> &sourceFiles)
|
||||||
|
{
|
||||||
|
m_shortNames.clear();
|
||||||
|
m_fullNames.clear();
|
||||||
|
QMap<QString, QString>::ConstIterator it = sourceFiles.begin();
|
||||||
|
QMap<QString, QString>::ConstIterator et = sourceFiles.end();
|
||||||
|
for (; it != et; ++it) {
|
||||||
|
m_shortNames.append(it.key());
|
||||||
|
m_fullNames.append(it.value());
|
||||||
|
}
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SourceFilesWindow
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
SourceFilesWindow::SourceFilesWindow(QWidget *parent)
|
||||||
|
: QTreeView(parent)
|
||||||
|
{
|
||||||
|
m_model = new SourceFilesModel(this);
|
||||||
|
|
||||||
|
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
|
||||||
|
proxyModel->setSourceModel(m_model);
|
||||||
|
setModel(proxyModel);
|
||||||
|
|
||||||
|
setWindowTitle(tr("Source Files"));
|
||||||
|
setSortingEnabled(true);
|
||||||
|
setAlternatingRowColors(true);
|
||||||
|
setRootIsDecorated(false);
|
||||||
|
setIconSize(QSize(10, 10));
|
||||||
|
//header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
|
this, SLOT(sourceFileActivated(QModelIndex)));
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceFilesWindow::~SourceFilesWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
qDebug() << "ACTIVATED: " << index.row() << index.column();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
|
{
|
||||||
|
QMenu menu;
|
||||||
|
QAction *act1 = new QAction(tr("Reload data"), &menu);
|
||||||
|
//act1->setCheckable(true);
|
||||||
|
|
||||||
|
menu.addAction(act1);
|
||||||
|
|
||||||
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
|
if (act == act1) {
|
||||||
|
emit reloadSourceFilesRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceFilesWindow::setSourceFiles(const QMap<QString, QString> &sourceFiles)
|
||||||
|
{
|
||||||
|
m_model->setSourceFiles(sourceFiles);
|
||||||
|
header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
|
}
|
76
src/plugins/debugger/sourcefileswindow.h
Normal file
76
src/plugins/debugger/sourcefileswindow.h
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008-2009 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.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DEBUGGER_SOURCEFILEWINDOW_H
|
||||||
|
#define DEBUGGER_SOURCEFILEWINDOW_H
|
||||||
|
|
||||||
|
#include <QtGui/QTreeWidget>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QComboBox;
|
||||||
|
class QModelIndex;
|
||||||
|
class QStandardItemModel;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class SourceFilesModel;
|
||||||
|
|
||||||
|
class SourceFilesWindow : public QTreeView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SourceFilesWindow(QWidget *parent = 0);
|
||||||
|
~SourceFilesWindow();
|
||||||
|
|
||||||
|
void setSourceFiles(const QMap<QString, QString> &sourceFiles);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void reloadSourceFilesRequested();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void sourceFileActivated(const QModelIndex &index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
|
SourceFilesModel *m_model;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
#endif // DEBUGGER_SOURCEFILEWINDOW_H
|
||||||
|
|
@@ -33,9 +33,10 @@
|
|||||||
|
|
||||||
#include "stackwindow.h"
|
#include "stackwindow.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@@ -33,9 +33,10 @@
|
|||||||
|
|
||||||
#include "threadswindow.h"
|
#include "threadswindow.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@@ -790,9 +790,9 @@ void WatchHandler::collapseChildren(const QModelIndex &idx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTC_ASSERT(checkIndex(idx.internalId()), return);
|
QTC_ASSERT(checkIndex(idx.internalId()), return);
|
||||||
#if 0
|
|
||||||
QString iname0 = m_displaySet.at(idx.internalId()).iname;
|
QString iname0 = m_displaySet.at(idx.internalId()).iname;
|
||||||
MODEL_DEBUG("COLLAPSE NODE" << iname0);
|
MODEL_DEBUG("COLLAPSE NODE" << iname0);
|
||||||
|
#if 0
|
||||||
QString iname1 = iname0 + '.';
|
QString iname1 = iname0 + '.';
|
||||||
for (int i = m_completeSet.size(); --i >= 0; ) {
|
for (int i = m_completeSet.size(); --i >= 0; ) {
|
||||||
QString iname = m_completeSet.at(i).iname;
|
QString iname = m_completeSet.at(i).iname;
|
||||||
@@ -803,10 +803,10 @@ void WatchHandler::collapseChildren(const QModelIndex &idx)
|
|||||||
m_expandedINames.remove(iname);
|
m_expandedINames.remove(iname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
m_expandedINames.remove(iname0);
|
m_expandedINames.remove(iname0);
|
||||||
//MODEL_DEBUG(toString());
|
//MODEL_DEBUG(toString());
|
||||||
//rebuildModel();
|
//rebuildModel();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::expandChildren(const QModelIndex &idx)
|
void WatchHandler::expandChildren(const QModelIndex &idx)
|
||||||
|
@@ -207,20 +207,20 @@ void GitClient::diff(const QString &workingDirectory,
|
|||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("diff") << diffArgs;
|
arguments << QLatin1String("diff") << diffArgs;
|
||||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||||
command->addJob(arguments);
|
command->addJob(arguments, m_settings.timeout);
|
||||||
} else {
|
} else {
|
||||||
// Files diff.
|
// Files diff.
|
||||||
if (!unstagedFileNames.empty()) {
|
if (!unstagedFileNames.empty()) {
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("diff") << diffArgs << QLatin1String("--") << unstagedFileNames;
|
arguments << QLatin1String("diff") << diffArgs << QLatin1String("--") << unstagedFileNames;
|
||||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||||
command->addJob(arguments);
|
command->addJob(arguments, m_settings.timeout);
|
||||||
}
|
}
|
||||||
if (!stagedFileNames.empty()) {
|
if (!stagedFileNames.empty()) {
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("diff") << QLatin1String("--cached") << diffArgs << QLatin1String("--") << stagedFileNames;
|
arguments << QLatin1String("diff") << QLatin1String("--cached") << diffArgs << QLatin1String("--") << stagedFileNames;
|
||||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||||
command->addJob(arguments);
|
command->addJob(arguments, m_settings.timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
command->execute();
|
command->execute();
|
||||||
@@ -503,7 +503,7 @@ void GitClient::executeGit(const QString &workingDirectory,
|
|||||||
{
|
{
|
||||||
m_plugin->outputWindow()->append(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
|
m_plugin->outputWindow()->append(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
|
||||||
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow);
|
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow);
|
||||||
command->addJob(arguments);
|
command->addJob(arguments, m_settings.timeout);
|
||||||
command->execute();
|
command->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,8 +55,9 @@ static inline QStringList environmentToList(const ProjectExplorer::Environment &
|
|||||||
return ProjectExplorer::Environment::systemEnvironment().toStringList();
|
return ProjectExplorer::Environment::systemEnvironment().toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
GitCommand::Job::Job(const QStringList &a) :
|
GitCommand::Job::Job(const QStringList &a, int t) :
|
||||||
arguments(a)
|
arguments(a),
|
||||||
|
timeout(t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,9 +68,9 @@ GitCommand::GitCommand(const QString &workingDirectory,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitCommand::addJob(const QStringList &arguments)
|
void GitCommand::addJob(const QStringList &arguments, int timeout)
|
||||||
{
|
{
|
||||||
m_jobs.push_back(Job(arguments));
|
m_jobs.push_back(Job(arguments, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitCommand::execute()
|
void GitCommand::execute()
|
||||||
@@ -109,7 +110,7 @@ void GitCommand::run()
|
|||||||
qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments;
|
qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments;
|
||||||
|
|
||||||
process.start(QLatin1String(Constants::GIT_BINARY), m_jobs.at(j).arguments);
|
process.start(QLatin1String(Constants::GIT_BINARY), m_jobs.at(j).arguments);
|
||||||
if (!process.waitForFinished()) {
|
if (!process.waitForFinished(m_jobs.at(j).timeout * 1000)) {
|
||||||
ok = false;
|
ok = false;
|
||||||
error += QLatin1String("Error: Git timed out");
|
error += QLatin1String("Error: Git timed out");
|
||||||
break;
|
break;
|
||||||
|
@@ -49,7 +49,7 @@ public:
|
|||||||
ProjectExplorer::Environment &environment);
|
ProjectExplorer::Environment &environment);
|
||||||
|
|
||||||
|
|
||||||
void addJob(const QStringList &arguments);
|
void addJob(const QStringList &arguments, int timeout);
|
||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -61,9 +61,10 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct Job {
|
struct Job {
|
||||||
explicit Job(const QStringList &a);
|
explicit Job(const QStringList &a, int t);
|
||||||
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
|
int timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
QStringList environment() const;
|
QStringList environment() const;
|
||||||
|
@@ -40,15 +40,17 @@ static const char *groupC = "Git";
|
|||||||
static const char *sysEnvKeyC = "SysEnv";
|
static const char *sysEnvKeyC = "SysEnv";
|
||||||
static const char *pathKeyC = "Path";
|
static const char *pathKeyC = "Path";
|
||||||
static const char *logCountKeyC = "LogCount";
|
static const char *logCountKeyC = "LogCount";
|
||||||
|
static const char *timeoutKeyC = "TimeOut";
|
||||||
|
|
||||||
enum { defaultLogCount = 10 };
|
enum { defaultLogCount = 10 , defaultTimeOut = 30};
|
||||||
|
|
||||||
namespace Git {
|
namespace Git {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
GitSettings::GitSettings() :
|
GitSettings::GitSettings() :
|
||||||
adoptPath(false),
|
adoptPath(false),
|
||||||
logCount(defaultLogCount)
|
logCount(defaultLogCount),
|
||||||
|
timeout(defaultTimeOut)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +60,7 @@ void GitSettings::fromSettings(QSettings *settings)
|
|||||||
adoptPath = settings->value(QLatin1String(sysEnvKeyC), false).toBool();
|
adoptPath = settings->value(QLatin1String(sysEnvKeyC), false).toBool();
|
||||||
path = settings->value(QLatin1String(pathKeyC), QString()).toString();
|
path = settings->value(QLatin1String(pathKeyC), QString()).toString();
|
||||||
logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt();
|
logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt();
|
||||||
|
timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,12 +70,13 @@ void GitSettings::toSettings(QSettings *settings) const
|
|||||||
settings->setValue(QLatin1String(sysEnvKeyC), adoptPath);
|
settings->setValue(QLatin1String(sysEnvKeyC), adoptPath);
|
||||||
settings->setValue(QLatin1String(pathKeyC), path);
|
settings->setValue(QLatin1String(pathKeyC), path);
|
||||||
settings->setValue(QLatin1String(logCountKeyC), logCount);
|
settings->setValue(QLatin1String(logCountKeyC), logCount);
|
||||||
|
settings->setValue(QLatin1String(timeoutKeyC), timeout);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitSettings::equals(const GitSettings &s) const
|
bool GitSettings::equals(const GitSettings &s) const
|
||||||
{
|
{
|
||||||
return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount;
|
return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount && timeout == s.timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -56,6 +56,7 @@ struct GitSettings
|
|||||||
bool adoptPath;
|
bool adoptPath;
|
||||||
QString path;
|
QString path;
|
||||||
int logCount;
|
int logCount;
|
||||||
|
int timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const GitSettings &p1, const GitSettings &p2)
|
inline bool operator==(const GitSettings &p1, const GitSettings &p2)
|
||||||
|
@@ -52,6 +52,7 @@ GitSettings SettingsPageWidget::settings() const
|
|||||||
rc.path = m_ui.pathLineEdit->text();
|
rc.path = m_ui.pathLineEdit->text();
|
||||||
rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty();
|
rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty();
|
||||||
rc.logCount = m_ui.logCountSpinBox->value();
|
rc.logCount = m_ui.logCountSpinBox->value();
|
||||||
|
rc.timeout = m_ui.timeoutSpinBox->value();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +61,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
|
|||||||
m_ui.environmentGroupBox->setChecked(s.adoptPath);
|
m_ui.environmentGroupBox->setChecked(s.adoptPath);
|
||||||
m_ui.pathLineEdit->setText(s.path);
|
m_ui.pathLineEdit->setText(s.path);
|
||||||
m_ui.logCountSpinBox->setValue(s.logCount);
|
m_ui.logCountSpinBox->setValue(s.logCount);
|
||||||
|
m_ui.timeoutSpinBox->setValue(s.timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPageWidget::setSystemPath()
|
void SettingsPageWidget::setSystemPath()
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>403</width>
|
<width>403</width>
|
||||||
<height>183</height>
|
<height>251</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -69,10 +69,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="logFormLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<item row="0" column="0">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<widget class="QLabel" name="logCountLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Log commit display count:</string>
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="logCountSpinBox">
|
<widget class="QSpinBox" name="logCountSpinBox">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
@@ -83,10 +87,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="logCountLabel">
|
<widget class="QLabel" name="timeoutLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Log commit display count:</string>
|
<string>Timeout (seconds):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="timeoutSpinBox">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>30</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@@ -221,7 +221,6 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess
|
|||||||
m_coreListener = new CoreListener(this);
|
m_coreListener = new CoreListener(this);
|
||||||
addObject(m_coreListener);
|
addObject(m_coreListener);
|
||||||
|
|
||||||
|
|
||||||
//register actions
|
//register actions
|
||||||
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
||||||
|
|
||||||
@@ -682,6 +681,8 @@ void PerforcePlugin::updateActions()
|
|||||||
|
|
||||||
bool PerforcePlugin::managesDirectory(const QString &directory) const
|
bool PerforcePlugin::managesDirectory(const QString &directory) const
|
||||||
{
|
{
|
||||||
|
if (!checkP4Command())
|
||||||
|
return false;
|
||||||
const QString p4Path = directory + QLatin1String("/...");
|
const QString p4Path = directory + QLatin1String("/...");
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << QLatin1String("fstat") << QLatin1String("-m1") << p4Path;
|
args << QLatin1String("fstat") << QLatin1String("-m1") << p4Path;
|
||||||
@@ -758,7 +759,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
|||||||
tempfile.setAutoRemove(true);
|
tempfile.setAutoRemove(true);
|
||||||
const QChar newLine = QLatin1Char('\n');
|
const QChar newLine = QLatin1Char('\n');
|
||||||
const QChar blank = QLatin1Char(' ');
|
const QChar blank = QLatin1Char(' ');
|
||||||
QStringList actualArgs = basicP4Args();
|
QStringList actualArgs = m_settings.basicP4Args();
|
||||||
if (!extraArgs.isEmpty()) {
|
if (!extraArgs.isEmpty()) {
|
||||||
if (tempfile.open()) {
|
if (tempfile.open()) {
|
||||||
QTextStream stream(&tempfile);
|
QTextStream stream(&tempfile);
|
||||||
@@ -773,7 +774,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
|||||||
actualArgs << args;
|
actualArgs << args;
|
||||||
|
|
||||||
if (logFlags & CommandToWindow) {
|
if (logFlags & CommandToWindow) {
|
||||||
QString command = m_settings.p4Command;
|
QString command = m_settings.p4Command();
|
||||||
command += blank;
|
command += blank;
|
||||||
command += actualArgs.join(QString(blank));
|
command += actualArgs.join(QString(blank));
|
||||||
const QString timeStamp = QTime::currentTime().toString(QLatin1String("HH:mm"));
|
const QString timeStamp = QTime::currentTime().toString(QLatin1String("HH:mm"));
|
||||||
@@ -799,7 +800,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
|||||||
connect(&process, SIGNAL(stdOutBuffered(QString,bool)), m_perforceOutputWindow, SLOT(append(QString,bool)));
|
connect(&process, SIGNAL(stdOutBuffered(QString,bool)), m_perforceOutputWindow, SLOT(append(QString,bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const Core::Utils::SynchronousProcessResponse sp_resp = process.run(m_settings.p4Command, actualArgs);
|
const Core::Utils::SynchronousProcessResponse sp_resp = process.run(m_settings.p4Command(), actualArgs);
|
||||||
if (Perforce::Constants::debug)
|
if (Perforce::Constants::debug)
|
||||||
qDebug() << sp_resp;
|
qDebug() << sp_resp;
|
||||||
|
|
||||||
@@ -817,7 +818,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
|||||||
response.message = tr("The process terminated abnormally.");
|
response.message = tr("The process terminated abnormally.");
|
||||||
break;
|
break;
|
||||||
case Core::Utils::SynchronousProcessResponse::StartFailed:
|
case Core::Utils::SynchronousProcessResponse::StartFailed:
|
||||||
response.message = tr("Could not start perforce '%1'. Please check your settings in the preferences.").arg(m_settings.p4Command);
|
response.message = tr("Could not start perforce '%1'. Please check your settings in the preferences.").arg(m_settings.p4Command());
|
||||||
break;
|
break;
|
||||||
case Core::Utils::SynchronousProcessResponse::Hang:
|
case Core::Utils::SynchronousProcessResponse::Hang:
|
||||||
response.message = tr("Perforce did not respond within timeout limit (%1 ms).").arg(p4Timeout );
|
response.message = tr("Perforce did not respond within timeout limit (%1 ms).").arg(p4Timeout );
|
||||||
@@ -969,8 +970,8 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
|
|||||||
proc.setEnvironment(environment());
|
proc.setEnvironment(environment());
|
||||||
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
proc.start(m_settings.p4Command,
|
proc.start(m_settings.p4Command(),
|
||||||
basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
|
m_settings.basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
|
||||||
if (!proc.waitForStarted(p4Timeout)) {
|
if (!proc.waitForStarted(p4Timeout)) {
|
||||||
showOutput(tr("Cannot execute p4 submit."), true);
|
showOutput(tr("Cannot execute p4 submit."), true);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
@@ -1018,8 +1019,8 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
|
|||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
proc.setEnvironment(environment());
|
proc.setEnvironment(environment());
|
||||||
proc.start(m_settings.p4Command,
|
proc.start(m_settings.p4Command(),
|
||||||
basicP4Args() << QLatin1String("fstat") << serverFilePath);
|
m_settings.basicP4Args() << QLatin1String("fstat") << serverFilePath);
|
||||||
|
|
||||||
QString path;
|
QString path;
|
||||||
if (proc.waitForFinished(3000)) {
|
if (proc.waitForFinished(3000)) {
|
||||||
@@ -1047,22 +1048,9 @@ QString PerforcePlugin::currentFileName()
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList PerforcePlugin::basicP4Args() const
|
|
||||||
{
|
|
||||||
QStringList lst;
|
|
||||||
if (!m_settings.defaultEnv) {
|
|
||||||
lst << QLatin1String("-c") << m_settings.p4Client;
|
|
||||||
lst << QLatin1String("-p") << m_settings.p4Port;
|
|
||||||
lst << QLatin1String("-u") << m_settings.p4User;
|
|
||||||
}
|
|
||||||
return lst;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PerforcePlugin::checkP4Command() const
|
bool PerforcePlugin::checkP4Command() const
|
||||||
{
|
{
|
||||||
if (m_settings.p4Command.isEmpty())
|
return m_settings.isValid();
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PerforcePlugin::pendingChangesData()
|
QString PerforcePlugin::pendingChangesData()
|
||||||
@@ -1074,8 +1062,8 @@ QString PerforcePlugin::pendingChangesData()
|
|||||||
QString user;
|
QString user;
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
proc.setEnvironment(environment());
|
proc.setEnvironment(environment());
|
||||||
proc.start(m_settings.p4Command,
|
proc.start(m_settings.p4Command(),
|
||||||
basicP4Args() << QLatin1String("info"));
|
m_settings.basicP4Args() << QLatin1String("info"));
|
||||||
if (proc.waitForFinished(3000)) {
|
if (proc.waitForFinished(3000)) {
|
||||||
QString output = QString::fromUtf8(proc.readAllStandardOutput());
|
QString output = QString::fromUtf8(proc.readAllStandardOutput());
|
||||||
if (!output.isEmpty()) {
|
if (!output.isEmpty()) {
|
||||||
@@ -1087,8 +1075,8 @@ QString PerforcePlugin::pendingChangesData()
|
|||||||
}
|
}
|
||||||
if (user.isEmpty())
|
if (user.isEmpty())
|
||||||
return data;
|
return data;
|
||||||
proc.start(m_settings.p4Command,
|
proc.start(m_settings.p4Command(),
|
||||||
basicP4Args() << QLatin1String("changes") << QLatin1String("-s") << QLatin1String("pending") << QLatin1String("-u") << user);
|
m_settings.basicP4Args() << QLatin1String("changes") << QLatin1String("-s") << QLatin1String("pending") << QLatin1String("-u") << user);
|
||||||
if (proc.waitForFinished(3000))
|
if (proc.waitForFinished(3000))
|
||||||
data = QString::fromUtf8(proc.readAllStandardOutput());
|
data = QString::fromUtf8(proc.readAllStandardOutput());
|
||||||
return data;
|
return data;
|
||||||
@@ -1139,17 +1127,24 @@ PerforcePlugin::~PerforcePlugin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PerforceSettings PerforcePlugin::settings() const
|
const PerforceSettings& PerforcePlugin::settings() const
|
||||||
{
|
{
|
||||||
return m_settings;
|
return m_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforcePlugin::setSettings(const PerforceSettings &s)
|
void PerforcePlugin::setSettings(const QString &p4Command, const QString &p4Port, const QString &p4Client, const QString p4User, bool defaultEnv)
|
||||||
{
|
{
|
||||||
if (s != m_settings) {
|
|
||||||
m_settings = s;
|
if (m_settings.p4Command() == p4Command
|
||||||
if (QSettings *settings = Core::ICore::instance()->settings())
|
&& m_settings.p4Port() == p4Port
|
||||||
m_settings.toSettings(settings);
|
&& m_settings.p4Client() == p4Client
|
||||||
|
&& m_settings.p4User() == p4User
|
||||||
|
&& m_settings.defaultEnv() == defaultEnv)
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
} else {
|
||||||
|
m_settings.setSettings(p4Command, p4Port, p4Client, p4User, defaultEnv);
|
||||||
|
m_settings.toSettings(Core::ICore::instance()->settings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1162,9 +1157,9 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
|||||||
return perforceName;
|
return perforceName;
|
||||||
// "where" remaps the file to client file tree
|
// "where" remaps the file to client file tree
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
QStringList args(basicP4Args());
|
QStringList args(m_settings.basicP4Args());
|
||||||
args << QLatin1String("where") << perforceName;
|
args << QLatin1String("where") << perforceName;
|
||||||
proc.start(m_settings.p4Command, args);
|
proc.start(m_settings.p4Command(), args);
|
||||||
if (!proc.waitForFinished()) {
|
if (!proc.waitForFinished()) {
|
||||||
*errorMessage = tr("Timeout waiting for \"where\" (%1).").arg(perforceName);
|
*errorMessage = tr("Timeout waiting for \"where\" (%1).").arg(perforceName);
|
||||||
return QString();
|
return QString();
|
||||||
|
@@ -93,7 +93,6 @@ public:
|
|||||||
PerforcePlugin();
|
PerforcePlugin();
|
||||||
~PerforcePlugin();
|
~PerforcePlugin();
|
||||||
|
|
||||||
QStringList basicP4Args() const;
|
|
||||||
SettingsPage *settingsPage() const { return m_settingsPage; }
|
SettingsPage *settingsPage() const { return m_settingsPage; }
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *error_message);
|
bool initialize(const QStringList &arguments, QString *error_message);
|
||||||
@@ -113,8 +112,8 @@ public:
|
|||||||
|
|
||||||
static PerforcePlugin *perforcePluginInstance();
|
static PerforcePlugin *perforcePluginInstance();
|
||||||
|
|
||||||
PerforceSettings settings() const;
|
const PerforceSettings& settings() const;
|
||||||
void setSettings(const PerforceSettings &s);
|
void setSettings(const QString &p4Command, const QString &p4Port, const QString &p4Client, const QString p4User, bool defaultEnv);
|
||||||
|
|
||||||
// Map a perforce name "//xx" to its real name in the file system
|
// Map a perforce name "//xx" to its real name in the file system
|
||||||
QString fileNameFromPerforceName(const QString& perforceName, QString *errorMessage) const;
|
QString fileNameFromPerforceName(const QString& perforceName, QString *errorMessage) const;
|
||||||
|
@@ -33,7 +33,11 @@
|
|||||||
|
|
||||||
#include "perforcesettings.h"
|
#include "perforcesettings.h"
|
||||||
|
|
||||||
|
#include <qtconcurrent/QtConcurrentTools>
|
||||||
|
#include <QtCore/QtConcurrentRun>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
static const char *groupC = "Perforce";
|
static const char *groupC = "Perforce";
|
||||||
static const char *commandKeyC = "Command";
|
static const char *commandKeyC = "Command";
|
||||||
@@ -55,41 +59,134 @@ static QString defaultCommand()
|
|||||||
namespace Perforce {
|
namespace Perforce {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
PerforceSettings::PerforceSettings() :
|
PerforceSettings::PerforceSettings()
|
||||||
p4Command(defaultCommand()),
|
: m_valid(false)
|
||||||
defaultEnv(true)
|
|
||||||
{
|
{
|
||||||
|
// We do all the initialization in fromSettings
|
||||||
|
}
|
||||||
|
|
||||||
|
PerforceSettings::~PerforceSettings()
|
||||||
|
{
|
||||||
|
// ensure that we are not still running
|
||||||
|
m_future.waitForFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PerforceSettings::isValid() const
|
||||||
|
{
|
||||||
|
m_future.waitForFinished();
|
||||||
|
m_mutex.lock();
|
||||||
|
bool valid = m_valid;
|
||||||
|
m_mutex.unlock();
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerforceSettings::run(QFutureInterface<void> &fi)
|
||||||
|
{
|
||||||
|
m_mutex.lock();
|
||||||
|
QString executable = m_p4Command;
|
||||||
|
QStringList arguments = basicP4Args();
|
||||||
|
m_mutex.unlock();
|
||||||
|
|
||||||
|
// TODO actually check
|
||||||
|
bool valid = true;
|
||||||
|
|
||||||
|
QProcess p4;
|
||||||
|
p4.start(m_p4Command, QStringList() << "client"<<"-o");
|
||||||
|
p4.waitForFinished(2000);
|
||||||
|
if (p4.state() != QProcess::NotRunning) {
|
||||||
|
p4.kill();
|
||||||
|
p4.waitForFinished();
|
||||||
|
valid = false;
|
||||||
|
} else {
|
||||||
|
QString response = p4.readAllStandardOutput();
|
||||||
|
if (!response.contains("View:"))
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_mutex.lock();
|
||||||
|
if (executable == m_p4Command && arguments == basicP4Args()) // Check that those settings weren't changed in between
|
||||||
|
m_valid = valid;
|
||||||
|
m_mutex.unlock();
|
||||||
|
fi.reportFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforceSettings::fromSettings(QSettings *settings)
|
void PerforceSettings::fromSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
|
m_mutex.lock();
|
||||||
settings->beginGroup(QLatin1String(groupC));
|
settings->beginGroup(QLatin1String(groupC));
|
||||||
p4Command = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
|
m_p4Command = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
|
||||||
defaultEnv = settings->value(QLatin1String(defaultKeyC), true).toBool();
|
m_defaultEnv = settings->value(QLatin1String(defaultKeyC), true).toBool();
|
||||||
p4Port = settings->value(QLatin1String(portKeyC), QString()).toString();
|
m_p4Port = settings->value(QLatin1String(portKeyC), QString()).toString();
|
||||||
p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString();
|
m_p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString();
|
||||||
p4User = settings->value(QLatin1String(userKeyC), QString()).toString();
|
m_p4User = settings->value(QLatin1String(userKeyC), QString()).toString();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
m_mutex.unlock();
|
||||||
|
|
||||||
|
m_future = QtConcurrent::run(&PerforceSettings::run, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforceSettings::toSettings(QSettings *settings) const
|
void PerforceSettings::toSettings(QSettings *settings) const
|
||||||
{
|
{
|
||||||
|
m_mutex.lock();
|
||||||
settings->beginGroup(QLatin1String(groupC));
|
settings->beginGroup(QLatin1String(groupC));
|
||||||
settings->setValue(commandKeyC, p4Command);
|
settings->setValue(commandKeyC, m_p4Command);
|
||||||
settings->setValue(defaultKeyC, defaultEnv);
|
settings->setValue(defaultKeyC, m_defaultEnv);
|
||||||
settings->setValue(portKeyC, p4Port);
|
settings->setValue(portKeyC, m_p4Port);
|
||||||
settings->setValue(clientKeyC, p4Client);
|
settings->setValue(clientKeyC, m_p4Client);
|
||||||
settings->setValue(userKeyC, p4User);
|
settings->setValue(userKeyC, m_p4User);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PerforceSettings::equals(const PerforceSettings &s) const
|
void PerforceSettings::setSettings(const QString &p4Command, const QString &p4Port, const QString &p4Client, const QString p4User, bool defaultEnv)
|
||||||
{
|
{
|
||||||
return p4Command == s.p4Command && p4Port == s.p4Port
|
m_mutex.lock();
|
||||||
&& p4Client == s.p4Client && p4User == s.p4User
|
m_p4Command = p4Command;
|
||||||
&& defaultEnv == s.defaultEnv;
|
m_p4Port = p4Port;
|
||||||
|
m_p4Client = p4Client;
|
||||||
|
m_p4User = p4User;
|
||||||
|
m_defaultEnv = defaultEnv;
|
||||||
|
m_valid = false;
|
||||||
|
m_mutex.unlock();
|
||||||
|
m_future = QtConcurrent::run(&PerforceSettings::run, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString PerforceSettings::p4Command() const
|
||||||
|
{
|
||||||
|
return m_p4Command;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PerforceSettings::p4Port() const
|
||||||
|
{
|
||||||
|
return m_p4Port;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PerforceSettings::p4Client() const
|
||||||
|
{
|
||||||
|
return m_p4Client;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PerforceSettings::p4User() const
|
||||||
|
{
|
||||||
|
return m_p4User;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PerforceSettings::defaultEnv() const
|
||||||
|
{
|
||||||
|
return m_defaultEnv;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList PerforceSettings::basicP4Args() const
|
||||||
|
{
|
||||||
|
QStringList lst;
|
||||||
|
if (!m_defaultEnv) {
|
||||||
|
lst << QLatin1String("-c") << m_p4Client;
|
||||||
|
lst << QLatin1String("-p") << m_p4Port;
|
||||||
|
lst << QLatin1String("-u") << m_p4User;
|
||||||
|
}
|
||||||
|
return lst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Perforce
|
} // Perforce
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#define PERFOCESETTINGS_H
|
#define PERFOCESETTINGS_H
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QFuture>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QSettings;
|
class QSettings;
|
||||||
@@ -43,24 +44,35 @@ QT_END_NAMESPACE
|
|||||||
namespace Perforce {
|
namespace Perforce {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
struct PerforceSettings {
|
class PerforceSettings {
|
||||||
|
public:
|
||||||
PerforceSettings();
|
PerforceSettings();
|
||||||
void fromSettings(QSettings *);
|
~PerforceSettings();
|
||||||
|
void fromSettings(QSettings *settings);
|
||||||
void toSettings(QSettings *) const;
|
void toSettings(QSettings *) const;
|
||||||
bool equals(const PerforceSettings &s) const;
|
void setSettings(const QString &p4Command, const QString &p4Port, const QString &p4Client, const QString p4User, bool defaultEnv);
|
||||||
|
bool isValid() const;
|
||||||
|
|
||||||
QString p4Command;
|
QString p4Command() const;
|
||||||
QString p4Port;
|
QString p4Port() const;
|
||||||
QString p4Client;
|
QString p4Client() const;
|
||||||
QString p4User;
|
QString p4User() const;
|
||||||
bool defaultEnv;
|
bool defaultEnv() const;
|
||||||
|
QStringList basicP4Args() const;
|
||||||
|
private:
|
||||||
|
void run(QFutureInterface<void> &fi);
|
||||||
|
mutable QFuture<void> m_future;
|
||||||
|
mutable QMutex m_mutex;
|
||||||
|
|
||||||
|
QString m_p4Command;
|
||||||
|
QString m_p4Port;
|
||||||
|
QString m_p4Client;
|
||||||
|
QString m_p4User;
|
||||||
|
bool m_defaultEnv;
|
||||||
|
bool m_valid;
|
||||||
|
Q_DISABLE_COPY(PerforceSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const PerforceSettings &p1, const PerforceSettings &p2)
|
|
||||||
{ return p1.equals(p2); }
|
|
||||||
inline bool operator!=(const PerforceSettings &p1, const PerforceSettings &p2)
|
|
||||||
{ return !p1.equals(p2); }
|
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Perforce
|
} // Perforce
|
||||||
|
|
||||||
|
@@ -49,24 +49,38 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
|||||||
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
|
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerforceSettings SettingsPageWidget::settings() const
|
QString SettingsPageWidget::p4Command() const
|
||||||
{
|
{
|
||||||
PerforceSettings rc;
|
return m_ui.pathChooser->path();
|
||||||
rc.p4Command = m_ui.pathChooser->path();
|
}
|
||||||
rc.defaultEnv = m_ui.defaultCheckBox->isChecked();
|
|
||||||
rc.p4Port = m_ui.portLineEdit->text();
|
bool SettingsPageWidget::defaultEnv() const
|
||||||
rc.p4Client = m_ui.clientLineEdit->text();
|
{
|
||||||
rc.p4User = m_ui.userLineEdit->text();
|
return m_ui.defaultCheckBox->isChecked();
|
||||||
return rc;
|
}
|
||||||
|
|
||||||
|
QString SettingsPageWidget::p4Port() const
|
||||||
|
{
|
||||||
|
return m_ui.portLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SettingsPageWidget::p4User() const
|
||||||
|
{
|
||||||
|
return m_ui.userLineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SettingsPageWidget::p4Client() const
|
||||||
|
{
|
||||||
|
return m_ui.clientLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPageWidget::setSettings(const PerforceSettings &s)
|
void SettingsPageWidget::setSettings(const PerforceSettings &s)
|
||||||
{
|
{
|
||||||
m_ui.pathChooser->setPath(s.p4Command);
|
m_ui.pathChooser->setPath(s.p4Command());
|
||||||
m_ui.defaultCheckBox->setChecked(s.defaultEnv);
|
m_ui.defaultCheckBox->setChecked(s.defaultEnv());
|
||||||
m_ui.portLineEdit->setText(s.p4Port);
|
m_ui.portLineEdit->setText(s.p4Port());
|
||||||
m_ui.clientLineEdit->setText(s.p4Client);
|
m_ui.clientLineEdit->setText(s.p4Client());
|
||||||
m_ui.userLineEdit->setText(s.p4User);
|
m_ui.userLineEdit->setText(s.p4User());
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage::SettingsPage()
|
SettingsPage::SettingsPage()
|
||||||
@@ -101,5 +115,5 @@ void SettingsPage::apply()
|
|||||||
if (!m_widget)
|
if (!m_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PerforcePlugin::perforcePluginInstance()->setSettings(m_widget->settings());
|
PerforcePlugin::perforcePluginInstance()->setSettings(m_widget->p4Command(), m_widget->p4Port(), m_widget->p4Client(), m_widget->p4User(), m_widget->defaultEnv());
|
||||||
}
|
}
|
||||||
|
@@ -51,7 +51,12 @@ class SettingsPageWidget : public QWidget {
|
|||||||
public:
|
public:
|
||||||
explicit SettingsPageWidget(QWidget *parent);
|
explicit SettingsPageWidget(QWidget *parent);
|
||||||
|
|
||||||
PerforceSettings settings() const;
|
QString p4Command() const;
|
||||||
|
bool defaultEnv() const;
|
||||||
|
QString p4Port() const;
|
||||||
|
QString p4User() const;
|
||||||
|
QString p4Client() const;
|
||||||
|
|
||||||
void setSettings(const PerforceSettings &);
|
void setSettings(const PerforceSettings &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -110,9 +110,12 @@ OutputPane::OutputPane()
|
|||||||
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||||
|
|
||||||
m_mainWidget->setLayout(layout);
|
m_mainWidget->setLayout(layout);
|
||||||
|
|
||||||
|
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
|
||||||
|
this, SLOT(coreAboutToClose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputPane::~OutputPane()
|
void OutputPane::coreAboutToClose()
|
||||||
{
|
{
|
||||||
while (m_tabWidget->count()) {
|
while (m_tabWidget->count()) {
|
||||||
RunControl *rc = runControlForTab(0);
|
RunControl *rc = runControlForTab(0);
|
||||||
@@ -120,6 +123,10 @@ OutputPane::~OutputPane()
|
|||||||
rc->stop();
|
rc->stop();
|
||||||
closeTab(0);
|
closeTab(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputPane::~OutputPane()
|
||||||
|
{
|
||||||
delete m_mainWidget;
|
delete m_mainWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -84,6 +84,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void projectRemoved();
|
void projectRemoved();
|
||||||
|
void coreAboutToClose();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void insertLine();
|
void insertLine();
|
||||||
|
@@ -124,7 +124,15 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
|
|||||||
qmake.start(m_qmake, QStringList()<<"-spec"<<mkspec<<configarguments<<"gdbmacros.pro");
|
qmake.start(m_qmake, QStringList()<<"-spec"<<mkspec<<configarguments<<"gdbmacros.pro");
|
||||||
qmake.waitForFinished();
|
qmake.waitForFinished();
|
||||||
|
|
||||||
qmake.start(qt4Project->qtVersion(m_buildConfiguration)->makeCommand(), makeArguments);
|
QString makeCmd = qt4Project->qtVersion(m_buildConfiguration)->makeCommand();
|
||||||
|
if (!value(m_buildConfiguration, "makeCmd").toString().isEmpty())
|
||||||
|
makeCmd = value(m_buildConfiguration, "makeCmd").toString();
|
||||||
|
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||||
|
// Try to detect command in environment
|
||||||
|
QString tmp = qt4Project->environment(m_buildConfiguration).searchInPath(makeCmd);
|
||||||
|
makeCmd = tmp;
|
||||||
|
}
|
||||||
|
qmake.start(makeCmd, makeArguments);
|
||||||
qmake.waitForFinished();
|
qmake.waitForFinished();
|
||||||
|
|
||||||
fi.reportResult(true);
|
fi.reportResult(true);
|
||||||
|
@@ -296,12 +296,13 @@ void QtVersionManager::updateSystemVersion()
|
|||||||
foreach (QtVersion *version, m_versions) {
|
foreach (QtVersion *version, m_versions) {
|
||||||
if (version->isSystemVersion()) {
|
if (version->isSystemVersion()) {
|
||||||
version->setPath(findSystemQt());
|
version->setPath(findSystemQt());
|
||||||
|
version->setName(tr("Auto-detected Qt"));
|
||||||
haveSystemVersion = true;
|
haveSystemVersion = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (haveSystemVersion)
|
if (haveSystemVersion)
|
||||||
return;
|
return;
|
||||||
QtVersion *version = new QtVersion(tr("System Qt"),
|
QtVersion *version = new QtVersion(tr("Auto-detected Qt"),
|
||||||
findSystemQt(),
|
findSystemQt(),
|
||||||
getUniqueId(),
|
getUniqueId(),
|
||||||
true);
|
true);
|
||||||
|
@@ -2504,14 +2504,13 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
|
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
|
||||||
if (e->button() == Qt::LeftButton) {
|
if (e->button() == Qt::LeftButton) {
|
||||||
if (d->m_codeFoldingVisible && TextBlockUserData::canCollapse(cursor.block())
|
if (d->m_codeFoldingVisible && TextBlockUserData::canCollapse(cursor.block())
|
||||||
&& !TextBlockUserData::hasClosingCollapseInside(cursor.block().next())
|
&& !TextBlockUserData::hasClosingCollapseInside(cursor.block().next())
|
||||||
&& collapseBox(cursor.block()).contains(e->pos())) {
|
&& collapseBox(cursor.block()).contains(e->pos())) {
|
||||||
setTextCursor(cursor);
|
|
||||||
toggleBlockVisible(cursor.block());
|
toggleBlockVisible(cursor.block());
|
||||||
|
d->moveCursorVisible(false);
|
||||||
} else if (d->m_marksVisible && e->pos().x() > markWidth) {
|
} else if (d->m_marksVisible && e->pos().x() > markWidth) {
|
||||||
QTextCursor selection = cursor;
|
QTextCursor selection = cursor;
|
||||||
selection.setVisualNavigation(true);
|
selection.setVisualNavigation(true);
|
||||||
@@ -3392,14 +3391,15 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BaseTextEditorPrivate::moveCursorVisible()
|
void BaseTextEditorPrivate::moveCursorVisible(bool ensureVisible)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = q->textCursor();
|
QTextCursor cursor = q->textCursor();
|
||||||
if (!cursor.block().isVisible()) {
|
if (!cursor.block().isVisible()) {
|
||||||
cursor.setVisualNavigation(true);
|
cursor.setVisualNavigation(true);
|
||||||
cursor.movePosition(QTextCursor::PreviousBlock);
|
cursor.movePosition(QTextCursor::Up);
|
||||||
q->setTextCursor(cursor);
|
q->setTextCursor(cursor);
|
||||||
}
|
}
|
||||||
|
if (ensureVisible)
|
||||||
q->ensureCursorVisible();
|
q->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3463,12 +3463,12 @@ void BaseTextEditor::unCollapseAll()
|
|||||||
if (TextBlockUserData::canCollapse(block))
|
if (TextBlockUserData::canCollapse(block))
|
||||||
TextBlockUserData::doCollapse(block, makeVisible);
|
TextBlockUserData::doCollapse(block, makeVisible);
|
||||||
block = block.next();
|
block = block.next();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d->moveCursorVisible();
|
d->moveCursorVisible();
|
||||||
documentLayout->requestUpdate();
|
documentLayout->requestUpdate();
|
||||||
documentLayout->emitDocumentSizeChanged();
|
documentLayout->emitDocumentSizeChanged();
|
||||||
|
centerCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::setTextCodec(QTextCodec *codec)
|
void BaseTextEditor::setTextCodec(QTextCodec *codec)
|
||||||
|
@@ -218,7 +218,7 @@ public:
|
|||||||
QTextCursor m_findScope;
|
QTextCursor m_findScope;
|
||||||
QTextCursor m_selectBlockAnchor;
|
QTextCursor m_selectBlockAnchor;
|
||||||
|
|
||||||
void moveCursorVisible();
|
void moveCursorVisible(bool ensureVisible = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -384,8 +384,9 @@ bool CheckSpecifier::visit(TypeofSpecifierAST *ast)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckSpecifier::visit(AttributeSpecifierAST *)
|
bool CheckSpecifier::visit(AttributeSpecifierAST *ast)
|
||||||
{
|
{
|
||||||
|
accept(ast->next);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -768,11 +768,15 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
|
|||||||
case ProVariable::RemoveOperator: // -=
|
case ProVariable::RemoveOperator: // -=
|
||||||
if (!m_cumulative) {
|
if (!m_cumulative) {
|
||||||
if (!m_skipLevel) {
|
if (!m_skipLevel) {
|
||||||
removeEach(&m_valuemap, varName, v);
|
// the insertUnique is a hack for the moment to fix the
|
||||||
removeEach(&m_filevaluemap[currentProFile()], varName, v);
|
// CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before)
|
||||||
|
if (removeEach(&m_valuemap, varName, v) == 0)
|
||||||
|
insertUnique(&m_valuemap, QString("-%1").arg(varName), v);
|
||||||
|
if (removeEach(&m_filevaluemap[currentProFile()], varName, v) == 0)
|
||||||
|
insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v);
|
||||||
}
|
}
|
||||||
} else if (!m_skipLevel) {
|
} else if (!m_skipLevel) {
|
||||||
// this is a hack for the moment to fix the
|
// the insertUnique is a hack for the moment to fix the
|
||||||
// CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before)
|
// CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before)
|
||||||
insertUnique(&m_valuemap, QString("-%1").arg(varName), v);
|
insertUnique(&m_valuemap, QString("-%1").arg(varName), v);
|
||||||
insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v);
|
insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v);
|
||||||
|
@@ -140,12 +140,14 @@ static void insertUnique(QHash<QString, QStringList> *map,
|
|||||||
sl.append(str);
|
sl.append(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void removeEach(QHash<QString, QStringList> *map,
|
static int removeEach(QHash<QString, QStringList> *map,
|
||||||
const QString &key, const QStringList &value)
|
const QString &key, const QStringList &value)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
QStringList &sl = (*map)[key];
|
QStringList &sl = (*map)[key];
|
||||||
foreach (const QString &str, value)
|
foreach (const QString &str, value)
|
||||||
sl.removeAll(str);
|
count += sl.removeAll(str);
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user