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 <unistd.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\class QDumper
|
||||
\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();
|
||||
foreach (Symbol *candidate, candidates) {
|
||||
if (ScopedSymbol *scoped = candidate->asScopedSymbol()) {
|
||||
expand(scoped->members(), visibleScopes, &scopes);
|
||||
scopes.append(scoped->members());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -68,6 +68,11 @@ bool Overview::showReturnTypes() const
|
||||
return _showReturnTypes;
|
||||
}
|
||||
|
||||
unsigned Overview::markArgument() const
|
||||
{
|
||||
return _markArgument;
|
||||
}
|
||||
|
||||
void Overview::setMarkArgument(unsigned position)
|
||||
{
|
||||
_markArgument = position;
|
||||
@@ -98,9 +103,5 @@ QString Overview::prettyType(const FullySpecifiedType &ty,
|
||||
const QString &name) const
|
||||
{
|
||||
TypePrettyPrinter pp(this);
|
||||
pp.setMarkArgument(_markArgument);
|
||||
pp.setShowArgumentNames(_showArgumentNames);
|
||||
pp.setShowReturnTypes(_showReturnTypes);
|
||||
pp.setShowFunctionSignatures(_showFunctionSignatures);
|
||||
return pp(ty, name);
|
||||
}
|
||||
|
@@ -57,7 +57,10 @@ public:
|
||||
bool showFunctionSignatures() const;
|
||||
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
|
||||
{ return prettyName(name); }
|
||||
|
@@ -42,37 +42,12 @@ using namespace CPlusPlus;
|
||||
|
||||
TypePrettyPrinter::TypePrettyPrinter(const Overview *overview)
|
||||
: _overview(overview),
|
||||
_name(0),
|
||||
_markArgument(0),
|
||||
_showArgumentNames(false),
|
||||
_showReturnTypes(false),
|
||||
_showFunctionSignatures(true)
|
||||
_name(0)
|
||||
{ }
|
||||
|
||||
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
|
||||
{ return _overview; }
|
||||
|
||||
@@ -102,15 +77,16 @@ QString TypePrettyPrinter::operator()(const FullySpecifiedType &type, const QStr
|
||||
|
||||
void TypePrettyPrinter::acceptType(const FullySpecifiedType &ty)
|
||||
{
|
||||
if (ty.isConst())
|
||||
_text += QLatin1String("const ");
|
||||
if (ty.isVolatile())
|
||||
_text += QLatin1String("volatile ");
|
||||
if (ty.isSigned())
|
||||
_text += QLatin1String("signed ");
|
||||
if (ty.isUnsigned())
|
||||
_text += QLatin1String("unsigned ");
|
||||
out(QLatin1String("signed "));
|
||||
|
||||
else if (ty.isUnsigned())
|
||||
out(QLatin1String("unsigned "));
|
||||
|
||||
const FullySpecifiedType previousFullySpecifiedType = _fullySpecifiedType;
|
||||
_fullySpecifiedType = ty;
|
||||
accept(ty.type());
|
||||
_fullySpecifiedType = previousFullySpecifiedType;
|
||||
}
|
||||
|
||||
QString TypePrettyPrinter::switchName(const QString &name)
|
||||
@@ -127,9 +103,9 @@ QString TypePrettyPrinter::switchText(const QString &name)
|
||||
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;
|
||||
return previousPtrOperators;
|
||||
}
|
||||
@@ -137,31 +113,53 @@ QList<Type *> TypePrettyPrinter::switchPtrOperators(const QList<Type *> &ptrOper
|
||||
void TypePrettyPrinter::applyPtrOperators(bool wantSpace)
|
||||
{
|
||||
for (int i = _ptrOperators.size() - 1; i != -1; --i) {
|
||||
Type *op = _ptrOperators.at(i);
|
||||
const FullySpecifiedType op = _ptrOperators.at(i);
|
||||
|
||||
if (i == 0 && wantSpace)
|
||||
_text += QLatin1Char(' ');
|
||||
space();
|
||||
|
||||
if (PointerType *ptrTy = op->asPointerType()) {
|
||||
_text += QLatin1Char('*');
|
||||
if (ptrTy->elementType().isConst())
|
||||
_text += " const";
|
||||
if (ptrTy->elementType().isVolatile())
|
||||
_text += " volatile";
|
||||
if (op->isPointerType()) {
|
||||
out(QLatin1Char('*'));
|
||||
outCV(op);
|
||||
} else if (op->isReferenceType()) {
|
||||
_text += QLatin1Char('&');
|
||||
} else if (PointerToMemberType *memPtrTy = op->asPointerToMemberType()) {
|
||||
_text += QLatin1Char(' ');
|
||||
_text += _overview->prettyName(memPtrTy->memberName());
|
||||
_text += QLatin1Char('*');
|
||||
out(QLatin1Char('&'));
|
||||
} else if (const PointerToMemberType *memPtrTy = op->asPointerToMemberType()) {
|
||||
space();
|
||||
out(_overview->prettyName(memPtrTy->memberName()));
|
||||
out(QLatin1Char('*'));
|
||||
outCV(op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -169,25 +167,25 @@ void TypePrettyPrinter::visit(IntegerType *type)
|
||||
{
|
||||
switch (type->kind()) {
|
||||
case IntegerType::Char:
|
||||
_text += QLatin1String("char");
|
||||
out(QLatin1String("char"));
|
||||
break;
|
||||
case IntegerType::WideChar:
|
||||
_text += QLatin1String("wchar_t");
|
||||
out(QLatin1String("wchar_t"));
|
||||
break;
|
||||
case IntegerType::Bool:
|
||||
_text += QLatin1String("bool");
|
||||
out(QLatin1String("bool"));
|
||||
break;
|
||||
case IntegerType::Short:
|
||||
_text += QLatin1String("short");
|
||||
out(QLatin1String("short"));
|
||||
break;
|
||||
case IntegerType::Int:
|
||||
_text += QLatin1String("int");
|
||||
out(QLatin1String("int"));
|
||||
break;
|
||||
case IntegerType::Long:
|
||||
_text += QLatin1String("long");
|
||||
out(QLatin1String("long"));
|
||||
break;
|
||||
case IntegerType::LongLong:
|
||||
_text += QLatin1String("long long");
|
||||
out(QLatin1String("long long"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -198,13 +196,13 @@ void TypePrettyPrinter::visit(FloatType *type)
|
||||
{
|
||||
switch (type->kind()) {
|
||||
case FloatType::Float:
|
||||
_text += QLatin1String("float");
|
||||
out(QLatin1String("float"));
|
||||
break;
|
||||
case FloatType::Double:
|
||||
_text += QLatin1String("double");
|
||||
out(QLatin1String("double"));
|
||||
break;
|
||||
case FloatType::LongDouble:
|
||||
_text += QLatin1String("long double");
|
||||
out(QLatin1String("long double"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -213,99 +211,135 @@ void TypePrettyPrinter::visit(FloatType *type)
|
||||
|
||||
void TypePrettyPrinter::visit(PointerToMemberType *type)
|
||||
{
|
||||
_ptrOperators.append(type);
|
||||
outCV(type->elementType());
|
||||
space();
|
||||
|
||||
_ptrOperators.append(_fullySpecifiedType);
|
||||
acceptType(type->elementType());
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(PointerType *type)
|
||||
{
|
||||
_ptrOperators.append(type);
|
||||
outCV(type->elementType());
|
||||
space();
|
||||
|
||||
_ptrOperators.append(_fullySpecifiedType);
|
||||
acceptType(type->elementType());
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(ReferenceType *type)
|
||||
{
|
||||
_ptrOperators.append(type);
|
||||
outCV(type->elementType());
|
||||
space();
|
||||
|
||||
_ptrOperators.append(_fullySpecifiedType);
|
||||
acceptType(type->elementType());
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(ArrayType *type)
|
||||
{
|
||||
_text += overview()->prettyType(type->elementType());
|
||||
out(overview()->prettyType(type->elementType()));
|
||||
if (! _ptrOperators.isEmpty()) {
|
||||
_text += QLatin1Char('(');
|
||||
out(QLatin1Char('('));
|
||||
applyPtrOperators(false);
|
||||
if (! _name.isEmpty()) {
|
||||
_text += _name;
|
||||
out(_name);
|
||||
_name.clear();
|
||||
}
|
||||
_text += QLatin1Char(')');
|
||||
out(QLatin1Char(')'));
|
||||
}
|
||||
_text += QLatin1String("[]");
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(NamedType *type)
|
||||
{
|
||||
_text += overview()->prettyName(type->name());
|
||||
applyPtrOperators();
|
||||
out(QLatin1String("[]"));
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(Function *type)
|
||||
{
|
||||
if (_showReturnTypes)
|
||||
_text += _overview->prettyType(type->returnType());
|
||||
if (_overview->showReturnTypes())
|
||||
out(_overview->prettyType(type->returnType()));
|
||||
|
||||
if (! _ptrOperators.isEmpty()) {
|
||||
_text += QLatin1Char('(');
|
||||
out(QLatin1Char('('));
|
||||
applyPtrOperators(false);
|
||||
if (! _name.isEmpty()) {
|
||||
_text += _name;
|
||||
_name.clear();
|
||||
}
|
||||
_text += QLatin1Char(')');
|
||||
} else if (! _name.isEmpty() && _showFunctionSignatures) {
|
||||
_text += QLatin1Char(' '); // ### fixme
|
||||
_text += _name;
|
||||
out(QLatin1Char(')'));
|
||||
} else if (! _name.isEmpty() && _overview->showFunctionSignatures()) {
|
||||
space();
|
||||
out(_name);
|
||||
_name.clear();
|
||||
}
|
||||
|
||||
if (_showFunctionSignatures) {
|
||||
if (_overview->showFunctionSignatures()) {
|
||||
Overview argumentText;
|
||||
_text += QLatin1Char('(');
|
||||
argumentText.setShowReturnTypes(true);
|
||||
argumentText.setShowArgumentNames(false);
|
||||
argumentText.setShowFunctionSignatures(true);
|
||||
|
||||
out(QLatin1Char('('));
|
||||
|
||||
for (unsigned index = 0; index < type->argumentCount(); ++index) {
|
||||
if (index != 0)
|
||||
_text += QLatin1String(", ");
|
||||
out(QLatin1String(", "));
|
||||
|
||||
if (Argument *arg = type->argumentAt(index)->asArgument()) {
|
||||
if (index + 1 == _markArgument)
|
||||
_text += QLatin1String("<b>");
|
||||
if (index + 1 == _overview->markArgument())
|
||||
out(QLatin1String("<b>"));
|
||||
|
||||
Name *name = 0;
|
||||
if (_showArgumentNames)
|
||||
|
||||
if (_overview->showArgumentNames())
|
||||
name = arg->name();
|
||||
_text += argumentText(arg->type(), name);
|
||||
if (index + 1 == _markArgument)
|
||||
_text += QLatin1String("</b>");
|
||||
|
||||
out(argumentText(arg->type(), name));
|
||||
|
||||
if (index + 1 == _overview->markArgument())
|
||||
out(QLatin1String("</b>"));
|
||||
}
|
||||
}
|
||||
|
||||
if (type->isVariadic())
|
||||
_text += QLatin1String("...");
|
||||
out(QLatin1String("..."));
|
||||
|
||||
_text += QLatin1Char(')');
|
||||
|
||||
if (type->isConst())
|
||||
_text += QLatin1String(" const");
|
||||
|
||||
if (type->isVolatile())
|
||||
_text += QLatin1String(" volatile");
|
||||
out(QLatin1Char(')'));
|
||||
if (type->isConst() && type->isVolatile()) {
|
||||
space();
|
||||
out("const volatile");
|
||||
} else if (type->isConst()) {
|
||||
space();
|
||||
out("const");
|
||||
} else if (type->isVolatile()) {
|
||||
space();
|
||||
out("volatile");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TypePrettyPrinter::visit(Namespace *type)
|
||||
{ _text += overview()->prettyName(type->name()); }
|
||||
void TypePrettyPrinter::space()
|
||||
{
|
||||
if (_text.isEmpty())
|
||||
return;
|
||||
|
||||
void TypePrettyPrinter::visit(Class *type)
|
||||
{ _text += overview()->prettyName(type->name()); }
|
||||
const QChar ch = _text.at(_text.length() - 1);
|
||||
|
||||
void TypePrettyPrinter::visit(Enum *type)
|
||||
{ _text += overview()->prettyName(type->name()); }
|
||||
if (ch.isLetterOrNumber() || ch == QLatin1Char('_') || ch == QLatin1Char(')'))
|
||||
_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
|
||||
#define TYPEPRETTYPRINTER_H
|
||||
|
||||
#include "TypeVisitor.h"
|
||||
#include <TypeVisitor.h>
|
||||
#include <FullySpecifiedType.h>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
@@ -50,23 +51,12 @@ public:
|
||||
|
||||
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, const QString &name);
|
||||
|
||||
protected:
|
||||
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);
|
||||
|
||||
void applyPtrOperators(bool wantSpace = true);
|
||||
@@ -85,15 +75,17 @@ protected:
|
||||
virtual void visit(Class *type);
|
||||
virtual void visit(Enum *type);
|
||||
|
||||
void space();
|
||||
void out(const QString &text);
|
||||
void out(const QChar &ch);
|
||||
void outCV(const FullySpecifiedType &ty);
|
||||
|
||||
private:
|
||||
const Overview *_overview;
|
||||
QString _name;
|
||||
QString _text;
|
||||
QList<Type *> _ptrOperators;
|
||||
unsigned _markArgument;
|
||||
bool _showArgumentNames: 1;
|
||||
bool _showReturnTypes: 1;
|
||||
bool _showFunctionSignatures: 1;
|
||||
FullySpecifiedType _fullySpecifiedType;
|
||||
QList<FullySpecifiedType> _ptrOperators;
|
||||
};
|
||||
|
||||
} // end of namespace CPlusPlus
|
||||
|
@@ -39,7 +39,6 @@
|
||||
#include "iplugin.h"
|
||||
|
||||
#include <QtCore/QMetaProperty>
|
||||
#include <QtCore/QPluginLoader>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QWriteLocker>
|
||||
|
@@ -71,14 +71,14 @@ class CMakeRunner
|
||||
{
|
||||
public:
|
||||
CMakeRunner();
|
||||
void run(QFutureInterface<void> &fi);
|
||||
void setExecutable(const QString &executable);
|
||||
QString executable() const;
|
||||
QString version() const;
|
||||
bool supportsQtCreator() const;
|
||||
void waitForUpToDate() const;
|
||||
|
||||
private:
|
||||
void run(QFutureInterface<void> &fi);
|
||||
void waitForUpToDate() const;
|
||||
QString m_executable;
|
||||
QString m_version;
|
||||
bool m_supportsQtCreator;
|
||||
|
@@ -329,8 +329,8 @@ void StackedEditorGroup::updateToolBar(IEditor *editor)
|
||||
toolBar = m_defaultToolBar;
|
||||
if (m_activeToolBar == toolBar)
|
||||
return;
|
||||
toolBar->setVisible(true);
|
||||
m_activeToolBar->setVisible(false);
|
||||
toolBar->setVisible(true);
|
||||
m_activeToolBar = toolBar;
|
||||
}
|
||||
|
||||
|
@@ -185,7 +185,9 @@ void CodepasterPlugin::post()
|
||||
|
||||
// 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
|
||||
if (!data.contains("\r\n")) {
|
||||
|
@@ -65,8 +65,8 @@ public:
|
||||
QString username() const;
|
||||
QUrl serverUrl() const;
|
||||
|
||||
bool copyToClipBoard() const;
|
||||
bool displayOutput() const;
|
||||
inline bool copyToClipBoard() const { return m_copy; }
|
||||
inline bool displayOutput() const { return m_output; }
|
||||
|
||||
private:
|
||||
Ui_SettingsPage m_ui;
|
||||
|
@@ -78,7 +78,7 @@ class FunctionArgumentWidget : public QLabel
|
||||
{
|
||||
public:
|
||||
FunctionArgumentWidget();
|
||||
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
||||
void showFunctionHint(Function *functionSymbol, const LookupContext &context);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *e);
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
|
||||
QFrame *m_popupFrame;
|
||||
Function *m_item;
|
||||
Snapshot m_snapshot;
|
||||
LookupContext m_context;
|
||||
};
|
||||
|
||||
class ConvertToCompletionItem: protected NameVisitor
|
||||
@@ -187,10 +187,10 @@ using namespace CppTools::Internal;
|
||||
FunctionArgumentWidget::FunctionArgumentWidget()
|
||||
: m_item(0)
|
||||
{
|
||||
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
|
||||
QObject *editorObject = Core::EditorManager::instance()->currentEditor();
|
||||
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->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
@@ -215,10 +215,12 @@ FunctionArgumentWidget::FunctionArgumentWidget()
|
||||
}
|
||||
|
||||
void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol,
|
||||
const Snapshot &snapshot)
|
||||
const LookupContext &context)
|
||||
{
|
||||
m_popupFrame->hide();
|
||||
|
||||
m_item = functionSymbol;
|
||||
m_snapshot = snapshot;
|
||||
m_context = context;
|
||||
m_startpos = m_editor->position();
|
||||
|
||||
// update the text
|
||||
@@ -230,7 +232,7 @@ void FunctionArgumentWidget::showFunctionHint(Function *functionSymbol,
|
||||
m_popupFrame->move(pos);
|
||||
m_popupFrame->show();
|
||||
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
void FunctionArgumentWidget::update()
|
||||
@@ -432,7 +434,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
return -1;
|
||||
|
||||
m_editor = editor;
|
||||
m_startPosition = findStartOfName(editor);
|
||||
m_startPosition = findStartOfName();
|
||||
m_completionOperator = T_EOF_SYMBOL;
|
||||
|
||||
int endOfOperator = m_startPosition;
|
||||
@@ -518,9 +520,9 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
if (exprTy->isReferenceType())
|
||||
exprTy = exprTy->asReferenceType()->elementType();
|
||||
|
||||
if (m_completionOperator == T_LPAREN && completeFunction(exprTy, resolvedTypes, context)) {
|
||||
if (m_completionOperator == T_LPAREN && completeConstructorOrFunction(exprTy, resolvedTypes)) {
|
||||
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)) {
|
||||
return m_startPosition;
|
||||
} else if (m_completionOperator == T_COLON_COLON && completeScope(resolvedTypes, context)) {
|
||||
@@ -531,15 +533,40 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
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.
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy,
|
||||
const QList<TypeOfExpression::Result> &resolvedTypes,
|
||||
const LookupContext &)
|
||||
bool CppCodeCompletion::completeConstructorOrFunction(FullySpecifiedType exprTy,
|
||||
const QList<TypeOfExpression::Result> &resolvedTypes)
|
||||
{
|
||||
ConvertToCompletionItem toCompletionItem(this);
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -790,33 +821,45 @@ void CppCodeCompletion::addKeywords()
|
||||
|
||||
void CppCodeCompletion::addMacros(const LookupContext &context)
|
||||
{
|
||||
// macro completion items.
|
||||
QSet<QByteArray> macroNames;
|
||||
QSet<QString> processed;
|
||||
QList<QString> todo;
|
||||
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();
|
||||
}
|
||||
}
|
||||
QSet<QString> definedMacros;
|
||||
|
||||
foreach (const QByteArray ¯oName, macroNames) {
|
||||
addMacros_helper(context, context.thisDocument()->fileName(),
|
||||
&processed, &definedMacros);
|
||||
|
||||
foreach (const QString ¯oName, definedMacros) {
|
||||
TextEditor::CompletionItem item(this);
|
||||
item.m_text = QString::fromUtf8(macroName.constData(), macroName.length());
|
||||
item.m_text = macroName;
|
||||
item.m_icon = m_icons.macroIcon();
|
||||
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)
|
||||
{
|
||||
ConvertToCompletionItem toCompletionItem(this);
|
||||
@@ -1040,8 +1083,11 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
||||
Function *function = symbol->type()->asFunction();
|
||||
QTC_ASSERT(function, return);
|
||||
|
||||
m_functionArgumentWidget = new FunctionArgumentWidget();
|
||||
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
||||
// Recreate if necessary
|
||||
if (!m_functionArgumentWidget)
|
||||
m_functionArgumentWidget = new FunctionArgumentWidget;
|
||||
|
||||
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.lookupContext());
|
||||
}
|
||||
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
||||
QString toInsert = item.m_text;
|
||||
@@ -1052,11 +1098,14 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
||||
m_editor->replace(length, toInsert);
|
||||
} else {
|
||||
QString toInsert = item.m_text;
|
||||
int extraLength = 0;
|
||||
|
||||
//qDebug() << "current symbol:" << overview.prettyName(symbol->name())
|
||||
//<< overview.prettyType(symbol->type());
|
||||
|
||||
if (m_autoInsertBraces && symbol) {
|
||||
QString extraChars;
|
||||
|
||||
if (Function *function = symbol->type()->asFunction()) {
|
||||
// If the member is a function, automatically place the opening parenthesis,
|
||||
// except when it might take template parameters.
|
||||
@@ -1069,28 +1118,40 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
||||
} else if (function->templateParameterCount() != 0) {
|
||||
// If there are no arguments, then we need the template specification
|
||||
if (function->argumentCount() == 0) {
|
||||
toInsert.append(QLatin1Char('<'));
|
||||
extraChars += QLatin1Char('<');
|
||||
}
|
||||
} else {
|
||||
toInsert.append(QLatin1Char('('));
|
||||
extraChars += QLatin1Char('(');
|
||||
|
||||
// If the function takes no arguments, automatically place the closing parenthesis
|
||||
if (function->argumentCount() == 0 || (function->argumentCount() == 1 &&
|
||||
function->argumentAt(0)->type()->isVoidType())) {
|
||||
toInsert.append(QLatin1Char(')'));
|
||||
extraChars += QLatin1Char(')');
|
||||
|
||||
// If the function doesn't return anything, automatically place the semicolon,
|
||||
// unless we're doing a scope completion (then it might be function definition).
|
||||
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
|
||||
int length = m_editor->position() - m_startPosition;
|
||||
int length = m_editor->position() - m_startPosition + extraLength;
|
||||
m_editor->setCurPos(m_startPosition);
|
||||
m_editor->replace(length, toInsert);
|
||||
}
|
||||
@@ -1135,14 +1196,15 @@ void CppCodeCompletion::cleanup()
|
||||
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;
|
||||
|
||||
// Skip to the start of a name
|
||||
do {
|
||||
chr = editor->characterAt(--pos);
|
||||
chr = m_editor->characterAt(--pos);
|
||||
} while (chr.isLetterOrNumber() || chr == QLatin1Char('_'));
|
||||
|
||||
return pos + 1;
|
||||
|
@@ -84,11 +84,14 @@ public:
|
||||
private:
|
||||
void addKeywords();
|
||||
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);
|
||||
|
||||
bool completeFunction(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
bool completeConstructorOrFunction(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &);
|
||||
|
||||
bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
@@ -103,6 +106,8 @@ private:
|
||||
const CPlusPlus::LookupContext &context,
|
||||
bool staticLookup = true);
|
||||
|
||||
bool completeConstructors(CPlusPlus::Class *klass);
|
||||
|
||||
bool completeQtMethod(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context,
|
||||
@@ -118,7 +123,7 @@ private:
|
||||
const CPlusPlus::LookupContext &context)
|
||||
{ return completeQtMethod(exprTy, results, context, false); }
|
||||
|
||||
static int findStartOfName(const TextEditor::ITextEditor *editor);
|
||||
int findStartOfName(int pos = -1) const;
|
||||
|
||||
QList<TextEditor::CompletionItem> m_completions;
|
||||
|
||||
|
@@ -37,6 +37,7 @@ HEADERS += attachexternaldialog.h \
|
||||
scriptengine.h \
|
||||
stackhandler.h \
|
||||
stackwindow.h \
|
||||
sourcefileswindow.h \
|
||||
startexternaldialog.h \
|
||||
threadswindow.h \
|
||||
watchhandler.h \
|
||||
@@ -64,6 +65,7 @@ SOURCES += attachexternaldialog.cpp \
|
||||
scriptengine.cpp \
|
||||
stackhandler.cpp \
|
||||
stackwindow.cpp \
|
||||
sourcefileswindow.cpp \
|
||||
startexternaldialog.cpp \
|
||||
threadswindow.cpp \
|
||||
watchhandler.cpp \
|
||||
|
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "debuggermanager.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "debuggerconstants.h"
|
||||
#include "idebuggerengine.h"
|
||||
|
||||
@@ -43,6 +42,7 @@
|
||||
#include "moduleswindow.h"
|
||||
#include "registerwindow.h"
|
||||
#include "stackwindow.h"
|
||||
#include "sourcefileswindow.h"
|
||||
#include "threadswindow.h"
|
||||
#include "watchwindow.h"
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
#include "startexternaldialog.h"
|
||||
#include "attachexternaldialog.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
@@ -151,7 +153,7 @@ void DebuggerManager::init()
|
||||
m_busy = false;
|
||||
|
||||
m_attachedPID = 0;
|
||||
m_startMode = startInternal;
|
||||
m_startMode = StartInternal;
|
||||
|
||||
m_disassemblerHandler = 0;
|
||||
m_modulesHandler = 0;
|
||||
@@ -164,6 +166,7 @@ void DebuggerManager::init()
|
||||
m_outputWindow = new DebuggerOutputWindow;
|
||||
m_registerWindow = new RegisterWindow;
|
||||
m_stackWindow = new StackWindow;
|
||||
m_sourceFilesWindow = new SourceFilesWindow;
|
||||
m_threadsWindow = new ThreadsWindow;
|
||||
m_localsWindow = new WatchWindow(WatchWindow::LocalsType);
|
||||
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
|
||||
@@ -226,6 +229,13 @@ void DebuggerManager::init()
|
||||
connect(modulesView, SIGNAL(loadAllSymbolsRequested()),
|
||||
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
|
||||
QAbstractItemView *registerView =
|
||||
@@ -402,6 +412,10 @@ void DebuggerManager::init()
|
||||
|
||||
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);
|
||||
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
@@ -451,10 +465,7 @@ QDockWidget *DebuggerManager::createDockForWidget(QWidget *widget)
|
||||
{
|
||||
QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), m_mainWindow);
|
||||
dockWidget->setObjectName(widget->windowTitle());
|
||||
//dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas); // that space is needed.
|
||||
//dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
|
||||
dockWidget->setTitleBarWidget(new QWidget(dockWidget));
|
||||
dockWidget->setWidget(widget);
|
||||
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_registerDock);
|
||||
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
|
||||
// cycles since the corresponding information won't be retrieved.
|
||||
m_sourceFilesDock->hide();
|
||||
m_registerDock->hide();
|
||||
m_disassemblerDock->hide();
|
||||
m_modulesDock->hide();
|
||||
@@ -491,7 +504,7 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
|
||||
void DebuggerManager::setLocked(bool locked)
|
||||
{
|
||||
const QDockWidget::DockWidgetFeatures features =
|
||||
(locked) ? QDockWidget::NoDockWidgetFeatures :
|
||||
(locked) ? QDockWidget::DockWidgetClosable :
|
||||
QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable;
|
||||
|
||||
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);
|
||||
showStatusMessage(tr("Startup finished. Debugger ready."), -1);
|
||||
if (m_startMode == attachExternal) {
|
||||
// we continue the execution
|
||||
engine()->continueInferior();
|
||||
} else {
|
||||
engine()->runInferior();
|
||||
}
|
||||
setStatus(DebuggerInferiorStopRequested);
|
||||
showStatusMessage(tr("Stop requested..."), 5000);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorStopped()
|
||||
@@ -558,16 +565,10 @@ void DebuggerManager::notifyInferiorStopped()
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorUpdateFinished()
|
||||
{
|
||||
setStatus(DebuggerInferiorReady);
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorRunningRequested()
|
||||
{
|
||||
setStatus(DebuggerInferiorRunningRequested);
|
||||
showStatusMessage(tr("Running..."), 5000);
|
||||
showStatusMessage(tr("Running requested..."), 5000);
|
||||
}
|
||||
|
||||
void DebuggerManager::notifyInferiorRunning()
|
||||
@@ -578,7 +579,7 @@ void DebuggerManager::notifyInferiorRunning()
|
||||
|
||||
void DebuggerManager::notifyInferiorExited()
|
||||
{
|
||||
setStatus(DebuggerProcessReady);
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
showStatusMessage(tr("Stopped."), 5000);
|
||||
}
|
||||
|
||||
@@ -597,7 +598,19 @@ void DebuggerManager::showApplicationOutput(const QString &str)
|
||||
void DebuggerManager::shutdown()
|
||||
{
|
||||
//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
|
||||
// (who will delete the models for most views)
|
||||
delete m_breakWindow;
|
||||
@@ -651,41 +664,57 @@ void DebuggerManager::toggleBreakpoint()
|
||||
|
||||
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);
|
||||
if (index == -1)
|
||||
breakHandler()->setBreakpoint(fileName, lineNumber);
|
||||
m_breakHandler->setBreakpoint(fileName, lineNumber);
|
||||
else
|
||||
breakHandler()->removeBreakpoint(index);
|
||||
engine()->attemptBreakpointSynchronization();
|
||||
m_breakHandler->removeBreakpoint(index);
|
||||
m_engine->attemptBreakpointSynchronization();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
engine()->updateWatchModel();
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_engine->updateWatchModel();
|
||||
}
|
||||
|
||||
void DebuggerManager::expandChildren(const QModelIndex &idx)
|
||||
{
|
||||
watchHandler()->expandChildren(idx);
|
||||
QTC_ASSERT(m_watchHandler, return);
|
||||
m_watchHandler->expandChildren(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)
|
||||
{
|
||||
watchHandler()->removeWatchExpression(exp);
|
||||
QTC_ASSERT(m_watchHandler, return);
|
||||
m_watchHandler->removeWatchExpression(exp);
|
||||
}
|
||||
|
||||
QVariant DebuggerManager::sessionValue(const QString &name)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
QVariant value;
|
||||
emit sessionValueRequested(name, &value);
|
||||
return value;
|
||||
@@ -693,16 +722,19 @@ QVariant DebuggerManager::sessionValue(const QString &name)
|
||||
|
||||
void DebuggerManager::querySessionValue(const QString &name, QVariant *value)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
emit sessionValueRequested(name, value);
|
||||
}
|
||||
|
||||
void DebuggerManager::setSessionValue(const QString &name, const QVariant &value)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
emit setSessionValueRequested(name, value);
|
||||
}
|
||||
|
||||
QVariant DebuggerManager::configValue(const QString &name)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
QVariant value;
|
||||
emit configValueRequested(name, &value);
|
||||
return value;
|
||||
@@ -710,23 +742,25 @@ QVariant DebuggerManager::configValue(const QString &name)
|
||||
|
||||
void DebuggerManager::queryConfigValue(const QString &name, QVariant *value)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
emit configValueRequested(name, value);
|
||||
}
|
||||
|
||||
void DebuggerManager::setConfigValue(const QString &name, const QVariant &value)
|
||||
{
|
||||
// this is answered by the plugin
|
||||
emit setConfigValueRequested(name, value);
|
||||
}
|
||||
|
||||
void DebuggerManager::startExternalApplication()
|
||||
{
|
||||
if (!startNewDebugger(startExternal))
|
||||
if (!startNewDebugger(StartExternal))
|
||||
emit debuggingFinished();
|
||||
}
|
||||
|
||||
void DebuggerManager::attachExternalApplication()
|
||||
{
|
||||
if (!startNewDebugger(attachExternal))
|
||||
if (!startNewDebugger(AttachExternal))
|
||||
emit debuggingFinished();
|
||||
}
|
||||
|
||||
@@ -735,7 +769,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
||||
m_startMode = mode;
|
||||
// FIXME: Clean up
|
||||
|
||||
if (startMode() == startExternal) {
|
||||
if (startMode() == StartExternal) {
|
||||
StartExternalDialog dlg(mainWindow());
|
||||
dlg.setExecutableFile(
|
||||
configValue(QLatin1String("LastExternalExecutableFile")).toString());
|
||||
@@ -751,7 +785,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
||||
m_processArgs = dlg.executableArguments().split(' ');
|
||||
m_workingDir = QString();
|
||||
m_attachedPID = -1;
|
||||
} else if (startMode() == attachExternal) {
|
||||
} else if (startMode() == AttachExternal) {
|
||||
AttachExternalDialog dlg(mainWindow());
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
@@ -764,7 +798,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
||||
tr("Cannot attach to PID 0"));
|
||||
return false;
|
||||
}
|
||||
} else if (startMode() == startInternal) {
|
||||
} else if (startMode() == StartInternal) {
|
||||
if (m_executable.isEmpty()) {
|
||||
QString startDirectory = m_executable;
|
||||
if (m_executable.isEmpty()) {
|
||||
@@ -797,11 +831,13 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
||||
else
|
||||
setDebuggerType(GdbDebugger);
|
||||
|
||||
if (!engine()->startDebugger())
|
||||
setStatus(DebuggerProcessStartingUp);
|
||||
if (!m_engine->startDebugger()) {
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_busy = false;
|
||||
setStatus(DebuggerProcessStartingUp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -818,7 +854,9 @@ void DebuggerManager::cleanupViews()
|
||||
|
||||
void DebuggerManager::exitDebugger()
|
||||
{
|
||||
engine()->exitDebugger();
|
||||
//qDebug() << "DebuggerManager::exitDebugger";
|
||||
if (m_engine)
|
||||
m_engine->exitDebugger();
|
||||
cleanupViews();
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
setBusyCursor(false);
|
||||
@@ -827,62 +865,73 @@ void DebuggerManager::exitDebugger()
|
||||
|
||||
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)
|
||||
{
|
||||
engine()->activateFrame(index);
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_engine->activateFrame(index);
|
||||
}
|
||||
|
||||
void DebuggerManager::selectThread(int index)
|
||||
{
|
||||
engine()->selectThread(index);
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_engine->selectThread(index);
|
||||
}
|
||||
|
||||
void DebuggerManager::loadAllSymbols()
|
||||
{
|
||||
engine()->loadAllSymbols();
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_engine->loadAllSymbols();
|
||||
}
|
||||
|
||||
void DebuggerManager::loadSymbols(const QString &module)
|
||||
{
|
||||
engine()->loadSymbols(module);
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_engine->loadSymbols(module);
|
||||
}
|
||||
|
||||
void DebuggerManager::stepExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
resetLocation();
|
||||
engine()->stepExec();
|
||||
m_engine->stepExec();
|
||||
}
|
||||
|
||||
void DebuggerManager::stepOutExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
resetLocation();
|
||||
engine()->stepOutExec();
|
||||
m_engine->stepOutExec();
|
||||
}
|
||||
|
||||
void DebuggerManager::nextExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
resetLocation();
|
||||
engine()->nextExec();
|
||||
m_engine->nextExec();
|
||||
}
|
||||
|
||||
void DebuggerManager::stepIExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
resetLocation();
|
||||
engine()->stepIExec();
|
||||
m_engine->stepIExec();
|
||||
}
|
||||
|
||||
void DebuggerManager::nextIExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
resetLocation();
|
||||
engine()->nextIExec();
|
||||
m_engine->nextIExec();
|
||||
}
|
||||
|
||||
void DebuggerManager::executeDebuggerCommand(const QString &command)
|
||||
{
|
||||
engine()->executeDebuggerCommand(command);
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_engine->executeDebuggerCommand(command);
|
||||
}
|
||||
|
||||
void DebuggerManager::sessionLoaded()
|
||||
@@ -900,16 +949,18 @@ void DebuggerManager::aboutToSaveSession()
|
||||
|
||||
void DebuggerManager::loadSessionData()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_breakHandler->loadSessionData();
|
||||
m_watchHandler->loadSessionData();
|
||||
engine()->loadSessionData();
|
||||
m_engine->loadSessionData();
|
||||
}
|
||||
|
||||
void DebuggerManager::saveSessionData()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_breakHandler->saveSessionData();
|
||||
m_watchHandler->saveSessionData();
|
||||
engine()->saveSessionData();
|
||||
m_engine->saveSessionData();
|
||||
}
|
||||
|
||||
void DebuggerManager::dumpLog()
|
||||
@@ -927,33 +978,6 @@ void DebuggerManager::dumpLog()
|
||||
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()
|
||||
{
|
||||
// requires a selection, but that's the only case we want...
|
||||
@@ -968,19 +992,24 @@ void DebuggerManager::addToWatchWindow()
|
||||
|
||||
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)
|
||||
{
|
||||
breakHandler()->setBreakpoint(fileName, lineNumber);
|
||||
engine()->attemptBreakpointSynchronization();
|
||||
QTC_ASSERT(m_breakHandler, return);
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_breakHandler->setBreakpoint(fileName, lineNumber);
|
||||
m_engine->attemptBreakpointSynchronization();
|
||||
}
|
||||
|
||||
void DebuggerManager::breakByFunction(const QString &functionName)
|
||||
{
|
||||
breakHandler()->breakByFunction(functionName);
|
||||
engine()->attemptBreakpointSynchronization();
|
||||
QTC_ASSERT(m_breakHandler, return);
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_breakHandler->breakByFunction(functionName);
|
||||
m_engine->attemptBreakpointSynchronization();
|
||||
}
|
||||
|
||||
void DebuggerManager::breakByFunction()
|
||||
@@ -1011,16 +1040,11 @@ void DebuggerManager::setStatus(int status)
|
||||
const bool started = status == DebuggerInferiorRunning
|
||||
|| status == DebuggerInferiorRunningRequested
|
||||
|| status == DebuggerInferiorStopRequested
|
||||
|| status == DebuggerInferiorStopped
|
||||
|| status == DebuggerInferiorUpdating
|
||||
|| status == DebuggerInferiorUpdateFinishing
|
||||
|| status == DebuggerInferiorReady;
|
||||
|| status == DebuggerInferiorStopped;
|
||||
|
||||
const bool starting = status == DebuggerProcessStartingUp;
|
||||
const bool running = status == DebuggerInferiorRunning;
|
||||
const bool ready = status == DebuggerInferiorStopped
|
||||
|| status == DebuggerInferiorReady
|
||||
|| status == DebuggerProcessReady;
|
||||
const bool ready = status == DebuggerInferiorStopped;
|
||||
|
||||
m_startExternalAction->setEnabled(!started && !starting);
|
||||
m_attachExternalAction->setEnabled(!started && !starting);
|
||||
@@ -1088,26 +1112,18 @@ bool DebuggerManager::useCustomDumpers() const
|
||||
return m_settings.m_useCustomDumpers;
|
||||
}
|
||||
|
||||
bool DebuggerManager::useFastStart() const
|
||||
{
|
||||
return 0; // && m_settings.m_useFastStart;
|
||||
}
|
||||
|
||||
void DebuggerManager::setUseCustomDumpers(bool on)
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_settings.m_useCustomDumpers = on;
|
||||
engine()->setUseCustomDumpers(on);
|
||||
}
|
||||
|
||||
void DebuggerManager::setUseFastStart(bool on)
|
||||
{
|
||||
m_settings.m_useFastStart = on;
|
||||
m_engine->setUseCustomDumpers(on);
|
||||
}
|
||||
|
||||
void DebuggerManager::setDebugDumpers(bool on)
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
m_settings.m_debugDumpers = on;
|
||||
engine()->setDebugDumpers(on);
|
||||
m_engine->setDebugDumpers(on);
|
||||
}
|
||||
|
||||
void DebuggerManager::setSkipKnownFrames(bool on)
|
||||
@@ -1123,29 +1139,31 @@ void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,
|
||||
|
||||
void DebuggerManager::continueExec()
|
||||
{
|
||||
engine()->continueInferior();
|
||||
m_engine->continueInferior();
|
||||
}
|
||||
|
||||
void DebuggerManager::interruptDebuggingRequest()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
//qDebug() << "INTERRUPTING AT" << status();
|
||||
bool interruptIsExit = (status() != DebuggerInferiorRunning);
|
||||
if (interruptIsExit)
|
||||
exitDebugger();
|
||||
else {
|
||||
setStatus(DebuggerInferiorStopRequested);
|
||||
engine()->interruptInferior();
|
||||
m_engine->interruptInferior();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DebuggerManager::runToLineExec()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
QString fileName;
|
||||
int lineNumber = -1;
|
||||
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
|
||||
if (!fileName.isEmpty())
|
||||
engine()->runToLineExec(fileName, lineNumber);
|
||||
m_engine->runToLineExec(fileName, lineNumber);
|
||||
}
|
||||
|
||||
void DebuggerManager::runToFunctionExec()
|
||||
@@ -1177,7 +1195,7 @@ void DebuggerManager::runToFunctionExec()
|
||||
}
|
||||
//qDebug() << "RUN TO FUNCTION " << functionName;
|
||||
if (!functionName.isEmpty())
|
||||
engine()->runToFunctionExec(functionName);
|
||||
m_engine->runToFunctionExec(functionName);
|
||||
}
|
||||
|
||||
void DebuggerManager::jumpToLineExec()
|
||||
@@ -1186,20 +1204,20 @@ void DebuggerManager::jumpToLineExec()
|
||||
int lineNumber = -1;
|
||||
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
|
||||
if (!fileName.isEmpty())
|
||||
engine()->jumpToLineExec(fileName, lineNumber);
|
||||
m_engine->jumpToLineExec(fileName, lineNumber);
|
||||
}
|
||||
|
||||
void DebuggerManager::resetLocation()
|
||||
{
|
||||
//m_watchHandler->removeMouseMoveCatcher(editor->widget());
|
||||
// connected to the plugin
|
||||
emit resetLocationRequested();
|
||||
}
|
||||
|
||||
void DebuggerManager::gotoLocation(const QString &fileName, int line,
|
||||
bool setMarker)
|
||||
{
|
||||
// connected to the plugin
|
||||
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()
|
||||
{
|
||||
QTC_ASSERT(m_engine, return);
|
||||
if (!m_disassemblerDock || !m_disassemblerDock->isVisible())
|
||||
return;
|
||||
engine()->reloadDisassembler();
|
||||
m_engine->reloadDisassembler();
|
||||
}
|
||||
|
||||
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
|
||||
@@ -1233,7 +1272,7 @@ void DebuggerManager::reloadModules()
|
||||
{
|
||||
if (!m_modulesDock || !m_modulesDock->isVisible())
|
||||
return;
|
||||
engine()->reloadModules();
|
||||
m_engine->reloadModules();
|
||||
}
|
||||
|
||||
void DebuggerManager::modulesDockToggled(bool on)
|
||||
@@ -1251,11 +1290,13 @@ void DebuggerManager::modulesDockToggled(bool on)
|
||||
|
||||
void DebuggerManager::showDebuggerOutput(const QString &prefix, const QString &msg)
|
||||
{
|
||||
QTC_ASSERT(m_outputWindow, return);
|
||||
m_outputWindow->showOutput(prefix, msg);
|
||||
}
|
||||
|
||||
void DebuggerManager::showDebuggerInput(const QString &prefix, const QString &msg)
|
||||
{
|
||||
QTC_ASSERT(m_outputWindow, return);
|
||||
m_outputWindow->showInput(prefix, msg);
|
||||
}
|
||||
|
||||
@@ -1276,7 +1317,7 @@ void DebuggerManager::reloadRegisters()
|
||||
{
|
||||
if (!m_registerDock || !m_registerDock->isVisible())
|
||||
return;
|
||||
engine()->reloadRegisters();
|
||||
m_engine->reloadRegisters();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -66,6 +66,7 @@ class RegisterHandler;
|
||||
class StackHandler;
|
||||
class ThreadsHandler;
|
||||
class WatchHandler;
|
||||
class SourceFilesWindow;
|
||||
class WatchData;
|
||||
class BreakpointData;
|
||||
|
||||
@@ -76,8 +77,6 @@ class BreakpointData;
|
||||
// DebuggerProcessNotReady
|
||||
// |
|
||||
// DebuggerProcessStartingUp
|
||||
// |
|
||||
// DebuggerReady [R] [N]
|
||||
// | <-------------------------------------.
|
||||
// DebuggerInferiorRunningRequested |
|
||||
// | |
|
||||
@@ -87,12 +86,6 @@ class BreakpointData;
|
||||
// | |
|
||||
// DebuggerInferiorStopped |
|
||||
// | |
|
||||
// DebuggerInferiorUpdating |
|
||||
// | |
|
||||
// DebuggerInferiorUpdateFinishing |
|
||||
// | |
|
||||
// DebuggerInferiorReady [C] [N] |
|
||||
// | |
|
||||
// `---------------------------------------'
|
||||
//
|
||||
// Allowed actions:
|
||||
@@ -106,17 +99,11 @@ enum DebuggerStatus
|
||||
{
|
||||
DebuggerProcessNotReady, // Debugger not started
|
||||
DebuggerProcessStartingUp, // Debugger starting up
|
||||
DebuggerProcessReady, // Debugger started, Inferior not yet
|
||||
// running or already finished
|
||||
|
||||
DebuggerInferiorRunningRequested, // Debuggee requested to run
|
||||
DebuggerInferiorRunning, // Debuggee running
|
||||
DebuggerInferiorStopRequested, // Debuggee running, stop requested
|
||||
DebuggerInferiorStopped, // Debuggee stopped
|
||||
|
||||
DebuggerInferiorUpdating, // Debuggee updating data views
|
||||
DebuggerInferiorUpdateFinishing, // Debuggee updating data views aborting
|
||||
DebuggerInferiorReady,
|
||||
};
|
||||
|
||||
|
||||
@@ -150,9 +137,8 @@ private:
|
||||
friend class WinEngine;
|
||||
|
||||
// called from the engines after successful startup
|
||||
virtual void notifyStartupFinished() = 0;
|
||||
virtual void notifyInferiorStopRequested() = 0;
|
||||
virtual void notifyInferiorStopped() = 0;
|
||||
virtual void notifyInferiorUpdateFinished() = 0;
|
||||
virtual void notifyInferiorRunningRequested() = 0;
|
||||
virtual void notifyInferiorRunning() = 0;
|
||||
virtual void notifyInferiorExited() = 0;
|
||||
@@ -165,15 +151,21 @@ private:
|
||||
virtual StackHandler *stackHandler() = 0;
|
||||
virtual ThreadsHandler *threadsHandler() = 0;
|
||||
virtual WatchHandler *watchHandler() = 0;
|
||||
virtual SourceFilesWindow *sourceFileWindow() = 0;
|
||||
|
||||
virtual void showApplicationOutput(const QString &data) = 0;
|
||||
virtual bool skipKnownFrames() const = 0;
|
||||
virtual bool debugDumpers() 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 reloadModules() = 0;
|
||||
virtual void reloadSourceFiles() = 0;
|
||||
virtual void reloadRegisters() = 0;
|
||||
};
|
||||
|
||||
@@ -200,6 +192,11 @@ public:
|
||||
bool m_useToolTips;
|
||||
|
||||
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; }
|
||||
DebuggerSettings *settings() { return &m_settings; }
|
||||
|
||||
enum StartMode { startInternal, startExternal, attachExternal };
|
||||
enum StartMode { StartInternal, StartExternal, AttachExternal };
|
||||
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
|
||||
|
||||
public slots:
|
||||
@@ -283,7 +280,6 @@ public slots:
|
||||
void setUseCustomDumpers(bool on);
|
||||
void setDebugDumpers(bool on);
|
||||
void setSkipKnownFrames(bool on);
|
||||
void setUseFastStart(bool on);
|
||||
|
||||
private slots:
|
||||
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
||||
@@ -293,6 +289,9 @@ private slots:
|
||||
void reloadDisassembler();
|
||||
void disassemblerDockToggled(bool on);
|
||||
|
||||
void reloadSourceFiles();
|
||||
void sourceFilesDockToggled(bool on);
|
||||
|
||||
void reloadModules();
|
||||
void modulesDockToggled(bool on);
|
||||
void loadSymbols(const QString &moduleName);
|
||||
@@ -314,16 +313,23 @@ private:
|
||||
StackHandler *stackHandler() { return m_stackHandler; }
|
||||
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
||||
WatchHandler *watchHandler() { return m_watchHandler; }
|
||||
SourceFilesWindow *sourceFileWindow() { return m_sourceFilesWindow; }
|
||||
|
||||
bool skipKnownFrames() const;
|
||||
bool debugDumpers() 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 notifyInferiorUpdateFinished();
|
||||
void notifyInferiorRunningRequested();
|
||||
void notifyInferiorStopRequested();
|
||||
void notifyInferiorRunning();
|
||||
void notifyInferiorExited();
|
||||
void notifyInferiorPidChanged(int);
|
||||
@@ -399,6 +405,7 @@ private:
|
||||
QDockWidget *m_outputDock;
|
||||
QDockWidget *m_registerDock;
|
||||
QDockWidget *m_stackDock;
|
||||
QDockWidget *m_sourceFilesDock;
|
||||
QDockWidget *m_threadsDock;
|
||||
QDockWidget *m_watchDock;
|
||||
QList<QDockWidget*> m_dockWidgets;
|
||||
@@ -410,6 +417,7 @@ private:
|
||||
StackHandler *m_stackHandler;
|
||||
ThreadsHandler *m_threadsHandler;
|
||||
WatchHandler *m_watchHandler;
|
||||
SourceFilesWindow *m_sourceFilesWindow;
|
||||
|
||||
/// Actions
|
||||
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->setPath(m_settings.m_scriptFile);
|
||||
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.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers);
|
||||
m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers);
|
||||
m_ui.checkBoxFastStart->setChecked(m_settings.m_useFastStart);
|
||||
m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips);
|
||||
|
||||
connect(m_ui.radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
|
||||
m_ui.lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
#if 0
|
||||
cmd = am->registerAction(m_manager->m_dumpLogAction,
|
||||
@@ -294,14 +305,9 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
|
||||
#endif
|
||||
|
||||
// FIXME
|
||||
m_ui.autoStartBox->hide();
|
||||
m_ui.autoQuitBox->hide();
|
||||
m_ui.environmentEdit->hide();
|
||||
m_ui.labelEnvironment->hide();
|
||||
|
||||
m_ui.checkBoxFastStart->setChecked(false);
|
||||
m_ui.checkBoxFastStart->hide();
|
||||
|
||||
//m_dumpLogAction = new QAction(this);
|
||||
//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_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_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked();
|
||||
m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->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_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->writeSettings();
|
||||
}
|
||||
@@ -441,7 +453,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
#endif
|
||||
|
||||
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,
|
||||
Constants::INTERRUPT, globalcontext);
|
||||
@@ -889,11 +901,16 @@ void DebuggerPlugin::writeSettings() const
|
||||
s->setValue("AutoRun", m->m_autoRun);
|
||||
s->setValue("AutoQuit", m->m_autoQuit);
|
||||
|
||||
s->setValue("UseFastStart", m->m_useFastStart);
|
||||
s->setValue("UseToolTips", m->m_useToolTips);
|
||||
s->setValue("UseCustomDumpers", m->m_useCustomDumpers);
|
||||
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -911,6 +928,7 @@ void DebuggerPlugin::readSettings()
|
||||
QString defaultScript;
|
||||
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
|
||||
QByteArray ba = s->value("State", QByteArray()).toByteArray();
|
||||
m_toggleLockedAction->setChecked(s->value("Locked", true).toBool());
|
||||
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_debugDumpers = s->value("DebugDumpers", false).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_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();
|
||||
|
||||
m_manager->mainWindow()->restoreState(ba);
|
||||
|
@@ -107,11 +107,16 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
||||
: RunControl(runConfiguration), m_manager(manager), m_running(false)
|
||||
{
|
||||
connect(m_manager, SIGNAL(debuggingFinished()),
|
||||
this, SLOT(debuggingFinished()));
|
||||
this, SLOT(debuggingFinished()),
|
||||
Qt::QueuedConnection);
|
||||
connect(m_manager, SIGNAL(applicationOutputAvailable(QString)),
|
||||
this, SLOT(slotAddToOutputWindowInline(QString)));
|
||||
this, SLOT(slotAddToOutputWindowInline(QString)),
|
||||
Qt::QueuedConnection);
|
||||
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()
|
||||
@@ -132,7 +137,7 @@ void DebuggerRunControl::start()
|
||||
//<daniel> andre: + "\qtc-gdbmacros\"
|
||||
|
||||
//emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
|
||||
if (m_manager->startNewDebugger(DebuggerManager::startInternal))
|
||||
if (m_manager->startNewDebugger(DebuggerManager::StartInternal))
|
||||
emit started();
|
||||
else
|
||||
debuggingFinished();
|
||||
@@ -145,17 +150,21 @@ void DebuggerRunControl::slotAddToOutputWindowInline(const QString &data)
|
||||
|
||||
void DebuggerRunControl::stop()
|
||||
{
|
||||
m_manager->exitDebugger();
|
||||
//qDebug() << "DebuggerRunControl::stop";
|
||||
m_running = false;
|
||||
emit stopRequested();
|
||||
}
|
||||
|
||||
void DebuggerRunControl::debuggingFinished()
|
||||
{
|
||||
m_running = false;
|
||||
//qDebug() << "DebuggerRunControl::finished";
|
||||
//emit addToOutputWindow(this, tr("Debugging %1 finished").arg(m_executable));
|
||||
emit finished();
|
||||
}
|
||||
|
||||
bool DebuggerRunControl::isRunning() const
|
||||
{
|
||||
//qDebug() << "DebuggerRunControl::isRunning" << m_running;
|
||||
return m_running;
|
||||
}
|
||||
|
@@ -82,6 +82,9 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool isRunning() const;
|
||||
|
||||
signals:
|
||||
void stopRequested();
|
||||
|
||||
private slots:
|
||||
void debuggingFinished();
|
||||
void slotAddToOutputWindowInline(const QString &output);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "disassemblerhandler.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QAbstractTableModel>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -113,7 +113,6 @@ private:
|
||||
void exitDebugger();
|
||||
|
||||
void continueInferior();
|
||||
void runInferior();
|
||||
void interruptInferior();
|
||||
|
||||
void runToLineExec(const QString &fileName, int lineNumber);
|
||||
@@ -145,7 +144,8 @@ private:
|
||||
|
||||
bool supportsThreads() const;
|
||||
|
||||
void init(); // called by destructor
|
||||
void initializeConnections();
|
||||
void initializeVariables();
|
||||
void queryFullName(const QString &fileName, QString *fullName);
|
||||
QString fullName(const QString &fileName);
|
||||
QString shortName(const QString &fullName);
|
||||
@@ -158,12 +158,15 @@ private:
|
||||
// queue". resultNeeded == true increments m_pendingResults on
|
||||
// send and decrements on receipt, effectively preventing
|
||||
// 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(),
|
||||
bool needStop = false, bool synchronized = false);
|
||||
StopNeeded needStop = DoesNotNeedStop,
|
||||
Synchronization synchronized = NotSynchronized);
|
||||
void sendSynchronizedCommand(const QString & command,
|
||||
int type = 0, const QVariant &cookie = QVariant(),
|
||||
bool needStop = false);
|
||||
StopNeeded needStop = DoesNotNeedStop);
|
||||
|
||||
void setTokenBarrier();
|
||||
|
||||
@@ -179,7 +182,7 @@ private slots:
|
||||
|
||||
private:
|
||||
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 handleAsyncOutput(const GdbMi &data);
|
||||
void handleResultRecord(const GdbResultRecord &response);
|
||||
@@ -189,9 +192,11 @@ private:
|
||||
void handleExecRunToFunction(const GdbResultRecord &response);
|
||||
void handleInfoShared(const GdbResultRecord &response);
|
||||
void handleInfoProc(const GdbResultRecord &response);
|
||||
void handleInfoThreads(const GdbResultRecord &response);
|
||||
void handleShowVersion(const GdbResultRecord &response);
|
||||
void handleQueryPwd(const GdbResultRecord &response);
|
||||
void handleQuerySources(const GdbResultRecord &response);
|
||||
void debugMessage(const QString &msg);
|
||||
|
||||
OutputCollector m_outputCollector;
|
||||
QTextCodec *m_outputCodec;
|
||||
@@ -215,11 +220,10 @@ private:
|
||||
int m_oldestAcceptableToken;
|
||||
|
||||
int m_gdbVersion; // 6.8.0 is 680
|
||||
int m_shared;
|
||||
|
||||
// awful hack to keep track of used files
|
||||
QHash<QString, QString> m_shortToFullName;
|
||||
QHash<QString, QString> m_fullToShortName;
|
||||
QMap<QString, QString> m_shortToFullName;
|
||||
QMap<QString, QString> m_fullToShortName;
|
||||
|
||||
//
|
||||
// Breakpoint specific stuff
|
||||
@@ -259,6 +263,10 @@ private:
|
||||
void handleRegisterListNames(const GdbResultRecord &record);
|
||||
void handleRegisterListValues(const GdbResultRecord &record);
|
||||
|
||||
//
|
||||
// Source file specific stuff
|
||||
//
|
||||
void reloadSourceFiles();
|
||||
|
||||
//
|
||||
// Stack specific stuff
|
||||
@@ -330,6 +338,12 @@ private:
|
||||
QString m_currentFrame;
|
||||
QMap<QString, QString> m_varToType;
|
||||
|
||||
bool m_waitingForBreakpointSynchronizationToContinue;
|
||||
bool m_waitingForFirstBreakpointToBeHit;
|
||||
bool m_modulesListOutdated;
|
||||
|
||||
QList<GdbCookie> m_commandsToRunOnTemporaryBreak;
|
||||
|
||||
DebuggerManager *q;
|
||||
IDebuggerManagerAccessForEngines *qq;
|
||||
};
|
||||
|
@@ -6,26 +6,20 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>465</width>
|
||||
<height>372</height>
|
||||
<width>398</width>
|
||||
<height>385</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxLocations">
|
||||
<property name="title">
|
||||
<string>Locations</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
@@ -74,7 +68,70 @@
|
||||
</layout>
|
||||
</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>
|
||||
<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">
|
||||
<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>
|
||||
@@ -84,17 +141,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
|
||||
<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
|
||||
@@ -105,7 +152,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxUseToolTips">
|
||||
<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>
|
||||
@@ -115,7 +162,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxDebugDumpers">
|
||||
<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>
|
||||
@@ -125,29 +172,15 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoStartBox">
|
||||
<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>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>415</width>
|
||||
<height>41</height>
|
||||
<width>10</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
@@ -62,7 +62,6 @@ public:
|
||||
virtual void nextIExec() = 0;
|
||||
|
||||
virtual void continueInferior() = 0;
|
||||
virtual void runInferior() = 0;
|
||||
virtual void interruptInferior() = 0;
|
||||
|
||||
virtual void runToLineExec(const QString &fileName, int lineNumber) = 0;
|
||||
@@ -88,6 +87,8 @@ public:
|
||||
virtual void reloadRegisters() = 0;
|
||||
virtual void setDebugDumpers(bool on) = 0;
|
||||
virtual void setUseCustomDumpers(bool on) = 0;
|
||||
|
||||
virtual void reloadSourceFiles() = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "moduleshandler.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
|
@@ -80,7 +80,7 @@ bool OutputCollector::listen()
|
||||
return m_server->isListening();
|
||||
m_server = new QLocalServer(this);
|
||||
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
|
||||
if (!m_serverPath.isEmpty())
|
||||
return true;
|
||||
|
@@ -33,9 +33,10 @@
|
||||
|
||||
#include "registerhandler.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "debuggerconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QAbstractTableModel>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
|
@@ -216,7 +216,6 @@ bool ScriptEngine::startDebugger()
|
||||
m_scriptContents = stream.readAll();
|
||||
scriptFile.close();
|
||||
attemptBreakpointSynchronization();
|
||||
QTimer::singleShot(0, q, SLOT(notifyStartupFinished()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -112,6 +112,7 @@ private:
|
||||
void reloadDisassembler();
|
||||
void reloadModules();
|
||||
void reloadRegisters() {}
|
||||
void reloadSourceFiles() {}
|
||||
|
||||
bool supportsThreads() const { return true; }
|
||||
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 "assert.h"
|
||||
#include "stackhandler.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
|
@@ -33,9 +33,10 @@
|
||||
|
||||
#include "threadswindow.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "stackhandler.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
|
@@ -790,9 +790,9 @@ void WatchHandler::collapseChildren(const QModelIndex &idx)
|
||||
return;
|
||||
}
|
||||
QTC_ASSERT(checkIndex(idx.internalId()), return);
|
||||
#if 0
|
||||
QString iname0 = m_displaySet.at(idx.internalId()).iname;
|
||||
MODEL_DEBUG("COLLAPSE NODE" << iname0);
|
||||
#if 0
|
||||
QString iname1 = iname0 + '.';
|
||||
for (int i = m_completeSet.size(); --i >= 0; ) {
|
||||
QString iname = m_completeSet.at(i).iname;
|
||||
@@ -803,10 +803,10 @@ void WatchHandler::collapseChildren(const QModelIndex &idx)
|
||||
m_expandedINames.remove(iname);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
m_expandedINames.remove(iname0);
|
||||
//MODEL_DEBUG(toString());
|
||||
//rebuildModel();
|
||||
#endif
|
||||
}
|
||||
|
||||
void WatchHandler::expandChildren(const QModelIndex &idx)
|
||||
|
@@ -207,20 +207,20 @@ void GitClient::diff(const QString &workingDirectory,
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("diff") << diffArgs;
|
||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||
command->addJob(arguments);
|
||||
command->addJob(arguments, m_settings.timeout);
|
||||
} else {
|
||||
// Files diff.
|
||||
if (!unstagedFileNames.empty()) {
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("diff") << diffArgs << QLatin1String("--") << unstagedFileNames;
|
||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||
command->addJob(arguments);
|
||||
command->addJob(arguments, m_settings.timeout);
|
||||
}
|
||||
if (!stagedFileNames.empty()) {
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("diff") << QLatin1String("--cached") << diffArgs << QLatin1String("--") << stagedFileNames;
|
||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||
command->addJob(arguments);
|
||||
command->addJob(arguments, m_settings.timeout);
|
||||
}
|
||||
}
|
||||
command->execute();
|
||||
@@ -503,7 +503,7 @@ void GitClient::executeGit(const QString &workingDirectory,
|
||||
{
|
||||
m_plugin->outputWindow()->append(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
|
||||
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow);
|
||||
command->addJob(arguments);
|
||||
command->addJob(arguments, m_settings.timeout);
|
||||
command->execute();
|
||||
}
|
||||
|
||||
|
@@ -55,8 +55,9 @@ static inline QStringList environmentToList(const ProjectExplorer::Environment &
|
||||
return ProjectExplorer::Environment::systemEnvironment().toStringList();
|
||||
}
|
||||
|
||||
GitCommand::Job::Job(const QStringList &a) :
|
||||
arguments(a)
|
||||
GitCommand::Job::Job(const QStringList &a, int t) :
|
||||
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()
|
||||
@@ -109,7 +110,7 @@ void GitCommand::run()
|
||||
qDebug() << "GitCommand::run" << j << '/' << count << 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;
|
||||
error += QLatin1String("Error: Git timed out");
|
||||
break;
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
ProjectExplorer::Environment &environment);
|
||||
|
||||
|
||||
void addJob(const QStringList &arguments);
|
||||
void addJob(const QStringList &arguments, int timeout);
|
||||
void execute();
|
||||
|
||||
private:
|
||||
@@ -61,9 +61,10 @@ Q_SIGNALS:
|
||||
|
||||
private:
|
||||
struct Job {
|
||||
explicit Job(const QStringList &a);
|
||||
explicit Job(const QStringList &a, int t);
|
||||
|
||||
QStringList arguments;
|
||||
int timeout;
|
||||
};
|
||||
|
||||
QStringList environment() const;
|
||||
|
@@ -40,15 +40,17 @@ static const char *groupC = "Git";
|
||||
static const char *sysEnvKeyC = "SysEnv";
|
||||
static const char *pathKeyC = "Path";
|
||||
static const char *logCountKeyC = "LogCount";
|
||||
static const char *timeoutKeyC = "TimeOut";
|
||||
|
||||
enum { defaultLogCount = 10 };
|
||||
enum { defaultLogCount = 10 , defaultTimeOut = 30};
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
GitSettings::GitSettings() :
|
||||
adoptPath(false),
|
||||
logCount(defaultLogCount)
|
||||
logCount(defaultLogCount),
|
||||
timeout(defaultTimeOut)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +60,7 @@ void GitSettings::fromSettings(QSettings *settings)
|
||||
adoptPath = settings->value(QLatin1String(sysEnvKeyC), false).toBool();
|
||||
path = settings->value(QLatin1String(pathKeyC), QString()).toString();
|
||||
logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt();
|
||||
timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt();
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
@@ -67,12 +70,13 @@ void GitSettings::toSettings(QSettings *settings) const
|
||||
settings->setValue(QLatin1String(sysEnvKeyC), adoptPath);
|
||||
settings->setValue(QLatin1String(pathKeyC), path);
|
||||
settings->setValue(QLatin1String(logCountKeyC), logCount);
|
||||
settings->setValue(QLatin1String(timeoutKeyC), timeout);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
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;
|
||||
QString path;
|
||||
int logCount;
|
||||
int timeout;
|
||||
};
|
||||
|
||||
inline bool operator==(const GitSettings &p1, const GitSettings &p2)
|
||||
|
@@ -52,6 +52,7 @@ GitSettings SettingsPageWidget::settings() const
|
||||
rc.path = m_ui.pathLineEdit->text();
|
||||
rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty();
|
||||
rc.logCount = m_ui.logCountSpinBox->value();
|
||||
rc.timeout = m_ui.timeoutSpinBox->value();
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -60,6 +61,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
|
||||
m_ui.environmentGroupBox->setChecked(s.adoptPath);
|
||||
m_ui.pathLineEdit->setText(s.path);
|
||||
m_ui.logCountSpinBox->setValue(s.logCount);
|
||||
m_ui.timeoutSpinBox->setValue(s.timeout);
|
||||
}
|
||||
|
||||
void SettingsPageWidget::setSystemPath()
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>403</width>
|
||||
<height>183</height>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -69,10 +69,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="logFormLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="logCountLabel">
|
||||
<property name="text">
|
||||
<string>Log commit display count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="logCountSpinBox">
|
||||
<property name="toolTip">
|
||||
@@ -83,10 +87,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="logCountLabel">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
|
@@ -221,7 +221,6 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess
|
||||
m_coreListener = new CoreListener(this);
|
||||
addObject(m_coreListener);
|
||||
|
||||
|
||||
//register actions
|
||||
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
||||
|
||||
@@ -682,6 +681,8 @@ void PerforcePlugin::updateActions()
|
||||
|
||||
bool PerforcePlugin::managesDirectory(const QString &directory) const
|
||||
{
|
||||
if (!checkP4Command())
|
||||
return false;
|
||||
const QString p4Path = directory + QLatin1String("/...");
|
||||
QStringList args;
|
||||
args << QLatin1String("fstat") << QLatin1String("-m1") << p4Path;
|
||||
@@ -758,7 +759,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
||||
tempfile.setAutoRemove(true);
|
||||
const QChar newLine = QLatin1Char('\n');
|
||||
const QChar blank = QLatin1Char(' ');
|
||||
QStringList actualArgs = basicP4Args();
|
||||
QStringList actualArgs = m_settings.basicP4Args();
|
||||
if (!extraArgs.isEmpty()) {
|
||||
if (tempfile.open()) {
|
||||
QTextStream stream(&tempfile);
|
||||
@@ -773,7 +774,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
||||
actualArgs << args;
|
||||
|
||||
if (logFlags & CommandToWindow) {
|
||||
QString command = m_settings.p4Command;
|
||||
QString command = m_settings.p4Command();
|
||||
command += blank;
|
||||
command += actualArgs.join(QString(blank));
|
||||
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)));
|
||||
}
|
||||
|
||||
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)
|
||||
qDebug() << sp_resp;
|
||||
|
||||
@@ -817,7 +818,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
||||
response.message = tr("The process terminated abnormally.");
|
||||
break;
|
||||
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;
|
||||
case Core::Utils::SynchronousProcessResponse::Hang:
|
||||
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());
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
proc.start(m_settings.p4Command,
|
||||
basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
|
||||
proc.start(m_settings.p4Command(),
|
||||
m_settings.basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
|
||||
if (!proc.waitForStarted(p4Timeout)) {
|
||||
showOutput(tr("Cannot execute p4 submit."), true);
|
||||
QApplication::restoreOverrideCursor();
|
||||
@@ -1018,8 +1019,8 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
QProcess proc;
|
||||
proc.setEnvironment(environment());
|
||||
proc.start(m_settings.p4Command,
|
||||
basicP4Args() << QLatin1String("fstat") << serverFilePath);
|
||||
proc.start(m_settings.p4Command(),
|
||||
m_settings.basicP4Args() << QLatin1String("fstat") << serverFilePath);
|
||||
|
||||
QString path;
|
||||
if (proc.waitForFinished(3000)) {
|
||||
@@ -1047,22 +1048,9 @@ QString PerforcePlugin::currentFileName()
|
||||
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
|
||||
{
|
||||
if (m_settings.p4Command.isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
return m_settings.isValid();
|
||||
}
|
||||
|
||||
QString PerforcePlugin::pendingChangesData()
|
||||
@@ -1074,8 +1062,8 @@ QString PerforcePlugin::pendingChangesData()
|
||||
QString user;
|
||||
QProcess proc;
|
||||
proc.setEnvironment(environment());
|
||||
proc.start(m_settings.p4Command,
|
||||
basicP4Args() << QLatin1String("info"));
|
||||
proc.start(m_settings.p4Command(),
|
||||
m_settings.basicP4Args() << QLatin1String("info"));
|
||||
if (proc.waitForFinished(3000)) {
|
||||
QString output = QString::fromUtf8(proc.readAllStandardOutput());
|
||||
if (!output.isEmpty()) {
|
||||
@@ -1087,8 +1075,8 @@ QString PerforcePlugin::pendingChangesData()
|
||||
}
|
||||
if (user.isEmpty())
|
||||
return data;
|
||||
proc.start(m_settings.p4Command,
|
||||
basicP4Args() << QLatin1String("changes") << QLatin1String("-s") << QLatin1String("pending") << QLatin1String("-u") << user);
|
||||
proc.start(m_settings.p4Command(),
|
||||
m_settings.basicP4Args() << QLatin1String("changes") << QLatin1String("-s") << QLatin1String("pending") << QLatin1String("-u") << user);
|
||||
if (proc.waitForFinished(3000))
|
||||
data = QString::fromUtf8(proc.readAllStandardOutput());
|
||||
return data;
|
||||
@@ -1139,17 +1127,24 @@ PerforcePlugin::~PerforcePlugin()
|
||||
}
|
||||
}
|
||||
|
||||
PerforceSettings PerforcePlugin::settings() const
|
||||
const PerforceSettings& PerforcePlugin::settings() const
|
||||
{
|
||||
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 (QSettings *settings = Core::ICore::instance()->settings())
|
||||
m_settings.toSettings(settings);
|
||||
|
||||
if (m_settings.p4Command() == p4Command
|
||||
&& m_settings.p4Port() == p4Port
|
||||
&& 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;
|
||||
// "where" remaps the file to client file tree
|
||||
QProcess proc;
|
||||
QStringList args(basicP4Args());
|
||||
QStringList args(m_settings.basicP4Args());
|
||||
args << QLatin1String("where") << perforceName;
|
||||
proc.start(m_settings.p4Command, args);
|
||||
proc.start(m_settings.p4Command(), args);
|
||||
if (!proc.waitForFinished()) {
|
||||
*errorMessage = tr("Timeout waiting for \"where\" (%1).").arg(perforceName);
|
||||
return QString();
|
||||
|
@@ -93,7 +93,6 @@ public:
|
||||
PerforcePlugin();
|
||||
~PerforcePlugin();
|
||||
|
||||
QStringList basicP4Args() const;
|
||||
SettingsPage *settingsPage() const { return m_settingsPage; }
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message);
|
||||
@@ -113,8 +112,8 @@ public:
|
||||
|
||||
static PerforcePlugin *perforcePluginInstance();
|
||||
|
||||
PerforceSettings settings() const;
|
||||
void setSettings(const PerforceSettings &s);
|
||||
const PerforceSettings& settings() const;
|
||||
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
|
||||
QString fileNameFromPerforceName(const QString& perforceName, QString *errorMessage) const;
|
||||
|
@@ -33,7 +33,11 @@
|
||||
|
||||
#include "perforcesettings.h"
|
||||
|
||||
#include <qtconcurrent/QtConcurrentTools>
|
||||
#include <QtCore/QtConcurrentRun>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
static const char *groupC = "Perforce";
|
||||
static const char *commandKeyC = "Command";
|
||||
@@ -55,41 +59,134 @@ static QString defaultCommand()
|
||||
namespace Perforce {
|
||||
namespace Internal {
|
||||
|
||||
PerforceSettings::PerforceSettings() :
|
||||
p4Command(defaultCommand()),
|
||||
defaultEnv(true)
|
||||
PerforceSettings::PerforceSettings()
|
||||
: m_valid(false)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
m_mutex.lock();
|
||||
settings->beginGroup(QLatin1String(groupC));
|
||||
p4Command = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
|
||||
defaultEnv = settings->value(QLatin1String(defaultKeyC), true).toBool();
|
||||
p4Port = settings->value(QLatin1String(portKeyC), QString()).toString();
|
||||
p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString();
|
||||
p4User = settings->value(QLatin1String(userKeyC), QString()).toString();
|
||||
m_p4Command = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString();
|
||||
m_defaultEnv = settings->value(QLatin1String(defaultKeyC), true).toBool();
|
||||
m_p4Port = settings->value(QLatin1String(portKeyC), QString()).toString();
|
||||
m_p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString();
|
||||
m_p4User = settings->value(QLatin1String(userKeyC), QString()).toString();
|
||||
settings->endGroup();
|
||||
m_mutex.unlock();
|
||||
|
||||
m_future = QtConcurrent::run(&PerforceSettings::run, this);
|
||||
}
|
||||
|
||||
void PerforceSettings::toSettings(QSettings *settings) const
|
||||
{
|
||||
m_mutex.lock();
|
||||
settings->beginGroup(QLatin1String(groupC));
|
||||
settings->setValue(commandKeyC, p4Command);
|
||||
settings->setValue(defaultKeyC, defaultEnv);
|
||||
settings->setValue(portKeyC, p4Port);
|
||||
settings->setValue(clientKeyC, p4Client);
|
||||
settings->setValue(userKeyC, p4User);
|
||||
settings->setValue(commandKeyC, m_p4Command);
|
||||
settings->setValue(defaultKeyC, m_defaultEnv);
|
||||
settings->setValue(portKeyC, m_p4Port);
|
||||
settings->setValue(clientKeyC, m_p4Client);
|
||||
settings->setValue(userKeyC, m_p4User);
|
||||
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
|
||||
&& p4Client == s.p4Client && p4User == s.p4User
|
||||
&& defaultEnv == s.defaultEnv;
|
||||
m_mutex.lock();
|
||||
m_p4Command = p4Command;
|
||||
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
|
||||
} // Perforce
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#define PERFOCESETTINGS_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QFuture>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
@@ -43,24 +44,35 @@ QT_END_NAMESPACE
|
||||
namespace Perforce {
|
||||
namespace Internal {
|
||||
|
||||
struct PerforceSettings {
|
||||
class PerforceSettings {
|
||||
public:
|
||||
PerforceSettings();
|
||||
void fromSettings(QSettings *);
|
||||
~PerforceSettings();
|
||||
void fromSettings(QSettings *settings);
|
||||
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 p4Port;
|
||||
QString p4Client;
|
||||
QString p4User;
|
||||
bool defaultEnv;
|
||||
QString p4Command() const;
|
||||
QString p4Port() const;
|
||||
QString p4Client() const;
|
||||
QString p4User() const;
|
||||
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
|
||||
} // Perforce
|
||||
|
||||
|
@@ -49,24 +49,38 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
|
||||
}
|
||||
|
||||
PerforceSettings SettingsPageWidget::settings() const
|
||||
QString SettingsPageWidget::p4Command() const
|
||||
{
|
||||
PerforceSettings rc;
|
||||
rc.p4Command = m_ui.pathChooser->path();
|
||||
rc.defaultEnv = m_ui.defaultCheckBox->isChecked();
|
||||
rc.p4Port = m_ui.portLineEdit->text();
|
||||
rc.p4Client = m_ui.clientLineEdit->text();
|
||||
rc.p4User = m_ui.userLineEdit->text();
|
||||
return rc;
|
||||
return m_ui.pathChooser->path();
|
||||
}
|
||||
|
||||
bool SettingsPageWidget::defaultEnv() const
|
||||
{
|
||||
return m_ui.defaultCheckBox->isChecked();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_ui.pathChooser->setPath(s.p4Command);
|
||||
m_ui.defaultCheckBox->setChecked(s.defaultEnv);
|
||||
m_ui.portLineEdit->setText(s.p4Port);
|
||||
m_ui.clientLineEdit->setText(s.p4Client);
|
||||
m_ui.userLineEdit->setText(s.p4User);
|
||||
m_ui.pathChooser->setPath(s.p4Command());
|
||||
m_ui.defaultCheckBox->setChecked(s.defaultEnv());
|
||||
m_ui.portLineEdit->setText(s.p4Port());
|
||||
m_ui.clientLineEdit->setText(s.p4Client());
|
||||
m_ui.userLineEdit->setText(s.p4User());
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage()
|
||||
@@ -101,5 +115,5 @@ void SettingsPage::apply()
|
||||
if (!m_widget)
|
||||
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:
|
||||
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 &);
|
||||
|
||||
private:
|
||||
|
@@ -110,9 +110,12 @@ OutputPane::OutputPane()
|
||||
connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||
|
||||
m_mainWidget->setLayout(layout);
|
||||
|
||||
connect(Core::ICore::instance(), SIGNAL(coreAboutToClose()),
|
||||
this, SLOT(coreAboutToClose()));
|
||||
}
|
||||
|
||||
OutputPane::~OutputPane()
|
||||
void OutputPane::coreAboutToClose()
|
||||
{
|
||||
while (m_tabWidget->count()) {
|
||||
RunControl *rc = runControlForTab(0);
|
||||
@@ -120,6 +123,10 @@ OutputPane::~OutputPane()
|
||||
rc->stop();
|
||||
closeTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
OutputPane::~OutputPane()
|
||||
{
|
||||
delete m_mainWidget;
|
||||
}
|
||||
|
||||
|
@@ -84,6 +84,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void projectRemoved();
|
||||
void coreAboutToClose();
|
||||
|
||||
private slots:
|
||||
void insertLine();
|
||||
|
@@ -124,7 +124,15 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
|
||||
qmake.start(m_qmake, QStringList()<<"-spec"<<mkspec<<configarguments<<"gdbmacros.pro");
|
||||
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();
|
||||
|
||||
fi.reportResult(true);
|
||||
|
@@ -296,12 +296,13 @@ void QtVersionManager::updateSystemVersion()
|
||||
foreach (QtVersion *version, m_versions) {
|
||||
if (version->isSystemVersion()) {
|
||||
version->setPath(findSystemQt());
|
||||
version->setName(tr("Auto-detected Qt"));
|
||||
haveSystemVersion = true;
|
||||
}
|
||||
}
|
||||
if (haveSystemVersion)
|
||||
return;
|
||||
QtVersion *version = new QtVersion(tr("System Qt"),
|
||||
QtVersion *version = new QtVersion(tr("Auto-detected Qt"),
|
||||
findSystemQt(),
|
||||
getUniqueId(),
|
||||
true);
|
||||
|
@@ -2504,14 +2504,13 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
if (d->m_codeFoldingVisible && TextBlockUserData::canCollapse(cursor.block())
|
||||
&& !TextBlockUserData::hasClosingCollapseInside(cursor.block().next())
|
||||
&& collapseBox(cursor.block()).contains(e->pos())) {
|
||||
setTextCursor(cursor);
|
||||
toggleBlockVisible(cursor.block());
|
||||
d->moveCursorVisible(false);
|
||||
} else if (d->m_marksVisible && e->pos().x() > markWidth) {
|
||||
QTextCursor selection = cursor;
|
||||
selection.setVisualNavigation(true);
|
||||
@@ -3392,15 +3391,16 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange>
|
||||
}
|
||||
|
||||
|
||||
void BaseTextEditorPrivate::moveCursorVisible()
|
||||
void BaseTextEditorPrivate::moveCursorVisible(bool ensureVisible)
|
||||
{
|
||||
QTextCursor cursor = q->textCursor();
|
||||
if (!cursor.block().isVisible()) {
|
||||
cursor.setVisualNavigation(true);
|
||||
cursor.movePosition(QTextCursor::PreviousBlock);
|
||||
cursor.movePosition(QTextCursor::Up);
|
||||
q->setTextCursor(cursor);
|
||||
}
|
||||
q->ensureCursorVisible();
|
||||
if (ensureVisible)
|
||||
q->ensureCursorVisible();
|
||||
}
|
||||
|
||||
void BaseTextEditor::collapse()
|
||||
@@ -3463,12 +3463,12 @@ void BaseTextEditor::unCollapseAll()
|
||||
if (TextBlockUserData::canCollapse(block))
|
||||
TextBlockUserData::doCollapse(block, makeVisible);
|
||||
block = block.next();
|
||||
|
||||
}
|
||||
|
||||
d->moveCursorVisible();
|
||||
documentLayout->requestUpdate();
|
||||
documentLayout->emitDocumentSizeChanged();
|
||||
centerCursor();
|
||||
}
|
||||
|
||||
void BaseTextEditor::setTextCodec(QTextCodec *codec)
|
||||
|
@@ -218,7 +218,7 @@ public:
|
||||
QTextCursor m_findScope;
|
||||
QTextCursor m_selectBlockAnchor;
|
||||
|
||||
void moveCursorVisible();
|
||||
void moveCursorVisible(bool ensureVisible = true);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -384,8 +384,9 @@ bool CheckSpecifier::visit(TypeofSpecifierAST *ast)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckSpecifier::visit(AttributeSpecifierAST *)
|
||||
bool CheckSpecifier::visit(AttributeSpecifierAST *ast)
|
||||
{
|
||||
accept(ast->next);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -768,11 +768,15 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
|
||||
case ProVariable::RemoveOperator: // -=
|
||||
if (!m_cumulative) {
|
||||
if (!m_skipLevel) {
|
||||
removeEach(&m_valuemap, varName, v);
|
||||
removeEach(&m_filevaluemap[currentProFile()], varName, v);
|
||||
// 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)
|
||||
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) {
|
||||
// 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)
|
||||
insertUnique(&m_valuemap, 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);
|
||||
}
|
||||
|
||||
static void removeEach(QHash<QString, QStringList> *map,
|
||||
static int removeEach(QHash<QString, QStringList> *map,
|
||||
const QString &key, const QStringList &value)
|
||||
{
|
||||
int count = 0;
|
||||
QStringList &sl = (*map)[key];
|
||||
foreach (const QString &str, value)
|
||||
sl.removeAll(str);
|
||||
count += sl.removeAll(str);
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user