Merge commit 'origin/0.9.1-beta'

This commit is contained in:
con
2008-12-12 11:09:05 +01:00
71 changed files with 1335 additions and 565 deletions

View File

@@ -201,14 +201,18 @@ void BookmarksPlugin::updateActions(int state)
void BookmarksPlugin::editorOpened(Core::IEditor *editor)
{
connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
if (qobject_cast<ITextEditor *>(editor)) {
connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
}
}
void BookmarksPlugin::editorAboutToClose(Core::IEditor *editor)
{
disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
if (qobject_cast<ITextEditor *>(editor)) {
disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
}
}
void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,

View File

@@ -186,6 +186,15 @@ MainWindow::MainWindow() :
QCoreApplication::setOrganizationName(QLatin1String("Nokia"));
QSettings::setDefaultFormat(QSettings::IniFormat);
QString baseName = qApp->style()->objectName();
if (baseName == "windows") {
// Sometimes we get the standard windows 95 style as a fallback
// e.g. if we are running on a KDE4 desktop
QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
if (desktopEnvironment == "kde")
baseName = "plastique";
else
baseName = "cleanlooks";
}
qApp->setStyle(new ManhattanStyle(baseName));
statusBar()->setProperty("p_styled", true);
}

View File

@@ -334,6 +334,10 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget)
m_navigationComboBox = new NavComboBox(this);
m_navigationWidget = 0;
#ifdef Q_OS_MAC
// this is to avoid ugly tool bar behavior
m_navigationComboBox->setMaximumWidth(130);
#endif
m_toolbar = new QToolBar(this);
m_toolbar->setContentsMargins(0, 0, 0, 0);

View File

@@ -72,7 +72,7 @@ VersionDialog::VersionDialog(QWidget *parent)
"<br/>"
"Built on " __DATE__ " at " __TIME__ "<br />"
#ifdef IDE_REVISION
"Using revision %5<br/>"
"From revision %5<br/>"
#endif
"<br/>"
"<br/>"

View File

@@ -427,7 +427,9 @@ void CPPEditor::switchDeclarationDefinition()
if (!m_modelManager)
return;
Document::Ptr doc = m_modelManager->document(file()->fileName());
const Snapshot snapshot = m_modelManager->snapshot();
Document::Ptr doc = snapshot.value(file()->fileName());
if (!doc)
return;
Symbol *lastSymbol = doc->findSymbolAt(line, column);
@@ -445,7 +447,7 @@ void CPPEditor::switchDeclarationDefinition()
if (f) {
TypeOfExpression typeOfExpression;
typeOfExpression.setDocuments(m_modelManager->documents());
typeOfExpression.setSnapshot(m_modelManager->snapshot());
QList<TypeOfExpression::Result> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
const LookupContext &context = typeOfExpression.lookupContext();
@@ -474,26 +476,38 @@ void CPPEditor::jumpToDefinition()
if (!m_modelManager)
return;
const Snapshot snapshot = m_modelManager->snapshot();
// Find the last symbol up to the cursor position
int line = 0, column = 0;
convertPosition(position(), &line, &column);
Document::Ptr doc = m_modelManager->document(file()->fileName());
Document::Ptr doc = snapshot.value(file()->fileName());
if (!doc)
return;
QTextCursor tc = textCursor();
unsigned lineno = tc.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) {
if (incl.line() == lineno) {
if (openCppEditorAt(incl.fileName(), 0, 0))
return; // done
break;
}
}
Symbol *lastSymbol = doc->findSymbolAt(line, column);
if (!lastSymbol)
return;
// Get the expression under the cursor
const int endOfName = endOfNameUnderCursor();
QTextCursor tc = textCursor();
tc.setPosition(endOfName);
ExpressionUnderCursor expressionUnderCursor;
const QString expression = expressionUnderCursor(tc);
// Evaluate the type of the expression
TypeOfExpression typeOfExpression;
typeOfExpression.setDocuments(m_modelManager->documents());
typeOfExpression.setSnapshot(m_modelManager->snapshot());
QList<TypeOfExpression::Result> resolvedSymbols =
typeOfExpression(expression, doc, lastSymbol);
@@ -515,7 +529,7 @@ void CPPEditor::jumpToDefinition()
QList<Symbol *> candidates = context.resolve(namedType->name());
if (!candidates.isEmpty()) {
Symbol *s = candidates.takeFirst();
openEditorAt(s->fileName(), s->line(), s->column());
openCppEditorAt(s->fileName(), s->line(), s->column());
}
#endif
}
@@ -524,7 +538,7 @@ void CPPEditor::jumpToDefinition()
if (use.contains(endOfName - 1)) {
const Macro &macro = use.macro();
const QString fileName = QString::fromUtf8(macro.fileName);
if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
if (openCppEditorAt(fileName, macro.line, 0))
return; // done
}
}
@@ -562,7 +576,7 @@ Symbol *CPPEditor::findDefinition(Symbol *lastSymbol)
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
LookupContext context(&control);
const QMap<QString, Document::Ptr> documents = m_modelManager->documents();
const Snapshot documents = m_modelManager->snapshot();
foreach (Document::Ptr doc, documents) {
QList<Scope *> visibleScopes;
visibleScopes.append(doc->globalSymbols());
@@ -734,7 +748,8 @@ void CPPEditor::unCommentSelection()
QString endText = endBlock.text();
int endPos = end - endBlock.position();
bool hasTrailingCharacters = !endText.mid(endPos).trimmed().isEmpty();
bool hasTrailingCharacters = !endText.left(endPos).remove(QLatin1String("//")).trimmed().isEmpty()
&& !endText.mid(endPos).trimmed().isEmpty();
if ((endPos <= endText.length() - 2
&& endText.at(endPos) == QLatin1Char('*')
&& endText.at(endPos+1) == QLatin1Char('/'))) {
@@ -826,8 +841,15 @@ int CPPEditor::endOfNameUnderCursor()
return pos;
}
TextEditor::ITextEditor *CPPEditor::openCppEditorAt(const QString &fileName,
int line, int column)
{
return TextEditor::BaseTextEditor::openEditorAt(fileName, line, column,
Constants::C_CPPEDITOR);
}
bool CPPEditor::openEditorAt(Symbol *s)
{
const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength());
return TextEditor::BaseTextEditor::openEditorAt(fileName, s->line(), s->column());
return openCppEditorAt(fileName, s->line(), s->column());
}

View File

@@ -123,6 +123,9 @@ private:
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
TextEditor::ITextEditor *openCppEditorAt(const QString &fileName, int line,
int column = 0);
int previousBlockState(QTextBlock block) const;
QTextCursor moveToPreviousToken(QTextCursor::MoveMode mode) const;
QTextCursor moveToNextToken(QTextCursor::MoveMode mode) const;

View File

@@ -434,12 +434,15 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
//if (! expression.isEmpty())
//qDebug() << "***** expression:" << expression;
if (Document::Ptr thisDocument = m_manager->document(fileName)) {
const Snapshot snapshot = m_manager->snapshot();
if (Document::Ptr thisDocument = snapshot.value(fileName)) {
Symbol *symbol = thisDocument->findSymbolAt(line, column);
typeOfExpression.setDocuments(m_manager->documents());
typeOfExpression.setSnapshot(m_manager->snapshot());
QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol);
QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol,
TypeOfExpression::Preprocess);
LookupContext context = typeOfExpression.lookupContext();
if (!typeOfExpression.expressionAST() && (! m_completionOperator ||
@@ -963,8 +966,10 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
if (Function *function = symbol->type()->asFunction()) {
// If the member is a function, automatically place the opening parenthesis,
// except when it might take template parameters.
if (!function->returnType().isValid()
&& (function->identity() && !function->identity()->isDestructorNameId())) {
const bool hasReturnType = function->returnType().isValid() ||
function->returnType().isSigned() ||
function->returnType().isUnsigned();
if (! hasReturnType && (function->identity() && !function->identity()->isDestructorNameId())) {
// Don't insert any magic, since the user might have just wanted to select the class
} else if (function->templateParameterCount() != 0) {
@@ -1033,7 +1038,7 @@ void CppCodeCompletion::cleanup()
// Set empty map in order to avoid referencing old versions of the documents
// until the next completion
typeOfExpression.setDocuments(QMap<QString, Document::Ptr>());
typeOfExpression.setSnapshot(Snapshot());
}
int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor)

View File

@@ -165,9 +165,11 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
QTextCursor tc(edit->document());
tc.setPosition(pos);
const Snapshot documents = m_manager->snapshot();
const int lineNumber = tc.block().blockNumber() + 1;
const QString fileName = editor->file()->fileName();
Document::Ptr doc = m_manager->document(fileName);
Document::Ptr doc = documents.value(fileName);
if (doc) {
foreach (Document::DiagnosticMessage m, doc->diagnosticMessages()) {
if (m.line() == lineNumber) {
@@ -177,6 +179,16 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
}
}
if (m_toolTip.isEmpty()) {
unsigned lineno = tc.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) {
if (lineno == incl.line()) {
m_toolTip = incl.fileName();
break;
}
}
}
if (m_toolTip.isEmpty()) {
// Move to the end of a qualified name
bool stop = false;
@@ -202,7 +214,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
Symbol *lastSymbol = doc->findSymbolAt(line, column);
TypeOfExpression typeOfExpression;
typeOfExpression.setDocuments(m_manager->documents());
typeOfExpression.setSnapshot(documents);
QList<TypeOfExpression::Result> types = typeOfExpression(expression, doc, lastSymbol);
if (!types.isEmpty()) {

View File

@@ -138,11 +138,12 @@ protected:
virtual void stopExpandingMacro(unsigned offset, const Macro &macro);
virtual void startSkippingBlocks(unsigned offset);
virtual void stopSkippingBlocks(unsigned offset);
virtual void sourceNeeded(QString &fileName, IncludeType type);
virtual void sourceNeeded(QString &fileName, IncludeType type,
unsigned line);
private:
QPointer<CppModelManager> m_modelManager;
CppModelManager::DocumentTable m_documents;
Snapshot m_snapshot;
Environment env;
pp m_proc;
QStringList m_includePaths;
@@ -159,7 +160,7 @@ private:
CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
: m_modelManager(modelManager),
m_documents(modelManager->documents()),
m_snapshot(modelManager->snapshot()),
m_proc(this, env)
{ }
@@ -176,7 +177,7 @@ void CppPreprocessor::setProjectFiles(const QStringList &files)
{ m_projectFiles = files; }
void CppPreprocessor::run(QString &fileName)
{ sourceNeeded(fileName, IncludeGlobal); }
{ sourceNeeded(fileName, IncludeGlobal, /*line = */ 0); }
void CppPreprocessor::operator()(QString &fileName)
{ run(fileName); }
@@ -339,7 +340,7 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *process
processed->insert(fn);
foreach (QString includedFile, doc->includedFiles()) {
mergeEnvironment(m_documents.value(includedFile), processed);
mergeEnvironment(m_snapshot.value(includedFile), processed);
}
foreach (const Macro macro, doc->definedMacros()) {
@@ -361,7 +362,8 @@ void CppPreprocessor::stopSkippingBlocks(unsigned offset)
m_currentDoc->stopSkippingBlocks(offset);
}
void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
unsigned line)
{
if (fileName.isEmpty())
return;
@@ -369,7 +371,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
QByteArray contents = tryIncludeFile(fileName, type);
if (m_currentDoc) {
m_currentDoc->addIncludeFile(fileName);
m_currentDoc->addIncludeFile(fileName, line);
if (contents.isEmpty() && ! QFileInfo(fileName).isAbsolute()) {
QString msg;
msg += fileName;
@@ -384,7 +386,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
}
if (! contents.isEmpty()) {
Document::Ptr cachedDoc = m_documents.value(fileName);
Document::Ptr cachedDoc = m_snapshot.value(fileName);
if (cachedDoc && m_currentDoc) {
mergeEnvironment(cachedDoc);
} else {
@@ -475,11 +477,8 @@ CppModelManager::CppModelManager(QObject *parent) :
CppModelManager::~CppModelManager()
{ }
Document::Ptr CppModelManager::document(const QString &fileName) const
{ return m_documents.value(fileName); }
CppModelManager::DocumentTable CppModelManager::documents() const
{ return m_documents; }
Snapshot CppModelManager::snapshot() const
{ return m_snapshot; }
void CppModelManager::ensureUpdated()
{
@@ -670,7 +669,7 @@ void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
void CppModelManager::onDocumentUpdated(Document::Ptr doc)
{
const QString fileName = doc->fileName();
m_documents[fileName] = doc;
m_snapshot[fileName] = doc;
QList<Core::IEditor *> openedEditors = m_core->editorManager()->openedEditors();
foreach (Core::IEditor *editor, openedEditors) {
if (editor->file()->fileName() == fileName) {
@@ -835,7 +834,7 @@ void CppModelManager::parse(QFutureInterface<void> &future,
void CppModelManager::GC()
{
DocumentTable documents = m_documents;
Snapshot documents = m_snapshot;
QSet<QString> processed;
QStringList todo = projectFiles();
@@ -866,7 +865,7 @@ void CppModelManager::GC()
}
emit aboutToRemoveFiles(removedFiles);
m_documents = documents;
m_snapshot = documents;
}

View File

@@ -76,8 +76,7 @@ public:
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
virtual void updateProjectInfo(const ProjectInfo &pinfo);
virtual CPlusPlus::Document::Ptr document(const QString &fileName) const;
virtual DocumentTable documents() const;
virtual CPlusPlus::Snapshot snapshot() const;
virtual void GC();
QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
@@ -146,7 +145,7 @@ private:
Core::ICore *m_core;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
CppHoverHandler *m_hoverHandler;
DocumentTable m_documents;
CPlusPlus::Snapshot m_snapshot;
// cache
bool m_dirty;

View File

@@ -46,14 +46,11 @@ namespace ProjectExplorer {
namespace CppTools {
class CPPTOOLS_EXPORT CppModelManagerInterface
: public QObject
class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject
{
Q_OBJECT
public:
typedef QMap<QString, CPlusPlus::Document::Ptr> DocumentTable; // ### remove me
class ProjectInfo
{
public:
@@ -89,8 +86,7 @@ public:
virtual void GC() = 0;
virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
virtual CPlusPlus::Document::Ptr document(const QString &fileName) const = 0;
virtual DocumentTable documents() const = 0;
virtual CPlusPlus::Snapshot snapshot() const = 0;
virtual QList<ProjectInfo> projectInfos() const = 0;
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;

View File

@@ -6,7 +6,6 @@ include(cpptools_dependencies.pri)
# DEFINES += QT_NO_CAST_FROM_ASCII
DEFINES += QT_NO_CAST_TO_ASCII
unix:QMAKE_CXXFLAGS_DEBUG += -O3
INCLUDEPATH += .
DEFINES += CPPTOOLS_LIBRARY
CONFIG += help

View File

@@ -43,6 +43,7 @@
#include <QIcon>
#include <QMetaType>
#include <QString>
#include <QSet>
#include <functional>

View File

@@ -58,7 +58,6 @@ SOURCES += attachexternaldialog.cpp \
gdbengine.cpp \
gdbmi.cpp \
gdboptionpage.cpp \
gdbtypemacros.cpp \
gdbengine.h \
moduleshandler.cpp \
moduleswindow.cpp \
@@ -79,7 +78,6 @@ FORMS += attachexternaldialog.ui \
breakcondition.ui \
mode.ui \
gdboptionpage.ui \
gdbtypemacros.ui \
startexternaldialog.ui \
RESOURCES += debugger.qrc

View File

@@ -1033,7 +1033,6 @@ void DebuggerManager::addToWatchWindow()
void DebuggerManager::watchExpression(const QString &expression)
{
watchHandler()->watchExpression(expression);
//engine()->updateWatchModel();
}
void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber)

View File

@@ -183,7 +183,6 @@ DebuggerPlugin::DebuggerPlugin()
{
m_pm = 0;
m_generalOptionPage = 0;
m_typeMacroPage = 0;
m_locationMark = 0;
m_manager = 0;
}
@@ -202,7 +201,6 @@ void DebuggerPlugin::shutdown()
//qDebug() << "DebuggerPlugin::~DebuggerPlugin";
removeObject(m_debugMode);
removeObject(m_generalOptionPage);
removeObject(m_typeMacroPage);
// FIXME: when using the line below, BreakWindow etc gets deleted twice.
// so better leak for now...
@@ -212,9 +210,6 @@ void DebuggerPlugin::shutdown()
delete m_generalOptionPage;
m_generalOptionPage = 0;
delete m_typeMacroPage;
m_typeMacroPage = 0;
delete m_locationMark;
m_locationMark = 0;
@@ -409,13 +404,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
mdebug->addAction(cmd);
m_generalOptionPage = 0;
m_typeMacroPage = 0;
// FIXME:
m_generalOptionPage = new GdbOptionPage(&theGdbSettings());
addObject(m_generalOptionPage);
m_typeMacroPage = new TypeMacroPage(&theGdbSettings());
addObject(m_typeMacroPage);
m_locationMark = 0;

View File

@@ -54,7 +54,6 @@ namespace Internal {
class DebuggerManager;
class DebugMode;
class GdbOptionPage;
class TypeMacroPage;
class LocationMark;
class DebuggerPlugin : public ExtensionSystem::IPlugin
@@ -103,7 +102,6 @@ private:
ExtensionSystem::PluginManager *m_pm;
GdbOptionPage *m_generalOptionPage;
TypeMacroPage *m_typeMacroPage;
QString m_previousMode;
LocationMark *m_locationMark;

View File

@@ -2939,6 +2939,8 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
if (tmplate == "QSet")
return true;
}
if (tmplate == "std::list")
return true;
if (tmplate == "std::vector" && inner != "bool")
return true;
if (tmplate == "std::basic_string") {

View File

@@ -80,7 +80,7 @@ enum DataDumperState
DataDumperUnavailable,
};
// FIXME: Move to extra file?
class GdbSettings
{
public:

View File

@@ -58,7 +58,11 @@ GdbOptionPage::GdbOptionPage(GdbSettings *settings)
#if defined(Q_OS_WIN32)
defaultCommand.append(".exe");
#endif
QString defaultScript = coreIFace->resourcePath() +
QLatin1String("/gdb/qt4macros");
m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString();
m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString();
m_settings->m_gdbEnv = s->value("Environment", "").toString();
m_settings->m_autoRun = s->value("AutoRun", true).toBool();
m_settings->m_autoQuit = s->value("AutoQuit", true).toBool();
@@ -72,36 +76,50 @@ QString GdbOptionPage::name() const
QString GdbOptionPage::category() const
{
return "Debugger|Gdb";
return "Debugger";
}
QString GdbOptionPage::trCategory() const
{
return tr("Debugger|Gdb");
return tr("Debugger");
}
QWidget *GdbOptionPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_ui.gdbEdit->setText(m_settings->m_gdbCmd);
m_ui.envEdit->setText(m_settings->m_gdbEnv);
m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
m_ui.gdbLocationChooser->setPath(m_settings->m_gdbCmd);
m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
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);
connect(m_ui.pushButtonBrowse, SIGNAL(clicked()),
this, SLOT(browse()));
// FIXME
m_ui.autoStartBox->hide();
m_ui.autoQuitBox->hide();
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
connect(m_ui.gdbLocationChooser, SIGNAL(changed()),
this, SLOT(onGdbLocationChanged()));
connect(m_ui.scriptFileChooser, SIGNAL(changed()),
this, SLOT(onScriptFileChanged()));
return w;
}
void GdbOptionPage::browse()
void GdbOptionPage::onGdbLocationChanged()
{
QString fileName = QFileDialog::getOpenFileName(m_ui.pushButtonBrowse,
"Browse for gdb executable");
if (fileName.isEmpty())
return;
m_settings->m_gdbCmd = fileName;
m_ui.gdbEdit->setText(fileName);
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
}
void GdbOptionPage::onScriptFileChanged()
{
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
}
void GdbOptionPage::finished(bool accepted)
@@ -109,10 +127,11 @@ void GdbOptionPage::finished(bool accepted)
if (!accepted)
return;
m_settings->m_gdbCmd = m_ui.gdbEdit->text();
m_settings->m_gdbEnv = m_ui.envEdit->text();
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();
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())

View File

@@ -35,7 +35,6 @@
#define GDBOPTIONPAGE_H
#include "ui_gdboptionpage.h"
#include "ui_gdbtypemacros.h"
#include <coreplugin/dialogs/ioptionspage.h>
@@ -63,7 +62,8 @@ public:
void finished(bool accepted);
public slots:
void browse();
void onGdbLocationChanged();
void onScriptFileChanged();
private:
ExtensionSystem::PluginManager *m_pm;
@@ -72,6 +72,7 @@ private:
GdbSettings *m_settings;
};
#if 0
class TypeMacroPage : public Core::IOptionsPage
{
Q_OBJECT
@@ -87,7 +88,6 @@ public:
void finished(bool accepted);
private slots:
void onScriptButton();
void onAddButton();
void onDelButton();
void currentItemChanged(QTreeWidgetItem *item);
@@ -100,6 +100,7 @@ private:
GdbSettings *m_settings;
QWidget *m_widget;
};
#endif
} // namespace Internal
} // namespace Debugger

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>433</width>
<height>216</height>
<height>233</height>
</rect>
</property>
<property name="windowTitle">
@@ -23,7 +23,7 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Gdb Debug Options</string>
<string>Locations</string>
</property>
<layout class="QGridLayout">
<property name="margin">
@@ -32,46 +32,45 @@
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<widget class="QLineEdit" name="gdbEdit"/>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="envEdit"/>
<item row="1" column="1">
<widget class="QLineEdit" name="environmentEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelGdbLocaltion">
<property name="toolTip">
<string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH.</string>
</property>
<property name="text">
<string>Gdb Location:</string>
</property>
<property name="buddy">
<cstring>gdbEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelEnvironment">
<property name="text">
<string>Environment:</string>
</property>
<property name="buddy">
<cstring>envEdit</cstring>
<cstring>environmentEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonBrowse">
<item row="2" column="0">
<widget class="QLabel" name="labelGdbStartupScript">
<property name="toolTip">
<string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/qworkbench/images/fileopen.png</normaloff>:/qworkbench/images/fileopen.png</iconset>
</property>
<property name="checkable">
<bool>false</bool>
<string>Gdb Startup Script:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="scriptFileChooser" native="true"/>
</item>
<item row="0" column="1">
<widget class="Core::Utils::PathChooser" name="gdbLocationChooser" native="true"/>
</item>
</layout>
</widget>
</item>
@@ -104,6 +103,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>

View File

@@ -109,6 +109,8 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
m_widget = new QWidget(parent);
m_ui.setupUi(m_widget);
m_ui.scriptFile->setPromptDialogTitle(tr("Select Gdb Script"));
m_ui.scriptFile->setExpectedKind(Core::Utils::PathChooser::File);
connect(m_ui.addButton, SIGNAL(clicked()),
this, SLOT(onAddButton()));
@@ -116,8 +118,8 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
connect(m_ui.delButton, SIGNAL(clicked()),
this, SLOT(onDelButton()));
connect(m_ui.scriptButton, SIGNAL(clicked()),
this, SLOT(onScriptButton()));
connect(m_ui.scriptFile, SIGNAL(validChanged()),
this, SLOT(updateButtonState()));
connect(m_ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(currentItemChanged(QTreeWidgetItem *)));
@@ -139,7 +141,7 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
++i;
}
m_ui.scriptEdit->setText(m_settings->m_scriptFile);
m_ui.scriptFile->setPath(m_settings->m_scriptFile);
updateButtonState();
@@ -152,7 +154,7 @@ void TypeMacroPage::finished(bool accepted)
return;
m_settings->m_typeMacros.clear();
m_settings->m_scriptFile = m_ui.scriptEdit->text();
m_settings->m_scriptFile = m_ui.scriptFile->path();
for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
@@ -172,13 +174,6 @@ void TypeMacroPage::finished(bool accepted)
}
}
void TypeMacroPage::onScriptButton()
{
QString fileName = QFileDialog::getOpenFileName(m_widget, tr("Select Gdb Script"));
m_ui.scriptEdit->setText(fileName);
updateButtonState();
}
void TypeMacroPage::onAddButton()
{
if (m_ui.typeEdit->text().isEmpty() || m_ui.macroEdit->text().isEmpty())

View File

@@ -1,146 +1,115 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TypeMacroPage</class>
<widget class="QWidget" name="TypeMacroPage" >
<property name="geometry" >
<widget class="QWidget" name="TypeMacroPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>238</height>
<height>263</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Script File</string>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="scriptEdit" />
</item>
<item>
<widget class="QToolButton" name="scriptButton" >
<property name="minimumSize" >
<size>
<width>21</width>
<height>23</height>
</size>
</property>
<property name="text" >
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing" >
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="2" >
<widget class="QTreeWidget" name="treeWidget" >
<property name="rootIsDecorated" >
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="treeWidget">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text" >
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text" >
<property name="text">
<string>Macro</string>
</property>
</column>
</widget>
</item>
<item row="1" column="2" >
<widget class="QToolButton" name="addButton" >
<property name="minimumSize" >
<item row="1" column="2">
<widget class="QToolButton" name="addButton">
<property name="minimumSize">
<size>
<width>21</width>
<height>23</height>
</size>
</property>
<property name="text" >
<property name="text">
<string>+</string>
</property>
<property name="icon" >
<iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/newitem.png</iconset>
<property name="icon">
<iconset>
<normaloff>:/gdbdebugger/images/newitem.png</normaloff>:/gdbdebugger/images/newitem.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Macro Name:</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Parse as:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="macroEdit" />
<item row="2" column="1">
<widget class="QLineEdit" name="macroEdit"/>
</item>
<item row="0" column="2" >
<layout class="QVBoxLayout" >
<property name="margin" >
<item row="0" column="2">
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="spacing" >
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="delButton" >
<property name="minimumSize" >
<widget class="QToolButton" name="delButton">
<property name="minimumSize">
<size>
<width>21</width>
<height>23</height>
</size>
</property>
<property name="text" >
<property name="text">
<string>-</string>
</property>
<property name="icon" >
<iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/delete.png</iconset>
<property name="icon">
<iconset>
<normaloff>:/gdbdebugger/images/delete.png</normaloff>:/gdbdebugger/images/delete.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@@ -150,25 +119,25 @@
</item>
</layout>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="typeEdit" />
<item row="1" column="1">
<widget class="QLineEdit" name="typeEdit"/>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QComboBox" name="parseAsBox" >
<item row="3" column="1">
<widget class="QComboBox" name="parseAsBox">
<item>
<property name="text" >
<property name="text">
<string>ASCII (char *)</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Unicode (short)</string>
</property>
</item>
@@ -178,9 +147,8 @@
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources>
<include location="gdbdebugger.qrc" />
<include location="gdbdebugger.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -402,18 +402,41 @@ bool WatchHandler::setData(const QModelIndex &idx,
static QString niceType(QString type)
{
if (type.contains("std::")) {
static QRegExp re("std::vector<(.*)\\s*,std::allocator<(.*)>\\s*>");
re.setMinimal(true);
// std::string
type.replace("std::basic_string<char, std::char_traits<char>, "
"std::allocator<char> >", "std::string");
// std::wstring
type.replace("std::basic_string<wchar_t, std::char_traits<wchar_t>, "
"std::allocator<wchar_t> >", "std::wstring");
// std::vector
static QRegExp re1("std::vector<(.*), std::allocator<(.*)>\\s*>");
re1.setMinimal(true);
for (int i = 0; i != 10; ++i) {
if (re.indexIn(type) == -1 || re.cap(1) != re.cap(2))
if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2))
break;
type.replace(re.cap(0), "std::vector<" + re.cap(1) + ">");
type.replace(re1.cap(0), "std::vector<" + re1.cap(1) + ">");
}
// std::list
static QRegExp re2("std::list<(.*), std::allocator<(.*)>\\s*>");
re2.setMinimal(true);
for (int i = 0; i != 10; ++i) {
if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2))
break;
type.replace(re2.cap(0), "std::list<" + re2.cap(1) + ">");
}
// std::map
static QRegExp re3("std::map<(.*), (.*), std::less<(.*)\\s*>, "
"std::allocator<std::pair<const (.*), (.*)\\s*> > >");
re3.setMinimal(true);
for (int i = 0; i != 10; ++i) {
if (re3.indexIn(type) == -1 || re3.cap(1) != re3.cap(3)
|| re3.cap(1) != re3.cap(4) || re3.cap(2) != re3.cap(5))
break;
type.replace(re3.cap(0), "std::map<" + re3.cap(1) + ", " + re3.cap(2) + ">");
}
type.replace(" >", ">");
@@ -865,9 +888,9 @@ void WatchHandler::watchExpression(const QString &exp)
data.name = exp;
data.iname = "watch." + exp;
insertData(data);
emit watchModelUpdateRequested();
}
void WatchHandler::setDisplayedIName(const QString &iname, bool on)
{
WatchData *d = findData(iname);

View File

@@ -95,7 +95,7 @@ static QList<Document::Ptr> findDocumentsIncluding(const QString &fileName, bool
QList<Document::Ptr> docList;
// take all docs
CppTools::CppModelManagerInterface::DocumentTable docTable = cppModelManager->documents();
CPlusPlus::Snapshot docTable = cppModelManager->snapshot();
foreach (Document::Ptr doc, docTable) { // we go through all documents
QStringList includes = doc->includedFiles();
foreach (QString include, includes) {
@@ -286,7 +286,7 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
LookupContext context(&control);
const QMap<QString, Document::Ptr> documents = cppModelManager->documents();
const Snapshot documents = cppModelManager->snapshot();
foreach (Document::Ptr doc, documents) {
QList<Scope *> visibleScopes;
visibleScopes.append(doc->globalSymbols());

View File

@@ -197,7 +197,7 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &fileNam
const QString title = tr("Git Diff");
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDirectory, true, "originalFileName", workingDirectory);
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
executeGit(workingDirectory, arguments, editor);
}
@@ -215,14 +215,14 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
const QString sourceFile = source(workingDirectory, fileName);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "originalFileName", sourceFile);
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
executeGit(workingDirectory, arguments, editor);
}
void GitClient::status(const QString &workingDirectory)
{
QStringList statusArgs(QLatin1String("status"));
statusArgs << QLatin1String("-u");
executeGit(workingDirectory, statusArgs, m_plugin->outputWindow(), 0,true);
executeGit(workingDirectory, statusArgs, 0, true);
}
void GitClient::log(const QString &workingDirectory, const QString &fileName)
@@ -242,7 +242,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName)
const QString kind = QLatin1String(Git::Constants::GIT_LOG_EDITOR_KIND);
const QString sourceFile = source(workingDirectory, fileName);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, false, "logFileName", sourceFile);
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
executeGit(workingDirectory, arguments, editor);
}
void GitClient::show(const QString &source, const QString &id)
@@ -258,7 +258,7 @@ void GitClient::show(const QString &source, const QString &id)
const QFileInfo sourceFi(source);
const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
executeGit(workDir, arguments, m_plugin->outputWindow(), editor);
executeGit(workDir, arguments, editor);
}
void GitClient::blame(const QString &workingDirectory, const QString &fileName)
@@ -273,7 +273,7 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName)
const QString sourceFile = source(workingDirectory, fileName);
VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "blameFileName", sourceFile);
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
executeGit(workingDirectory, arguments, editor);
}
void GitClient::checkout(const QString &workingDirectory, const QString &fileName)
@@ -287,7 +287,7 @@ void GitClient::checkout(const QString &workingDirectory, const QString &fileNam
arguments << QLatin1String("checkout") << QLatin1String("HEAD") << QLatin1String("--")
<< fileName;
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
executeGit(workingDirectory, arguments, 0, true);
}
void GitClient::hardReset(const QString &workingDirectory, const QString &commit)
@@ -297,7 +297,7 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit
if (!commit.isEmpty())
arguments << commit;
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
executeGit(workingDirectory, arguments, 0, true);
}
void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
@@ -305,7 +305,7 @@ void GitClient::addFile(const QString &workingDirectory, const QString &fileName
QStringList arguments;
arguments << QLatin1String("add") << fileName;
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
executeGit(workingDirectory, arguments, 0, true);
}
bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
@@ -380,13 +380,14 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
}
void GitClient::executeGit(const QString &workingDirectory, const QStringList &arguments,
GitOutputWindow *outputWindow, VCSBase::VCSBaseEditor* editor,
VCSBase::VCSBaseEditor* editor,
bool outputToWindow)
{
if (Git::Constants::debug)
qDebug() << "executeGit" << workingDirectory << arguments << editor;
m_plugin->outputWindow()->append(formatCommand(QLatin1String(kGitCommand), arguments));
GitOutputWindow *outputWindow = m_plugin->outputWindow();
outputWindow->append(formatCommand(QLatin1String(kGitCommand), arguments));
QProcess process;
ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment();
@@ -396,8 +397,13 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
GitCommand* command = new GitCommand();
if (outputToWindow) {
connect(command, SIGNAL(outputText(QString)), outputWindow, SLOT(append(QString)));
connect(command, SIGNAL(outputData(QByteArray)), outputWindow, SLOT(appendData(QByteArray)));
if (!editor) { // assume that the commands output is the important thing
connect(command, SIGNAL(outputText(QString)), this, SLOT(appendAndPopup(QString)));
connect(command, SIGNAL(outputData(QByteArray)), this, SLOT(appendDataAndPopup(QByteArray)));
} else {
connect(command, SIGNAL(outputText(QString)), outputWindow, SLOT(append(QString)));
connect(command, SIGNAL(outputData(QByteArray)), outputWindow, SLOT(appendData(QByteArray)));
}
} else {
QTC_ASSERT(editor, /**/);
connect(command, SIGNAL(outputText(QString)), editor, SLOT(setPlainText(QString)));
@@ -405,11 +411,23 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
}
if (outputWindow)
connect(command, SIGNAL(errorText(QString)), outputWindow, SLOT(append(QString)));
connect(command, SIGNAL(errorText(QString)), this, SLOT(appendAndPopup(QString)));
command->execute(arguments, workingDirectory, environment);
}
void GitClient::appendDataAndPopup(const QByteArray &data)
{
m_plugin->outputWindow()->appendData(data);
m_plugin->outputWindow()->popup(false);
}
void GitClient::appendAndPopup(const QString &text)
{
m_plugin->outputWindow()->append(text);
m_plugin->outputWindow()->popup(false);
}
bool GitClient::synchronousGit(const QString &workingDirectory,
const QStringList &arguments,
QByteArray* outputText,
@@ -810,12 +828,12 @@ void GitClient::revert(const QStringList &files)
void GitClient::pull(const QString &workingDirectory)
{
executeGit(workingDirectory, QStringList(QLatin1String("pull")), m_plugin->outputWindow(), 0, true);
executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true);
}
void GitClient::push(const QString &workingDirectory)
{
executeGit(workingDirectory, QStringList(QLatin1String("push")), m_plugin->outputWindow(), 0, true);
executeGit(workingDirectory, QStringList(QLatin1String("push")), 0, true);
}
QString GitClient::msgNoChangedFiles()
@@ -829,7 +847,7 @@ void GitClient::stash(const QString &workingDirectory)
QString errorMessage;
switch (gitStatus(workingDirectory, false, 0, &errorMessage)) {
case StatusChanged:
executeGit(workingDirectory, QStringList(QLatin1String("stash")), m_plugin->outputWindow(), 0, true);
executeGit(workingDirectory, QStringList(QLatin1String("stash")), 0, true);
break;
case StatusUnchanged:
m_plugin->outputWindow()->append(msgNoChangedFiles());
@@ -846,21 +864,21 @@ void GitClient::stashPop(const QString &workingDirectory)
{
QStringList arguments(QLatin1String("stash"));
arguments << QLatin1String("pop");
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
executeGit(workingDirectory, arguments, 0, true);
}
void GitClient::branchList(const QString &workingDirectory)
{
QStringList arguments(QLatin1String("branch"));
arguments << QLatin1String("-r");
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
executeGit(workingDirectory, arguments, 0, true);
}
void GitClient::stashList(const QString &workingDirectory)
{
QStringList arguments(QLatin1String("stash"));
arguments << QLatin1String("list");
executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
executeGit(workingDirectory, arguments, 0, true);
}
QString GitClient::readConfig(const QString &workingDirectory, const QStringList &configVar)

View File

@@ -130,6 +130,10 @@ public:
public slots:
void show(const QString &source, const QString &id);
private slots:
void appendAndPopup(const QString &text);
void appendDataAndPopup(const QByteArray &data);
private:
VCSBase::VCSBaseEditor *createVCSEditor(const QString &kind,
QString title,
@@ -141,7 +145,6 @@ private:
void executeGit(const QString &workingDirectory,
const QStringList &arguments,
GitOutputWindow *outputWindow,
VCSBase::VCSBaseEditor* editor = 0,
bool outputToWindow = false);

View File

@@ -105,7 +105,6 @@ void GitOutputWindow::append(const QString &text)
foreach (const QString &s, lines)
m_outputListWidget->addItem(s);
m_outputListWidget->scrollToBottom();
popup();
}
void GitOutputWindow::setData(const QByteArray &data)

View File

@@ -496,7 +496,7 @@ QString GitPlugin::getWorkingDirectory()
if (workingDirectory.isEmpty()) {
m_outputWindow->clearContents();
m_outputWindow->append(tr("Could not find working directory"));
m_outputWindow->popup();
m_outputWindow->popup(false);
return QString();
}
return workingDirectory;
@@ -612,6 +612,7 @@ void GitPlugin::startCommit()
changeTmpFile->setAutoRemove(true);
if (!changeTmpFile->open()) {
m_outputWindow->append(tr("Cannot create temporary file: %1").arg(changeTmpFile->errorString()));
m_outputWindow->popup(false);
delete changeTmpFile;
return;
}

View File

@@ -77,7 +77,7 @@ QString SettingsPage::name() const
return tr("General");
}
QString SettingsPage::category() const
QString SettingsPage::category() const
{
return QLatin1String("Git");
}

View File

@@ -6,114 +6,97 @@
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>186</height>
<width>389</width>
<height>183</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="environmentGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Environment variables</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="pathlabel">
<property name="text">
<string>PATH:</string>
</property>
</widget>
<widget class="QGroupBox" name="environmentGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Environment variables</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="pathlabel">
<property name="text">
<string>PATH:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="pathLineEdit"/>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="pathLineEdit"/>
</item>
<item>
<widget class="QPushButton" name="adoptButton">
<property name="text">
<string>From system</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="noteLabel">
<item>
<widget class="QPushButton" name="adoptButton">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="noteFieldlabel">
<property name="text">
<string>Git needs to find Perl in the environment as well.</string>
<string>From system</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="noteLabel">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="noteFieldlabel">
<property name="text">
<string>Git needs to find Perl in the environment as well.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QFormLayout" name="logFormLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="1">
<widget class="QSpinBox" name="logCountSpinBox">
<property name="toolTip">
<string>Note that huge amount of commits might take some time.</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="logFormLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<item row="0" column="0">
<widget class="QLabel" name="logCountLabel">
<property name="text">
<string>Log commit display count:</string>
</property>
<item row="0" column="1">
<widget class="QSpinBox" name="logCountSpinBox">
<property name="toolTip">
<string>Note that huge amount of commits might take some time.</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="logCountLabel">
<property name="text">
<string>Log commit display count:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>

View File

@@ -626,7 +626,7 @@ QList<FolderNode*> DetailedModel::recursiveSubFolders(FolderNode *parentFolder)
FlatModel::FlatModel(SessionNode *rootNode, QObject *parent)
: QAbstractItemModel(parent),
m_filterProjects(true),
m_filterProjects(false),
m_filterGeneratedFiles(true),
m_rootNode(rootNode),
m_startupProject(0),
@@ -914,6 +914,8 @@ QModelIndex FlatModel::indexForNode(const Node *node_)
void FlatModel::setProjectFilterEnabled(bool filter)
{
if (filter == m_filterProjects)
return;
m_filterProjects = filter;
reset();
}

View File

@@ -90,6 +90,20 @@ protected:
if (event->reason() != Qt::PopupFocusReason)
QTreeView::focusOutEvent(event);
}
#ifdef Q_OS_MAC
void keyPressEvent(QKeyEvent *event)
{
if ((event->key() == Qt::Key_Return
|| event->key() == Qt::Key_Enter)
&& event->modifiers() == 0
&& currentIndex().isValid()) {
emit activated(currentIndex());
return;
}
QTreeView::keyPressEvent(event);
}
#endif
};
/*!

View File

@@ -45,6 +45,7 @@
#include <coreplugin/icore.h>
#include <QtCore/QDebug>
#include <QtGui/QApplication>
#include <QtGui/QBoxLayout>
#include <QtGui/QComboBox>
#include <QtGui/QTabWidget>
@@ -190,7 +191,14 @@ void ProjectWindow::updateTreeWidget()
// That one runs fully thorough and deletes all widgets, even that one that we are currently removing
// from m_panelsTabWidget.
// To prevent that, we simply prevent the focus switching....
m_treeWidget->setFocus();
QWidget *focusWidget = qApp->focusWidget();
while (focusWidget) {
if (focusWidget == this) {
m_treeWidget->setFocus();
break;
}
focusWidget = focusWidget->parentWidget();
}
m_treeWidget->clear();
foreach(Project *project, m_session->projects()) {

View File

@@ -628,8 +628,10 @@ bool SessionManager::loadImpl(const QString &fileName)
if (success) {
// restore the active mode
const QString &modeIdentifier = value(QLatin1String("ActiveMode")).toString();
if (!modeIdentifier.isEmpty())
if (!modeIdentifier.isEmpty()) {
m_core->modeManager()->activateMode(modeIdentifier);
m_core->modeManager()->setFocusToCurrentMode();
}
}
if (debug)

View File

@@ -498,12 +498,8 @@ void Qt4Project::updateCodeModel()
pinfo.sourceFiles = files;
modelmanager->updateProjectInfo(pinfo);
modelmanager->GC();
modelmanager->updateSourceFiles(pinfo.sourceFiles);
}
// update info
}

View File

@@ -54,14 +54,7 @@ QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry)
QString name = entryInfo.fileName();
QString directory = entryInfo.path();
QString filePath = entryInfo.filePath();
bool isDrive = false;
foreach (const QFileInfo &drive, QDir::drives()) {
if (filePath.startsWith(drive.path())) {
isDrive = true;
break;
}
}
if (!isDrive) {
if (entryInfo.isRelative()) {
if (filePath.startsWith("~/")) {
directory.replace(0, 1, QDir::homePath());
} else {

View File

@@ -54,8 +54,8 @@ class OpenDocumentsFilter : public QuickOpen::IQuickOpenFilter
public:
OpenDocumentsFilter(Core::EditorManager *editorManager);
QString trName() const { return tr("Open document"); }
QString name() const { return "Open document"; }
QString trName() const { return tr("Open documents"); }
QString name() const { return "Open documents"; }
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
void accept(QuickOpen::FilterEntry selection) const;

View File

@@ -128,12 +128,13 @@ protected:
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
int line,
int column)
int column,
const QString &editorKind)
{
Core::EditorManager *editorManager =
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager();
editorManager->addCurrentPositionToNavigationHistory(true);
Core::IEditor *editor = editorManager->openEditor(fileName, QString(), true);
Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true);
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
if (texteditor) {
texteditor->gotoLine(line, column);
@@ -684,6 +685,67 @@ void BaseTextEditor::selectBlockDown()
_q_matchParentheses();
}
void BaseTextEditor::moveLineUp()
{
moveLineUpDown(true);
}
void BaseTextEditor::moveLineDown()
{
moveLineUpDown(false);
}
void BaseTextEditor::moveLineUpDown(bool up)
{
QTextCursor cursor = textCursor();
QTextCursor move = cursor;
move.beginEditBlock();
bool hasSelection = cursor.hasSelection();
if (cursor.hasSelection()) {
move.setPosition(cursor.selectionStart());
move.movePosition(QTextCursor::StartOfBlock);
move.setPosition(cursor.selectionEnd(), QTextCursor::KeepAnchor);
move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
} else {
move.movePosition(QTextCursor::StartOfBlock);
move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
}
QString text = move.selectedText();
move.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
move.removeSelectedText();
if (up) {
move.movePosition(QTextCursor::PreviousBlock);
move.insertBlock();
move.movePosition(QTextCursor::Left);
} else {
move.movePosition(QTextCursor::EndOfBlock);
if (move.atBlockStart()) { // empty block
move.movePosition(QTextCursor::NextBlock);
move.insertBlock();
move.movePosition(QTextCursor::Left);
} else {
move.insertBlock();
}
}
int start = move.position();
move.clearSelection();
move.insertText(text);
int end = move.position();
if (hasSelection) {
move.setPosition(start);
move.setPosition(end, QTextCursor::KeepAnchor);
}
indent(document(), move, QChar::Null);
move.endEditBlock();
setTextCursor(move);
}
void BaseTextEditor::cleanWhitespace()
{
@@ -740,9 +802,13 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
QTextCursor cursor = textCursor();
if (d->m_inBlockSelectionMode)
cursor.clearSelection();
cursor.insertBlock();
if (d->m_document->tabSettings().m_autoIndent) {
cursor.beginEditBlock();
cursor.insertBlock();
indent(document(), cursor, QChar::Null);
cursor.endEditBlock();
} else {
cursor.insertBlock();
}
e->accept();
setTextCursor(cursor);
@@ -2451,7 +2517,7 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
}
} else if (e->button() == Qt::RightButton) {
QMenu * contextMenu = new QMenu(this);
emit d->m_editable->markContextMenuRequested(editableInterface(), cursor.blockNumber(), contextMenu);
emit d->m_editable->markContextMenuRequested(editableInterface(), cursor.blockNumber() + 1, contextMenu);
if (!contextMenu->isEmpty())
contextMenu->exec(e->globalPos());
delete contextMenu;
@@ -2702,6 +2768,8 @@ void BaseTextEditor::handleHomeKey(bool anchor)
while (character == tab || character.category() == QChar::Separator_Space) {
++pos;
if (pos == initpos)
break;
character = characterAt(pos);
}
@@ -2889,12 +2957,13 @@ void BaseTextEditor::markBlocksAsChanged(QList<int> blockNumbers) {
TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor *cursor, QChar c)
{
if (!TextEditDocumentLayout::hasParentheses(cursor->block()))
QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
return NoMatch;
Parentheses parenList = TextEditDocumentLayout::parentheses(cursor->block());
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
Parenthesis openParen, closedParen;
QTextBlock closedParenParag = cursor->block();
QTextBlock closedParenParag = block;
const int cursorPos = cursor->position() - closedParenParag.position();
int i = 0;
@@ -2919,7 +2988,8 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor
closedParenParag = closedParenParag.next();
if (!closedParenParag.isValid())
return NoMatch;
if (TextEditDocumentLayout::hasParentheses(closedParenParag)) {
if (TextEditDocumentLayout::hasParentheses(closedParenParag)
&& !TextEditDocumentLayout::ifdefedOut(closedParenParag)) {
parenList = TextEditDocumentLayout::parentheses(closedParenParag);
break;
}
@@ -2956,12 +3026,13 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor
TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCursor *cursor, QChar c)
{
if (!TextEditDocumentLayout::hasParentheses(cursor->block()))
QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
return NoMatch;
Parentheses parenList = TextEditDocumentLayout::parentheses(cursor->block());
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
Parenthesis openParen, closedParen;
QTextBlock openParenParag = cursor->block();
QTextBlock openParenParag = block;
const int cursorPos = cursor->position() - openParenParag.position();
int i = parenList.count() - 1;
@@ -2987,7 +3058,8 @@ TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCurs
if (!openParenParag.isValid())
return NoMatch;
if (TextEditDocumentLayout::hasParentheses(openParenParag)) {
if (TextEditDocumentLayout::hasParentheses(openParenParag)
&& !TextEditDocumentLayout::ifdefedOut(openParenParag)) {
parenList = TextEditDocumentLayout::parentheses(openParenParag);
break;
}
@@ -3029,7 +3101,7 @@ bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool se
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty()) {
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
for (int i = parenList.count()-1; i >= 0; --i) {
Parenthesis paren = parenList.at(i);
if (block == cursor->block() && position - block.position() <= paren.pos + 1)
@@ -3056,7 +3128,7 @@ bool TextBlockUserData::findNextClosingParenthesis(QTextCursor *cursor, bool sel
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty()) {
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
for (int i = 0; i < parenList.count(); ++i) {
Parenthesis paren = parenList.at(i);
if (block == cursor->block() && position - block.position() >= paren.pos)
@@ -3081,7 +3153,7 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorBackward(QTextCursor
cursor->clearSelection();
const QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block))
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
return NoMatch;
const int relPos = cursor->position() - block.position();
@@ -3103,7 +3175,7 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorForward(QTextCursor *
cursor->clearSelection();
const QTextBlock block = cursor->block();
if (!TextEditDocumentLayout::hasParentheses(block))
if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
return NoMatch;
const int relPos = cursor->position() - block.position();
@@ -3314,7 +3386,7 @@ void BaseTextEditorPrivate::moveCursorVisible()
if (!cursor.block().isVisible()) {
cursor.setVisualNavigation(true);
cursor.movePosition(QTextCursor::PreviousBlock);
q->setTextCursor(cursor);
q->setTextCursor(cursor);
}
q->ensureCursorVisible();
}

View File

@@ -230,7 +230,8 @@ public:
BaseTextEditor(QWidget *parent);
~BaseTextEditor();
static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0);
static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0,
const QString &editorKind = QString());
// EditorInterface
Core::IFile * file();
@@ -329,6 +330,9 @@ public slots:
void selectBlockUp();
void selectBlockDown();
void moveLineUp();
void moveLineDown();
void cleanWhitespace();
signals:
@@ -447,6 +451,7 @@ private:
void indentOrUnindent(bool doIndent);
void handleHomeKey(bool anchor);
void handleBackspaceKey();
void moveLineUpDown(bool up);
void toggleBlockVisible(const QTextBlock &block);
QRect collapseBox(const QTextBlock &block);

View File

@@ -66,6 +66,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>20</number>
</property>
@@ -132,6 +135,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>20</number>
</property>

View File

@@ -71,6 +71,7 @@ TextEditorActionHandler::TextEditorActionHandler(Core::ICore *core,
= m_gotoBlockStartAction = m_gotoBlockStartWithSelectionAction
= m_gotoBlockEndAction = m_gotoBlockEndWithSelectionAction
= m_selectBlockUpAction = m_selectBlockDownAction
= m_moveLineUpAction = m_moveLineDownAction
= 0;
m_contextId << m_core->uniqueIDManager()->uniqueIdentifier(context);
@@ -223,6 +224,16 @@ void TextEditorActionHandler::createActions()
command = am->registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown()));
m_moveLineUpAction= new QAction(tr("Move Line Up"), this);
command = am->registerAction(m_moveLineUpAction, Constants::MOVE_LINE_UP, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Up")));
connect(m_moveLineUpAction, SIGNAL(triggered()), this, SLOT(moveLineUp()));
m_moveLineDownAction= new QAction(tr("Move Line Down"), this);
command = am->registerAction(m_moveLineDownAction, Constants::MOVE_LINE_DOWN, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Down")));
connect(m_moveLineDownAction, SIGNAL(triggered()), this, SLOT(moveLineDown()));
}
bool TextEditorActionHandler::supportsAction(const QString & /*id */) const
@@ -287,6 +298,8 @@ void TextEditorActionHandler::updateActions(UpdateMode um)
m_gotoBlockEndWithSelectionAction->setEnabled(um != NoEditor);
m_selectBlockUpAction->setEnabled(um != NoEditor);
m_selectBlockDownAction->setEnabled(um != NoEditor);
m_moveLineUpAction->setEnabled(um != NoEditor);
m_moveLineDownAction->setEnabled(um != NoEditor);
m_visualizeWhitespaceAction->setEnabled(um != NoEditor);
if (m_currentEditor)
@@ -390,6 +403,8 @@ FUNCTION(gotoBlockStartWithSelection)
FUNCTION(gotoBlockEndWithSelection)
FUNCTION(selectBlockUp)
FUNCTION(selectBlockDown)
FUNCTION(moveLineUp)
FUNCTION(moveLineDown)
void TextEditorActionHandler::updateCurrentEditor(Core::IContext *object)
{

View File

@@ -116,6 +116,8 @@ private slots:
void gotoBlockEndWithSelection();
void selectBlockUp();
void selectBlockDown();
void moveLineUp();
void moveLineDown();
void updateCurrentEditor(Core::IContext *object);
private:
@@ -145,6 +147,8 @@ private:
QAction *m_gotoBlockEndWithSelectionAction;
QAction *m_selectBlockUpAction;
QAction *m_selectBlockDownAction;
QAction *m_moveLineUpAction;
QAction *m_moveLineDownAction;
uint m_optionalActions;
QPointer<BaseTextEditor> m_currentEditor;

View File

@@ -55,6 +55,8 @@ const char * const GOTO_BLOCK_END = "TextEditor.GotoBlockEnd";
const char * const GOTO_BLOCK_END_WITH_SELECTION = "TextEditor.GotoBlockEndWithSelection";
const char * const SELECT_BLOCK_UP = "TextEditor.SelectBlockUp";
const char * const SELECT_BLOCK_DOWN = "TextEditor.SelectBlockDown";
const char * const MOVE_LINE_UP = "TextEditor.MoveLineUp";
const char * const MOVE_LINE_DOWN = "TextEditor.MoveLineDown";
const char * const DELETE_LINE = "TextEditor.DeleteLine";
const char * const DELETE_WORD = "TextEditor.DeleteWord";
const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";