From 8b10d977673f67af7df2ea0550a5532f64b8b360 Mon Sep 17 00:00:00 2001 From: Aurindam Jana Date: Tue, 7 May 2013 11:05:22 +0200 Subject: Qnx: Add support for QML Profiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib87a39177120458155bbb657ff8c9b09e1a6ccb5 Reviewed-by: Tobias Nätterlund Reviewed-by: Aurindam Jana --- src/plugins/analyzerbase/ianalyzerengine.h | 1 + src/plugins/qmlprofiler/qmlprofilerengine.cpp | 9 +- src/plugins/qmlprofiler/qmlprofilerengine.h | 2 +- src/plugins/qnx/qnx.pro | 4 + src/plugins/qnx/qnx.qbs | 4 + src/plugins/qnx/qnxabstractrunsupport.cpp | 142 ++++++++++++++++++++++++++ src/plugins/qnx/qnxabstractrunsupport.h | 102 ++++++++++++++++++ src/plugins/qnx/qnxanalyzesupport.cpp | 134 ++++++++++++++++++++++++ src/plugins/qnx/qnxanalyzesupport.h | 74 ++++++++++++++ src/plugins/qnx/qnxdebugsupport.cpp | 81 +++++---------- src/plugins/qnx/qnxdebugsupport.h | 27 +---- src/plugins/qnx/qnxruncontrolfactory.cpp | 76 ++++++++++++-- 12 files changed, 560 insertions(+), 96 deletions(-) create mode 100644 src/plugins/qnx/qnxabstractrunsupport.cpp create mode 100644 src/plugins/qnx/qnxabstractrunsupport.h create mode 100644 src/plugins/qnx/qnxanalyzesupport.cpp create mode 100644 src/plugins/qnx/qnxanalyzesupport.h (limited to 'src') diff --git a/src/plugins/analyzerbase/ianalyzerengine.h b/src/plugins/analyzerbase/ianalyzerengine.h index 233564120a..deea4638ce 100644 --- a/src/plugins/analyzerbase/ianalyzerengine.h +++ b/src/plugins/analyzerbase/ianalyzerengine.h @@ -84,6 +84,7 @@ public: StartMode mode() const { return m_sp.startMode; } virtual void notifyRemoteSetupDone(quint16) {} + virtual void notifyRemoteFinished(bool) {} public slots: virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {} diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 6b0185685f..02398eff93 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -189,7 +189,7 @@ bool QmlProfilerEngine::start() } if (d->m_runner) { - connect(d->m_runner, SIGNAL(stopped()), this, SLOT(processEnded())); + connect(d->m_runner, SIGNAL(stopped()), this, SLOT(notifyRemoteFinished())); connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), this, SLOT(logApplicationMessage(QString,Utils::OutputFormat))); d->m_runner->start(); @@ -230,13 +230,16 @@ void QmlProfilerEngine::stop() } } -void QmlProfilerEngine::processEnded() +void QmlProfilerEngine::notifyRemoteFinished(bool success) { QTC_ASSERT(d->m_profilerState, return); switch (d->m_profilerState->currentState()) { case QmlProfilerStateManager::AppRunning : { - d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); + if (success) + d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); + else + d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled); AnalyzerManager::stopTool(); emit finished(); diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h index fe8cc47313..2a7d24998f 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.h +++ b/src/plugins/qmlprofiler/qmlprofilerengine.h @@ -62,7 +62,7 @@ public slots: void stop(); private slots: - void processEnded(); + void notifyRemoteFinished(bool success = true); void cancelProcess(); void logApplicationMessage(const QString &msg, Utils::OutputFormat format); diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index 8f71ef4a23..a50ed1d8b5 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -33,6 +33,8 @@ SOURCES += qnxplugin.cpp \ qnxdeviceconfigurationwizardpages.cpp \ qnxrunconfiguration.cpp \ qnxruncontrolfactory.cpp \ + qnxabstractrunsupport.cpp \ + qnxanalyzesupport.cpp \ qnxdebugsupport.cpp \ qnxdeploystepfactory.cpp \ qnxdeployconfigurationfactory.cpp \ @@ -123,6 +125,8 @@ HEADERS += qnxplugin.h\ qnxdeviceconfigurationwizardpages.h \ qnxrunconfiguration.h \ qnxruncontrolfactory.h \ + qnxabstractrunsupport.h \ + qnxanalyzesupport.h \ qnxdebugsupport.h \ qnxdeploystepfactory.h \ qnxdeployconfigurationfactory.h \ diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 530f180912..83d168aab3 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -188,6 +188,10 @@ QtcPlugin { "qnxbaseqtconfigwidget.h", "qnxbaseqtconfigwidget.ui", "qnxconstants.h", + "qnxabstractrunsupport.cpp", + "qnxabstractrunsupport.h", + "qnxanalyzesupport.cpp", + "qnxanalyzesupport.h", "qnxdebugsupport.cpp", "qnxdebugsupport.h", "qnxdeployconfiguration.cpp", diff --git a/src/plugins/qnx/qnxabstractrunsupport.cpp b/src/plugins/qnx/qnxabstractrunsupport.cpp new file mode 100644 index 0000000000..cb97aa36f9 --- /dev/null +++ b/src/plugins/qnx/qnxabstractrunsupport.cpp @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qnxabstractrunsupport.h" +#include "qnxrunconfiguration.h" + +#include +#include +#include +#include +#include +#include + +using namespace ProjectExplorer; +using namespace RemoteLinux; + +using namespace Qnx; +using namespace Qnx::Internal; + +QnxAbstractRunSupport::QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent) + : QObject(parent) + , m_remoteExecutable(runConfig->remoteExecutableFilePath()) + , m_commandPrefix(runConfig->commandPrefix()) + , m_device(DeviceKitInformation::device(runConfig->target()->kit())) + , m_state(Inactive) +{ + m_runner = new DeviceApplicationRunner(this); + m_portsGatherer = new DeviceUsedPortsGatherer(this); + + connect(m_portsGatherer, SIGNAL(error(QString)), SLOT(handleError(QString))); + connect(m_portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady())); +} + +void QnxAbstractRunSupport::handleAdapterSetupRequested() +{ + QTC_ASSERT(m_state == Inactive, return); + + m_state = GatheringPorts; + m_portsGatherer->start(m_device); +} + +void QnxAbstractRunSupport::handlePortListReady() +{ + QTC_ASSERT(m_state == GatheringPorts, return); + m_portList = m_device->freePorts(); + startExecution(); +} + +void QnxAbstractRunSupport::handleRemoteProcessStarted() +{ + m_state = Running; +} + +void QnxAbstractRunSupport::handleRemoteProcessFinished(bool) +{ +} + +void QnxAbstractRunSupport::setFinished() +{ + if (m_state != GatheringPorts && m_state != Inactive) + m_runner->stop(m_device->processSupport()->killProcessByNameCommandLine(executable()).toUtf8()); + + m_state = Inactive; +} + +QnxAbstractRunSupport::State QnxAbstractRunSupport::state() const +{ + return m_state; +} + +void QnxAbstractRunSupport::setState(QnxAbstractRunSupport::State state) +{ + m_state = state; +} + +DeviceApplicationRunner *QnxAbstractRunSupport::appRunner() const +{ + return m_runner; +} + +QString QnxAbstractRunSupport::commandPrefix() const +{ + return m_commandPrefix; +} + +const IDevice::ConstPtr QnxAbstractRunSupport::device() const +{ + return m_device; +} + +void QnxAbstractRunSupport::handleProgressReport(const QString &) +{ +} + +void QnxAbstractRunSupport::handleRemoteOutput(const QByteArray &) +{ +} + +void QnxAbstractRunSupport::handleError(const QString &) +{ +} + +bool QnxAbstractRunSupport::setPort(int &port) +{ + port = m_portsGatherer->getNextFreePort(&m_portList); + if (port == -1) { + handleError(tr("Not enough free ports on device for debugging.")); + return false; + } + return true; +} + +QString QnxAbstractRunSupport::executable() const +{ + return m_remoteExecutable; +} diff --git a/src/plugins/qnx/qnxabstractrunsupport.h b/src/plugins/qnx/qnxabstractrunsupport.h new file mode 100644 index 0000000000..1e37059774 --- /dev/null +++ b/src/plugins/qnx/qnxabstractrunsupport.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QNXABSTRACTRUNSUPPORT_H +#define QNXABSTRACTRUNSUPPORT_H + +#include +#include + +#include +#include + +namespace ProjectExplorer { +class DeviceApplicationRunner; +class DeviceUsedPortsGatherer; +} + +namespace Qnx { +namespace Internal { + +class QnxRunConfiguration; + +class QnxAbstractRunSupport : public QObject +{ + Q_OBJECT +protected: + enum State { + Inactive, + GatheringPorts, + StartingRemoteProcess, + Running + }; +public: + QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent = 0); + +protected: + bool setPort(int &port); + virtual void startExecution() = 0; + + virtual QString executable() const; + + void setFinished(); + + State state() const; + void setState(State state); + + ProjectExplorer::DeviceApplicationRunner *appRunner() const; + QString commandPrefix() const; + const ProjectExplorer::IDevice::ConstPtr device() const; + +protected slots: + virtual void handleAdapterSetupRequested(); + + virtual void handleRemoteProcessStarted(); + virtual void handleRemoteProcessFinished(bool); + virtual void handleProgressReport(const QString &progressOutput); + virtual void handleRemoteOutput(const QByteArray &output); + virtual void handleError(const QString &); + +private slots: + void handlePortListReady(); + +private: + ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer; + Utils::PortList m_portList; + const QString m_remoteExecutable; + const QString m_commandPrefix; + ProjectExplorer::IDevice::ConstPtr m_device; + ProjectExplorer::DeviceApplicationRunner *m_runner; + State m_state; +}; + +} // namespace Internal +} // namespace Qnx + +#endif // QNXABSTRACTRUNSUPPORT_H diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp new file mode 100644 index 0000000000..ac7cea766c --- /dev/null +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qnxanalyzesupport.h" + +#include +#include +#include + +#include + +using namespace ProjectExplorer; + +using namespace Qnx; +using namespace Qnx::Internal; + +QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig, + Analyzer::IAnalyzerEngine *engine) + : QnxAbstractRunSupport(runConfig, engine) + , m_engine(engine) + , m_qmlPort(-1) +{ + const DeviceApplicationRunner *runner = appRunner(); + connect(runner, SIGNAL(reportError(QString)), SLOT(handleError(QString))); + connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); + connect(runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool))); + connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); + connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); + connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); + + connect(m_engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), + SLOT(handleAdapterSetupRequested())); +} + +void QnxAnalyzeSupport::handleAdapterSetupRequested() +{ + QTC_ASSERT(state() == Inactive, return); + + showMessage(tr("Preparing remote side...\n"), Utils::NormalMessageFormat); + QnxAbstractRunSupport::handleAdapterSetupRequested(); +} + +void QnxAnalyzeSupport::startExecution() +{ + if (state() == Inactive) + return; + + if (!setPort(m_qmlPort) && m_qmlPort == -1) + return; + + setState(StartingRemoteProcess); + + const QString args = m_engine->startParameters().debuggeeArgs + + QString::fromLatin1(" -qmljsdebugger=port:%1,block").arg(m_qmlPort); + const QString command = QString::fromLatin1("%1 %2 %3").arg(commandPrefix(), executable(), args); + appRunner()->start(device(), command.toUtf8()); +} + +void QnxAnalyzeSupport::handleRemoteProcessStarted() +{ + QnxAbstractRunSupport::handleRemoteProcessStarted(); + if (m_engine) + m_engine->notifyRemoteSetupDone(m_qmlPort); +} + +void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success) +{ + if (m_engine || state() == Inactive) + return; + + if (!success) + showMessage(tr("The %1 process closed unexpectedly.").arg(executable()), + Utils::NormalMessageFormat); + m_engine->notifyRemoteFinished(success); +} + +void QnxAnalyzeSupport::handleProfilingFinished() +{ + setFinished(); +} + +void QnxAnalyzeSupport::handleProgressReport(const QString &progressOutput) +{ + showMessage(progressOutput + QLatin1Char('\n'), Utils::NormalMessageFormat); +} + +void QnxAnalyzeSupport::handleRemoteOutput(const QByteArray &output) +{ + QTC_ASSERT(state() == Inactive || state() == Running, return); + + showMessage(QString::fromUtf8(output), Utils::StdOutFormat); +} + +void QnxAnalyzeSupport::handleError(const QString &error) +{ + if (state() == Running) { + showMessage(error, Utils::ErrorMessageFormat); + } else if (state() != Inactive) { + showMessage(tr("Initial setup failed: %1").arg(error), Utils::NormalMessageFormat); + setFinished(); + } +} + +void QnxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format) +{ + if (state() != Inactive && m_engine) + m_engine->logApplicationMessage(msg, format); +} diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h new file mode 100644 index 0000000000..66fa580abd --- /dev/null +++ b/src/plugins/qnx/qnxanalyzesupport.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QNXANALYZESUPPORT_H +#define QNXANALYZESUPPORT_H + +#include "qnxabstractrunsupport.h" + +#include +#include + +namespace Analyzer { class IAnalyzerEngine; } + +namespace Qnx { +namespace Internal { + +class QnxRunConfiguration; + +class QnxAnalyzeSupport : public QnxAbstractRunSupport +{ + Q_OBJECT +public: + QnxAnalyzeSupport(QnxRunConfiguration *runConfig, Analyzer::IAnalyzerEngine *engine); + +public slots: + void handleProfilingFinished(); + +private slots: + void handleAdapterSetupRequested(); + + void handleRemoteProcessStarted(); + void handleRemoteProcessFinished(bool success); + void handleProgressReport(const QString &progressOutput); + void handleRemoteOutput(const QByteArray &output); + void handleError(const QString &error); + +private: + void startExecution(); + void showMessage(const QString &, Utils::OutputFormat); + + Analyzer::IAnalyzerEngine *m_engine; + int m_qmlPort; +}; + +} // namespace Internal +} // namespace Qnx + +#endif // QNXANALYZESUPPORT_H diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index fdc7b447c0..7b76080fc7 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include using namespace ProjectExplorer; @@ -50,66 +49,44 @@ using namespace Qnx; using namespace Qnx::Internal; QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerEngine *engine) - : QObject(engine) - , m_remoteExecutable(runConfig->remoteExecutableFilePath()) - , m_commandPrefix(runConfig->commandPrefix()) - , m_device(DeviceKitInformation::device(runConfig->target()->kit())) + : QnxAbstractRunSupport(runConfig, engine) , m_engine(engine) , m_pdebugPort(-1) , m_qmlPort(-1) , m_useCppDebugger(runConfig->extraAspect()->useCppDebugger()) , m_useQmlDebugger(runConfig->extraAspect()->useQmlDebugger()) - , m_state(Inactive) { - m_runner = new DeviceApplicationRunner(this); - m_portsGatherer = new DeviceUsedPortsGatherer(this); - - connect(m_portsGatherer, SIGNAL(error(QString)), SLOT(handleError(QString))); - connect(m_portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady())); - - connect(m_runner, SIGNAL(reportError(QString)), SLOT(handleError(QString))); - connect(m_runner, SIGNAL(remoteProcessStarted()), this, SLOT(handleRemoteProcessStarted())); - connect(m_runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool))); - connect(m_runner, SIGNAL(reportProgress(QString)), this, SLOT(handleProgressReport(QString))); - connect(m_runner, SIGNAL(remoteStdout(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); - connect(m_runner, SIGNAL(remoteStderr(QByteArray)), this, SLOT(handleRemoteOutput(QByteArray))); + const DeviceApplicationRunner *runner = appRunner(); + connect(runner, SIGNAL(reportError(QString)), SLOT(handleError(QString))); + connect(runner, SIGNAL(remoteProcessStarted()), SLOT(handleRemoteProcessStarted())); + connect(runner, SIGNAL(finished(bool)), SLOT(handleRemoteProcessFinished(bool))); + connect(runner, SIGNAL(reportProgress(QString)), SLOT(handleProgressReport(QString))); + connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); + connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray))); connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested())); } void QnxDebugSupport::handleAdapterSetupRequested() { - QTC_ASSERT(m_state == Inactive, return); + QTC_ASSERT(state() == Inactive, return); - m_state = GatheringPorts; if (m_engine) m_engine->showMessage(tr("Preparing remote side...\n"), Debugger::AppStuff); - m_portsGatherer->start(m_device); -} - -void QnxDebugSupport::handlePortListReady() -{ - QTC_ASSERT(m_state == GatheringPorts, return); - startExecution(); + QnxAbstractRunSupport::handleAdapterSetupRequested(); } void QnxDebugSupport::startExecution() { - if (m_state == Inactive) + if (state() == Inactive) return; - Utils::PortList portList = m_device->freePorts(); - if (m_useCppDebugger) - m_pdebugPort = m_portsGatherer->getNextFreePort(&portList); - if (m_useQmlDebugger) - m_qmlPort = m_portsGatherer->getNextFreePort(&portList); - - if ((m_useCppDebugger && m_pdebugPort == -1) || (m_useQmlDebugger && m_qmlPort == -1)) { - handleError(tr("Not enough free ports on device for debugging.")); + if (m_useCppDebugger && !setPort(m_pdebugPort)) + return; + if (m_useQmlDebugger && !setPort(m_qmlPort)) return; - } - m_state = StartingRemoteProcess; + setState(StartingRemoteProcess); if (m_useQmlDebugger) m_engine->startParameters().processArgs += QString::fromLocal8Bit(" -qmljsdebugger=port:%1,block").arg(m_qmlPort); @@ -117,27 +94,27 @@ void QnxDebugSupport::startExecution() QString remoteCommandLine; if (m_useCppDebugger) remoteCommandLine = QString::fromLatin1("%1 %2 %3") - .arg(m_commandPrefix, executable()).arg(m_pdebugPort); + .arg(commandPrefix(), executable()).arg(m_pdebugPort); else if (m_useQmlDebugger && !m_useCppDebugger) remoteCommandLine = QString::fromLatin1("%1 %2 %3") - .arg(m_commandPrefix, executable(), m_engine->startParameters().processArgs); + .arg(commandPrefix(), executable(), m_engine->startParameters().processArgs); - m_runner->start(m_device, remoteCommandLine.toUtf8()); + appRunner()->start(device(), remoteCommandLine.toUtf8()); } void QnxDebugSupport::handleRemoteProcessStarted() { - m_state = Debugging; + QnxAbstractRunSupport::handleRemoteProcessStarted(); if (m_engine) m_engine->notifyEngineRemoteSetupDone(m_pdebugPort, m_qmlPort); } void QnxDebugSupport::handleRemoteProcessFinished(bool success) { - if (m_engine || m_state == Inactive) + if (m_engine || state() == Inactive) return; - if (m_state == Debugging) { + if (state() == Running) { if (!success) m_engine->notifyInferiorIll(); @@ -152,17 +129,9 @@ void QnxDebugSupport::handleDebuggingFinished() setFinished(); } -void QnxDebugSupport::setFinished() -{ - if (m_state != GatheringPorts && m_state != Inactive) - m_runner->stop(m_device->processSupport()->killProcessByNameCommandLine(executable()).toUtf8()); - - m_state = Inactive; -} - QString QnxDebugSupport::executable() const { - return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : m_remoteExecutable; + return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : QnxAbstractRunSupport::executable(); } void QnxDebugSupport::handleProgressReport(const QString &progressOutput) @@ -173,7 +142,7 @@ void QnxDebugSupport::handleProgressReport(const QString &progressOutput) void QnxDebugSupport::handleRemoteOutput(const QByteArray &output) { - QTC_ASSERT(m_state == Inactive || m_state == Debugging, return); + QTC_ASSERT(state() == Inactive || state() == Running, return); if (m_engine) m_engine->showMessage(QString::fromUtf8(output), Debugger::AppOutput); @@ -181,12 +150,12 @@ void QnxDebugSupport::handleRemoteOutput(const QByteArray &output) void QnxDebugSupport::handleError(const QString &error) { - if (m_state == Debugging) { + if (state() == Running) { if (m_engine) { m_engine->showMessage(error, Debugger::AppError); m_engine->notifyInferiorIll(); } - } else if (m_state != Inactive) { + } else if (state() != Inactive) { setFinished(); if (m_engine) m_engine->notifyEngineRemoteSetupFailed(tr("Initial setup failed: %1").arg(error)); diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h index 891b6acd87..1bcb84016f 100644 --- a/src/plugins/qnx/qnxdebugsupport.h +++ b/src/plugins/qnx/qnxdebugsupport.h @@ -32,23 +32,16 @@ #ifndef QNX_INTERNAL_QNXDEBUGSUPPORT_H #define QNX_INTERNAL_QNXDEBUGSUPPORT_H -#include - -#include -#include +#include "qnxabstractrunsupport.h" namespace Debugger { class DebuggerEngine; } -namespace ProjectExplorer { -class DeviceApplicationRunner; -class DeviceUsedPortsGatherer; -} namespace Qnx { namespace Internal { class QnxRunConfiguration; -class QnxDebugSupport : public QObject +class QnxDebugSupport : public QnxAbstractRunSupport { Q_OBJECT public: @@ -66,34 +59,18 @@ private slots: void handleProgressReport(const QString &progressOutput); void handleRemoteOutput(const QByteArray &output); void handleError(const QString &error); - void handlePortListReady(); private: void startExecution(); - void setFinished(); QString executable() const; - enum State { - Inactive, - GatheringPorts, - StartingRemoteProcess, - Debugging - }; - - const QString m_remoteExecutable; - const QString m_commandPrefix; - ProjectExplorer::IDevice::ConstPtr m_device; - ProjectExplorer::DeviceApplicationRunner *m_runner; - ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer; Debugger::DebuggerEngine *m_engine; int m_pdebugPort; int m_qmlPort; bool m_useCppDebugger; bool m_useQmlDebugger; - - State m_state; }; } // namespace Internal diff --git a/src/plugins/qnx/qnxruncontrolfactory.cpp b/src/plugins/qnx/qnxruncontrolfactory.cpp index 29f58f2715..d80363b39f 100644 --- a/src/plugins/qnx/qnxruncontrolfactory.cpp +++ b/src/plugins/qnx/qnxruncontrolfactory.cpp @@ -33,6 +33,7 @@ #include "qnxconstants.h" #include "qnxrunconfiguration.h" #include "qnxdebugsupport.h" +#include "qnxanalyzesupport.h" #include "qnxqtversion.h" #include "qnxruncontrol.h" #include "qnxutils.h" @@ -44,6 +45,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -51,6 +56,7 @@ #include #include +using namespace Analyzer; using namespace Debugger; using namespace ProjectExplorer; using namespace Qnx; @@ -107,6 +113,32 @@ DebuggerStartParameters createStartParameters(const QnxRunConfiguration *runConf return params; } +AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig, RunMode mode) +{ + AnalyzerStartParameters params; + Target *target = runConfig->target(); + Kit *k = target->kit(); + + const IDevice::ConstPtr device = DeviceKitInformation::device(k); + if (device.isNull()) + return params; + + if (mode == QmlProfilerRunMode) + params.startMode = StartQmlRemote; + params.debuggee = runConfig->remoteExecutableFilePath(); + params.debuggeeArgs = runConfig->arguments(); + params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters(); + params.analyzerCmdPrefix = runConfig->commandPrefix(); + params.displayName = runConfig->displayName(); + params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString(); + params.analyzerHost = params.connParams.host; + params.analyzerPort = params.connParams.port; + + if (EnvironmentAspect *environment = runConfig->extraAspect()) + params.environment = environment->environment(); + + return params; +} QnxRunControlFactory::QnxRunControlFactory(QObject *parent) : IRunControlFactory(parent) @@ -115,7 +147,7 @@ QnxRunControlFactory::QnxRunControlFactory(QObject *parent) bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const { - if (mode != NormalRunMode && mode != DebugRunMode) + if (mode != NormalRunMode && mode != DebugRunMode && mode != QmlProfilerRunMode) return false; if (!runConfiguration->isEnabled() @@ -125,7 +157,7 @@ bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mo const QnxRunConfiguration * const rc = qobject_cast(runConfiguration); - if (mode == DebugRunMode) { + if (mode == DebugRunMode || mode == QmlProfilerRunMode) { const QnxDeviceConfiguration::ConstPtr dev = DeviceKitInformation::device(runConfiguration->target()->kit()) .dynamicCast(); if (dev.isNull()) @@ -141,16 +173,38 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo QnxRunConfiguration *rc = qobject_cast(runConfig); Q_ASSERT(rc); - if (mode == NormalRunMode) + switch (mode) { + case NormalRunMode: return new QnxRunControl(rc); + case DebugRunMode: { + const DebuggerStartParameters params = createStartParameters(rc); + DebuggerRunControl * const runControl = DebuggerPlugin::createDebugger(params, rc, errorMessage); + if (!runControl) + return 0; - const DebuggerStartParameters params = createStartParameters(rc); - DebuggerRunControl * const runControl = DebuggerPlugin::createDebugger(params, rc, errorMessage); - if (!runControl) - return 0; + QnxDebugSupport *debugSupport = new QnxDebugSupport(rc, runControl->engine()); + connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished())); - QnxDebugSupport *debugSupport = new QnxDebugSupport(rc, runControl->engine()); - connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished())); - - return runControl; + return runControl; + } + case QmlProfilerRunMode: { + IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode); + if (!tool) { + if (errorMessage) + *errorMessage = tr("No analyzer tool selected."); + return 0; + } + const AnalyzerStartParameters params = createAnalyzerStartParameters(rc, mode); + AnalyzerRunControl * const runControl = new AnalyzerRunControl(tool, params, runConfig); + QnxAnalyzeSupport * const analyzeSupport = new QnxAnalyzeSupport(rc, runControl->engine()); + connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished())); + return runControl; + } + case NoRunMode: + case CallgrindRunMode: + case MemcheckRunMode: + case DebugRunModeWithBreakOnMain: + QTC_ASSERT(false, return 0); + } + return 0; } -- cgit v1.2.1 From 21c821806db143239d1824af42eac2dcb216c76f Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 30 May 2013 12:57:41 +0200 Subject: Test: Correct path of loaded project for Mac Change-Id: I91e0126b0f66e1635c6c1427d9f22842eeafcdd9 Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index f90354e2b7..4dca818a7c 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -3582,11 +3582,10 @@ void DebuggerPlugin::testPythonDumpers() void DebuggerPluginPrivate::testPythonDumpers1() { m_testSuccess = true; - QString proFile = ICore::resourcePath() -#ifndef Q_OS_MAC - + QLatin1String("/../..") -#endif - + QLatin1String("/tests/manual/debugger/simple/simple.pro"); + QString proFile = ICore::resourcePath(); + if (Utils::HostOsInfo::isMacHost()) + proFile += QLatin1String("/../.."); + proFile += QLatin1String("/../../tests/manual/debugger/simple/simple.pro"); testLoadProject(proFile, TestCallBack(this, "testPythonDumpers2")); QVERIFY(m_testSuccess); QTestEventLoop::instance().enterLoop(20); @@ -3617,8 +3616,10 @@ void DebuggerPlugin::testStateMachine() void DebuggerPluginPrivate::testStateMachine1() { m_testSuccess = true; - QString proFile = ICore::resourcePath() - + QLatin1String("/../../tests/manual/debugger/simple/simple.pro"); + QString proFile = ICore::resourcePath(); + if (Utils::HostOsInfo::isMacHost()) + proFile += QLatin1String("/../.."); + proFile += QLatin1String("/../../tests/manual/debugger/simple/simple.pro"); testLoadProject(proFile, TestCallBack(this, "testStateMachine2")); QVERIFY(m_testSuccess); QTestEventLoop::instance().enterLoop(20); -- cgit v1.2.1 From b97422b710be8489c3798febcc82dc8cc6b86c3d Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 28 May 2013 14:14:07 +0200 Subject: QmlDesigner: Add container item support in node instances Change-Id: I30e0d11346b8c63188d052b46656e7ede179e55d Reviewed-by: Thomas Hartmann --- .../components/formeditor/formeditoritem.cpp | 6 ++-- .../components/formeditor/movemanipulator.cpp | 14 +++++--- .../components/formeditor/resizemanipulator.cpp | 14 ++++---- .../components/formeditor/resizemanipulator.h | 5 +-- .../components/formeditor/snappinglinecreator.cpp | 28 +++++++++++++-- .../components/formeditor/snappinglinecreator.h | 7 ++-- .../designercore/include/nodeinstance.h | 4 +++ .../qmldesigner/designercore/include/qmlitemnode.h | 6 ++++ .../designercore/include/qmlobjectnode.h | 3 ++ .../designercore/instances/nodeinstance.cpp | 40 ++++++++++++++++++++++ .../qmldesigner/designercore/model/qmlitemnode.cpp | 26 +++++++++++--- .../designercore/model/qmlobjectnode.cpp | 20 +++++++++++ 12 files changed, 147 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp index 17f556d15d..8bfcd04206 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp @@ -91,7 +91,7 @@ void FormEditorItem::updateGeometry() prepareGeometryChange(); m_boundingRect = qmlItemNode().instanceBoundingRect().adjusted(0, 0, 1., 1.); m_paintedBoundingRect = qmlItemNode().instancePaintedBoundingRect().united(m_boundingRect); - setTransform(qmlItemNode().instanceTransform()); + setTransform(qmlItemNode().instanceTransformWithContentTransform()); setTransform(m_attentionTransform, true); //the property for zValue is called z in QGraphicsObject if (qmlItemNode().instanceValue("z").isValid()) @@ -142,7 +142,7 @@ void FormEditorItem::setAttentionScale(double sinusScale) m_attentionTransform.translate(-centerPoint.x(), -centerPoint.y()); m_inverseAttentionTransform = m_attentionTransform.inverted(); prepareGeometryChange(); - setTransform(qmlItemNode().instanceTransform()); + setTransform(qmlItemNode().instanceTransformWithContentTransform()); setTransform(m_attentionTransform, true); } else { m_attentionTransform.reset(); @@ -391,7 +391,7 @@ SnapLineMap FormEditorItem::rightSnappingOffsets() const void FormEditorItem::updateSnappingLines(const QList &exceptionList, FormEditorItem *transformationSpaceItem) { - m_snappingLineCreator.update(exceptionList, transformationSpaceItem); + m_snappingLineCreator.update(exceptionList, transformationSpaceItem, this); } diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp index 4d35342924..b1e1800ddf 100644 --- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp @@ -116,8 +116,9 @@ void MoveManipulator::updateHashes() // foreach (FormEditorItem* item, m_itemList) // m_beginItemRectHash[item] = item->mapRectToParent(item->qmlItemNode().instanceBoundingRect()); + QTransform fromSceneToContentItemTransform = m_snapper.containerFormEditorItem()->qmlItemNode().instanceSceneContentItemTransform().inverted(); foreach (FormEditorItem* item, m_itemList) { - QPointF positionInParentSpace = m_snapper.containerFormEditorItem()->mapFromScene(m_beginPositionInSceneSpaceHash.value(item)); + QPointF positionInParentSpace = fromSceneToContentItemTransform.map(m_beginPositionInSceneSpaceHash.value(item)); m_beginItemRectHash[item].translate(positionInParentSpace - m_beginPositionHash.value(item)); m_beginPositionHash.insert(item, positionInParentSpace); } @@ -147,17 +148,19 @@ void MoveManipulator::begin(const QPointF &beginPoint) m_beginItemRectHash.insert(item, m_snapper.containerFormEditorItem()->mapRectFromItem(item, item->qmlItemNode().instanceBoundingRect())); } + QTransform fromContentItemToSceneTransform = m_snapper.containerFormEditorItem()->qmlItemNode().instanceSceneContentItemTransform(); foreach (FormEditorItem* item, m_itemList) { if (item && item->qmlItemNode().isValid()) { QPointF positionInParentSpace(item->qmlItemNode().instancePosition()); - QPointF positionInScenesSpace = m_snapper.containerFormEditorItem()->mapToScene(positionInParentSpace); + QPointF positionInScenesSpace = fromContentItemToSceneTransform.map(positionInParentSpace); m_beginPositionInSceneSpaceHash.insert(item, positionInScenesSpace); } } + QTransform fromSceneToContentItemTransform = m_snapper.containerFormEditorItem()->qmlItemNode().instanceSceneContentItemTransform().inverted(); foreach (FormEditorItem* item, m_itemList) { if (item && item->qmlItemNode().isValid()) { - QPointF positionInParentSpace = m_snapper.containerFormEditorItem()->mapFromScene(m_beginPositionInSceneSpaceHash.value(item)); + QPointF positionInParentSpace = fromSceneToContentItemTransform.map(m_beginPositionInSceneSpaceHash.value(item)); m_beginPositionHash.insert(item, positionInParentSpace); QmlAnchors anchors(item->qmlItemNode().anchors()); @@ -270,8 +273,9 @@ void MoveManipulator::update(const QPointF& updatePoint, Snapper::Snapping useSn if (m_itemList.isEmpty()) { return; } else { - QPointF updatePointInContainerSpace(m_snapper.containerFormEditorItem()->mapFromScene(updatePoint)); - QPointF beginPointInContainerSpace(m_snapper.containerFormEditorItem()->mapFromScene(m_beginPoint)); + QTransform fromSceneToContentItemTransform = m_snapper.containerFormEditorItem()->qmlItemNode().instanceSceneContentItemTransform().inverted(); + QPointF updatePointInContainerSpace(fromSceneToContentItemTransform.map(updatePoint)); + QPointF beginPointInContainerSpace(fromSceneToContentItemTransform.map(m_beginPoint)); QPointF offsetVector(updatePointInContainerSpace - beginPointInContainerSpace); diff --git a/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp index 5d92f0f4aa..e35b2ede56 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp @@ -77,8 +77,9 @@ void ResizeManipulator::begin(const QPointF &/*beginPoint*/) if (m_resizeController.isValid()) { m_isActive = true; m_beginBoundingRect = m_resizeController.formEditorItem()->qmlItemNode().instanceBoundingRect(); - m_beginToSceneTransform = m_resizeController.formEditorItem()->qmlItemNode().instanceSceneTransform(); - m_beginFromSceneTransform = m_beginToSceneTransform.inverted(); + m_beginFromContentItemToSceneTransform = m_resizeController.formEditorItem()->qmlItemNode().instanceSceneContentItemTransform(); + m_beginFromSceneToContentItemTransform = m_beginFromContentItemToSceneTransform.inverted(); + m_beginFromItemToSceneTransform = m_resizeController.formEditorItem()->qmlItemNode().instanceSceneTransform(); m_beginToParentTransform = m_resizeController.formEditorItem()->qmlItemNode().instanceTransform(); m_rewriterTransaction = m_view->beginRewriterTransaction(); m_snapper.updateSnappingLines(m_resizeController.formEditorItem()); @@ -116,7 +117,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapper::Snapping use if (!containerItem) return; - QPointF updatePointInLocalSpace = m_beginFromSceneTransform.map(updatePoint); + QPointF updatePointInLocalSpace = m_beginFromSceneToContentItemTransform.map(updatePoint); QmlAnchors anchors(formEditorItem->qmlItemNode().anchors()); QRectF boundingRect(m_beginBoundingRect); @@ -372,7 +373,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapper::Snapping use if (snap) m_graphicsLineList = m_snapper.generateSnappingLines(boundingRect, m_layerItem.data(), - m_beginToSceneTransform); + m_beginFromItemToSceneTransform); } } @@ -484,8 +485,9 @@ void ResizeManipulator::clear() deleteSnapLines(); m_beginBoundingRect = QRectF(); - m_beginFromSceneTransform = QTransform(); - m_beginToSceneTransform = QTransform(); + m_beginFromSceneToContentItemTransform = QTransform(); + m_beginFromContentItemToSceneTransform = QTransform(); + m_beginFromItemToSceneTransform = QTransform(); m_beginToParentTransform = QTransform(); m_beginTopMargin = 0.0; m_beginLeftMargin = 0.0; diff --git a/src/plugins/qmldesigner/components/formeditor/resizemanipulator.h b/src/plugins/qmldesigner/components/formeditor/resizemanipulator.h index 61a8e23044..2654a36598 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizemanipulator.h +++ b/src/plugins/qmldesigner/components/formeditor/resizemanipulator.h @@ -72,8 +72,9 @@ private: QWeakPointer m_view; QList m_graphicsLineList; ResizeController m_resizeController; // hold the controller so that the handle cant be deleted - QTransform m_beginFromSceneTransform; - QTransform m_beginToSceneTransform; + QTransform m_beginFromSceneToContentItemTransform; + QTransform m_beginFromContentItemToSceneTransform; + QTransform m_beginFromItemToSceneTransform; QTransform m_beginToParentTransform; QRectF m_beginBoundingRect; QPointF m_beginBottomRightPoint; diff --git a/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.cpp b/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.cpp index 83ea59b3f5..0179af9d36 100644 --- a/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.cpp @@ -32,6 +32,8 @@ #include "formeditoritem.h" #include "formeditorview.h" +#include + namespace QmlDesigner { SnappingLineCreator::SnappingLineCreator(FormEditorItem *formEditorItem) @@ -117,7 +119,7 @@ void SnappingLineCreator::generateLines(const QList &exceptionL } } -void SnappingLineCreator::setContainerPadding(double containerPadding) +void SnappingLineCreator::setContainerPaddingByGloablPadding(double containerPadding) { m_topPadding = containerPadding; m_bottomPadding = containerPadding; @@ -125,6 +127,14 @@ void SnappingLineCreator::setContainerPadding(double containerPadding) m_rightPadding = containerPadding; } +void SnappingLineCreator::setContainerPaddingByContentItem(const QRectF &contentRectangle, const QRectF &itemBoundingRectangle) +{ + m_topPadding = contentRectangle.top() - itemBoundingRectangle.top(); + m_bottomPadding = itemBoundingRectangle.bottom() - contentRectangle.bottom(); + m_leftPadding = contentRectangle.left() - itemBoundingRectangle.left(); + m_rightPadding = itemBoundingRectangle.right() - contentRectangle.right(); +} + void SnappingLineCreator::setSpacing(double spacing) { m_topOffset = spacing; @@ -134,10 +144,11 @@ void SnappingLineCreator::setSpacing(double spacing) } void SnappingLineCreator::update(const QList &exceptionList, - FormEditorItem *transformationSpaceItem) + FormEditorItem *transformationSpaceItem, + FormEditorItem *containerFormEditorItem) { clearLines(); - setContainerPadding(m_formEditorItem->formEditorView()->containerPadding()); + setContainerPaddingItem(containerFormEditorItem); setSpacing(m_formEditorItem->formEditorView()->spacing()); generateLines(exceptionList, transformationSpaceItem); } @@ -192,4 +203,15 @@ SnapLineMap SnappingLineCreator::rightOffsets() const return m_rightOffsetMap; } +void SnappingLineCreator::setContainerPaddingItem(FormEditorItem *transformationSpaceItem) +{ + QmlItemNode containerItemNode = transformationSpaceItem->qmlItemNode(); + QRectF contentRect = containerItemNode.instanceContentItemBoundingRect(); + + if (contentRect.isValid()) + setContainerPaddingByContentItem(contentRect, containerItemNode.instanceBoundingRect()); + else + setContainerPaddingByGloablPadding(m_formEditorItem->formEditorView()->containerPadding()); +} + } diff --git a/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.h b/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.h index 7c6adc804b..e3b4e7e2ac 100644 --- a/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.h +++ b/src/plugins/qmldesigner/components/formeditor/snappinglinecreator.h @@ -48,7 +48,8 @@ public: SnappingLineCreator(FormEditorItem *formEditorItem); void update(const QList &exceptionList, - FormEditorItem *transformationSpaceItem); + FormEditorItem *transformationSpaceItem, + FormEditorItem *containerFormEditorItem); SnapLineMap topLines() const; @@ -63,7 +64,9 @@ public: SnapLineMap leftOffsets() const; SnapLineMap rightOffsets() const; - void setContainerPadding(double containerPadding); + void setContainerPaddingItem(FormEditorItem *transformationSpaceItem); + void setContainerPaddingByGloablPadding(double containerPadding); + void setContainerPaddingByContentItem(const QRectF &contentRectangle, const QRectF &itemBoundingRectangle); void setSpacing(double spacing); protected: diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstance.h b/src/plugins/qmldesigner/designercore/include/nodeinstance.h index 284059f103..2f21d5cd1e 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstance.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstance.h @@ -59,6 +59,7 @@ public: bool isValid() const; void makeInvalid(); QRectF boundingRect() const; + QRectF contentItemBoundingRect() const; bool hasContent() const; bool isAnchoredBySibling() const; bool isAnchoredByChildren() const; @@ -66,6 +67,7 @@ public: bool isResizable() const; QTransform transform() const; QTransform contentTransform() const; + QTransform contentItemTransform() const; QTransform sceneTransform() const; bool isInLayoutable() const; QPointF position() const; @@ -93,8 +95,10 @@ protected: InformationName setInformationSize(const QSizeF &size); InformationName setInformationBoundingRect(const QRectF &rectangle); + InformationName setInformationContentItemBoundingRect(const QRectF &rectangle); InformationName setInformationTransform(const QTransform &transform); InformationName setInformationContentTransform(const QTransform &contentTransform); + InformationName setInformationContentItemTransform(const QTransform &contentItemTransform); InformationName setInformationPenWith(int penWidth); InformationName setInformationPosition(const QPointF &position); InformationName setInformationIsInLayoutable(bool isInLayoutable); diff --git a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h index 1d37ad4416..cebb50b590 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h @@ -53,6 +53,8 @@ public: bool isValid() const; bool isRootNode() const; + static bool isItemOrWindow(const ModelNode &modelNode); + QmlModelStateGroup states() const; QList children() const; QList resources() const; @@ -75,8 +77,12 @@ public: QRectF instanceBoundingRect() const; QRectF instancePaintedBoundingRect() const; + QRectF instanceContentItemBoundingRect() const; QTransform instanceTransform() const; + QTransform instanceTransformWithContentTransform() const; + QTransform instanceTransformWithContentItemTransform() const; QTransform instanceSceneTransform() const; + QTransform instanceSceneContentItemTransform() const; QPointF instanceScenePosition() const; QPointF instancePosition() const; QSizeF instanceSize() const; diff --git a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h index bbbecdbe6f..092b19f6c0 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h @@ -50,8 +50,10 @@ public: bool hasNodeParent() const; bool hasInstanceParent() const; + bool hasInstanceParentItem() const; void setParentProperty(const NodeAbstractProperty &parentProeprty); QmlObjectNode instanceParent() const; + QmlItemNode instanceParentItem() const; void setId(const QString &id); QString id() const; @@ -105,6 +107,7 @@ public: protected: NodeInstance nodeInstance() const; QmlObjectNode nodeForInstance(const NodeInstance &instance) const; + QmlItemNode itemForInstance(const NodeInstance &instance) const; protected: QList allDefinedStates() const; diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp index e787d46c39..efc4ad080b 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp @@ -53,10 +53,12 @@ public: qint32 parentInstanceId; ModelNode modelNode; QRectF boundingRect; + QRectF contentItemBoundingRect; QPointF position; QSizeF size; QTransform transform; QTransform contentTransform; + QTransform contentItemTransform; QTransform sceneTransform; int penWidth; bool isAnchoredBySibling; @@ -144,6 +146,14 @@ QRectF NodeInstance::boundingRect() const return QRectF(); } +QRectF NodeInstance::contentItemBoundingRect() const +{ + if (isValid()) + return d->contentItemBoundingRect; + else + return QRectF(); +} + bool NodeInstance::hasContent() const { if (isValid()) @@ -199,6 +209,14 @@ QTransform NodeInstance::contentTransform() const else return QTransform(); } + +QTransform NodeInstance::contentItemTransform() const +{ + if (isValid()) + return d->contentItemTransform; + else + return QTransform(); +} QTransform NodeInstance::sceneTransform() const { if (isValid()) @@ -333,6 +351,16 @@ InformationName NodeInstance::setInformationBoundingRect(const QRectF &rectangle return NoInformationChange; } +InformationName NodeInstance::setInformationContentItemBoundingRect(const QRectF &rectangle) +{ + if (d->contentItemBoundingRect != rectangle) { + d->contentItemBoundingRect = rectangle; + return ContentItemBoundingRect; + } + + return NoInformationChange; +} + InformationName NodeInstance::setInformationTransform(const QTransform &transform) { if (d->transform != transform) { @@ -353,6 +381,16 @@ InformationName NodeInstance::setInformationContentTransform(const QTransform &c return NoInformationChange; } +InformationName NodeInstance::setInformationContentItemTransform(const QTransform &contentItemTransform) +{ + if (d->contentItemTransform != contentItemTransform) { + d->contentItemTransform = contentItemTransform; + return ContentItemTransform; + } + + return NoInformationChange; +} + InformationName NodeInstance::setInformationPenWith(int penWidth) { if (d->penWidth != penWidth) { @@ -489,8 +527,10 @@ InformationName NodeInstance::setInformation(InformationName name, const QVarian switch (name) { case Size: return setInformationSize(information.toSizeF()); case BoundingRect: return setInformationBoundingRect(information.toRectF()); + case ContentItemBoundingRect: setInformationContentItemBoundingRect(information.toRectF()); case Transform: return setInformationTransform(information.value()); case ContentTransform: return setInformationContentTransform(information.value()); + case ContentItemTransform: return setInformationContentItemTransform(information.value()); case PenWidth: return setInformationPenWith(information.toInt()); case Position: return setInformationPosition(information.toPointF()); case IsInLayoutable: return setInformationIsInLayoutable(information.toBool()); diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index f9626b18fc..0da7a5445c 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -37,9 +37,7 @@ namespace QmlDesigner { -namespace { - -bool isItemOrWindow(const ModelNode &modelNode) +bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode) { if (modelNode.metaInfo().isSubclassOf("QtQuick.Item", -1, -1)) return true; @@ -50,8 +48,6 @@ bool isItemOrWindow(const ModelNode &modelNode) return false; } -} - bool QmlItemNode::isValid() const { return QmlModelNodeFacade::isValid() && modelNode().metaInfo().isValid() && isItemOrWindow(modelNode()); @@ -239,16 +235,36 @@ QRectF QmlItemNode::instancePaintedBoundingRect() const return nodeInstance().boundingRect(); } +QRectF QmlItemNode::instanceContentItemBoundingRect() const +{ + return nodeInstance().contentItemBoundingRect(); +} + QTransform QmlItemNode::instanceTransform() const { return nodeInstance().transform(); } +QTransform QmlItemNode::instanceTransformWithContentTransform() const +{ + return nodeInstance().transform() * nodeInstance().contentTransform(); +} + +QTransform QmlItemNode::instanceTransformWithContentItemTransform() const +{ + return nodeInstance().transform() * nodeInstance().contentItemTransform(); +} + QTransform QmlItemNode::instanceSceneTransform() const { return nodeInstance().sceneTransform(); } +QTransform QmlItemNode::instanceSceneContentItemTransform() const +{ + return nodeInstance().sceneTransform() * nodeInstance().contentItemTransform(); +} + QPointF QmlItemNode::instanceScenePosition() const { QmlItemNode parentNode = instanceParent().toQmlItemNode(); diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 42643ed82f..42c41dc6ab 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -444,6 +444,11 @@ QmlObjectNode QmlObjectNode::nodeForInstance(const NodeInstance &instance) const return QmlObjectNode(ModelNode(instance.modelNode(), qmlModelView())); } +QmlItemNode QmlObjectNode::itemForInstance(const NodeInstance &instance) const +{ + return QmlItemNode(ModelNode(instance.modelNode(), qmlModelView())); +} + bool QmlObjectNode::hasNodeParent() const { return modelNode().hasParentProperty(); @@ -454,6 +459,13 @@ bool QmlObjectNode::hasInstanceParent() const return nodeInstance().parentId() >= 0 && qmlModelView()->nodeInstanceView()->hasInstanceForId(nodeInstance().parentId()); } +bool QmlObjectNode::hasInstanceParentItem() const +{ + return nodeInstance().parentId() >= 0 + && qmlModelView()->nodeInstanceView()->hasInstanceForId(nodeInstance().parentId()) + && QmlItemNode::isItemOrWindow(qmlModelView()->modelNodeForInternalId(nodeInstance().parentId())); +} + void QmlObjectNode::setParentProperty(const NodeAbstractProperty &parentProeprty) { @@ -468,6 +480,14 @@ QmlObjectNode QmlObjectNode::instanceParent() const return QmlObjectNode(); } +QmlItemNode QmlObjectNode::instanceParentItem() const +{ + if (hasInstanceParentItem()) + return itemForInstance(qmlModelView()->nodeInstanceView()->instanceForId(nodeInstance().parentId())); + + return QmlItemNode(); +} + void QmlObjectNode::setId(const QString &id) { modelNode().setId(id); -- cgit v1.2.1 From d080c54327391df7e658ad99c424c75b898dd92c Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 30 May 2013 14:14:42 +0200 Subject: Qbs: Actually emit signal that parsing started The logic to disable building depends on this signal. Change-Id: I2341ddb70eebeb25c8c4ffdbbb1e5a83945fb971 Reviewed-by: Tobias Hunger --- src/plugins/qbsprojectmanager/qbsproject.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index f01cdd4e52..92f7efbf52 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -385,6 +385,8 @@ void QbsProject::parse(const QVariantMap &config, const QString &dir) this, SLOT(handleQbsParsingTaskSetup(QString,int))); connect(m_qbsSetupProjectJob, SIGNAL(taskProgress(int,qbs::AbstractJob*)), this, SLOT(handleQbsParsingProgress(int))); + + emit projectParsingStarted(); } void QbsProject::prepareForParsing() -- cgit v1.2.1 From 271a96b19a17083d2cd7d2350aa83d3c11b462d3 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Wed, 29 May 2013 14:04:33 +0200 Subject: qmljs: moving all mime types into qmljstools This reduces uneeded dependencies for modules that need the types like the qbs module. Change-Id: I59a6067a4c24a6d0401bf57fdfa8f5dc1f03595c Reviewed-by: Kai Koehne Reviewed-by: Tobias Hunger Reviewed-by: Orgad Shaneh --- src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml | 42 ----------------------- src/plugins/qmljseditor/qmljseditor.pro | 1 - src/plugins/qmljseditor/qmljseditor.qbs | 1 - src/plugins/qmljseditor/qmljseditor.qrc | 1 - src/plugins/qmljseditor/qmljseditorplugin.cpp | 4 --- src/plugins/qmljstools/QmlJSTools.mimetypes.xml | 42 +++++++++++++++++++++++ src/plugins/qmljstools/qmljstools.pro | 3 ++ src/plugins/qmljstools/qmljstools.qbs | 1 + src/plugins/qmljstools/qmljstools.qrc | 1 + src/plugins/qmljstools/qmljstoolsplugin.cpp | 5 +++ 10 files changed, 52 insertions(+), 49 deletions(-) delete mode 100644 src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml create mode 100644 src/plugins/qmljstools/QmlJSTools.mimetypes.xml (limited to 'src') diff --git a/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml b/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml deleted file mode 100644 index a1bdef531e..0000000000 --- a/src/plugins/qmljseditor/QmlJSEditor.mimetypes.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - QML file - - - - - - Qt Build Suite file - - - - - - Qt Creator Qt UI project file - - - - - - QML file - - - - - - - - Qt Script file - - - - - - - JSON file - - - diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro index d6201be052..9a40aa33ea 100644 --- a/src/plugins/qmljseditor/qmljseditor.pro +++ b/src/plugins/qmljseditor/qmljseditor.pro @@ -68,7 +68,6 @@ SOURCES += \ qmljswrapinloader.cpp RESOURCES += qmljseditor.qrc -OTHER_FILES += QmlJSEditor.mimetypes.xml FORMS += \ quicktoolbarsettingspage.ui \ diff --git a/src/plugins/qmljseditor/qmljseditor.qbs b/src/plugins/qmljseditor/qmljseditor.qbs index 32d3ef4d35..72c9294c14 100644 --- a/src/plugins/qmljseditor/qmljseditor.qbs +++ b/src/plugins/qmljseditor/qmljseditor.qbs @@ -17,7 +17,6 @@ QtcPlugin { Depends { name: "CPlusPlus" } files: [ - "QmlJSEditor.mimetypes.xml", "jsfilewizard.cpp", "jsfilewizard.h", "qmlexpressionundercursor.cpp", diff --git a/src/plugins/qmljseditor/qmljseditor.qrc b/src/plugins/qmljseditor/qmljseditor.qrc index 38e57bac80..35ecba5f6e 100644 --- a/src/plugins/qmljseditor/qmljseditor.qrc +++ b/src/plugins/qmljseditor/qmljseditor.qrc @@ -1,6 +1,5 @@ - QmlJSEditor.mimetypes.xml images/qmlfile.png diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 21044644d2..afaafd6c33 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -53,7 +53,6 @@ #include #include -#include #include #include #include @@ -114,9 +113,6 @@ QmlJSEditorPlugin::~QmlJSEditorPlugin() bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { - if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/qmljseditor/QmlJSEditor.mimetypes.xml"), errorMessage)) - return false; - m_modelManager = QmlJS::ModelManagerInterface::instance(); addAutoReleasedObject(new QmlJSSnippetProvider); diff --git a/src/plugins/qmljstools/QmlJSTools.mimetypes.xml b/src/plugins/qmljstools/QmlJSTools.mimetypes.xml new file mode 100644 index 0000000000..a1bdef531e --- /dev/null +++ b/src/plugins/qmljstools/QmlJSTools.mimetypes.xml @@ -0,0 +1,42 @@ + + + + + + QML file + + + + + + Qt Build Suite file + + + + + + Qt Creator Qt UI project file + + + + + + QML file + + + + + + + + Qt Script file + + + + + + + JSON file + + + diff --git a/src/plugins/qmljstools/qmljstools.pro b/src/plugins/qmljstools/qmljstools.pro index 93021dd6a8..c3fdd89e7d 100644 --- a/src/plugins/qmljstools/qmljstools.pro +++ b/src/plugins/qmljstools/qmljstools.pro @@ -60,6 +60,9 @@ SOURCES += \ RESOURCES += \ qmljstools.qrc +OTHER_FILES += \ + QmlJSTools.mimetypes.xml + FORMS += \ $$PWD/qmljscodestylesettingspage.ui diff --git a/src/plugins/qmljstools/qmljstools.qbs b/src/plugins/qmljstools/qmljstools.qbs index 682dc34de1..dc8b1f78b2 100644 --- a/src/plugins/qmljstools/qmljstools.qbs +++ b/src/plugins/qmljstools/qmljstools.qbs @@ -20,6 +20,7 @@ QtcPlugin { cpp.includePaths: base.concat("../../libs/3rdparty") files: [ + "QmlJSTools.mimetypes.xml", "qmljsbundleprovider.cpp", "qmljsbundleprovider.h", "qmljscodestylepreferencesfactory.cpp", diff --git a/src/plugins/qmljstools/qmljstools.qrc b/src/plugins/qmljstools/qmljstools.qrc index 9e396a3995..ab7f6f798c 100644 --- a/src/plugins/qmljstools/qmljstools.qrc +++ b/src/plugins/qmljstools/qmljstools.qrc @@ -6,5 +6,6 @@ images/log.png images/expand.png images/error.png + QmlJSTools.mimetypes.xml diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp index 0d2889019c..50d76d8427 100644 --- a/src/plugins/qmljstools/qmljstoolsplugin.cpp +++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,10 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) + if (!Core::ICore::mimeDatabase() + ->addMimeTypes(QLatin1String(":/qmljstools/QmlJSTools.mimetypes.xml"), error)) + return false; + m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings // Objects -- cgit v1.2.1 From f2631ad031d936fb2a2e2ceeec39ff870bd9f6c8 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 30 May 2013 15:03:54 +0200 Subject: C++: do not strip trailing newlines in the preprocessor output. Doing so resulted in an incorrect position for the EOF token when the preprocessed output would be parsed. That in turn leads to incorrect insertion positions for refactoring actions. This is especially true when a file contains only preprocessor directives: the EOF token would point to line 1 column 1, which is usually not the place where code should be inserted. Change-Id: I7d359aa7a6c04bc52c8b873fd49ad6afc3a77319 Reviewed-by: hjk --- src/libs/cplusplus/pp-engine.cpp | 15 --------------- src/libs/cplusplus/pp-engine.h | 1 - src/plugins/cppeditor/cppquickfix_test.cpp | 20 ++++++++++---------- 3 files changed, 10 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 91aa73efb9..77ff055b1b 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1332,19 +1332,6 @@ void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine) adjustForCommentOrStringNewlines(&m_env->currentLine, tk); } -void Preprocessor::removeTrailingOutputLines() -{ - QByteArray &buffer = currentOutputBuffer(); - int i = buffer.size() - 1; - while (i >= 0 && buffer.at(i) == '\n') - --i; - const int mightChop = buffer.size() - i - 1; - if (mightChop > 1) { - // Keep one new line at end. - buffer.chop(mightChop - 1); - } -} - std::size_t Preprocessor::computeDistance(const Preprocessor::PPToken &tk, bool forceTillLine) { // Find previous non-space character or line begin. @@ -1450,8 +1437,6 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source, } while (tk.isNot(T_EOF_SYMBOL)); - removeTrailingOutputLines(); - if (includeGuardMacroName) { if (m_state.m_includeGuardState == State::IncludeGuardState_AfterDefine || m_state.m_includeGuardState == State::IncludeGuardState_AfterEndif) diff --git a/src/libs/cplusplus/pp-engine.h b/src/libs/cplusplus/pp-engine.h index f118a00da4..2614c107b1 100644 --- a/src/libs/cplusplus/pp-engine.h +++ b/src/libs/cplusplus/pp-engine.h @@ -237,7 +237,6 @@ private: void maybeStartOutputLine(); void generateOutputLineMarker(unsigned lineno); void synchronizeOutputLines(const PPToken &tk, bool forceLine = false); - void removeTrailingOutputLines(); void enforceSpacing(const PPToken &tk, bool forceSpacing = false); static std::size_t computeDistance(const PPToken &tk, bool forceTillLine = false); diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 17823ecade..74e64c8766 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -842,17 +842,17 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_headerSource_namespace2() // Source File original = - "#include \"file.h\"\n" - "using namespace N;\n" - "\n" - ; + "#include \"file.h\"\n" + "using namespace N;\n" + ; expected = original + - "\n" - "Foo::Foo()\n" - "{\n\n" - "}\n" - "\n" - ; + "\n" + "\n" + "Foo::Foo()\n" + "{\n\n" + "}\n" + "\n" + ; testFiles << TestDocument::create(original, expected, QLatin1String("file.cpp")); InsertDefFromDecl factory; -- cgit v1.2.1 From 77c136646b29ffcbe14c4ca2e96fa73e7f114405 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Tue, 28 May 2013 21:23:58 +0200 Subject: Gerrit - Removed all patch set stuff Change-Id: I013c116fc7e0ac1571513005b8ea49992e0771a3 Reviewed-by: Friedemann Kleint Reviewed-by: Orgad Shaneh Reviewed-by: Jarek Kobus --- src/plugins/git/gerrit/gerritplugin.cpp | 121 ++++++++------------------------ src/plugins/git/gitclient.cpp | 6 +- src/plugins/git/gitclient.h | 3 +- 3 files changed, 34 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index c1687fb797..c05af4310c 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -106,28 +106,23 @@ private slots: void processReadyReadStandardOutput(); private: - // State enumeration. It starts in 'FetchState' and then - // branches to 'WritePatchFileState', 'CherryPickState' - // or 'CheckoutState' depending on FetchMode. enum State { - FetchState, // Fetch patch - WritePatchFileState, // Write patch to a file + FetchState, DoneState, ErrorState }; void handleError(const QString &message); - void startWritePatchFile(); + void show(); void cherryPick(); + void checkout(); const QSharedPointer m_change; const QString m_repository; const FetchMode m_fetchMode; const QString m_git; const QSharedPointer m_parameters; - QScopedPointer m_patchFile; - QString m_patchFileName; State m_state; QProcess m_process; QFutureInterface m_progress; @@ -183,7 +178,6 @@ void FetchContext::start() void FetchContext::processFinished(int exitCode, QProcess::ExitStatus es) { - Git::Internal::GitClient *client = Git::Internal::GitPlugin::instance()->gitClient(); if (es != QProcess::NormalExit) { handleError(tr("%1 crashed.").arg(m_git)); return; @@ -192,60 +186,18 @@ void FetchContext::processFinished(int exitCode, QProcess::ExitStatus es) handleError(tr("%1 returned %2.").arg(m_git).arg(exitCode)); return; } - switch (m_state) { - case DoneState: - case ErrorState: - break; - case FetchState: + if (m_state == FetchState) { m_progress.setProgressValue(m_progress.progressValue() + 1); - switch (m_fetchMode) { - case FetchDisplay: - if (client->settings()->boolValue(Git::Internal::GitSettings::useDiffEditorKey)) { - client->show(m_repository, QLatin1String("FETCH_HEAD")); - m_progress.reportFinished(); - m_state = DoneState; - deleteLater(); - } else { - m_state = WritePatchFileState; - startWritePatchFile(); - } - break; - case FetchCherryPick: - case FetchCheckout: - if (m_fetchMode == FetchCherryPick) { - cherryPick(); - } else { - client->synchronousCheckout(m_repository, QLatin1String("FETCH_HEAD")); - } - m_progress.reportFinished(); - m_state = DoneState; - deleteLater(); - break; - } // switch (m_fetchMode) - break; - case WritePatchFileState: - switch (m_fetchMode) { - case FetchDisplay: { - m_patchFileName = m_patchFile->fileName(); - m_patchFile->close(); - m_patchFile.reset(); - m_state = DoneState; - m_progress.reportFinished(); - QString title = QString(QLatin1String("Gerrit patch %1/%2")) - .arg(m_change->number).arg(m_change->currentPatchSet.patchSetNumber); - Core::IEditor *editor = Core::EditorManager::openEditor( - m_patchFileName, Git::Constants::GIT_DIFF_EDITOR_ID); - VcsBase::VcsBaseEditorWidget *vcsEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(editor); - vcsEditor->setDiffBaseDirectory(m_repository); - vcsEditor->setForceReadOnly(true); - vcsEditor->setDisplayName(title); - deleteLater(); - break; - } - default: - break; - } - break; + if (m_fetchMode == FetchDisplay) + show(); + else if (m_fetchMode == FetchCherryPick) + cherryPick(); + else if (m_fetchMode == FetchCheckout) + checkout(); + + m_progress.reportFinished(); + m_state = DoneState; + deleteLater(); } } @@ -262,10 +214,7 @@ void FetchContext::processReadyReadStandardError() void FetchContext::processReadyReadStandardOutput() { const QByteArray output = m_process.readAllStandardOutput(); - if (m_state == WritePatchFileState) - m_patchFile->write(output); - else - VcsBase::VcsBaseOutputWindow::instance()->append(QString::fromLocal8Bit(output)); + VcsBase::VcsBaseOutputWindow::instance()->append(QString::fromLocal8Bit(output)); } void FetchContext::handleError(const QString &e) @@ -286,42 +235,30 @@ void FetchContext::processError(QProcess::ProcessError e) VcsBase::VcsBaseOutputWindow::instance()->appendError(msg); } -void FetchContext::startWritePatchFile() +void FetchContext::show() { - // Fetch to file in temporary folder. - QString tempPattern = QDir::tempPath(); - if (!tempPattern.endsWith(QLatin1Char('/'))) - tempPattern += QLatin1Char('/'); - tempPattern += QLatin1String("gerrit_") + QString::number(m_change->number) - + QLatin1Char('_') - + QString::number(m_change->currentPatchSet.patchSetNumber) - + QLatin1String("XXXXXX.patch"); - m_patchFile.reset(new QTemporaryFile(tempPattern)); - m_patchFile->setAutoRemove(false); - if (!m_patchFile->open()) { - handleError(tr("Error writing to temporary file.")); - return; - } - VcsBase::VcsBaseOutputWindow::instance()->append(tr("Writing %1...").arg(m_patchFile->fileName())); - QStringList args; - args << QLatin1String("format-patch") << QLatin1String("-1") - << QLatin1String("--stdout") << QLatin1String("FETCH_HEAD"); - VcsBase::VcsBaseOutputWindow::instance()->appendCommand(m_repository, m_git, args); - if (debug) - qDebug() << m_git << args; - m_process.start(m_git, args); - m_process.closeWriteChannel(); + const QString title = QString::number(m_change->number) + QLatin1Char('/') + + QString::number(m_change->currentPatchSet.patchSetNumber); + Git::Internal::GitPlugin::instance()->gitClient()->show( + m_repository, QLatin1String("FETCH_HEAD"), QStringList(), title); } void FetchContext::cherryPick() { // Point user to errors. - VcsBase::VcsBaseOutputWindow::instance()->popup(Core::IOutputPane::ModeSwitch | Core::IOutputPane::WithFocus); - VcsBase::VcsBaseOutputWindow::instance()->append(tr("Cherry-picking %1...").arg(m_patchFileName)); + VcsBase::VcsBaseOutputWindow::instance()->popup(Core::IOutputPane::ModeSwitch + | Core::IOutputPane::WithFocus); Git::Internal::GitPlugin::instance()->gitClient()->synchronousCherryPick( m_repository, QLatin1String("FETCH_HEAD")); } +void FetchContext::checkout() +{ + Git::Internal::GitPlugin::instance()->gitClient()->synchronousCheckout( + m_repository, QLatin1String("FETCH_HEAD")); +} + + GerritPlugin::GerritPlugin(QObject *parent) : QObject(parent) , m_parameters(new GerritParameters) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index ed2172c605..6a1324683b 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1116,15 +1116,16 @@ static inline QString msgCannotShow(const QString &sha) return GitClient::tr("Cannot describe \"%1\".").arg(sha); } -void GitClient::show(const QString &source, const QString &id, const QStringList &args) +void GitClient::show(const QString &source, const QString &id, + const QStringList &args, const QString &name) { if (!canShow(id)) { outputWindow()->append(msgCannotShow(id)); return; } + QString title = tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name); if (settings()->boolValue(GitSettings::useDiffEditorKey)) { - QString title = tr("Git Show \"%1\"").arg(id); const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("show", id); @@ -1140,7 +1141,6 @@ void GitClient::show(const QString &source, const QString &id, const QStringList GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), source, processEnvironment(), timeout); handler->show(id); } else { - const QString title = tr("Git Show \"%1\"").arg(id); const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID; VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("show", id); if (!editor) diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 414efe6521..9dc1d936f7 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -320,7 +320,8 @@ public: static const char *decorateOption; public slots: - void show(const QString &source, const QString &id, const QStringList &args = QStringList()); + void show(const QString &source, const QString &id, + const QStringList &args = QStringList(), const QString &name = QString()); void saveSettings(); private slots: -- cgit v1.2.1 From 77ae4a8cb62199c458707feffd683773235cd6a0 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 May 2013 12:01:07 +0200 Subject: DiffEditor: Cosmetics Add a bit of space around "Context Lines" label. Remove extra spinbox frame. Change-Id: I69533c2fa3e93473f41194bdc36ce07042df9855 Reviewed-by: Jarek Kobus --- src/plugins/diffeditor/diffeditoreditable.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/diffeditor/diffeditoreditable.cpp b/src/plugins/diffeditor/diffeditoreditable.cpp index 50f1f0f2e7..2c348e96b3 100644 --- a/src/plugins/diffeditor/diffeditoreditable.cpp +++ b/src/plugins/diffeditor/diffeditoreditable.cpp @@ -140,12 +140,15 @@ QWidget *DiffEditorEditable::toolBar() m_editorWidget, SLOT(setIgnoreWhitespaces(bool))); m_toolWidget->addWidget(whitespaceButton); - QLabel *contextLabel = new QLabel(tr("Context lines:"), m_toolWidget); + QLabel *contextLabel = new QLabel(m_toolWidget); + contextLabel->setText(tr("Context Lines:")); + contextLabel->setMargin(6); m_toolWidget->addWidget(contextLabel); QSpinBox *contextSpinBox = new QSpinBox(m_toolWidget); contextSpinBox->setRange(-1, 100); contextSpinBox->setValue(3); + contextSpinBox->setFrame(false); connect(contextSpinBox, SIGNAL(valueChanged(int)), m_editorWidget, SLOT(setContextLinesNumber(int))); m_toolWidget->addWidget(contextSpinBox); -- cgit v1.2.1 From 00f3fc28464fd772d773c3973408a38b522e9154 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 30 May 2013 16:13:03 +0200 Subject: Make option for diff viewer in git options clearer Change-Id: Iae0f427ed447430c82852c967022bc30ee4e88d1 Reviewed-by: Jarek Kobus --- src/plugins/git/settingspage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui index c72a4c3eb1..26b51f527f 100644 --- a/src/plugins/git/settingspage.ui +++ b/src/plugins/git/settingspage.ui @@ -140,7 +140,7 @@ - Use Diff Editor + Show diff side-by-side -- cgit v1.2.1 From 2fb8590f8763cf321579632b3d3e903d019a0dfc Mon Sep 17 00:00:00 2001 From: hluk Date: Tue, 14 May 2013 19:09:57 +0200 Subject: FakeVim: Fix behavior of 'dw' command Task-number: QTCREATORBUG-9289 Change-Id: I7ac1c925a13df49d60db410dce2d90b02cac7cfd Reviewed-by: hjk --- src/plugins/fakevim/fakevim_test.cpp | 15 +++++++++++++++ src/plugins/fakevim/fakevimhandler.cpp | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp index ae2a7a31c3..0cabd226ac 100644 --- a/src/plugins/fakevim/fakevim_test.cpp +++ b/src/plugins/fakevim/fakevim_test.cpp @@ -786,6 +786,21 @@ void FakeVimPlugin::test_vim_delete() KEYS("\"xd$", X "" N "def"); KEYS("\"xp", "ab" X "c" N "def"); KEYS("2\"xp", "abcabcab" X "c" N "def"); + + /* QTCREATORBUG-9289 */ + data.setText("abc" N "def"); + KEYS("$" "dw", "a" X "b" N "def"); + KEYS("dw", X "a" N "def"); + KEYS("dw", X "" N "def"); + KEYS("dw", X "def"); + + data.setText("abc" N "def ghi"); + KEYS("2dw", X "ghi"); + + data.setText("abc" N X "" N "def"); + KEYS("dw", "abc" N X "def"); + KEYS("k$" "dw", "a" X "b" N "def"); + KEYS("j$h" "dw", "ab" N X "d"); } void FakeVimPlugin::test_vim_delete_inner_word() diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index b288d73f8a..7bebc74ddc 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1505,7 +1505,7 @@ public: bool atBlockStart() const { return m_cursor.atBlockStart(); } bool atBlockEnd() const { return m_cursor.atBlockEnd(); } bool atEndOfLine() const { return atBlockEnd() && block().length() > 1; } - bool atDocumentEnd() const { return position() >= lastPositionInDocument(); } + bool atDocumentEnd() const { return position() >= lastPositionInDocument(true); } bool atDocumentStart() const { return m_cursor.atStart(); } bool atEmptyLine(const QTextCursor &tc = QTextCursor()) const; @@ -3507,6 +3507,11 @@ bool FakeVimHandler::Private::handleMovement(const Input &input) m_movetype = MoveInclusive; } else { moveToNextWordStart(count, simple, true); + // Command 'dw' deletes to the next word on the same line or to end of line. + if (m_submode == DeleteSubMode && count == 1) { + const QTextBlock currentBlock = document()->findBlock(anchor()); + setPosition(qMin(position(), currentBlock.position() + currentBlock.length())); + } m_movetype = MoveExclusive; } setTargetColumn(); -- cgit v1.2.1 From 55bb2e42fc7d704f6f678eb6fe4e16ee41bbd9be Mon Sep 17 00:00:00 2001 From: hluk Date: Tue, 14 May 2013 20:35:31 +0200 Subject: FakeVim: Select/unselect line break in visual selection Task-number: QTCREATORBUG-9289 Change-Id: Ic05b71491f8ed625df0ce514182eff916171666a Reviewed-by: hjk --- src/plugins/fakevim/fakevim_test.cpp | 8 +++++++ src/plugins/fakevim/fakevimhandler.cpp | 38 +++++++++++++++++++++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/fakevim/fakevim_test.cpp b/src/plugins/fakevim/fakevim_test.cpp index 0cabd226ac..e946ae20da 100644 --- a/src/plugins/fakevim/fakevim_test.cpp +++ b/src/plugins/fakevim/fakevim_test.cpp @@ -801,6 +801,14 @@ void FakeVimPlugin::test_vim_delete() KEYS("dw", "abc" N X "def"); KEYS("k$" "dw", "a" X "b" N "def"); KEYS("j$h" "dw", "ab" N X "d"); + + data.setText("abc" N "def"); + KEYS("2lvx", "a" X "b" N "def"); + KEYS("vlx", "a" X "def"); + + data.setText("abc" N "def"); + KEYS("2lvox", "a" X "b" N "def"); + KEYS("vlox", "a" X "def"); } void FakeVimPlugin::test_vim_delete_inner_word() diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 7bebc74ddc..df06f9ff16 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1501,7 +1501,7 @@ public: int count() const { return mvCount() * opCount(); } QTextBlock block() const { return m_cursor.block(); } int leftDist() const { return position() - block().position(); } - int rightDist() const { return block().length() - leftDist() - 1; } + int rightDist() const { return block().length() - leftDist() - (isVisualCharMode() ? 0 : 1); } bool atBlockStart() const { return m_cursor.atBlockStart(); } bool atBlockEnd() const { return m_cursor.atBlockEnd(); } bool atEndOfLine() const { return atBlockEnd() && block().length() > 1; } @@ -1604,7 +1604,14 @@ public: } void moveRight(int n = 1) { //dump("RIGHT 1"); - m_cursor.movePosition(Right, KeepAnchor, n); + if (isVisualCharMode()) { + const QTextBlock currentBlock = block(); + const int max = currentBlock.position() + currentBlock.length() - 1; + const int pos = position() + n; + setPosition(qMin(pos, max)); + } else { + m_cursor.movePosition(Right, KeepAnchor, n); + } if (atEndOfLine()) emit q->fold(1, false); //dump("RIGHT 2"); @@ -2049,7 +2056,8 @@ void FakeVimHandler::Private::leaveFakeVim() // The command might have destroyed the editor. if (m_textedit || m_plaintextedit) { // We fake vi-style end-of-line behaviour - m_fakeEnd = atEndOfLine() && m_mode == CommandMode && !isVisualBlockMode(); + m_fakeEnd = atEndOfLine() && m_mode == CommandMode && !isVisualBlockMode() + && !isVisualCharMode(); //QTC_ASSERT(m_mode == InsertMode || m_mode == ReplaceMode // || !atBlockEnd() || block().length() <= 1, @@ -2236,7 +2244,7 @@ void FakeVimHandler::Private::exportSelection() if (visualBlockInverted) setAnchorAndPosition(anc + 1, pos); else - setAnchorAndPosition(anc, pos + 1); + setAnchorAndPosition(anc, pos); if (m_visualMode == VisualBlockMode) { commitCursor(); @@ -2807,6 +2815,23 @@ void FakeVimHandler::Private::fixSelection() if (m_rangemode == RangeBlockMode) return; + if (m_movetype == MoveInclusive) { + // If position or anchor is after end of non-empty line, include line break in selection. + if (document()->characterAt(position()) == ParagraphSeparator) { + if (!atEmptyLine()) { + setPosition(position() + 1); + return; + } + } else if (document()->characterAt(anchor()) == ParagraphSeparator) { + QTextCursor tc = m_cursor; + tc.setPosition(anchor()); + if (!atEmptyLine(tc)) { + setAnchorAndPosition(anchor() + 1, position()); + return; + } + } + } + if (m_movetype == MoveExclusive) { if (anchor() < position() && atBlockStart()) { // Exlusive motion ending at the beginning of line @@ -7259,8 +7284,7 @@ void FakeVimHandler::Private::updateCursorShape() bool thinCursor = m_mode == ExMode || m_subsubmode == SearchSubSubMode || m_mode == InsertMode - || isVisualMode() - || m_cursor.hasSelection(); + || (isVisualMode() && !isVisualCharMode()); EDITOR(setOverwriteMode(!thinCursor)); } @@ -7336,7 +7360,7 @@ void FakeVimHandler::Private::initVisualInsertMode(QChar command) void FakeVimHandler::Private::enterCommandMode(Mode returnToMode) { - if (atEndOfLine()) + if (isNoVisualMode() && atEndOfLine()) moveLeft(); m_mode = CommandMode; clearCommandMode(); -- cgit v1.2.1 From 2d68f9c808f3f718a4869d02c9887d7809109e05 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 30 May 2013 12:07:01 +0300 Subject: Git: Avoid version warning when Git is not found Task-number: QTCREATORBUG-9411 Change-Id: I0bb90e508b78d0e7c7ff86fda72399036ad665ae Reviewed-by: Christian Stenger --- src/plugins/git/gitplugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 665c332b21..8b3774793a 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -956,7 +956,8 @@ void GitPlugin::startCommit(CommitType commitType) void GitPlugin::updateVersionWarning() { - if (m_gitClient->gitVersion() >= minimumRequiredVersion) + unsigned version = m_gitClient->gitVersion(); + if (!version || version >= minimumRequiredVersion) return; Core::IEditor *curEditor = Core::EditorManager::currentEditor(); if (!curEditor) -- cgit v1.2.1 From d8eb5ddb757744300fcaf498c39086ac8d62bcd5 Mon Sep 17 00:00:00 2001 From: Sergey Shambir Date: Sun, 26 May 2013 10:57:41 +0400 Subject: CppTools: cleanup CppPreprocessor header, added short docs. Change-Id: Ib61197da939165d24b99e40f29f9de13d109e044 Reviewed-by: Leena Miettinen Reviewed-by: hjk --- src/plugins/cpptools/cpppreprocessor.cpp | 12 ++++++++++++ src/plugins/cpptools/cpppreprocessor.h | 9 +++++---- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/cpptools/cpppreprocessor.cpp b/src/plugins/cpptools/cpppreprocessor.cpp index 5c5d1bd803..d12b56b207 100644 --- a/src/plugins/cpptools/cpppreprocessor.cpp +++ b/src/plugins/cpptools/cpppreprocessor.cpp @@ -5,6 +5,18 @@ #include +/*! + * \class CppTools::Internal::CppPreprocessor + * \brief The CppPreprocessor class updates set of indexed C++ files. + * + * Indexed file is truncated version of fully parsed document: copy of source + * code and full AST will be dropped when indexing is done. Working copy ensures + * that documents with most recent copy placed in memory will be parsed correctly. + * + * \sa CPlusPlus::Document + * \sa CppTools::CppModelManagerInterface::WorkingCopy + */ + using namespace CPlusPlus; using namespace CppTools; using namespace CppTools::Internal; diff --git a/src/plugins/cpptools/cpppreprocessor.h b/src/plugins/cpptools/cpppreprocessor.h index d931a880c4..c54bbefb30 100644 --- a/src/plugins/cpptools/cpppreprocessor.h +++ b/src/plugins/cpptools/cpppreprocessor.h @@ -14,11 +14,14 @@ namespace Internal { class CppModelManager; +// Documentation inside. class CPPTOOLS_EXPORT CppPreprocessor: public CPlusPlus::Client { Q_DISABLE_COPY(CppPreprocessor) public: + static QString cleanPath(const QString &path); + CppPreprocessor(QPointer modelManager, bool dumpFileNameWhileParsing = false); virtual ~CppPreprocessor(); @@ -26,15 +29,11 @@ public: void setWorkingCopy(const CppTools::CppModelManagerInterface::WorkingCopy &workingCopy); void setIncludePaths(const QStringList &includePaths); void setFrameworkPaths(const QStringList &frameworkPaths); - void addFrameworkPath(const QString &frameworkPath); - void setProjectFiles(const QStringList &files); void setTodo(const QStringList &files); void run(const QString &fileName); void removeFromCache(const QString &fileName); - void resetEnvironment(); - static QString cleanPath(const QString &path); const QSet &todo() const { return m_todo; } @@ -69,6 +68,8 @@ protected: virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType type); private: + void addFrameworkPath(const QString &frameworkPath); + CPlusPlus::Snapshot m_snapshot; QPointer m_modelManager; bool m_dumpFileNameWhileParsing; -- cgit v1.2.1 From cb00983043bce64547da5e357e6aae0551eac2b2 Mon Sep 17 00:00:00 2001 From: hjk Date: Sat, 25 May 2013 01:22:41 +0200 Subject: TextEditor: Move HighlightDefinition constants to where they are used Change-Id: Ibdd3147cc2a64407802fa237b7943d2e96c90030 Reviewed-by: Orgad Shaneh Reviewed-by: David Schulz --- .../highlightdefinitionmetadata.cpp | 43 ---------------------- .../highlightdefinitionmetadata.h | 10 +---- .../texteditor/generichighlighter/manager.cpp | 24 +++++++----- src/plugins/texteditor/texteditor.pro | 1 - src/plugins/texteditor/texteditor.qbs | 1 - 5 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.cpp (limited to 'src') diff --git a/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.cpp b/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.cpp deleted file mode 100644 index f29daa6c84..0000000000 --- a/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "highlightdefinitionmetadata.h" - -using namespace TextEditor; -using namespace Internal; - -const QLatin1String HighlightDefinitionMetaData::kPriority("priority"); -const QLatin1String HighlightDefinitionMetaData::kName("name"); -const QLatin1String HighlightDefinitionMetaData::kExtensions("extensions"); -const QLatin1String HighlightDefinitionMetaData::kMimeType("mimetype"); -const QLatin1String HighlightDefinitionMetaData::kVersion("version"); -const QLatin1String HighlightDefinitionMetaData::kUrl("url"); - -HighlightDefinitionMetaData::HighlightDefinitionMetaData() : priority(0) -{} diff --git a/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.h b/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.h index ed2309be21..a641fa5df2 100644 --- a/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.h +++ b/src/plugins/texteditor/generichighlighter/highlightdefinitionmetadata.h @@ -30,7 +30,6 @@ #ifndef HIGHLIGHTDEFINITIONMETADATA_H #define HIGHLIGHTDEFINITIONMETADATA_H -#include #include #include @@ -40,14 +39,7 @@ namespace Internal { class HighlightDefinitionMetaData { public: - HighlightDefinitionMetaData(); - - static const QLatin1String kPriority; - static const QLatin1String kName; - static const QLatin1String kExtensions; - static const QLatin1String kMimeType; - static const QLatin1String kVersion; - static const QLatin1String kUrl; + HighlightDefinitionMetaData() : priority(0) {} public: int priority; diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index 167256f1e7..109b667387 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -67,6 +67,13 @@ using namespace TextEditor; using namespace Internal; +const char kPriority[] = "priority"; +const char kName[] = "name"; +const char kExtensions[] = "extensions"; +const char kMimeType[] = "mimetype"; +const char kVersion[] = "version"; +const char kUrl[] = "url"; + Manager::Manager() : m_isDownloadingDefinitionsSpec(false), m_hasQueuedRegistration(false) @@ -360,14 +367,13 @@ QSharedPointer Manager::parseMetadata(const QFileIn metaData->fileName = fileInfo.fileName(); metaData->id = fileInfo.absoluteFilePath(); - metaData->name = atts.value(HighlightDefinitionMetaData::kName).toString(); - metaData->version = atts.value(HighlightDefinitionMetaData::kVersion).toString(); - metaData->priority = atts.value(HighlightDefinitionMetaData::kPriority).toString() - .toInt(); - metaData->patterns = atts.value(HighlightDefinitionMetaData::kExtensions) + metaData->name = atts.value(QLatin1String(kName)).toString(); + metaData->version = atts.value(QLatin1String(kVersion)).toString(); + metaData->priority = atts.value(QLatin1String(kPriority)).toString().toInt(); + metaData->patterns = atts.value(QLatin1String(kExtensions)) .toString().split(kSemiColon, QString::SkipEmptyParts); - QStringList mimeTypes = atts.value(HighlightDefinitionMetaData::kMimeType). + QStringList mimeTypes = atts.value(QLatin1String(kMimeType)). toString().split(kSemiColon, QString::SkipEmptyParts); if (mimeTypes.isEmpty()) { // There are definitions which do not specify a MIME type, but specify file @@ -400,9 +406,9 @@ QList Manager::parseAvailableDefinitionsList(QIODev const QXmlStreamAttributes &atts = reader.attributes(); HighlightDefinitionMetaData metaData; - metaData.name = atts.value(HighlightDefinitionMetaData::kName).toString(); - metaData.version = atts.value(HighlightDefinitionMetaData::kVersion).toString(); - QString url(atts.value(HighlightDefinitionMetaData::kUrl).toString()); + metaData.name = atts.value(QLatin1String(kName)).toString(); + metaData.version = atts.value(QLatin1String(kVersion)).toString(); + QString url = atts.value(QLatin1String(kUrl)).toString(); metaData.url = QUrl(url); const int slash = url.lastIndexOf(kSlash); if (slash != -1) diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index a5193ff862..eaca9ab8d9 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -56,7 +56,6 @@ SOURCES += texteditorplugin.cpp \ generichighlighter/highlightersettingspage.cpp \ generichighlighter/highlightersettings.cpp \ generichighlighter/managedefinitionsdialog.cpp \ - generichighlighter/highlightdefinitionmetadata.cpp \ generichighlighter/definitiondownloader.cpp \ refactoringchanges.cpp \ refactoroverlay.cpp \ diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index 9792f6a884..6998dbf478 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -212,7 +212,6 @@ QtcPlugin { "highlightdefinition.h", "highlightdefinitionhandler.cpp", "highlightdefinitionhandler.h", - "highlightdefinitionmetadata.cpp", "highlightdefinitionmetadata.h", "highlighter.cpp", "highlighter.h", -- cgit v1.2.1 From 7d986f0486dc48b718a974682e7d37ecb2b12844 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 22 May 2013 16:00:26 +0200 Subject: Cycle through extra editor windows when cycling through splits Change-Id: I1bd5654d62b11456c35cc5bf1099e41fb3559bc7 Reviewed-by: David Schulz --- src/plugins/coreplugin/coreconstants.h | 2 +- .../coreplugin/editormanager/editormanager.cpp | 118 ++++++++++++++++----- .../coreplugin/editormanager/editormanager.h | 7 +- .../coreplugin/editormanager/editorview.cpp | 4 +- src/plugins/cppeditor/cppeditor.cpp | 2 - src/plugins/cpptools/cpptoolsplugin.cpp | 2 +- src/plugins/fakevim/fakevimplugin.cpp | 2 +- src/plugins/texteditor/basetexteditor.cpp | 2 - 8 files changed, 103 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index 1bdc864a07..db0b96591f 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -109,7 +109,7 @@ const char SPLIT_SIDE_BY_SIDE[] = "QtCreator.SplitSideBySide"; const char SPLIT_NEW_WINDOW[] = "QtCreator.SplitNewWindow"; const char REMOVE_CURRENT_SPLIT[] = "QtCreator.RemoveCurrentSplit"; const char REMOVE_ALL_SPLITS[] = "QtCreator.RemoveAllSplits"; -const char GOTO_OTHER_SPLIT[] = "QtCreator.GotoOtherSplit"; +const char GOTO_NEXT_SPLIT[] = "QtCreator.GotoOtherSplit"; const char CLOSE[] = "QtCreator.Close"; const char CLOSE_ALTERNATIVE[] = "QtCreator.Close_Alternative"; // temporary, see QTCREATORBUG-72 const char CLOSEALL[] = "QtCreator.CloseAll"; diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 88762f1f29..b31a5d131b 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -196,7 +196,7 @@ struct EditorManagerPrivate QAction *m_splitNewWindowAction; QAction *m_removeCurrentSplitAction; QAction *m_removeAllSplitsAction; - QAction *m_gotoOtherSplitAction; + QAction *m_gotoNextSplitAction; QAction *m_saveCurrentEditorContextAction; QAction *m_saveAsCurrentEditorContextAction; @@ -399,11 +399,11 @@ EditorManager::EditorManager(QWidget *parent) : mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits())); - d->m_gotoOtherSplitAction = new QAction(tr("Go to Next Split"), this); - cmd = ActionManager::registerAction(d->m_gotoOtherSplitAction, Constants::GOTO_OTHER_SPLIT, editManagerContext); + d->m_gotoNextSplitAction = new QAction(tr("Go to Next Split"), this); + cmd = ActionManager::registerAction(d->m_gotoNextSplitAction, Constants::GOTO_NEXT_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); - connect(d->m_gotoOtherSplitAction, SIGNAL(triggered()), this, SLOT(gotoOtherSplit())); + connect(d->m_gotoNextSplitAction, SIGNAL(triggered()), this, SLOT(gotoNextSplit())); ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT); ActionContainer *advancedMenu = ActionManager::createMenu(Constants::M_EDIT_ADVANCED); @@ -604,13 +604,20 @@ EditorView *EditorManager::viewForEditor(IEditor *editor) return 0; } -SplitterOrView *EditorManager::findRoot(EditorView *view) +SplitterOrView *EditorManager::findRoot(const EditorView *view, int *rootIndex) { SplitterOrView *current = view->parentSplitterOrView(); - while (current && !m_instance->d->m_root.contains(current)) { + while (current) { + int index = m_instance->d->m_root.indexOf(current); + if (index >= 0) { + if (rootIndex) + *rootIndex = index; + return current; + } current = current->findParentSplitter(); } - return current; + QTC_CHECK(false); // we should never have views without a root + return 0; } QList EditorManager::editorsForFileName(const QString &filename) const @@ -1151,6 +1158,18 @@ void EditorManager::activateEditorForIndex(Internal::EditorView *view, const QMo d->m_editorModel->removeEditor(index); } +void EditorManager::activateView(EditorView *view) +{ + QTC_ASSERT(view, return); + if (IEditor *editor = view->currentEditor()) { + setCurrentEditor(editor, true); + editor->widget()->setFocus(); + ICore::raiseWindow(editor->widget()); + } else { + setCurrentView(view); + } +} + Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core::IEditor *editor) { Q_ASSERT(view && editor); @@ -1398,11 +1417,8 @@ IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId, fileName, editorId, flags, newEditor); } -IEditor *EditorManager::openEditorInNextSplit(const QString &fileName, const Id &editorId, OpenEditorFlags flags, bool *newEditor) +IEditor *EditorManager::openEditorInOtherSplit(const QString &fileName, const Id &editorId, OpenEditorFlags flags, bool *newEditor) { - if (!m_instance->hasSplitter()) - m_instance->splitSideBySide(); - m_instance->gotoOtherSplit(); return m_instance->openEditor(m_instance->currentEditorView(), fileName, editorId, flags, newEditor); @@ -1973,7 +1989,7 @@ void EditorManager::updateActions() bool hasSplitter = parentSplitter && parentSplitter->isSplitter(); d->m_removeCurrentSplitAction->setEnabled(hasSplitter); d->m_removeAllSplitsAction->setEnabled(hasSplitter); - d->m_gotoOtherSplitAction->setEnabled(hasSplitter); + d->m_gotoNextSplitAction->setEnabled(hasSplitter || d->m_root.size() > 1); } void EditorManager::setCloseSplitEnabled(SplitterOrView *splitterOrView, bool enable) @@ -2010,7 +2026,8 @@ QList EditorManager::visibleEditors() const if (view->currentEditor()) editors.append(view->currentEditor()); view = view->findNextView(); - } while (view && view != firstView); + QTC_ASSERT(view != firstView, break); // we start with firstView and shouldn't have cycles + } while (view); } } else { if (root->editor()) @@ -2375,26 +2392,77 @@ void EditorManager::removeAllSplits() root->unsplitAll(); } +/*! + * Moves focus to the next split, cycling through windows. + */ +void EditorManager::gotoNextSplit() +{ + EditorView *view = currentEditorView(); + if (!view) + return; + EditorView *nextView = view->findNextView(); + if (!nextView) { + // we are in the "last" view in this root + int rootIndex = -1; + SplitterOrView *root = findRoot(view, &rootIndex); + QTC_ASSERT(root, return); + QTC_ASSERT(rootIndex >= 0 && rootIndex < d->m_root.size(), return); + // find next root. this might be the same root if there's only one. + int nextRootIndex = rootIndex + 1; + if (nextRootIndex >= d->m_root.size()) + nextRootIndex = 0; + nextView = d->m_root.at(nextRootIndex)->findFirstView(); + QTC_CHECK(nextView); + } + + if (nextView) + activateView(nextView); +} + +/*! + * Moves focus to "other" split, possibly creating a split if necessary. + * If there's no split and no other window, a side-by-side split is created. + * If the current window is split, focus is moved to the next split within this window, cycling. + * If the current window is not split, focus is moved to the next window. + */ void EditorManager::gotoOtherSplit() { EditorView *view = currentEditorView(); if (!view) return; - SplitterOrView *root = findRoot(view); - QTC_ASSERT(root, return); - if (!root->isSplitter()) - splitSideBySide(); - - view = view->findNextView(); - if (view) { - if (IEditor *editor = view->currentEditor()) { - setCurrentEditor(editor, true); - editor->widget()->setFocus(); - ICore::raiseWindow(editor->widget()); + EditorView *nextView = view->findNextView(); + if (!nextView) { + // we are in the "last" view in this root + int rootIndex = -1; + SplitterOrView *root = findRoot(view, &rootIndex); + QTC_ASSERT(root, return); + QTC_ASSERT(rootIndex >= 0 && rootIndex < d->m_root.size(), return); + // stay in same window if it is split + if (root->isSplitter()) { + nextView = root->findFirstView(); + QTC_CHECK(nextView != view); } else { - setCurrentView(view); + // find next root. this might be the same root if there's only one. + int nextRootIndex = rootIndex + 1; + if (nextRootIndex >= d->m_root.size()) + nextRootIndex = 0; + nextView = d->m_root.at(nextRootIndex)->findFirstView(); + QTC_CHECK(nextView); + // if we had only one root with only one view, we end up at the startpoint + // in that case we need to split + if (nextView == view) { + QTC_CHECK(!root->isSplitter()); + splitSideBySide(); // that deletes 'view' + view = root->findFirstView(); + nextView = view->findNextView(); + QTC_CHECK(nextView != view); + QTC_CHECK(nextView); + } } } + + if (nextView) + activateView(nextView); } qint64 EditorManager::maxTextFileSize() diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 1dabf2f368..7429730460 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -117,7 +117,7 @@ public: static QString splitLineNumber(QString *fileName); static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0); - static IEditor *openEditorInNextSplit(const QString &fileName, const Id &editorId = Id(), + static IEditor *openEditorInOtherSplit(const QString &fileName, const Id &editorId = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0); static IEditor *openEditorWithContents(const Id &editorId, QString *titlePattern = 0, const QString &contents = QString()); @@ -234,6 +234,8 @@ private slots: void rootDestroyed(QObject *root); void setCurrentEditorFromContextChange(); + void gotoNextSplit(); + public slots: void goBackInNavigationHistory(); void goForwardInNavigationHistory(); @@ -257,6 +259,7 @@ private: IEditor *duplicateEditor(IEditor *editor); IEditor *activateEditor(Internal::EditorView *view, IEditor *editor, OpenEditorFlags flags = 0); void activateEditorForIndex(Internal::EditorView *view, const QModelIndex &index, OpenEditorFlags = 0); + void activateView(Internal::EditorView *view); IEditor *openEditor(Internal::EditorView *view, const QString &fileName, const Id &id = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0); @@ -264,7 +267,7 @@ private: void setCurrentView(Internal::EditorView *view); Internal::EditorView *currentEditorView() const; static Internal::EditorView *viewForEditor(IEditor *editor); - static Internal::SplitterOrView *findRoot(Internal::EditorView *view); + static Internal::SplitterOrView *findRoot(const Internal::EditorView *view, int *rootIndex = 0); void closeEditor(IEditor *editor); void closeDuplicate(IEditor *editor); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 87e4ecee5a..30cbb9c023 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -144,8 +144,8 @@ EditorView *EditorView::findNextView() current = parent; parent = current->findParentSplitter(); } - // current has no parent, so just take the very first view - return current->findFirstView(); + // current has no parent, so we are at the top and there is no "next" view + return 0; } void EditorView::closeView() diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index dd42d6cb7f..00e6a93237 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1994,8 +1994,6 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit) Core::EditorManager *editorManager = Core::EditorManager::instance(); if (inNextSplit) { - if (!editorManager->hasSplitter()) - editorManager->splitSideBySide(); editorManager->gotoOtherSplit(); } else if (baseTextDocument()->fileName() == link.targetFileName) { editorManager->addCurrentPositionToNavigationHistory(); diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 7f70a37640..66e8a68966 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -164,7 +164,7 @@ void CppToolsPlugin::switchHeaderSourceInNextSplit() QString otherFile = correspondingHeaderOrSource( Core::EditorManager::currentEditor()->document()->fileName()); if (!otherFile.isEmpty()) - Core::EditorManager::openEditorInNextSplit(otherFile); + Core::EditorManager::openEditorInOtherSplit(otherFile); } static QStringList findFilesInProject(const QString &name, diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 235696eda6..3d9c30356a 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1324,7 +1324,7 @@ void FakeVimPluginPrivate::windowCommand(const QString &map, int count) else if (key == _("S") || key == _("")) triggerAction(Core::Constants::SPLIT); else if (key == _("W") || key == _("")) - triggerAction(Core::Constants::GOTO_OTHER_SPLIT); + triggerAction(Core::Constants::GOTO_NEXT_SPLIT); else if (key.contains(_("RIGHT")) || key == _("L") || key == _("")) moveSomewhere(&moveRightWeight, key == _("") ? -1 : count); else if (key.contains(_("LEFT")) || key == _("H") || key == _("")) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 2b3f5eef3a..3984a4ca9b 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -4910,8 +4910,6 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit) Core::EditorManager *editorManager = Core::EditorManager::instance(); if (inNextSplit) { - if (!editorManager->hasSplitter()) - editorManager->splitSideBySide(); editorManager->gotoOtherSplit(); } else if (baseTextDocument()->fileName() == link.targetFileName) { editorManager->addCurrentPositionToNavigationHistory(); -- cgit v1.2.1 From d2571548f81f3249f00a22b61d03ac9d03fcf058 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 30 May 2013 16:20:17 +0200 Subject: Remove unneeded IEditorFactor::open re-implementations. Change-Id: I261bc1ee09a2c22155e4874a4429a868d837c256 Reviewed-by: hjk Reviewed-by: David Schulz --- src/plugins/imageviewer/imageviewerfactory.cpp | 5 ----- src/plugins/imageviewer/imageviewerfactory.h | 1 - src/plugins/pythoneditor/pythoneditorfactory.cpp | 10 ---------- src/plugins/pythoneditor/pythoneditorfactory.h | 5 ----- src/plugins/qnx/bardescriptoreditorfactory.cpp | 6 ------ src/plugins/qnx/bardescriptoreditorfactory.h | 1 - 6 files changed, 28 deletions(-) (limited to 'src') diff --git a/src/plugins/imageviewer/imageviewerfactory.cpp b/src/plugins/imageviewer/imageviewerfactory.cpp index 55d501c5c4..d925ea6cc9 100644 --- a/src/plugins/imageviewer/imageviewerfactory.cpp +++ b/src/plugins/imageviewer/imageviewerfactory.cpp @@ -103,11 +103,6 @@ QString ImageViewerFactory::displayName() const return qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME); } -Core::IDocument *ImageViewerFactory::open(const QString & /*fileName*/) -{ - return 0; -} - void ImageViewerFactory::extensionsInitialized() { d->actionHandler->createActions(); diff --git a/src/plugins/imageviewer/imageviewerfactory.h b/src/plugins/imageviewer/imageviewerfactory.h index 427eacadd4..77d372a265 100644 --- a/src/plugins/imageviewer/imageviewerfactory.h +++ b/src/plugins/imageviewer/imageviewerfactory.h @@ -50,7 +50,6 @@ public: QStringList mimeTypes() const; Core::Id id() const; QString displayName() const; - Core::IDocument *open(const QString &fileName); void extensionsInitialized(); diff --git a/src/plugins/pythoneditor/pythoneditorfactory.cpp b/src/plugins/pythoneditor/pythoneditorfactory.cpp index 5afe99883d..5dc783f6ae 100644 --- a/src/plugins/pythoneditor/pythoneditorfactory.cpp +++ b/src/plugins/pythoneditor/pythoneditorfactory.cpp @@ -56,16 +56,6 @@ QString EditorFactory::displayName() const return tr(Constants::C_EDITOR_DISPLAY_NAME); } -Core::IDocument *EditorFactory::open(const QString &fileName) -{ - Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id()); - if (!iface) { - qWarning() << "CEditorFactory::open: openEditor failed for " << fileName; - return 0; - } - return iface->document(); -} - Core::IEditor *EditorFactory::createEditor(QWidget *parent) { EditorWidget *widget = new EditorWidget(parent); diff --git a/src/plugins/pythoneditor/pythoneditorfactory.h b/src/plugins/pythoneditor/pythoneditorfactory.h index b483e6e4dc..5879e6fe39 100644 --- a/src/plugins/pythoneditor/pythoneditorfactory.h +++ b/src/plugins/pythoneditor/pythoneditorfactory.h @@ -54,11 +54,6 @@ public: Core::Id id() const; QString displayName() const; - /** - Opens file in new editor - */ - Core::IDocument *open(const QString &fileName); - /** Creates and initializes new editor widget */ diff --git a/src/plugins/qnx/bardescriptoreditorfactory.cpp b/src/plugins/qnx/bardescriptoreditorfactory.cpp index da3a933dce..ac300d3710 100644 --- a/src/plugins/qnx/bardescriptoreditorfactory.cpp +++ b/src/plugins/qnx/bardescriptoreditorfactory.cpp @@ -61,12 +61,6 @@ QString BarDescriptorEditorFactory::displayName() const return tr("Bar descriptor editor"); } -Core::IDocument *BarDescriptorEditorFactory::open(const QString &fileName) -{ - Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id()); - return iface ? iface->document() : 0; -} - Core::IEditor *BarDescriptorEditorFactory::createEditor(QWidget *parent) { BarDescriptorEditorWidget *editorWidget = new BarDescriptorEditorWidget(parent); diff --git a/src/plugins/qnx/bardescriptoreditorfactory.h b/src/plugins/qnx/bardescriptoreditorfactory.h index 1e49ac3247..36bade0089 100644 --- a/src/plugins/qnx/bardescriptoreditorfactory.h +++ b/src/plugins/qnx/bardescriptoreditorfactory.h @@ -48,7 +48,6 @@ public: QStringList mimeTypes() const; Core::Id id() const; QString displayName() const; - Core::IDocument *open(const QString &fileName); Core::IEditor *createEditor(QWidget *parent); -- cgit v1.2.1 From 316b9a36e9b557f10d375b2ab2d0382739c8f411 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 31 May 2013 13:54:51 +0200 Subject: Move comment into the right place Change-Id: I296de582b4ddb706d9f5f3f7092654b3f5d79e46 Reviewed-by: Tobias Hunger --- src/plugins/qbsprojectmanager/qbsinstallstep.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index bac939de88..2215b8a559 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -44,15 +44,15 @@ #include +// -------------------------------------------------------------------- +// Constants: +// -------------------------------------------------------------------- + static const char QBS_INSTALL_ROOT[] = "Qbs.InstallRoot"; static const char QBS_REMOVE_FIRST[] = "Qbs.RemoveFirst"; static const char QBS_DRY_RUN[] = "Qbs.DryRun"; static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing"; -// -------------------------------------------------------------------- -// Constants: -// -------------------------------------------------------------------- - namespace QbsProjectManager { namespace Internal { -- cgit v1.2.1 From cbb6db1232e454dcce83c73a68ce1c970e9b36c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20N=C3=A4tterlund?= Date: Thu, 30 May 2013 14:31:41 +0200 Subject: ProjectExplorer/QNX: Add build step for checking device existence This introduces a DeviceCheckBuildStep which any DeployConfigurationFactory could use to insert a step to check whether a device is set up for the current kit or not. Currently only used in the QNX deploy configuration. If there is no device known to a QNX kit, ask the user to add one. Launch the appropriate device wizard if the user agrees to add a device. Change-Id: I42db995f50890e2a2dd7aacc24a0049cdd6a6fee Reviewed-by: Christian Kandeler --- .../devicesupport/devicecheckbuildstep.cpp | 109 +++++++++++++++++++++ .../devicesupport/devicecheckbuildstep.h | 61 ++++++++++++ src/plugins/projectexplorer/projectexplorer.pro | 2 + src/plugins/projectexplorer/projectexplorer.qbs | 2 + src/plugins/qnx/qnxdeployconfigurationfactory.cpp | 5 +- src/plugins/qnx/qnxdeploystepfactory.cpp | 22 ++++- 6 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp create mode 100644 src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h (limited to 'src') diff --git a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp new file mode 100644 index 0000000000..1c9554755e --- /dev/null +++ b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.cpp @@ -0,0 +1,109 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.com) +** Contact: KDAB (info@kdab.com) +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "devicecheckbuildstep.h" + +#include "../kitinformation.h" +#include "../target.h" +#include "devicemanager.h" +#include "idevice.h" +#include "idevicefactory.h" + +#include + +using namespace ProjectExplorer; + +DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, Core::Id id) + : BuildStep(bsl, id) +{ + setDefaultDisplayName(stepDisplayName()); +} + +DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, DeviceCheckBuildStep *bs) + : BuildStep(bsl, bs) +{ + setDefaultDisplayName(stepDisplayName()); +} + +bool DeviceCheckBuildStep::init() +{ + IDevice::ConstPtr device = DeviceKitInformation::device(target()->kit()); + if (!device) { + Core::Id deviceTypeId = DeviceTypeKitInformation::deviceTypeId(target()->kit()); + IDeviceFactory *factory = IDeviceFactory::find(deviceTypeId); + if (!factory || !factory->canCreate()) { + emit addOutput(tr("No device configured."), BuildStep::ErrorMessageOutput); + return false; + } + + QMessageBox msgBox(QMessageBox::Question, tr("Set Up Device"), + tr("There is no device set up for this kit. Do you want to add a device?"), + QMessageBox::Yes|QMessageBox::No); + msgBox.setDefaultButton(QMessageBox::Yes); + if (msgBox.exec() == QMessageBox::No) { + emit addOutput(tr("No device configured."), BuildStep::ErrorMessageOutput); + return false; + } + + IDevice::Ptr newDevice = factory->create(deviceTypeId); + if (newDevice.isNull()) { + emit addOutput(tr("No device configured."), BuildStep::ErrorMessageOutput); + return false; + } + + DeviceManager *dm = DeviceManager::instance(); + dm->addDevice(newDevice); + + DeviceKitInformation::setDevice(target()->kit(), newDevice); + } + + return true; +} + +void DeviceCheckBuildStep::run(QFutureInterface &fi) +{ + fi.reportResult(true); +} + +BuildStepConfigWidget *DeviceCheckBuildStep::createConfigWidget() +{ + return new SimpleBuildStepConfigWidget(this); +} + +Core::Id DeviceCheckBuildStep::stepId() +{ + return Core::Id("ProjectExplorer.DeviceCheckBuildStep"); +} + +QString DeviceCheckBuildStep::stepDisplayName() +{ + return tr("Check for a configured device"); +} diff --git a/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h new file mode 100644 index 0000000000..96f982e649 --- /dev/null +++ b/src/plugins/projectexplorer/devicesupport/devicecheckbuildstep.h @@ -0,0 +1,61 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.com) +** Contact: KDAB (info@kdab.com) +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef PROJECTEXPLORER_DEVICECHECKBUILDSTEP_H +#define PROJECTEXPLORER_DEVICECHECKBUILDSTEP_H + +#include "../buildstep.h" +#include "../projectexplorer_export.h" + +namespace ProjectExplorer { + +class BuildStepList; + +class PROJECTEXPLORER_EXPORT DeviceCheckBuildStep : public BuildStep +{ + Q_OBJECT +public: + DeviceCheckBuildStep(BuildStepList *bsl, Core::Id id); + DeviceCheckBuildStep(ProjectExplorer::BuildStepList *bsl, DeviceCheckBuildStep *bs); + + bool init(); + + void run(QFutureInterface &fi); + + BuildStepConfigWidget *createConfigWidget(); + + static Core::Id stepId(); + static QString stepDisplayName(); +}; + +} // namespace ProjectExplorer + +#endif // PROJECTEXPLORER_DEVICECHECKBUILDSTEP_H diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 8c381ecc48..fb71346958 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.pro @@ -113,6 +113,7 @@ HEADERS += projectexplorer.h \ devicesupport/desktopdevicefactory.h \ devicesupport/idevicewidget.h \ devicesupport/idevicefactory.h \ + devicesupport/devicecheckbuildstep.h \ devicesupport/devicemanager.h \ devicesupport/devicemanagermodel.h \ devicesupport/devicefactoryselectiondialog.h \ @@ -228,6 +229,7 @@ SOURCES += projectexplorer.cpp \ devicesupport/desktopdevice.cpp \ devicesupport/desktopdevicefactory.cpp \ devicesupport/idevicefactory.cpp \ + devicesupport/devicecheckbuildstep.cpp \ devicesupport/devicemanager.cpp \ devicesupport/devicemanagermodel.cpp \ devicesupport/devicefactoryselectiondialog.cpp \ diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index c8b5785c80..a63070d2b9 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -251,6 +251,8 @@ QtcPlugin { "devicesupport/desktopdevicefactory.h", "devicesupport/deviceapplicationrunner.cpp", "devicesupport/deviceapplicationrunner.h", + "devicesupport/devicecheckbuildstep.cpp", + "devicesupport/devicecheckbuildstep.h", "devicesupport/devicefactoryselectiondialog.cpp", "devicesupport/devicefactoryselectiondialog.h", "devicesupport/devicefactoryselectiondialog.ui", diff --git a/src/plugins/qnx/qnxdeployconfigurationfactory.cpp b/src/plugins/qnx/qnxdeployconfigurationfactory.cpp index e84ea7552b..f72e7c7143 100644 --- a/src/plugins/qnx/qnxdeployconfigurationfactory.cpp +++ b/src/plugins/qnx/qnxdeployconfigurationfactory.cpp @@ -35,6 +35,7 @@ #include "qnxdeployconfiguration.h" #include "qnxdeviceconfigurationfactory.h" +#include #include #include #include @@ -77,7 +78,9 @@ ProjectExplorer::DeployConfiguration *QnxDeployConfigurationFactory::create(Proj ProjectExplorer::DeployConfiguration * const dc = new QnxDeployConfiguration(parent, id, displayNameForId(id)); - dc->stepList()->insertStep(0, new RemoteLinux::GenericDirectUploadStep(dc->stepList(), + dc->stepList()->insertStep(0, new ProjectExplorer::DeviceCheckBuildStep(dc->stepList(), + ProjectExplorer::DeviceCheckBuildStep::stepId())); + dc->stepList()->insertStep(1, new RemoteLinux::GenericDirectUploadStep(dc->stepList(), RemoteLinux::GenericDirectUploadStep::stepId())); return dc; } diff --git a/src/plugins/qnx/qnxdeploystepfactory.cpp b/src/plugins/qnx/qnxdeploystepfactory.cpp index 579214cb97..3b053761e6 100644 --- a/src/plugins/qnx/qnxdeploystepfactory.cpp +++ b/src/plugins/qnx/qnxdeploystepfactory.cpp @@ -34,6 +34,7 @@ #include "qnxdeviceconfigurationfactory.h" #include +#include #include #include #include @@ -56,13 +57,17 @@ QList QnxDeployStepFactory::availableCreationIds(ProjectExplorer::Buil if (deviceType != QnxDeviceConfigurationFactory::deviceType()) return QList(); - return QList() << RemoteLinux::GenericDirectUploadStep::stepId(); + return QList() << RemoteLinux::GenericDirectUploadStep::stepId() + << ProjectExplorer::DeviceCheckBuildStep::stepId(); } QString QnxDeployStepFactory::displayNameForId(const Core::Id id) const { if (id == RemoteLinux::GenericDirectUploadStep::stepId()) return RemoteLinux::GenericDirectUploadStep::displayName(); + else if (id == ProjectExplorer::DeviceCheckBuildStep::stepId()) + return ProjectExplorer::DeviceCheckBuildStep::stepDisplayName(); + return QString(); } @@ -75,7 +80,12 @@ ProjectExplorer::BuildStep *QnxDeployStepFactory::create(ProjectExplorer::BuildS { if (!canCreate(parent, id)) return 0; - return new RemoteLinux::GenericDirectUploadStep(parent, id); + + if (id == RemoteLinux::GenericDirectUploadStep::stepId()) + return new RemoteLinux::GenericDirectUploadStep(parent, id); + else if (id == ProjectExplorer::DeviceCheckBuildStep::stepId()) + return new ProjectExplorer::DeviceCheckBuildStep(parent, id); + return 0; } bool QnxDeployStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const @@ -103,5 +113,11 @@ ProjectExplorer::BuildStep *QnxDeployStepFactory::clone(ProjectExplorer::BuildSt { if (!canClone(parent, product)) return 0; - return new RemoteLinux::GenericDirectUploadStep(parent, static_cast(product)); + + if (RemoteLinux::GenericDirectUploadStep * const other = qobject_cast(product)) + return new RemoteLinux::GenericDirectUploadStep(parent, other); + else if (ProjectExplorer::DeviceCheckBuildStep * const other = qobject_cast(product)) + return new ProjectExplorer::DeviceCheckBuildStep(parent, other); + + return 0; } -- cgit v1.2.1 From 7cf9312a4cf97591b009dccf13054ed2b669f44f Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 31 May 2013 14:33:24 +0200 Subject: Qbs: Do not list Qbs steps in non-Qbs projects They can not work there anyway. Change-Id: Ic643ae7e35ad599ffb3928530eafb6ec537f3f04 Reviewed-by: Tobias Hunger --- src/plugins/qbsprojectmanager/qbsbuildstep.cpp | 6 ++++-- src/plugins/qbsprojectmanager/qbsinstallstep.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 37304766d6..93a5d304f7 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -422,7 +422,8 @@ QbsBuildStepFactory::QbsBuildStepFactory(QObject *parent) : QList QbsBuildStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const { if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_BUILD - && qobject_cast(parent->parent())) + && qobject_cast(parent->parent()) + && qobject_cast(parent->target()->project())) return QList() << Core::Id(Constants::QBS_BUILDSTEP_ID); return QList(); } @@ -437,7 +438,8 @@ QString QbsBuildStepFactory::displayNameForId(const Core::Id id) const bool QbsBuildStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const { if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD) - || !qobject_cast(parent->parent())) + || !qobject_cast(parent->parent()) + || !qobject_cast(parent->target()->project())) return false; return id == Core::Id(Constants::QBS_BUILDSTEP_ID); } diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index 2215b8a559..b08b11ad5b 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -363,7 +363,8 @@ QbsInstallStepFactory::QbsInstallStepFactory(QObject *parent) : QList QbsInstallStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const { if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY - && qobject_cast(parent->parent())) + && qobject_cast(parent->parent()) + && qobject_cast(parent->target()->project())) return QList() << Core::Id(Constants::QBS_INSTALLSTEP_ID); return QList(); } @@ -378,7 +379,8 @@ QString QbsInstallStepFactory::displayNameForId(const Core::Id id) const bool QbsInstallStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const { if (parent->id() != Core::Id(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY) - || !qobject_cast(parent->parent())) + || !qobject_cast(parent->parent()) + || !qobject_cast(parent->target()->project())) return false; return id == Core::Id(Constants::QBS_INSTALLSTEP_ID); } -- cgit v1.2.1 From 7b5b5b13b458b2da02f13701dc95325f67eaecd5 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 30 May 2013 12:07:23 +0300 Subject: Ignore unconfigured VCS Change-Id: I4a63734793debfcb37283257bb7cbf4b1153197f Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller Reviewed-by: Tobias Hunger --- src/plugins/coreplugin/vcsmanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index 461c1526a5..f4839a1dc2 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -226,8 +226,10 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input foreach (IVersionControl * versionControl, versionControls) { QString topLevel; - if (versionControl->managesDirectory(directory, &topLevel)) + if (versionControl->isConfigured() + && versionControl->managesDirectory(directory, &topLevel)) { allThatCanManage.push_back(StringVersionControlPair(topLevel, versionControl)); + } } // To properly find a nested repository (say, git checkout inside SVN), -- cgit v1.2.1 From f3eedaf3000ca948816028b8e4902994bbc8db65 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 31 May 2013 12:38:48 +0300 Subject: Git: Warn when commits are not found Change-Id: I5e03853f0b658d7f246538ca90e35f38cc2f49d4 Reviewed-by: Tobias Hunger --- src/plugins/git/logchangedialog.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 78cf8b04d5..373e8f37e8 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -31,6 +31,8 @@ #include "gitplugin.h" #include "gitclient.h" +#include + #include #include #include @@ -67,8 +69,14 @@ LogChangeWidget::LogChangeWidget(QWidget *parent) bool LogChangeWidget::init(const QString &repository, const QString &commit, bool includeRemote) { - if (!populateLog(repository, commit, includeRemote) || !m_model->rowCount()) + if (!populateLog(repository, commit, includeRemote)) + return false; + if (!m_model->rowCount()) { + VcsBase::VcsBaseOutputWindow::instance()->appendError( + includeRemote ? tr("No commits were found") + : tr("No local commits were found")); return false; + } selectionModel()->select(m_model->index(0, 0), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); return true; @@ -181,7 +189,7 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) : bool LogChangeDialog::runDialog(const QString &repository, const QString &commit, bool includeRemote) { if (!widget->init(repository, commit, includeRemote)) - return QDialog::Rejected; + return false; return QDialog::exec() == QDialog::Accepted; } -- cgit v1.2.1 From b90e3bbd8bea27ad915a4d9033e0d5bda26f5667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20N=C3=A4tterlund?= Date: Thu, 30 May 2013 13:53:28 +0200 Subject: QNX/RemoteLinux/Madde: Made device test more generic Any device inheriting from LinuxDevice can now implement a createDeviceTester() method to return their own AbstractLinuxDeviceTester that runs when the device wizard is completed, or when the Test Device button is pressed. The MaddeDevice implementation of the device actions now completely matches that of LinuxDevice, so those are removed. The QNX device check was improved with additional tool checking. Change-Id: Ie761b7cfc5591238aa2a18a74fe1843fb2cdbeaa Reviewed-by: Christian Kandeler Reviewed-by: Nicolas Arnaud-Cormos Reviewed-by: Tobias Hunger --- src/plugins/madde/maddedevice.cpp | 38 +----- src/plugins/madde/maddedevice.h | 5 +- src/plugins/qnx/qnx.pro | 6 +- src/plugins/qnx/qnx.qbs | 2 + src/plugins/qnx/qnxdeviceconfiguration.cpp | 6 + src/plugins/qnx/qnxdeviceconfiguration.h | 2 + src/plugins/qnx/qnxdeviceconfigurationwizard.cpp | 4 +- src/plugins/qnx/qnxdevicetester.cpp | 163 +++++++++++++++++++++++ src/plugins/qnx/qnxdevicetester.h | 84 ++++++++++++ src/plugins/remotelinux/linuxdevice.cpp | 7 +- src/plugins/remotelinux/linuxdevice.h | 2 + 11 files changed, 277 insertions(+), 42 deletions(-) create mode 100644 src/plugins/qnx/qnxdevicetester.cpp create mode 100644 src/plugins/qnx/qnxdevicetester.h (limited to 'src') diff --git a/src/plugins/madde/maddedevice.cpp b/src/plugins/madde/maddedevice.cpp index f8b963246e..e8f3c5546f 100644 --- a/src/plugins/madde/maddedevice.cpp +++ b/src/plugins/madde/maddedevice.cpp @@ -41,7 +41,6 @@ using namespace RemoteLinux; namespace Madde { namespace Internal { -const char MaddeDeviceTestActionId[] = "Madde.DeviceTestAction"; MaddeDevice::Ptr MaddeDevice::create() { @@ -78,38 +77,6 @@ QString MaddeDevice::displayType() const return maddeDisplayType(type()); } -QList MaddeDevice::actionIds() const -{ - return QList() << Core::Id(MaddeDeviceTestActionId) - << Core::Id(Constants::GenericDeployKeyToDeviceActionId); -} - -QString MaddeDevice::displayNameForActionId(Core::Id actionId) const -{ - QTC_ASSERT(actionIds().contains(actionId), return QString()); - - if (actionId == MaddeDeviceTestActionId) - return tr("Test"); - if (actionId == Constants::GenericDeployKeyToDeviceActionId) - return tr("Deploy Public Key..."); - return QString(); // Can't happen. -} - -void MaddeDevice::executeAction(Core::Id actionId, QWidget *parent) const -{ - QTC_ASSERT(actionIds().contains(actionId), return); - - QDialog *d = 0; - const IDevice::ConstPtr device = sharedFromThis(); - if (actionId == MaddeDeviceTestActionId) - d = new LinuxDeviceTestDialog(device, new MaddeDeviceTester, parent); - else if (actionId == Constants::GenericDeployKeyToDeviceActionId) - d = PublicKeyDeploymentDialog::createDialog(device, parent); - if (d) - d->exec(); - delete d; -} - QString MaddeDevice::maddeDisplayType(Core::Id type) { if (type == Maemo5OsType) @@ -144,5 +111,10 @@ QSize MaddeDevice::packageManagerIconSize(Core::Id type) return QSize(); } +AbstractLinuxDeviceTester *MaddeDevice::createDeviceTester() const +{ + return new MaddeDeviceTester; +} + } // namespace Internal } // namespace Madde diff --git a/src/plugins/madde/maddedevice.h b/src/plugins/madde/maddedevice.h index 0d95614775..463c225231 100644 --- a/src/plugins/madde/maddedevice.h +++ b/src/plugins/madde/maddedevice.h @@ -49,9 +49,6 @@ public: Origin origin = ManuallyAdded, Core::Id id = Core::Id()); QString displayType() const; - QList actionIds() const; - QString displayNameForActionId(Core::Id actionId) const; - void executeAction(Core::Id actionId, QWidget *parent) const; ProjectExplorer::IDevice::Ptr clone() const; static QString maddeDisplayType(Core::Id type); @@ -61,6 +58,8 @@ public: static QSize packageManagerIconSize(Core::Id type); + RemoteLinux::AbstractLinuxDeviceTester *createDeviceTester() const; + private: MaddeDevice(); MaddeDevice(const QString &name, Core::Id type, MachineType machineType, diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index a50ed1d8b5..16f02fa6f2 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -92,7 +92,8 @@ SOURCES += qnxplugin.cpp \ bardescriptoreditorabstractpanelwidget.cpp \ blackberrysetupwizard.cpp \ blackberrysetupwizardpages.cpp \ - blackberryutils.cpp + blackberryutils.cpp \ + qnxdevicetester.cpp HEADERS += qnxplugin.h\ qnxconstants.h \ @@ -184,7 +185,8 @@ HEADERS += qnxplugin.h\ bardescriptoreditorabstractpanelwidget.h \ blackberrysetupwizard.h \ blackberrysetupwizardpages.h \ - blackberryutils.h + blackberryutils.h \ + qnxdevicetester.h FORMS += \ blackberrydeviceconfigurationwizardsetuppage.ui \ diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 83d168aab3..214e43e302 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -208,6 +208,8 @@ QtcPlugin { "qnxdeviceconfigurationwizard.h", "qnxdeviceconfigurationwizardpages.cpp", "qnxdeviceconfigurationwizardpages.h", + "qnxdevicetester.cpp", + "qnxdevicetester.h", "qnxplugin.cpp", "qnxplugin.h", "qnxqtversion.cpp", diff --git a/src/plugins/qnx/qnxdeviceconfiguration.cpp b/src/plugins/qnx/qnxdeviceconfiguration.cpp index 50cc3a89cd..7fb16988a6 100644 --- a/src/plugins/qnx/qnxdeviceconfiguration.cpp +++ b/src/plugins/qnx/qnxdeviceconfiguration.cpp @@ -30,6 +30,7 @@ ****************************************************************************/ #include "qnxdeviceconfiguration.h" +#include "qnxdevicetester.h" #include @@ -185,3 +186,8 @@ ProjectExplorer::DeviceProcessList *QnxDeviceConfiguration::createProcessListMod { return new QnxDeviceProcessList(sharedFromThis(), parent); } + +RemoteLinux::AbstractLinuxDeviceTester *QnxDeviceConfiguration::createDeviceTester() const +{ + return new QnxDeviceTester; +} diff --git a/src/plugins/qnx/qnxdeviceconfiguration.h b/src/plugins/qnx/qnxdeviceconfiguration.h index f1645d6793..1e2a9d0aef 100644 --- a/src/plugins/qnx/qnxdeviceconfiguration.h +++ b/src/plugins/qnx/qnxdeviceconfiguration.h @@ -54,6 +54,8 @@ public: ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const; ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const; + RemoteLinux::AbstractLinuxDeviceTester *createDeviceTester() const; + QString displayType() const; protected: diff --git a/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp b/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp index cc8b9929b0..c14d69530c 100644 --- a/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp +++ b/src/plugins/qnx/qnxdeviceconfigurationwizard.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include using namespace ProjectExplorer; @@ -77,8 +76,7 @@ IDevice::Ptr QnxDeviceConfigurationWizard::device() device->setSshParameters(sshParams); device->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100"))); - RemoteLinux::GenericLinuxDeviceTester *devTester = new RemoteLinux::GenericLinuxDeviceTester(this); - RemoteLinux::LinuxDeviceTestDialog dlg(device, devTester, this); + RemoteLinux::LinuxDeviceTestDialog dlg(device, device->createDeviceTester(), this); dlg.exec(); return device; diff --git a/src/plugins/qnx/qnxdevicetester.cpp b/src/plugins/qnx/qnxdevicetester.cpp new file mode 100644 index 0000000000..c7ce356483 --- /dev/null +++ b/src/plugins/qnx/qnxdevicetester.cpp @@ -0,0 +1,163 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.com) +** Contact: KDAB (info@kdab.com) +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qnxdevicetester.h" + +#include +#include + +using namespace Qnx; +using namespace Qnx::Internal; + +QnxDeviceTester::QnxDeviceTester(QObject *parent) + : RemoteLinux::AbstractLinuxDeviceTester(parent) + , m_result(TestSuccess) + , m_state(Inactive) + , m_currentCommandIndex(-1) +{ + m_genericTester = new RemoteLinux::GenericLinuxDeviceTester(this); + + m_processRunner = new QSsh::SshRemoteProcessRunner(this); + connect(m_processRunner, SIGNAL(connectionError()), SLOT(handleConnectionError())); + connect(m_processRunner, SIGNAL(processClosed(int)), SLOT(handleProcessFinished(int))); + + m_commandsToTest << QLatin1String("awk") + << QLatin1String("grep") + << QLatin1String("kill") + << QLatin1String("netstat") + << QLatin1String("print") + << QLatin1String("printf") + << QLatin1String("ps") + << QLatin1String("read") + << QLatin1String("sed") + << QLatin1String("sleep") + << QLatin1String("uname"); +} + +void QnxDeviceTester::testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration) +{ + QTC_ASSERT(m_state == Inactive, return); + + m_deviceConfiguration = deviceConfiguration; + + connect(m_genericTester, SIGNAL(progressMessage(QString)), SIGNAL(progressMessage(QString))); + connect(m_genericTester, SIGNAL(errorMessage(QString)), SIGNAL(errorMessage(QString))); + connect(m_genericTester, SIGNAL(finished(RemoteLinux::AbstractLinuxDeviceTester::TestResult)), + SLOT(handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult))); + + m_state = GenericTest; + m_genericTester->testDevice(deviceConfiguration); +} + +void QnxDeviceTester::stopTest() +{ + QTC_ASSERT(m_state != Inactive, return); + + switch (m_state) { + case Inactive: + break; + case GenericTest: + m_genericTester->stopTest(); + break; + case CommandsTest: + m_processRunner->cancel(); + break; + } + + m_result = TestFailure; + setFinished(); +} + +void QnxDeviceTester::handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result) +{ + QTC_ASSERT(m_state == GenericTest, return); + + if (result == TestFailure) { + m_result = TestFailure; + setFinished(); + return; + } + + m_state = CommandsTest; + testNextCommand(); +} + +void QnxDeviceTester::handleProcessFinished(int exitStatus) +{ + QTC_ASSERT(m_state == CommandsTest, return); + + const QString command = m_commandsToTest[m_currentCommandIndex]; + if (exitStatus == QSsh::SshRemoteProcess::NormalExit) { + if (m_processRunner->processExitCode() == 0) { + emit progressMessage(tr("%1 found.\n").arg(command)); + } else { + emit errorMessage(tr("%1 not found.\n").arg(command)); + m_result = TestFailure; + } + } else { + emit errorMessage(tr("An error occurred checking for %1.\n").arg(command)); + m_result = TestFailure; + } + testNextCommand(); +} + +void QnxDeviceTester::handleConnectionError() +{ + QTC_ASSERT(m_state == CommandsTest, return); + + m_result = TestFailure; + emit errorMessage(tr("SSH connection error: %1\n").arg(m_processRunner->lastConnectionErrorString())); + setFinished(); +} + +void QnxDeviceTester::testNextCommand() +{ + ++m_currentCommandIndex; + + if (m_currentCommandIndex >= m_commandsToTest.size()) { + setFinished(); + return; + } + + QString command = m_commandsToTest[m_currentCommandIndex]; + emit progressMessage(tr("Checking for %1...").arg(command)); + + m_processRunner->run("command -v " + command.toLatin1(), m_deviceConfiguration->sshParameters()); +} + +void QnxDeviceTester::setFinished() +{ + m_state = Inactive; + disconnect(m_genericTester, 0, this, 0); + if (m_processRunner) + disconnect(m_processRunner, 0, this, 0); + emit finished(m_result); +} diff --git a/src/plugins/qnx/qnxdevicetester.h b/src/plugins/qnx/qnxdevicetester.h new file mode 100644 index 0000000000..ccec636f08 --- /dev/null +++ b/src/plugins/qnx/qnxdevicetester.h @@ -0,0 +1,84 @@ +/************************************************************************** +** +** Copyright (C) 2011 - 2013 Research In Motion +** +** Contact: Research In Motion (blackberry-qt@qnx.com) +** Contact: KDAB (info@kdab.com) +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QNX_INTERNAL_QNXDEVICETESTER_H +#define QNX_INTERNAL_QNXDEVICETESTER_H + +#include + +#include + +namespace QSsh { +class SshRemoteProcessRunner; +} + +namespace Qnx { +namespace Internal { + +class QnxDeviceTester : public RemoteLinux::AbstractLinuxDeviceTester +{ + Q_OBJECT +public: + explicit QnxDeviceTester(QObject *parent = 0); + + void testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration); + void stopTest(); + +private slots: + void handleGenericTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result); + + void handleProcessFinished(int exitStatus); + void handleConnectionError(); + +private: + enum State { + Inactive, + GenericTest, + CommandsTest + }; + + void testNextCommand(); + void setFinished(); + + RemoteLinux::GenericLinuxDeviceTester *m_genericTester; + ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration; + TestResult m_result; + State m_state; + + int m_currentCommandIndex; + QStringList m_commandsToTest; + QSsh::SshRemoteProcessRunner *m_processRunner; +}; + +} // namespace Internal +} // namespace Qnx + +#endif // QNX_INTERNAL_QNXDEVICETESTER_H diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 70796e54cd..8c530ac3ac 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -214,7 +214,7 @@ void LinuxDevice::executeAction(Core::Id actionId, QWidget *parent) const QDialog *d = 0; const LinuxDevice::ConstPtr device = sharedFromThis().staticCast(); if (actionId == Constants::GenericTestDeviceActionId) - d = new LinuxDeviceTestDialog(device, new GenericLinuxDeviceTester, parent); + d = new LinuxDeviceTestDialog(device, createDeviceTester(), parent); else if (actionId == Constants::GenericDeployKeyToDeviceActionId) d = PublicKeyDeploymentDialog::createDialog(device, parent); if (d) @@ -264,4 +264,9 @@ DeviceProcessList *LinuxDevice::createProcessListModel(QObject *parent) const return new LinuxDeviceProcessList(sharedFromThis(), parent); } +AbstractLinuxDeviceTester *LinuxDevice::createDeviceTester() const +{ + return new GenericLinuxDeviceTester; +} + } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 0daa95e58e..0ec84cd44e 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -41,6 +41,7 @@ namespace Utils { class PortList; } namespace RemoteLinux { namespace Internal { class LinuxDevicePrivate; } +class AbstractLinuxDeviceTester; class REMOTELINUX_EXPORT LinuxDeviceProcessSupport : public ProjectExplorer::DeviceProcessSupport { @@ -73,6 +74,7 @@ public: ProjectExplorer::PortsGatheringMethod::Ptr portsGatheringMethod() const; bool canCreateProcessModel() const { return true; } ProjectExplorer::DeviceProcessList *createProcessListModel(QObject *parent) const; + virtual AbstractLinuxDeviceTester *createDeviceTester() const; protected: LinuxDevice() {} -- cgit v1.2.1 From 05a6fc48ba6abf017aa4336f248a3f11e1cf8c86 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 28 May 2013 20:19:53 +0300 Subject: Git: Support change links on commit editor Useful for commit messages with "reverts " for example. Can later be extended for interactive rebase Change-Id: Ibf77433ecddfacbd8d443636ddbc406bda474aa7 Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 13 +++++++++++++ src/plugins/git/gitclient.h | 1 + src/plugins/git/giteditor.cpp | 16 ++++++++++++++++ src/plugins/git/giteditor.h | 2 ++ src/plugins/vcsbase/vcsbaseeditor.cpp | 15 +++++++++++++-- src/plugins/vcsbase/vcsbaseeditor.h | 1 + 6 files changed, 46 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 6a1324683b..a351299dcd 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -794,6 +794,19 @@ QString GitClient::findGitDirForRepository(const QString &repositoryDir) const return res; } +QString GitClient::findRepositoryForGitDir(const QString &gitDir) const +{ + static QHash gitDirCache; + QString &res = gitDirCache[gitDir]; + if (!res.isEmpty()) + return res; + QByteArray outputText; + QStringList arguments; + arguments << QLatin1String("rev-parse") << QLatin1String("--show-toplevel"); + fullySynchronousGit(gitDir, arguments, &outputText, 0, false); + return QString::fromLocal8Bit(outputText.trimmed()); +} + VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const { diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 9dc1d936f7..4b230594b6 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -138,6 +138,7 @@ public: QString findRepositoryForDirectory(const QString &dir); QString findGitDirForRepository(const QString &repositoryDir) const; + QString findRepositoryForGitDir(const QString &gitDir) const; void diff(const QString &workingDirectory, const QStringList &diffArgs, const QString &fileName); void diff(const QString &workingDirectory, const QStringList &diffArgs, diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index 2c6062799b..1819fd7a34 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -235,6 +235,16 @@ void GitEditor::init() new GitSubmitHighlighter(baseTextDocument().data()); } +bool GitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) +{ + bool res = VcsBaseEditorWidget::open(errorString, fileName, realFileName); + if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) { + QFileInfo fi(fileName); + setSource(GitPlugin::instance()->gitClient()->findRepositoryForGitDir(fi.absolutePath())); + } + return res; +} + QString GitEditor::decorateVersion(const QString &revision) const { const QFileInfo fi(source()); @@ -284,5 +294,11 @@ QString GitEditor::revisionSubject(const QTextBlock &inBlock) const return QString(); } +bool GitEditor::supportChangeLinks() const +{ + return VcsBaseEditorWidget::supportChangeLinks() + || (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID); +} + } // namespace Internal } // namespace Git diff --git a/src/plugins/git/giteditor.h b/src/plugins/git/giteditor.h index 5010fd8193..b5539892c9 100644 --- a/src/plugins/git/giteditor.h +++ b/src/plugins/git/giteditor.h @@ -60,6 +60,7 @@ private slots: private: void init(); + bool open(QString *errorString, const QString &fileName, const QString &realFileName); QSet annotationChanges() const; QString changeUnderCursor(const QTextCursor &) const; VcsBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet &changes, const QColor &bg) const; @@ -68,6 +69,7 @@ private: bool isValidRevision(const QString &revision) const; void addChangeActions(QMenu *menu, const QString &change); QString revisionSubject(const QTextBlock &inBlock) const; + bool supportChangeLinks() const; mutable QRegExp m_changeNumberPattern; QString m_currentChange; diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index ecf43b2005..00445b2375 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -663,6 +663,17 @@ void VcsBaseEditorWidget::setLogEntryPattern(const QRegExp &pattern) d->m_logEntryPattern = pattern; } +bool VcsBaseEditorWidget::supportChangeLinks() const +{ + switch (d->m_parameters->type) { + case LogOutput: + case AnnotateOutput: + return true; + default: + return false; + } +} + void VcsBaseEditorWidget::init() { d->m_editor = editor(); @@ -963,7 +974,7 @@ void VcsBaseEditorWidget::mouseMoveEvent(QMouseEvent *e) bool overrideCursor = false; Qt::CursorShape cursorShape; - if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) { + if (supportChangeLinks()) { // Link emulation behaviour for 'click on change-interaction' const QTextCursor cursor = cursorForPosition(e->pos()); Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor); @@ -987,7 +998,7 @@ void VcsBaseEditorWidget::mouseReleaseEvent(QMouseEvent *e) { const bool wasDragging = d->m_mouseDragging; d->m_mouseDragging = false; - if (!wasDragging && (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput)) { + if (!wasDragging && supportChangeLinks()) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { const QTextCursor cursor = cursorForPosition(e->pos()); Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor); diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h index 955c194d90..6971b701cf 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.h +++ b/src/plugins/vcsbase/vcsbaseeditor.h @@ -103,6 +103,7 @@ protected: void setDiffFilePattern(const QRegExp &pattern); // Pattern for log entry. hash/revision number must be in the first capture group void setLogEntryPattern(const QRegExp &pattern); + virtual bool supportChangeLinks() const; public: virtual void init(); -- cgit v1.2.1 From a7fa0dd4b9c113dda6c94b9bd27990424a91c81c Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari Date: Wed, 29 May 2013 16:52:14 +0200 Subject: Qnx: Fix slog2er parsing when logs contain \n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the logs contain a '\n' the message parts in the new lines are not displayed. The new line messages are displayed with no buffer details and are ignored when the parsing is processed. Change-Id: I0e174dd5283a64c4e9b0434c06dd417f1be2c810 Reviewed-by: Tobias Nätterlund Reviewed-by: Nicolas Arnaud-Cormos --- src/plugins/qnx/blackberryapplicationrunner.cpp | 42 +++++++++++++++++-------- src/plugins/qnx/blackberryapplicationrunner.h | 1 + 2 files changed, 30 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp index 1943a0374e..1f24c5765f 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.cpp +++ b/src/plugins/qnx/blackberryapplicationrunner.cpp @@ -59,6 +59,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe : QObject(parent) , m_debugMode(debugMode) , m_slog2infoFound(false) + , m_currentLogs(false) , m_pid(-1) , m_appId(QString()) , m_running(false) @@ -155,6 +156,7 @@ ProjectExplorer::RunControl::StopResult BlackBerryApplicationRunner::stop() return ProjectExplorer::RunControl::AsynchronousStop; m_stopping = true; + m_currentLogs = false; if (m_testSlog2Process && m_testSlog2Process->isProcessRunning()) { m_testSlog2Process->cancel(); @@ -312,19 +314,33 @@ void BlackBerryApplicationRunner::handleTailOutput() if (m_slog2infoFound) { const QStringList multiLine = message.split(QLatin1Char('\n')); Q_FOREACH (const QString &line, multiLine) { - QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(), - QString::fromLatin1("dd HH:mm:ss.zzz")); - if (dateTime >= m_launchDateTime) { - QStringList validLineBeginnings; - validLineBeginnings << QLatin1String("qt-msg 0 ") - << QLatin1String("qt-msg* 0 ") - << QLatin1String("default* 9000 ") - << QLatin1String("default 9000 ") - << QLatin1String(" 0 "); - Q_FOREACH (const QString &beginning, validLineBeginnings) { - if (showQtMessage(beginning, line)) - break; - } + // Check if logs are from the recent launch + // Note: This is useless if/once slog2info -b displays only logs from recent launches + if (!m_currentLogs) { + QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(), + QString::fromLatin1("dd HH:mm:ss.zzz")); + + m_currentLogs = dateTime >= m_launchDateTime; + if (!m_currentLogs) + continue; + } + + // The line could be a part of a previous log message that contains a '\n' + // In that case only the message body is displayed + if (!line.contains(m_appId) && !line.isEmpty()) { + emit output(line + QLatin1Char('\n'), Utils::StdOutFormat); + continue; + } + + QStringList validLineBeginnings; + validLineBeginnings << QLatin1String("qt-msg 0 ") + << QLatin1String("qt-msg* 0 ") + << QLatin1String("default* 9000 ") + << QLatin1String("default 9000 ") + << QLatin1String(" 0 "); + Q_FOREACH (const QString &beginning, validLineBeginnings) { + if (showQtMessage(beginning, line)) + break; } } return; diff --git a/src/plugins/qnx/blackberryapplicationrunner.h b/src/plugins/qnx/blackberryapplicationrunner.h index 3b8eec9097..afe7bba7ee 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.h +++ b/src/plugins/qnx/blackberryapplicationrunner.h @@ -104,6 +104,7 @@ private: bool m_debugMode; bool m_slog2infoFound; + bool m_currentLogs; QDateTime m_launchDateTime; -- cgit v1.2.1 From 1dac4ba7917d30c1c6b75a4629a912ab41f7b179 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 May 2013 15:35:52 +0200 Subject: Debugger: Prepare assigning of values in LLDB interface Change-Id: I722e78c352066ddd05e96199fd8ead088e3e9f59 Reviewed-by: hjk --- src/plugins/debugger/lldb/lldbengine.cpp | 101 +++++++++---------------------- src/plugins/debugger/lldb/lldbengine.h | 2 +- 2 files changed, 28 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 2b3af11a48..5a07e40e34 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -164,6 +164,8 @@ void LldbEngine::setupInferior() { QString executable = QFileInfo(startParameters().executable).absoluteFilePath(); runCommand(Command("setupInferior").arg("executable", executable)); + + requestUpdateWatchers(); } void LldbEngine::runEngine() @@ -676,18 +678,16 @@ void LldbEngine::updateAll() // ////////////////////////////////////////////////////////////////////// -void LldbEngine::assignValueInDebugger(const Internal::WatchData *, const QString &expression, const QVariant &value) +void LldbEngine::assignValueInDebugger(const Internal::WatchData *data, + const QString &expression, const QVariant &value) { - Q_UNUSED(expression); - Q_UNUSED(value); - //SDEBUG("ASSIGNING: " << (expression + QLatin1Char('=') + value.toString())); -#if 0 - m_scriptEngine->evaluate(expression + QLatin1Char('=') + value.toString()); - updateLocals(); -#endif + Q_UNUSED(data); + Command cmd("assignValue"); + cmd.arg("exp", expression.toLatin1().toHex()); + cmd.arg("value", value.toString().toLatin1().toHex()); + runCommand(cmd); } - void LldbEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags &flags) { Q_UNUSED(data); @@ -699,12 +699,13 @@ void LldbEngine::updateLocals() { WatchHandler *handler = watchHandler(); + requestUpdateWatchers(); + Command cmd("updateData"); cmd.arg("expanded", handler->expansionRequests()); cmd.arg("typeformats", handler->typeFormatRequests()); cmd.arg("formats", handler->individualFormatRequests()); - QList watcherData; // const QString fileName = stackHandler()->currentFrame().file; // if (!fileName.isEmpty()) { // const QString function = stackHandler()->currentFrame().function; @@ -739,16 +740,6 @@ void LldbEngine::updateLocals() // } // } - QHashIterator it(handler->watcherNames()); - while (it.hasNext()) { - it.next(); - QHash hash; - hash["exp"] = '\'' + it.key() + '\''; - hash["id"] = "'watch." + QByteArray::number(it.value()) + '\''; - watcherData.append(Command::toData(hash)); - } - cmd.args.append("'watchers':" + Command::toData(watcherData) + ','); - const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty(); cmd.arg("passexeptions", alwaysVerbose); cmd.arg("fancy", debuggerCore()->boolSetting(UseDebuggingHelpers)); @@ -839,58 +830,21 @@ void LldbEngine::readLldbStandardOutput() } } -QByteArray LldbEngine::currentOptions() const +void LldbEngine::requestUpdateWatchers() { - QByteArray localsOptions; - QByteArray stackOptions; - QByteArray threadsOptions; - - { - QByteArray watchers; - //if (!m_toolTipExpression.isEmpty()) - // watchers += m_toolTipExpression.toLatin1() - // + '#' + tooltipINameForExpression(m_toolTipExpression.toLatin1()); - - WatchHandler *handler = watchHandler(); - QHash watcherNames = handler->watcherNames(); - QHashIterator it(watcherNames); - while (it.hasNext()) { - it.next(); - if (!watchers.isEmpty()) - watchers += "##"; - watchers += it.key() + "#watch." + QByteArray::number(it.value()); - } - - QByteArray options; - if (debuggerCore()->boolSetting(UseDebuggingHelpers)) - options += "fancy,"; - if (debuggerCore()->boolSetting(AutoDerefPointers)) - options += "autoderef,"; - if (options.isEmpty()) - options += "defaults,"; - options.chop(1); - - localsOptions = "options:" + options + " " - + "vars: " - + "expanded:" + handler->expansionRequests() + " " - + "typeformats:" + handler->typeFormatRequests() + " " - + "formats:" + handler->individualFormatRequests() + " " - + "watcher:" + watchers.toHex(); - } - - { - int maxdepth = debuggerCore()->action(MaximalStackDepth)->value().toInt(); - ThreadId curthread = threadsHandler()->currentThread(); - stackOptions += "maxdepth:" + QByteArray::number(maxdepth); - stackOptions += ",curthread:" + QByteArray::number(curthread.raw()); + WatchHandler *handler = watchHandler(); + QHashIterator it(handler->watcherNames()); + QList watcherData; + while (it.hasNext()) { + it.next(); + QHash hash; + hash["iname"] = "'watch." + QByteArray::number(it.value()) + '\''; + hash["exp"] = '\'' + it.key().toHex() + '\''; + watcherData.append(Command::toData(hash)); } - - QByteArray result; - result += "\"locals\":\"" + localsOptions + '"'; - result += ",\"stack\":\"" + stackOptions + '"'; - result += ",\"threads\":\"" + threadsOptions + '"'; - - return result; + Command cmd("setWatchers"); + cmd.args.append("'watchers':" + Command::toData(watcherData) + ','); + runCommand(cmd); } void LldbEngine::refreshLocals(const GdbMi &vars) @@ -911,10 +865,9 @@ void LldbEngine::refreshLocals(const GdbMi &vars) dummy.iname = child["iname"].data(); GdbMi wname = child["wname"]; if (wname.isValid()) { - // Happens (only) for watched expressions. They are encoded as - // base64 encoded 8 bit data, without quotes - dummy.name = decodeData(wname.data(), Base64Encoded8Bit); - dummy.exp = dummy.name.toUtf8(); + // Happens (only) for watched expressions. + dummy.exp = QByteArray::fromHex(wname.data()); + dummy.name = QString::fromUtf8(dummy.exp); } else { dummy.name = child["name"].toUtf8(); } diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index fe44c1940a..ff239aeee3 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -134,6 +134,7 @@ private: bool supportsThreads() const { return true; } bool isSynchronous() const { return true; } void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags); + void requestUpdateWatchers(); void setRegisterValue(int regnr, const QString &value); void fetchMemory(Internal::MemoryAgent *, QObject *, quint64 addr, quint64 length); @@ -171,7 +172,6 @@ private: typedef void (LldbEngine::*LldbCommandContinuation)(); - QByteArray currentOptions() const; void handleStop(const QByteArray &response); void handleListLocals(const QByteArray &response); void handleListModules(const QByteArray &response); -- cgit v1.2.1 From 7b21f07cd44feb56e848be851ceb8a03c1f1dd17 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 31 May 2013 17:11:47 +0200 Subject: Kits: Only make information on autodetected kits sticky All others may not have sticky settings in the first place. This fixes the name and icon fields always becoming disabled, even for manually added kits. Change-Id: Ie62ec6083586d65db851cee5d9a464e6c316be40 Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/kitmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index 0b363001cd..569b3234c2 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -59,7 +59,7 @@ public: widget = KitManager::instance()->createConfigWidget(k); if (widget) { - if (k) + if (k->isAutoDetected()) widget->makeStickySubWidgetsReadOnly(); widget->setVisible(false); } -- cgit v1.2.1 From de24f0170b10a55ee23978f15166a34291c2f480 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 31 May 2013 18:05:14 +0200 Subject: Subversion: Remove code for SVN version 1.4 This was necessary ages ago for the mac. That comes with SVN 1.6.18 nowadays, so get rid of it. Change-Id: Ie7dfc0acdd7670099fa6ccefc84867ba05d87b7c Reviewed-by: Tobias Hunger --- src/plugins/subversion/subversionplugin.cpp | 42 ----------------------------- src/plugins/subversion/subversionplugin.h | 2 -- 2 files changed, 44 deletions(-) (limited to 'src') diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 1565adf128..59d2e55927 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -1186,14 +1186,6 @@ SubversionPlugin *SubversionPlugin::instance() } bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName) -{ - if (Utils::HostOsInfo::isMacHost()) // See below. - return vcsAdd14(workingDir, rawFileName); - return vcsAdd15(workingDir, rawFileName); -} - -// Post 1.4 add: Use "--parents" to add directories -bool SubversionPlugin::vcsAdd15(const QString &workingDir, const QString &rawFileName) { const QString file = QDir::toNativeSeparators(rawFileName); QStringList args; @@ -1204,40 +1196,6 @@ bool SubversionPlugin::vcsAdd15(const QString &workingDir, const QString &rawFil return !response.error; } -// Pre 1.5 add: Add directories in a loop. To be deprecated -// once Mac ships newer svn-versions -bool SubversionPlugin::vcsAdd14(const QString &workingDir, const QString &rawFileName) -{ - const QChar slash = QLatin1Char('/'); - const QStringList relativePath = rawFileName.split(slash); - // Add directories (dir1/dir2/file.cpp) in a loop. - if (relativePath.size() > 1) { - QString path; - const int lastDir = relativePath.size() - 1; - for (int p = 0; p < lastDir; p++) { - if (!path.isEmpty()) - path += slash; - path += relativePath.at(p); - if (!checkSVNSubDir(QDir(path))) { - QStringList addDirArgs; - addDirArgs << QLatin1String("add") << QLatin1String("--non-recursive") << QDir::toNativeSeparators(path); - const SubversionResponse addDirResponse = - runSvn(workingDir, addDirArgs, m_settings.timeOutMs(), - SshPasswordPrompt|ShowStdOutInLogWindow); - if (addDirResponse.error) - return false; - } - } - } - // Add file - QStringList args; - args << QLatin1String("add") << QDir::toNativeSeparators(rawFileName); - const SubversionResponse response = - runSvn(workingDir, args, m_settings.timeOutMs(), - SshPasswordPrompt|ShowStdOutInLogWindow); - return !response.error; -} - bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName) { const QString file = QDir::toNativeSeparators(rawFileName); diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 2020313a60..0299ae942e 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -93,8 +93,6 @@ public: // IVersionControl bool vcsAdd(const QString &workingDir, const QString &fileName); - bool vcsAdd14(const QString &workingDir, const QString &fileName); - bool vcsAdd15(const QString &workingDir, const QString &fileName); bool vcsDelete(const QString &workingDir, const QString &fileName); bool vcsMove(const QString &workingDir, const QString &from, const QString &to); bool managesDirectory(const QString &directory, QString *topLevel = 0) const; -- cgit v1.2.1 From f8b052188f3ce798e5a3002b675dc50e13163723 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 31 May 2013 18:47:22 +0200 Subject: SVN: Add method to find SVN version and use it in svnDiff We want to enforce the internal diff if possible, but that option is only in 1.7 and later. Task-number: QTCREATORBUG-9425 Change-Id: If89f0a7eedae51a04a5f1c40d48287a6425f7a12 Reviewed-by: Tobias Hunger --- src/plugins/subversion/subversionplugin.cpp | 30 ++++++++++++++++++++++++++++- src/plugins/subversion/subversionplugin.h | 12 ++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 59d2e55927..4251930b63 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -572,7 +572,9 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet QFileInfo(p.files.front()).fileName() : p.diffName; QStringList args(QLatin1String("diff")); - args.append(QLatin1String("--internal-diff")); + Version v = svnVersion(); + if (v.majorVersion >= 1 && v.minorVersion >= 7) // --internal-diff is new in v1.7.0 + args.append(QLatin1String("--internal-diff")); args.append(p.arguments); args << p.files; @@ -1110,6 +1112,32 @@ QStringList SubversionPlugin::addAuthenticationOptions(const QStringList &args, return rc; } +SubversionPlugin::Version SubversionPlugin::svnVersion() +{ + if (m_svnVersionBinary != m_settings.binaryPath()) { + QStringList args; + args << QLatin1String("--version") << QLatin1String("-q"); + const Utils::SynchronousProcessResponse response = + VcsBase::VcsBasePlugin::runVcs(QDir().absolutePath(), m_settings.binaryPath(), + args, m_settings.timeOutMs(), 0); + if (response.result == Utils::SynchronousProcessResponse::Finished && + response.exitCode == 0) { + m_svnVersionBinary = m_settings.binaryPath(); + m_svnVersion = response.stdOut.trimmed(); + } else { + m_svnVersionBinary.clear(); + m_svnVersion.clear(); + } + } + + SubversionPlugin::Version v; + if (::sscanf(m_svnVersion.toLatin1().constData(), "%d.%d.%d", + &v.majorVersion, &v.minorVersion, &v.patchVersion) != 3) + v.majorVersion = v.minorVersion = v.patchVersion = -1; + + return v; +} + SubversionResponse SubversionPlugin::runSvn(const QString &workingDir, const QString &userName, const QString &password, const QStringList &arguments, int timeOut, diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 0299ae942e..b92e5309af 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -106,6 +106,15 @@ public: const QString &userName = QString(), const QString &password = QString()); + class Version { + public: + int majorVersion; + int minorVersion; + int patchVersion; + }; + + Version svnVersion(); + public slots: void vcsAnnotate(const QString &workingDir, const QString &file, const QString &revision = QString(), int lineNumber = -1); @@ -204,6 +213,9 @@ private: QAction *m_menuAction; bool m_submitActionTriggered; + QString m_svnVersionBinary; + QString m_svnVersion; + static SubversionPlugin *m_subversionPluginInstance; }; -- cgit v1.2.1 From 55e087ab05449cfe13228126da3de2accfcd6d30 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Mon, 3 Jun 2013 09:00:18 +0300 Subject: Git: fix bug with Log and Blame not showing stuff correctly. Task-number: QTCREATORBUG-9375 Change-Id: I4e18e4c2d4db71392aa305d49ffce924f8451a0b Reviewed-by: Orgad Shaneh --- src/plugins/git/gitclient.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index a351299dcd..747ad6e4cb 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1138,6 +1138,8 @@ void GitClient::show(const QString &source, const QString &id, } QString title = tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name); + const QFileInfo sourceFi(source); + const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath(); if (settings()->boolValue(GitSettings::useDiffEditorKey)) { const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; @@ -1151,7 +1153,9 @@ void GitClient::show(const QString &source, const QString &id, } int timeout = settings()->intValue(GitSettings::timeoutKey); - GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), source, processEnvironment(), timeout); + GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), + findRepositoryForDirectory(workDir), + processEnvironment(), timeout); handler->show(id); } else { const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID; @@ -1169,8 +1173,6 @@ void GitClient::show(const QString &source, const QString &id, arguments.append(userArgs); arguments << id; - const QFileInfo sourceFi(source); - const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath(); editor->setDiffBaseDirectory(workDir); executeGit(workDir, arguments, editor); } -- cgit v1.2.1 From 97915bbceafeda7e44e07a2eb8da4d029e18c071 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 31 May 2013 13:56:14 +0200 Subject: Make 'open in other split' a flag instead of another method. Change-Id: I1acafd85ec7a87ba2ac61240f30c329d56461118 Reviewed-by: David Schulz --- src/plugins/coreplugin/editormanager/editormanager.cpp | 9 ++------- src/plugins/coreplugin/editormanager/editormanager.h | 5 ++--- src/plugins/cpptools/cpptoolsplugin.cpp | 3 ++- 3 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index b31a5d131b..93c1f4c1d2 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1413,13 +1413,8 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName, IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId, OpenEditorFlags flags, bool *newEditor) { - return m_instance->openEditor(m_instance->currentEditorView(), - fileName, editorId, flags, newEditor); -} - -IEditor *EditorManager::openEditorInOtherSplit(const QString &fileName, const Id &editorId, OpenEditorFlags flags, bool *newEditor) -{ - m_instance->gotoOtherSplit(); + if (flags & EditorManager::OpenInOtherSplit) + m_instance->gotoOtherSplit(); return m_instance->openEditor(m_instance->currentEditorView(), fileName, editorId, flags, newEditor); } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 7429730460..e0d2ba6026 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -110,15 +110,14 @@ public: NoActivate = 1, IgnoreNavigationHistory = 2, ModeSwitch = 4, - CanContainLineNumber = 8 + CanContainLineNumber = 8, + OpenInOtherSplit = 16 }; Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag) static QString splitLineNumber(QString *fileName); static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0); - static IEditor *openEditorInOtherSplit(const QString &fileName, const Id &editorId = Id(), - OpenEditorFlags flags = 0, bool *newEditor = 0); static IEditor *openEditorWithContents(const Id &editorId, QString *titlePattern = 0, const QString &contents = QString()); diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 66e8a68966..af579bb5a7 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -164,7 +164,8 @@ void CppToolsPlugin::switchHeaderSourceInNextSplit() QString otherFile = correspondingHeaderOrSource( Core::EditorManager::currentEditor()->document()->fileName()); if (!otherFile.isEmpty()) - Core::EditorManager::openEditorInOtherSplit(otherFile); + Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit + | Core::EditorManager::ModeSwitch); } static QStringList findFilesInProject(const QString &name, -- cgit v1.2.1 From 37c22861dc834a25b7a480dbd0e781ceac2e6730 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 31 May 2013 16:24:43 +0200 Subject: Fix showing of info bar in .ui text editor. Removes another useless IEditorFactor::open implementation Change-Id: I01d3c46131e8e3d6dcce1f0e338bc7d637153e98 Reviewed-by: David Schulz --- src/plugins/designer/formeditorfactory.cpp | 16 ++++------------ src/plugins/designer/formeditorfactory.h | 1 - 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/plugins/designer/formeditorfactory.cpp b/src/plugins/designer/formeditorfactory.cpp index 736a033d47..3da34f486a 100644 --- a/src/plugins/designer/formeditorfactory.cpp +++ b/src/plugins/designer/formeditorfactory.cpp @@ -66,23 +66,15 @@ QString FormEditorFactory::displayName() const return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME); } -Core::IDocument *FormEditorFactory::open(const QString &fileName) +Core::IEditor *FormEditorFactory::createEditor(QWidget *parent) { - Core::IEditor *iface = Core::EditorManager::openEditor(fileName, id()); - if (!iface) - return 0; - if (qobject_cast(iface)) { + const EditorData data = FormEditorW::instance()->createEditor(parent); + if (data.formWindowEditor) { Core::InfoBarEntry info(Core::Id(Constants::INFO_READ_ONLY), tr("This file can only be edited in Design mode.")); info.setCustomButtonInfo(tr("Switch mode"), this, SLOT(designerModeClicked())); - iface->document()->infoBar()->addInfo(info); + data.formWindowEditor->document()->infoBar()->addInfo(info); } - return iface->document(); -} - -Core::IEditor *FormEditorFactory::createEditor(QWidget *parent) -{ - const EditorData data = FormEditorW::instance()->createEditor(parent); return data.formWindowEditor; } diff --git a/src/plugins/designer/formeditorfactory.h b/src/plugins/designer/formeditorfactory.h index 602d663025..d1183fbfc5 100644 --- a/src/plugins/designer/formeditorfactory.h +++ b/src/plugins/designer/formeditorfactory.h @@ -48,7 +48,6 @@ public: QStringList mimeTypes() const; Core::Id id() const; QString displayName() const; - Core::IDocument *open(const QString &fileName); Core::IEditor *createEditor(QWidget *parent); private slots: -- cgit v1.2.1 From 97ce8e4098fbfcfaac26e50a6ed3a9fc0eaa3e76 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 31 May 2013 16:25:26 +0200 Subject: Remove IEditorFactor::open implementation with a warning Looks very much like the current IDocumentFactory / IEditorFactory set up does not make much sense. Should be cleaned up in a follow-up commit. Change-Id: I000b68fe6b6d75add713866818711545b41dfe23 Reviewed-by: David Schulz --- src/plugins/coreplugin/editormanager/ieditorfactory.cpp | 11 ++++++----- src/plugins/coreplugin/editormanager/ieditorfactory.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp index f501289f92..fdceef33b9 100644 --- a/src/plugins/coreplugin/editormanager/ieditorfactory.cpp +++ b/src/plugins/coreplugin/editormanager/ieditorfactory.cpp @@ -29,11 +29,12 @@ #include "ieditorfactory.h" -#include "ieditor.h" -#include "editormanager.h" +#include -Core::IDocument *Core::IEditorFactory::open(const QString &fileName) +Core::IDocument *Core::IEditorFactory::open(const QString &) { - Core::IEditor *iface = Core::EditorManager::openEditor(fileName, id()); - return iface ? iface->document() : 0; + qWarning("This should never be called, use IEditorFactor::createEditor, " + "or EditorManager::openEditor instead!"); + QTC_CHECK(false); + return 0; } diff --git a/src/plugins/coreplugin/editormanager/ieditorfactory.h b/src/plugins/coreplugin/editormanager/ieditorfactory.h index 5d59ab0e31..029554af0d 100644 --- a/src/plugins/coreplugin/editormanager/ieditorfactory.h +++ b/src/plugins/coreplugin/editormanager/ieditorfactory.h @@ -44,7 +44,7 @@ public: IEditorFactory(QObject *parent = 0) : IDocumentFactory(parent) {} virtual IEditor *createEditor(QWidget *parent) = 0; - virtual IDocument *open(const QString &fileName); + virtual IDocument *open(const QString &); }; } // namespace Core -- cgit v1.2.1 From 2125525e775de909a181cb7f6cfa18200722f230 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 30 May 2013 17:26:51 +0200 Subject: Move openEditorAt from BaseTextEditorWidget to EditorManager More sensible place, gotoLine is a method in IEditor anyhow. Change-Id: I420a6bf17060c16e6f1a4f45e0bef89379fb6bf8 Reviewed-by: David Schulz --- src/plugins/bookmarks/bookmarkmanager.cpp | 6 +++--- src/plugins/classview/classviewmanager.cpp | 6 +----- .../coreplugin/editormanager/editormanager.cpp | 13 ++++++++++++ .../coreplugin/editormanager/editormanager.h | 3 +++ src/plugins/cppeditor/cppeditor.cpp | 8 ++++---- src/plugins/cppeditor/cpptypehierarchy.cpp | 16 +++++++-------- src/plugins/cpptools/cppcurrentdocumentfilter.cpp | 4 ++-- src/plugins/cpptools/cppfindreferences.cpp | 10 ++++----- src/plugins/cpptools/cpplocatorfilter.cpp | 4 ++-- src/plugins/cpptools/symbolsfindfilter.cpp | 6 +++--- src/plugins/designer/qtcreatorintegration.cpp | 4 ++-- .../projectexplorer/showineditortaskhandler.cpp | 4 ++-- src/plugins/qmljseditor/qmljsfindreferences.cpp | 7 +++---- src/plugins/qmljstools/qmlconsoleview.cpp | 4 ++-- src/plugins/qmljstools/qmljsfunctionfilter.cpp | 6 +++--- src/plugins/qtsupport/qtoutputformatter.cpp | 11 +++++----- src/plugins/texteditor/basefilefind.cpp | 13 ++++++------ src/plugins/texteditor/basetexteditor.cpp | 24 ++-------------------- src/plugins/texteditor/basetexteditor.h | 5 ----- src/plugins/texteditor/itexteditor.cpp | 3 --- src/plugins/texteditor/itexteditor.h | 1 + src/plugins/texteditor/refactoringchanges.cpp | 2 +- src/plugins/valgrind/callgrindtool.cpp | 4 ++-- src/plugins/valgrind/memcheckerrorview.cpp | 7 ++++--- src/plugins/valgrind/memchecktool.cpp | 11 +++++----- 25 files changed, 84 insertions(+), 98 deletions(-) (limited to 'src') diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index aee3b30f6c..dd8929014d 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -508,8 +508,8 @@ Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) bool BookmarkManager::gotoBookmark(Bookmark *bookmark) { using namespace TextEditor; - if (ITextEditor *editor = qobject_cast(BaseTextEditorWidget::openEditorAt(bookmark->filePath(), - bookmark->lineNumber()))) { + if (ITextEditor *editor = qobject_cast(EditorManager::openEditorAt(bookmark->filePath(), + bookmark->lineNumber()))) { return (editor->currentLine() == bookmark->lineNumber()); } return false; diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index d2d718b1d4..73ea0ff6db 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -287,10 +286,7 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc) void Manager::gotoLocation(const QString &fileName, int line, int column) { - bool newEditor = false; - TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column, Core::Id(), - Core::EditorManager::IgnoreNavigationHistory, - &newEditor); + Core::EditorManager::openEditorAt(fileName, line, column); } void Manager::gotoLocations(const QList &list) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 93c1f4c1d2..a6802a6187 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1419,6 +1419,19 @@ IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId, fileName, editorId, flags, newEditor); } +IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column, + const Id &editorId, OpenEditorFlags flags, bool *newEditor) +{ + m_instance->cutForwardNavigationHistory(); + m_instance->addCurrentPositionToNavigationHistory(); + OpenEditorFlags tempFlags = flags | IgnoreNavigationHistory; + Core::IEditor *editor = Core::EditorManager::openEditor(fileName, editorId, + tempFlags, newEditor); + if (editor && line != -1) + editor->gotoLine(line, column); + return editor; +} + static int extractLineNumber(QString *fileName) { int i = fileName->length() - 1; diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index e0d2ba6026..b3bae535e4 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -118,6 +118,9 @@ public: static QString splitLineNumber(QString *fileName); static IEditor *openEditor(const QString &fileName, const Id &editorId = Id(), OpenEditorFlags flags = 0, bool *newEditor = 0); + static IEditor *openEditorAt(const QString &fileName, int line, int column = 0, + const Id &editorId = Id(), OpenEditorFlags flags = 0, + bool *newEditor = 0); static IEditor *openEditorWithContents(const Id &editorId, QString *titlePattern = 0, const QString &contents = QString()); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 00e6a93237..b1b31f0e37 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -2002,10 +2002,10 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit) return true; } - return TextEditor::BaseTextEditorWidget::openEditorAt(link.targetFileName, - link.targetLine, - link.targetColumn, - Constants::CPPEDITOR_ID); + return Core::EditorManager::openEditorAt(link.targetFileName, + link.targetLine, + link.targetColumn, + Constants::CPPEDITOR_ID); } void CPPEditorWidget::semanticRehighlight(bool force) diff --git a/src/plugins/cppeditor/cpptypehierarchy.cpp b/src/plugins/cppeditor/cpptypehierarchy.cpp index 11d75cc4ae..2883a6f8f2 100644 --- a/src/plugins/cppeditor/cpptypehierarchy.cpp +++ b/src/plugins/cppeditor/cpptypehierarchy.cpp @@ -105,10 +105,10 @@ private: if (!m_link.hasValidTarget()) return; - TextEditor::BaseTextEditorWidget::openEditorAt(m_link.targetFileName, - m_link.targetLine, - m_link.targetColumn, - Constants::CPPEDITOR_ID); + Core::EditorManager::openEditorAt(m_link.targetFileName, + m_link.targetLine, + m_link.targetColumn, + Constants::CPPEDITOR_ID); } CPPEditorWidget::Link m_link; @@ -205,10 +205,10 @@ void CppTypeHierarchyWidget::onItemClicked(const QModelIndex &index) const TextEditor::BaseTextEditorWidget::Link link = index.data(LinkRole).value(); if (link.hasValidTarget()) - TextEditor::BaseTextEditorWidget::openEditorAt(link.targetFileName, - link.targetLine, - link.targetColumn, - Constants::CPPEDITOR_ID); + Core::EditorManager::openEditorAt(link.targetFileName, + link.targetLine, + link.targetColumn, + Constants::CPPEDITOR_ID); } // CppTypeHierarchyStackedWidget diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index eaf3aa358d..b26042d0a6 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -110,8 +110,8 @@ QList CppCurrentDocumentFilter::matchesFor(QFutureInterfac void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const { ModelItemInfo info = qvariant_cast(selection.internalData); - TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column, - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(info.fileName, info.line, info.column, + Core::Id(), Core::EditorManager::ModeSwitch); } void CppCurrentDocumentFilter::refresh(QFutureInterface &future) diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 4d8283c145..f27d92081d 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -32,11 +32,11 @@ #include "cpptoolsconstants.h" #include "cppmodelmanagerinterface.h" +#include #include #include #include #include -#include #include #include @@ -509,10 +509,10 @@ void CppFindReferences::setPaused(bool paused) void CppFindReferences::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { - TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()), - item.lineNumber, item.textMarkPos, - Core::Id(), - Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), + item.lineNumber, item.textMarkPos, + Core::Id(), + Core::EditorManager::ModeSwitch); } else { Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text), Core::Id(), Core::EditorManager::ModeSwitch); diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 6bb5c8ef51..e2ea80f0d2 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -177,8 +177,8 @@ QList CppLocatorFilter::matchesFor(QFutureInterface(selection.internalData); - TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, info.line, info.column, - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(info.fileName, info.line, info.column, + Core::Id(), Core::EditorManager::ModeSwitch); } void CppLocatorFilter::reset() diff --git a/src/plugins/cpptools/symbolsfindfilter.cpp b/src/plugins/cpptools/symbolsfindfilter.cpp index 78c636674d..290b5bd5fd 100644 --- a/src/plugins/cpptools/symbolsfindfilter.cpp +++ b/src/plugins/cpptools/symbolsfindfilter.cpp @@ -187,9 +187,9 @@ void SymbolsFindFilter::openEditor(const Find::SearchResultItem &item) if (!item.userData.canConvert()) return; ModelItemInfo info = item.userData.value(); - TextEditor::BaseTextEditorWidget::openEditorAt(info.fileName, - info.line, - info.column); + Core::EditorManager::openEditorAt(info.fileName, + info.line, + info.column); } QWidget *SymbolsFindFilter::createConfigWidget() diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 3b1395159f..1fbb5a9d2c 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -270,7 +270,7 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line) static inline ITextEditor *editableAt(const QString &fileName, int line, int column) { - return qobject_cast(TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, column)); + return qobject_cast(Core::EditorManager::openEditorAt(fileName, line, column)); } static void addDeclaration(const Snapshot &snapshot, @@ -626,7 +626,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, } // jump to function definition, position within code - TextEditor::BaseTextEditorWidget::openEditorAt(sourceDoc->fileName(), line + 2, indentation); + Core::EditorManager::openEditorAt(sourceDoc->fileName(), line + 2, indentation); return true; } diff --git a/src/plugins/projectexplorer/showineditortaskhandler.cpp b/src/plugins/projectexplorer/showineditortaskhandler.cpp index f01c9e3ced..3090fb47d7 100644 --- a/src/plugins/projectexplorer/showineditortaskhandler.cpp +++ b/src/plugins/projectexplorer/showineditortaskhandler.cpp @@ -31,7 +31,7 @@ #include "task.h" -#include +#include #include #include @@ -49,7 +49,7 @@ bool ShowInEditorTaskHandler::canHandle(const ProjectExplorer::Task &task) const void ShowInEditorTaskHandler::handle(const ProjectExplorer::Task &task) { QFileInfo fi(task.file.toFileInfo()); - TextEditor::BaseTextEditorWidget::openEditorAt(fi.filePath(), task.movedLine); + Core::EditorManager::openEditorAt(fi.filePath(), task.movedLine); } QAction *ShowInEditorTaskHandler::createAction(QObject *parent) const diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 50ebf9a6b2..e5aa05c2e7 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -29,7 +29,6 @@ #include "qmljsfindreferences.h" -#include #include #include #include @@ -985,9 +984,9 @@ void FindReferences::setPaused(bool paused) void FindReferences::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { - TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()), - item.lineNumber, item.textMarkPos, Core::Id(), - Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), + item.lineNumber, item.textMarkPos, Core::Id(), + Core::EditorManager::ModeSwitch); } else { Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text), Core::Id(), Core::EditorManager::ModeSwitch); diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index c44ddd7f45..b8e3e5fd3b 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -31,7 +31,7 @@ #include "qmlconsoleitemdelegate.h" #include "qmlconsoleitemmodel.h" -#include +#include #include #include @@ -231,7 +231,7 @@ void QmlConsoleView::onRowActivated(const QModelIndex &index) QFileInfo fi(filePath); if (fi.exists() && fi.isFile() && fi.isReadable()) { int line = model()->data(index, QmlConsoleItemModel::LineRole).toInt(); - TextEditor::BaseTextEditorWidget::openEditorAt(fi.canonicalFilePath(), line); + Core::EditorManager::openEditorAt(fi.canonicalFilePath(), line); } } } diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.cpp b/src/plugins/qmljstools/qmljsfunctionfilter.cpp index 3c500314c9..13710f5dd0 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.cpp +++ b/src/plugins/qmljstools/qmljsfunctionfilter.cpp @@ -30,7 +30,7 @@ #include "qmljsfunctionfilter.h" #include "qmljslocatordata.h" -#include +#include #include @@ -111,6 +111,6 @@ QList FunctionFilter::matchesFor(QFutureInterface(selection.internalData); - TextEditor::BaseTextEditorWidget::openEditorAt(entry.fileName, entry.line, entry.column, - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column, + Core::Id(), Core::EditorManager::ModeSwitch); } diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index 34b7d38f1c..82d0dcc891 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -29,11 +29,12 @@ #include "qtoutputformatter.h" -#include +#include #include -#include +#include #include +#include using namespace ProjectExplorer; using namespace QtSupport; @@ -195,7 +196,7 @@ void QtOutputFormatter::handleLink(const QString &href) const int line = qmlLineColumnLink.cap(2).toInt(); const int column = qmlLineColumnLink.cap(3).toInt(); - TextEditor::BaseTextEditorWidget::openEditorAt(m_projectFinder.findFile(fileUrl), line, column - 1); + Core::EditorManager::openEditorAt(m_projectFinder.findFile(fileUrl), line, column - 1); return; } @@ -206,7 +207,7 @@ void QtOutputFormatter::handleLink(const QString &href) if (qmlLineLink.indexIn(href) != -1) { const QUrl fileUrl = QUrl(qmlLineLink.cap(1)); const int line = qmlLineLink.cap(2).toInt(); - TextEditor::BaseTextEditorWidget::openEditorAt(m_projectFinder.findFile(fileUrl), line); + Core::EditorManager::openEditorAt(m_projectFinder.findFile(fileUrl), line); return; } @@ -233,7 +234,7 @@ void QtOutputFormatter::handleLink(const QString &href) if (!fileName.isEmpty()) { fileName = m_projectFinder.findFile(QUrl::fromLocalFile(fileName)); - TextEditor::BaseTextEditorWidget::openEditorAt(fileName, line, 0); + Core::EditorManager::openEditorAt(fileName, line, 0); return; } } diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 8f1ccf1e64..baf1318dc1 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -309,11 +310,11 @@ void BaseFileFind::openEditor(const Find::SearchResultItem &item) SearchResult *result = qobject_cast(sender()); Core::IEditor *openedEditor = 0; if (item.path.size() > 0) { - openedEditor = TextEditor::BaseTextEditorWidget::openEditorAt(QDir::fromNativeSeparators(item.path.first()), - item.lineNumber, - item.textMarkPos, - Core::Id(), - Core::EditorManager::ModeSwitch); + openedEditor = Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), + item.lineNumber, + item.textMarkPos, + Core::Id(), + Core::EditorManager::ModeSwitch); } else { openedEditor = Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text), Core::Id(), Core::EditorManager::ModeSwitch); diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 3984a4ca9b..ab343d4ad4 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -154,25 +154,6 @@ private: using namespace Internal; -Core::IEditor *BaseTextEditorWidget::openEditorAt(const QString &fileName, int line, int column, - Core::Id editorKind, - Core::EditorManager::OpenEditorFlags flags, - bool *newEditor) -{ - Core::EditorManager *editorManager = Core::EditorManager::instance(); - editorManager->cutForwardNavigationHistory(); - editorManager->addCurrentPositionToNavigationHistory(); - Core::IEditor *editor = Core::EditorManager::openEditor(fileName, editorKind, - flags, newEditor); - TextEditor::ITextEditor *texteditor = qobject_cast(editor); - if (texteditor && line != -1) { - texteditor->gotoLine(line, column); - return texteditor; - } - - return editor; -} - QString BaseTextEditorWidget::plainTextFromSelection(const QTextCursor &cursor) const { // Copy the selected text as plain text @@ -4918,9 +4899,8 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit) return true; } - return openEditorAt(link.targetFileName, link.targetLine, link.targetColumn, Core::Id(), - Core::EditorManager::IgnoreNavigationHistory - | Core::EditorManager::ModeSwitch); + return Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn, + Core::Id(), Core::EditorManager::ModeSwitch); } void BaseTextEditorWidget::updateLink(QMouseEvent *e) diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index c109bc4396..4a1f17e571 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -131,11 +131,6 @@ public: BaseTextEditorWidget(QWidget *parent); ~BaseTextEditorWidget(); - static Core::IEditor *openEditorAt(const QString &fileName, int line, int column = 0, - Core::Id editorId = Core::Id(), - Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory, - bool *newEditor = 0); - const Utils::ChangeSet &changeSet() const; void setChangeSet(const Utils::ChangeSet &changeSet); diff --git a/src/plugins/texteditor/itexteditor.cpp b/src/plugins/texteditor/itexteditor.cpp index beb34d75a6..75248dd1b3 100644 --- a/src/plugins/texteditor/itexteditor.cpp +++ b/src/plugins/texteditor/itexteditor.cpp @@ -29,8 +29,6 @@ #include "itexteditor.h" -#include - #include using namespace TextEditor; @@ -66,7 +64,6 @@ QMap TextEditor::ITextEditor::openedTextEditorsEncodings( return workingCopy; } - ITextEditorDocument *ITextEditor::textDocument() { return qobject_cast(document()); diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h index 2e1ae06e38..dd9a3fcb7f 100644 --- a/src/plugins/texteditor/itexteditor.h +++ b/src/plugins/texteditor/itexteditor.h @@ -35,6 +35,7 @@ #include "itextmark.h" #include +#include #include #include diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index f5638ae600..8ca3a3cc8d 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -141,7 +141,7 @@ BaseTextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bo // openEditorAt uses a 1-based line and a 0-based column! column -= 1; } - Core::IEditor *editor = BaseTextEditorWidget::openEditorAt( + Core::IEditor *editor = Core::EditorManager::openEditorAt( fileName, line, column, Core::Id(), flags); if (editor) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 48f5f1d7f5..efaaba214d 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include @@ -322,7 +322,7 @@ void CallgrindToolPrivate::selectFunction(const Function *func) if (QFile::exists(func->file())) { ///TODO: custom position support? int line = func->lineNumber(); - TextEditor::BaseTextEditorWidget::openEditorAt(func->file(), qMax(line, 0)); + Core::EditorManager::openEditorAt(func->file(), qMax(line, 0)); } } diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index 8943616975..874c54ea86 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -41,9 +41,9 @@ #include "xmlprotocol/suppression.h" #include -#include +#include #include -#include +#include #include #include @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -432,7 +433,7 @@ void MemcheckErrorDelegate::openLinkInEditor(const QString &link) const int pathEnd = link.lastIndexOf(QLatin1Char(':')); const QString path = link.mid(pathStart, pathEnd - pathStart); const int line = link.mid(pathEnd + 1).toInt(0); - TextEditor::BaseTextEditorWidget::openEditorAt(path, qMax(line, 0)); + Core::EditorManager::openEditorAt(path, qMax(line, 0)); } MemcheckErrorView::MemcheckErrorView(QWidget *parent) diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 5e82687068..39e91f9bc0 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -54,15 +54,14 @@ #include #include -#include -#include -#include #include +#include #include +#include +#include +#include #include -#include - #include #include #include @@ -502,7 +501,7 @@ void MemcheckTool::suppressionActionTriggered() const QString file = action->data().toString(); QTC_ASSERT(!file.isEmpty(), return); - TextEditor::BaseTextEditorWidget::openEditorAt(file, 0); + Core::EditorManager::openEditorAt(file, 0); } void MemcheckTool::parserError(const Valgrind::XmlProtocol::Error &error) -- cgit v1.2.1 From 4933406f061ed20f3856be71f6e935d7a0ca9e4c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 31 May 2013 15:16:06 +0200 Subject: Use EditorManager::openEditorAt instead of duplicating code Change-Id: I231e89849e2f06958d05a511320ec236b5702a1c Reviewed-by: Aurindam Jana Reviewed-by: David Schulz --- src/plugins/cppeditor/cppeditor.cpp | 16 +++++----------- src/plugins/debugger/qml/qmlinspectoradapter.cpp | 13 ++----------- 2 files changed, 7 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index b1b31f0e37..e49af606fa 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1992,20 +1992,14 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit) if (!link.hasValidTarget()) return false; - Core::EditorManager *editorManager = Core::EditorManager::instance(); - if (inNextSplit) { - editorManager->gotoOtherSplit(); - } else if (baseTextDocument()->fileName() == link.targetFileName) { - editorManager->addCurrentPositionToNavigationHistory(); - gotoLine(link.targetLine, link.targetColumn); - setFocus(); - return true; - } - + Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::ModeSwitch; + if (inNextSplit) + flags |= Core::EditorManager::OpenInOtherSplit; return Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn, - Constants::CPPEDITOR_ID); + Constants::CPPEDITOR_ID, + flags); } void CPPEditorWidget::semanticRehighlight(bool force) diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp index c2cd81e0d5..b167f344cd 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp +++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp @@ -472,17 +472,8 @@ void QmlInspectorAdapter::jumpToObjectDefinitionInEditor( { const QString fileName = m_engine->toFileInProject(objSource.url()); - Core::EditorManager *editorManager = Core::EditorManager::instance(); - Core::IEditor *editor = editorManager->openEditor(fileName); - TextEditor::ITextEditor *textEditor - = qobject_cast(editor); - - if (textEditor) { - editorManager->addCurrentPositionToNavigationHistory(); - textEditor->gotoLine(objSource.lineNumber()); - textEditor->widget()->setFocus(); - } - + Core::EditorManager::openEditorAt(fileName, objSource.lineNumber(), + 0, Core::Id(), Core::EditorManager::ModeSwitch); if (debugId != -1 && debugId != m_currentSelectedDebugId) { m_currentSelectedDebugId = debugId; m_currentSelectedDebugName = agent()->displayName(debugId); -- cgit v1.2.1 From db7caaa76c3118375d435e84973d057e548bcd10 Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari Date: Wed, 29 May 2013 16:52:14 +0200 Subject: Qnx: Fix slog2er parsing when logs contain \n If the logs contain a '\n' the message parts in the new lines are not displayed. The new line messages are displayed with no buffer details and are ignored when the parsing is processed. Cherry-picked: a7fa0dd4b9c113dda6c94b9bd27990424a91c81c Change-Id: I0e174dd5283a64c4e9b0434c06dd417f1be2c810 Reviewed-by: Tobias Hunger --- src/plugins/qnx/blackberryapplicationrunner.cpp | 42 +++++++++++++++++-------- src/plugins/qnx/blackberryapplicationrunner.h | 1 + 2 files changed, 30 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp index 34d661d91b..54e22d76c6 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.cpp +++ b/src/plugins/qnx/blackberryapplicationrunner.cpp @@ -85,6 +85,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe : QObject(parent) , m_debugMode(debugMode) , m_slog2infoFound(false) + , m_currentLogs(false) , m_pid(-1) , m_appId(QString()) , m_running(false) @@ -179,6 +180,7 @@ ProjectExplorer::RunControl::StopResult BlackBerryApplicationRunner::stop() return ProjectExplorer::RunControl::AsynchronousStop; m_stopping = true; + m_currentLogs = false; if (m_testSlog2Process && m_testSlog2Process->isProcessRunning()) { m_testSlog2Process->cancel(); @@ -330,19 +332,33 @@ void BlackBerryApplicationRunner::handleTailOutput() if (m_slog2infoFound) { const QStringList multiLine = message.split(QLatin1Char('\n')); Q_FOREACH (const QString &line, multiLine) { - QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(), - QString::fromLatin1("dd HH:mm:ss.zzz")); - if (dateTime >= m_launchDateTime) { - QStringList validLineBeginnings; - validLineBeginnings << QLatin1String("qt-msg 0 ") - << QLatin1String("qt-msg* 0 ") - << QLatin1String("default* 9000 ") - << QLatin1String("default 9000 ") - << QLatin1String(" 0 "); - Q_FOREACH (const QString &beginning, validLineBeginnings) { - if (showQtMessage(beginning, line)) - break; - } + // Check if logs are from the recent launch + // Note: This is useless if/once slog2info -b displays only logs from recent launches + if (!m_currentLogs) { + QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(), + QString::fromLatin1("dd HH:mm:ss.zzz")); + + m_currentLogs = dateTime >= m_launchDateTime; + if (!m_currentLogs) + continue; + } + + // The line could be a part of a previous log message that contains a '\n' + // In that case only the message body is displayed + if (!line.contains(m_appId) && !line.isEmpty()) { + emit output(line + QLatin1Char('\n'), Utils::StdOutFormat); + continue; + } + + QStringList validLineBeginnings; + validLineBeginnings << QLatin1String("qt-msg 0 ") + << QLatin1String("qt-msg* 0 ") + << QLatin1String("default* 9000 ") + << QLatin1String("default 9000 ") + << QLatin1String(" 0 "); + Q_FOREACH (const QString &beginning, validLineBeginnings) { + if (showQtMessage(beginning, line)) + break; } } return; diff --git a/src/plugins/qnx/blackberryapplicationrunner.h b/src/plugins/qnx/blackberryapplicationrunner.h index f9bf0161d8..788d0c3dbe 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.h +++ b/src/plugins/qnx/blackberryapplicationrunner.h @@ -98,6 +98,7 @@ private: bool m_debugMode; bool m_slog2infoFound; + bool m_currentLogs; QDateTime m_launchDateTime; -- cgit v1.2.1 From 1d0e5f479121399ccbbee689f964bba640e37fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Sun, 2 Jun 2013 15:14:49 +0200 Subject: KitNode ctor is called with Kit *k=0 by design Check k before using it. Change-Id: Ic240b7a60b0d2b89e209a795525097cd99c9518a Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/kitmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp index 569b3234c2..087d822743 100644 --- a/src/plugins/projectexplorer/kitmodel.cpp +++ b/src/plugins/projectexplorer/kitmodel.cpp @@ -59,7 +59,7 @@ public: widget = KitManager::instance()->createConfigWidget(k); if (widget) { - if (k->isAutoDetected()) + if (k && k->isAutoDetected()) widget->makeStickySubWidgetsReadOnly(); widget->setVisible(false); } -- cgit v1.2.1 From 5a4cdc11cbf10e205e30bf118bc4e672a4d198af Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Tue, 21 May 2013 11:35:15 +0200 Subject: qmljs: adding qrc support Qmljs now keeps a cache of parsed qrc files, and can resolve "qrc:" links. This breaks the assumption that the name that the qml files has on the filesystem is the one that qml sees, and that contents of directories can be found just looking at file whose path starts with the directory path. Currently the first file is used when multiple qrc files contain the same path, but support for strict and weak path resolving is already there. At the moment only qrc files for projects that call updateQmljsCodeModel are updated. ChangeLog: QmljsSupport: Imports using qrc links are resolved. Task-number: QTCREATORBUG-8953 Change-Id: I695fac2692af2417d49c192c580a1c2e7b4873f4 Reviewed-by: Fawzi Mohamed --- src/libs/qmljs/qmljs-lib.pri | 6 +- src/libs/qmljs/qmljs.pro | 2 +- src/libs/qmljs/qmljs.qbs | 4 +- src/libs/qmljs/qmljsdocument.cpp | 16 + src/libs/qmljs/qmljsdocument.h | 1 + src/libs/qmljs/qmljsinterpreter.cpp | 27 +- src/libs/qmljs/qmljsinterpreter.h | 2 + src/libs/qmljs/qmljslink.cpp | 35 +- src/libs/qmljs/qmljsmodelmanagerinterface.h | 15 + src/libs/qmljs/qmljsqrcparser.cpp | 517 +++++++++++++++++++++ src/libs/qmljs/qmljsqrcparser.h | 87 ++++ src/libs/qmljs/qmljsscopechain.cpp | 6 +- .../designercore/model/texttomodelmerger.cpp | 8 + src/plugins/qmljseditor/qmljshoverhandler.cpp | 7 + src/plugins/qmljstools/qmljsmodelmanager.cpp | 142 +++++- src/plugins/qmljstools/qmljsmodelmanager.h | 16 + src/plugins/qt4projectmanager/qt4nodes.cpp | 4 + src/plugins/qt4projectmanager/qt4nodes.h | 2 + src/plugins/qt4projectmanager/qt4project.cpp | 4 + 19 files changed, 883 insertions(+), 18 deletions(-) create mode 100644 src/libs/qmljs/qmljsqrcparser.cpp create mode 100644 src/libs/qmljs/qmljsqrcparser.h (limited to 'src') diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri index f31879a6f0..12913de0a5 100644 --- a/src/libs/qmljs/qmljs-lib.pri +++ b/src/libs/qmljs/qmljs-lib.pri @@ -39,7 +39,8 @@ HEADERS += \ $$PWD/consoleitem.h \ $$PWD/iscriptevaluator.h \ $$PWD/qmljssimplereader.h \ - $$PWD/persistenttrie.h + $$PWD/persistenttrie.h \ + $$PWD/qmljsqrcparser.h SOURCES += \ $$PWD/qmljsbind.cpp \ @@ -69,7 +70,8 @@ SOURCES += \ $$PWD/consolemanagerinterface.cpp \ $$PWD/consoleitem.cpp \ $$PWD/qmljssimplereader.cpp \ - $$PWD/persistenttrie.cpp + $$PWD/persistenttrie.cpp \ + $$PWD/qmljsqrcparser.cpp RESOURCES += \ $$PWD/qmljs.qrc diff --git a/src/libs/qmljs/qmljs.pro b/src/libs/qmljs/qmljs.pro index c9c018de5c..5db252b290 100644 --- a/src/libs/qmljs/qmljs.pro +++ b/src/libs/qmljs/qmljs.pro @@ -1,5 +1,5 @@ DEFINES += QMLJS_BUILD_DIR -QT +=script +QT +=script xml include(../../qtcreatorlibrary.pri) include(qmljs-lib.pri) diff --git a/src/libs/qmljs/qmljs.qbs b/src/libs/qmljs/qmljs.qbs index 2bef9864c4..7029b1149f 100644 --- a/src/libs/qmljs/qmljs.qbs +++ b/src/libs/qmljs/qmljs.qbs @@ -12,7 +12,7 @@ QtcLibrary { Depends { name: "Utils" } Depends { name: "LanguageUtils" } - Depends { name: "Qt"; submodules: ["widgets", "script"] } + Depends { name: "Qt"; submodules: ["widgets", "script", "xml"] } files: [ "jsoncheck.cpp", @@ -52,6 +52,8 @@ QtcLibrary { "qmljsmodelmanagerinterface.h", "qmljspropertyreader.cpp", "qmljspropertyreader.h", + "qmljsqrcparser.cpp", + "qmljsqrcparser.h", "qmljsreformatter.cpp", "qmljsreformatter.h", "qmljsrewriter.cpp", diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index 3e55ccc42a..a7eb00c354 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -115,6 +115,22 @@ bool Document::isFullySupportedLanguage(Document::Language language) return false; } +bool Document::isQmlLikeOrJsLanguage(Document::Language language) +{ + switch (language) { + case QmlLanguage: + case QmlQtQuick1Language: + case QmlQtQuick2Language: + case QmlQbsLanguage: + case QmlProjectLanguage: + case QmlTypeInfoLanguage: + case JavaScriptLanguage: + return true; + default: + return false; + } +} + Document::Document(const QString &fileName, Language language) : _engine(0) , _ast(0) diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index e18f95d475..56ebb7061e 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -65,6 +65,7 @@ public: static bool isQmlLikeLanguage(Language languge); static bool isFullySupportedLanguage(Language language); + static bool isQmlLikeOrJsLanguage(Language language); protected: Document(const QString &fileName, Language language); diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 24d68d4948..c9b1f4381a 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -35,6 +35,7 @@ #include "qmljstypedescriptionreader.h" #include "qmljsvalueowner.h" #include "qmljscontext.h" +#include "qmljsmodelmanagerinterface.h" #include "parser/qmljsast_p.h" #include @@ -2107,13 +2108,19 @@ ImportInfo ImportInfo::pathImport(const QString &docPath, const QString &path, importFileInfo = QFileInfo(docPath + QDir::separator() + path); info._path = importFileInfo.absoluteFilePath(); - if (importFileInfo.isFile()) + if (importFileInfo.isFile()) { info._type = FileImport; - else if (importFileInfo.isDir()) + } else if (importFileInfo.isDir()) { info._type = DirectoryImport; - else + } else if (path.startsWith(QLatin1String("qrc:"))) { + info._path = path; + if (ModelManagerInterface::instance()->filesAtQrcPath(info.path()).isEmpty()) + info._type = QrcDirectoryImport; + else + info._type = QrcFileImport; + } else { info._type = UnknownFileImport; - + } info._version = version; info._as = as; info._ast = ast; @@ -2192,7 +2199,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context const ImportInfo &info = i.info; // JS import has no types - if (info.type() == ImportInfo::FileImport) + if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) continue; if (!info.as().isEmpty()) { @@ -2222,7 +2229,7 @@ void TypeScope::processMembers(MemberProcessor *processor) const const ImportInfo &info = i.info; // JS import has no types - if (info.type() == ImportInfo::FileImport) + if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) continue; if (!info.as().isEmpty()) @@ -2249,7 +2256,7 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *, const ImportInfo &info = i.info; // JS imports are always: import "somefile.js" as Foo - if (info.type() != ImportInfo::FileImport) + if (info.type() != ImportInfo::FileImport && info.type() != ImportInfo::QrcFileImport) continue; if (info.as() == name) { @@ -2272,7 +2279,7 @@ void JSImportScope::processMembers(MemberProcessor *processor) const const ObjectValue *import = i.object; const ImportInfo &info = i.info; - if (info.type() == ImportInfo::FileImport) + if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) processor->processProperty(info.as(), import); } } @@ -2329,7 +2336,7 @@ ImportInfo Imports::info(const QString &name, const Context *context) const continue; } - if (info.type() == ImportInfo::FileImport) { + if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) { if (import->className() == firstId) return info; } else { @@ -2349,7 +2356,7 @@ QString Imports::nameForImportedObject(const ObjectValue *value, const Context * const ObjectValue *import = i.object; const ImportInfo &info = i.info; - if (info.type() == ImportInfo::FileImport) { + if (info.type() == ImportInfo::FileImport || info.type() == ImportInfo::QrcFileImport) { if (import == value) return import->className(); } else { diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 56f914713f..356f52bb38 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -872,6 +872,8 @@ public: LibraryImport, FileImport, DirectoryImport, + QrcFileImport, + QrcDirectoryImport, UnknownFileImport // refers a file/directory that wasn't found }; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index e90dd9a9ae..2d5672fa20 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -34,6 +34,7 @@ #include "qmljsbind.h" #include "qmljsutils.h" #include "qmljsmodelmanagerinterface.h" +#include #include #include @@ -245,6 +246,8 @@ void LinkPrivate::populateImportedTypes(Imports *imports, Document::Ptr doc) switch (info.type()) { case ImportInfo::FileImport: case ImportInfo::DirectoryImport: + case ImportInfo::QrcFileImport: + case ImportInfo::QrcDirectoryImport: import = importFileOrDirectory(doc, info); break; case ImportInfo::LibraryImport: @@ -285,7 +288,7 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i import.object = 0; import.valid = true; - const QString &path = importInfo.path(); + QString path = importInfo.path(); if (importInfo.type() == ImportInfo::DirectoryImport || importInfo.type() == ImportInfo::ImplicitDirectoryImport) { @@ -304,8 +307,36 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i Document::Ptr importedDoc = snapshot.document(path); if (importedDoc) import.object = importedDoc->bind()->rootObjectValue(); - } + } else if (importInfo.type() == ImportInfo::QrcFileImport) { + QLocale locale; + QStringList filePaths = ModelManagerInterface::instance() + ->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources); + if (filePaths.isEmpty()) { + filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path); + } + if (!filePaths.isEmpty()) { + Document::Ptr importedDoc = snapshot.document(filePaths.at(0)); + if (importedDoc) + import.object = importedDoc->bind()->rootObjectValue(); + } + } else if (importInfo.type() == ImportInfo::QrcDirectoryImport){ + import.object = new ObjectValue(valueOwner); + + importLibrary(doc, path, &import); + QMapIterator iter(ModelManagerInterface::instance() + ->filesInQrcPath(path)); + while (iter.hasNext()) { + iter.next(); + if (Document::isQmlLikeLanguage(Document::guessLanguageFromSuffix(iter.key()))) { + Document::Ptr importedDoc = snapshot.document(iter.value().at(0)); + if (importedDoc && importedDoc->bind()->rootObjectValue()) { + const QString targetName = QFileInfo(iter.key()).baseName(); + import.object->setMember(targetName, importedDoc->bind()->rootObjectValue()); + } + } + } + } return import; } diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index b708c3ca41..cdcaef362d 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -53,6 +53,11 @@ class QMLJS_EXPORT ModelManagerInterface: public QObject Q_OBJECT public: + enum QrcResourceSelector { + ActiveQrcResources, + AllQrcResources + }; + class ProjectInfo { public: @@ -80,6 +85,8 @@ public: QPointer project; QStringList sourceFiles; QStringList importPaths; + QStringList activeResourceFiles; + QStringList allResourceFiles; // whether trying to run qmldump makes sense bool tryQmlDump; @@ -142,6 +149,14 @@ public: bool emitDocumentOnDiskChanged) = 0; virtual void fileChangedOnDisk(const QString &path) = 0; virtual void removeFiles(const QStringList &files) = 0; + virtual QStringList filesAtQrcPath(const QString &path, const QLocale *locale = 0, + ProjectExplorer::Project *project = 0, + QrcResourceSelector resources = AllQrcResources) = 0; + virtual QMap filesInQrcPath(const QString &path, + const QLocale *locale = 0, + ProjectExplorer::Project *project = 0, + bool addDirs = false, + QrcResourceSelector resources = AllQrcResources) = 0; virtual QList projectInfos() const = 0; virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0; diff --git a/src/libs/qmljs/qmljsqrcparser.cpp b/src/libs/qmljs/qmljsqrcparser.cpp new file mode 100644 index 0000000000..cdecbcd735 --- /dev/null +++ b/src/libs/qmljs/qmljsqrcparser.cpp @@ -0,0 +1,517 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qmljsqrcparser.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace QmlJS { + +namespace Internal { +/*! + * \class QrcParser + * \brief Parses one or more qrc files, and keeps their content cached + * + * A Qrc resource contains files read from the filesystem but organized in a possibly different way. + * + * To easily describe that with a simple structure we use a map from qrc paths to the paths in the + * filesystem. + * By using a map we can easily find all qrc paths that start with a given prefix, and thus loop + * on a qrc directory. + * + * Qrc files also support languages, those are mapped to a prefix of the qrc path. + * For example the french /image/bla.png (lang=fr) will have the path "fr/image/bla.png". + * The empty language represent the default resource. + * Languages are looked up using the locale uiLanguages() property + * + * For a single qrc a given path maps to a single file, but when one has multiple + * (platform specific exclusive) qrc files, then multiple files match, so QStringList are used. + * + * Especially the collect* methods are thought as low level interface. + */ +class QrcParserPrivate +{ + Q_DECLARE_TR_FUNCTIONS(QmlJS::QrcParser) +public: + typedef QMap SMap; + QrcParserPrivate(QrcParser *q); + bool parseFile(const QString &path); + QString firstFileAtPath(const QString &path, const QLocale &locale) const; + void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = 0) const; + bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const; + void collectFilesInPath(const QString &path, QMap *res, bool addDirs = false, + const QLocale *locale = 0) const; + QStringList errorMessages() const; + QStringList languages() const; +private: + static QString fixPrefix(const QString &prefix); + QStringList allUiLanguages(const QLocale *locale) const; + + SMap m_resources; + QStringList m_languages; + QStringList m_errorMessages; +}; + +class QrcCachePrivate +{ + Q_DECLARE_TR_FUNCTIONS(QmlJS::QrcCachePrivate) +public: + QrcCachePrivate(QrcCache *q); + QrcParser::Ptr addPath(const QString &path); + void removePath(const QString &path); + QrcParser::Ptr updatePath(const QString &path); + QrcParser::Ptr parsedPath(const QString &path); + void clear(); +private: + QHash > m_cache; + QMutex m_mutex; +}; +} // namespace Internal + +/*! \brief normalizes the path to a file in a qrc resource by dropping the "qrc:/" or ":" and + * any extra slashes at the beginning + */ +QString QrcParser::normalizedQrcFilePath(const QString &path) { + QString normPath = path; + int endPrefix = 0; + if (path.startsWith(QLatin1String("qrc:/"))) { + endPrefix = 4; + } else if (path.startsWith(QLatin1String(":/"))) { + endPrefix = 1; + } + if (endPrefix < path.size() && path.at(endPrefix) == QLatin1Char('/')) + while (endPrefix + 1 < path.size() && path.at(endPrefix+1) == QLatin1Char('/')) + ++endPrefix; + normPath = path.right(path.size()-endPrefix); + if (!normPath.startsWith(QLatin1String("/"))) + normPath.insert(0, QLatin1Char('/')); + return normPath; +} + +/*! \brief normalizes the path to a directory in a qrc resource by dropping the "qrc:/" or ":" and + * any extra slashes at the beginning, and ensuring it ends with a slash + */ +QString QrcParser::normalizedQrcDirectoryPath(const QString &path) { + QString normPath = normalizedQrcFilePath(path); + if (!normPath.endsWith(QLatin1Char('/'))) + normPath.append(QLatin1Char('/')); + return normPath; +} + +QrcParser::QrcParser() +{ + d = new Internal::QrcParserPrivate(this); +} + +QrcParser::~QrcParser() +{ + delete d; +} + +bool QrcParser::parseFile(const QString &path) +{ + return d->parseFile(path); +} + +/*! \brief returns fs path of the first (active) file at the given qrc path + */ +QString QrcParser::firstFileAtPath(const QString &path, const QLocale &locale) const +{ + return d->firstFileAtPath(path, locale); +} + +/*! \brief adds al the fs paths for the given qrc path to *res + * If locale is null all possible files are added, otherwise just the first match + * using that locale. + */ +void QrcParser::collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale) const +{ + d->collectFilesAtPath(path, res, locale); +} + +/*! \brief returns true if the given path is a non empty directory + */ +bool QrcParser::hasDirAtPath(const QString &path, const QLocale *locale) const +{ + return d->hasDirAtPath(path, locale); +} + +/*! \brief adds the directory contents of the given qrc path to res + * + * adds the qrcFileName => fs paths associations contained in the given qrc path + * to res. If addDirs is true directories are also added. + * If locale is null all possible files are added, otherwise just the first match + * using that locale. + */ +void QrcParser::collectFilesInPath(const QString &path, QMap *res, bool addDirs, + const QLocale *locale) const +{ + d->collectFilesInPath(path, res, addDirs, locale); +} + +/*! \brief returns the errors found while parsing + */ +QStringList QrcParser::errorMessages() const +{ + return d->errorMessages(); +} + +/*! \brief returns all languages used in this qrc resource + */ +QStringList QrcParser::languages() const +{ + return d->languages(); +} + +/*! \brief if the contents are valid + */ +bool QrcParser::isValid() const +{ + return errorMessages().isEmpty(); +} + +QrcParser::Ptr QrcParser::parseQrcFile(const QString &path) +{ + Ptr res(new QrcParser); + if (!path.isEmpty()) + res->parseFile(path); + return res; +} + +// ---------------- + +QrcCache::QrcCache() +{ + d = new Internal::QrcCachePrivate(this); +} + +QrcCache::~QrcCache() +{ + delete d; +} + +QrcParser::ConstPtr QrcCache::addPath(const QString &path) +{ + return d->addPath(path); +} + +void QrcCache::removePath(const QString &path) +{ + d->removePath(path); +} + +QrcParser::ConstPtr QrcCache::updatePath(const QString &path) +{ + return d->updatePath(path); +} + +QrcParser::ConstPtr QrcCache::parsedPath(const QString &path) +{ + return d->parsedPath(path); +} + +void QrcCache::clear() +{ + d->clear(); +} + +// -------------------- + +namespace Internal { + +QrcParserPrivate::QrcParserPrivate(QrcParser *) +{ } + +bool QrcParserPrivate::parseFile(const QString &path) +{ + QFile file(path); + if (!file.open(QIODevice::ReadOnly)) { + m_errorMessages.append(file.errorString()); + return false; + } + + QDomDocument doc; + + QString error_msg; + int error_line, error_col; + if (!doc.setContent(&file, &error_msg, &error_line, &error_col)) { + m_errorMessages.append(tr("XML error on line %1, col %2: %3") + .arg(error_line).arg(error_col).arg(error_msg)); + return false; + } + + QDomElement root = doc.firstChildElement(QLatin1String("RCC")); + if (root.isNull()) { + m_errorMessages.append(tr("The root element is missing.")); + return false; + } + + QDomElement relt = root.firstChildElement(QLatin1String("qresource")); + for (; !relt.isNull(); relt = relt.nextSiblingElement(QLatin1String("qresource"))) { + + QString prefix = fixPrefix(relt.attribute(QLatin1String("prefix"))); + const QString language = relt.attribute(QLatin1String("lang")); + if (!m_languages.contains(language)) + m_languages.append(language); + + QDomElement felt = relt.firstChildElement(QLatin1String("file")); + for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) { + const QString fileName = felt.text(); + QTC_CHECK(!QDir::isAbsolutePath(fileName)); + const QString alias = felt.attribute(QLatin1String("alias")); + QString filePath = QFileInfo(path).path() + QLatin1Char('/') + fileName; + QString accessPath; + if (!alias.isEmpty()) + accessPath = language + prefix + alias; + else + accessPath = language + prefix + fileName; + if (m_resources.contains(accessPath)) { + QStringList &val = m_resources[accessPath]; + if (!val.contains(filePath)) + val.append(filePath); + } else { + m_resources.insert(accessPath, QStringList(filePath)); + } + } + } + return true; +} + +// path is assumed to be a normalized absolute path +QString QrcParserPrivate::firstFileAtPath(const QString &path, const QLocale &locale) const +{ + QTC_CHECK(path.startsWith(QLatin1Char('/'))); + QStringList langs = allUiLanguages(&locale); + foreach (const QString &language, langs) { + if (m_languages.contains(language)) { + SMap::const_iterator res = m_resources.find(language + path); + if (res != m_resources.end()) + return res.value().at(0); + } + } + return QString(); +} + +void QrcParserPrivate::collectFilesAtPath(const QString &path, QStringList *files, + const QLocale *locale) const +{ + QTC_CHECK(path.startsWith(QLatin1Char('/'))); + QStringList langs = allUiLanguages(locale); + foreach (const QString &language, langs) { + if (m_languages.contains(language)) { + SMap::const_iterator res = m_resources.find(language + path); + if (res != m_resources.end()) + (*files) << res.value(); + } + } +} + +// path is expected to be normalized and start and end with a slash +bool QrcParserPrivate::hasDirAtPath(const QString &path, const QLocale *locale) const +{ + QTC_CHECK(path.startsWith(QLatin1Char('/'))); + QTC_CHECK(path.endsWith(QLatin1Char('/'))); + QStringList langs = allUiLanguages(locale); + foreach (const QString &language, langs) { + if (m_languages.contains(language)) { + QString key = language + path; + SMap::const_iterator res = m_resources.lowerBound(key); + if (res != m_resources.end() && res.key().startsWith(key)) + return true; + } + } + return false; +} + +void QrcParserPrivate::collectFilesInPath(const QString &path, QMap *contents, + bool addDirs, const QLocale *locale) const +{ + QTC_CHECK(path.startsWith(QLatin1Char('/'))); + QTC_CHECK(path.endsWith(QLatin1Char('/'))); + SMap::const_iterator end = m_resources.end(); + QStringList langs = allUiLanguages(locale); + foreach (const QString &language, langs) { + QString key = language + path; + SMap::const_iterator res = m_resources.lowerBound(key); + while (res != end && res.key().startsWith(key)) { + const QString &actualKey = res.key(); + int endDir = actualKey.indexOf(QLatin1Char('/'), key.size()); + if (endDir == -1) { + QString fileName = res.key().right(res.key().size()-key.size()); + QStringList &els = (*contents)[fileName]; + foreach (const QString &val, res.value()) + if (!els.contains(val)){ + els << val; + } + ++res; + } else { + QString dirName = res.key().mid(key.size(), endDir - key.size() + 1); + if (addDirs) + contents->insert(dirName, QStringList()); + QString key2 = key + dirName; + do { + ++res; + } while (res != end && res.key().startsWith(key2)); + } + } + } +} + +QStringList QrcParserPrivate::errorMessages() const +{ + return m_errorMessages; +} + +QStringList QrcParserPrivate::languages() const +{ + return m_languages; +} + +QString QrcParserPrivate::fixPrefix(const QString &prefix) +{ + const QChar slash = QLatin1Char('/'); + QString result = QString(slash); + for (int i = 0; i < prefix.size(); ++i) { + const QChar c = prefix.at(i); + if (c == slash && result.at(result.size() - 1) == slash) + continue; + result.append(c); + } + + if (!result.endsWith(slash)) + result.append(slash); + + return result; +} + +QStringList QrcParserPrivate::allUiLanguages(const QLocale *locale) const +{ + if (!locale) + return languages(); + QStringList langs = locale->uiLanguages(); + foreach (const QString &language, langs) { // qt4 support + if (language.contains(QLatin1Char('_')) || language.contains(QLatin1Char('-'))) { + QStringList splits = QString(language).replace(QLatin1Char('_'), QLatin1Char('-')) + .split(QLatin1Char('-')); + if (splits.size() > 1 && !langs.contains(splits.at(0))) + langs.append(splits.at(0)); + } + } + if (!langs.contains(QString())) + langs.append(QString()); + return langs; +} + +// ---------------- + +QrcCachePrivate::QrcCachePrivate(QrcCache *) +{ } + +QrcParser::Ptr QrcCachePrivate::addPath(const QString &path) +{ + QPair currentValue; + { + QMutexLocker l(&m_mutex); + currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0)); + currentValue.second += 1; + if (currentValue.second > 1) { + m_cache.insert(path, currentValue); + return currentValue.first; + } + } + QrcParser::Ptr newParser = QrcParser::parseQrcFile(path); + if (!newParser->isValid()) + qDebug() << "adding invalid qrc " << path << " to the cache:" << newParser->errorMessages(); + { + QMutexLocker l(&m_mutex); + QPair currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0)); + if (currentValue.first.isNull()) + currentValue.first = newParser; + currentValue.second += 1; + m_cache.insert(path, currentValue); + return currentValue.first; + } +} + +void QrcCachePrivate::removePath(const QString &path) +{ + QPair currentValue; + { + QMutexLocker l(&m_mutex); + currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0)); + if (currentValue.second == 1) { + m_cache.remove(path); + } else if (currentValue.second > 1) { + currentValue.second -= 1; + m_cache.insert(path, currentValue); + } else { + QTC_CHECK(!m_cache.contains(path)); + } + } +} + +QrcParser::Ptr QrcCachePrivate::updatePath(const QString &path) +{ + QrcParser::Ptr newParser = QrcParser::parseQrcFile(path); + { + QMutexLocker l(&m_mutex); + QPair currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0)); + QTC_CHECK(currentValue.second > 0); + currentValue.first = newParser; + m_cache.insert(path, currentValue); + return currentValue.first; + } +} + +QrcParser::Ptr QrcCachePrivate::parsedPath(const QString &path) +{ + QMutexLocker l(&m_mutex); + QPair currentValue = m_cache.value(path, qMakePair(QrcParser::Ptr(0), 0)); + return currentValue.first; +} + +void QrcCachePrivate::clear() +{ + QMutexLocker l(&m_mutex); + m_cache.clear(); +} + +} // namespace Internal +} // namespace QmlJS diff --git a/src/libs/qmljs/qmljsqrcparser.h b/src/libs/qmljs/qmljsqrcparser.h new file mode 100644 index 0000000000..e25baa2c73 --- /dev/null +++ b/src/libs/qmljs/qmljsqrcparser.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMLJSQRCPARSER_H +#define QMLJSQRCPARSER_H +#include "qmljs_global.h" + +#include +#include +#include +#include + +QT_FORWARD_DECLARE_CLASS(QLocale) + +namespace QmlJS { + +namespace Internal { +class QrcParserPrivate; +class QrcCachePrivate; +} + +class QMLJS_EXPORT QrcParser +{ +public: + typedef QSharedPointer Ptr; + typedef QSharedPointer ConstPtr; + ~QrcParser(); + bool parseFile(const QString &path); + QString firstFileAtPath(const QString &path, const QLocale &locale) const; + void collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale = 0) const; + bool hasDirAtPath(const QString &path, const QLocale *locale = 0) const; + void collectFilesInPath(const QString &path, QMap *res, bool addDirs = false, + const QLocale *locale = 0) const; + QStringList errorMessages() const; + QStringList languages() const; + bool isValid() const; + + static Ptr parseQrcFile(const QString &path); + static QString normalizedQrcFilePath(const QString &path); + static QString normalizedQrcDirectoryPath(const QString &path); +private: + QrcParser(); + QrcParser(const QrcParser &); + Internal::QrcParserPrivate *d; +}; + +class QMLJS_EXPORT QrcCache +{ +public: + QrcCache(); + ~QrcCache(); + QrcParser::ConstPtr addPath(const QString &path); + void removePath(const QString &path); + QrcParser::ConstPtr updatePath(const QString &path); + QrcParser::ConstPtr parsedPath(const QString &path); + void clear(); +private: + Internal::QrcCachePrivate *d; +}; +} +#endif // QMLJSQRCPARSER_H diff --git a/src/libs/qmljs/qmljsscopechain.cpp b/src/libs/qmljs/qmljsscopechain.cpp index 4c6ff96c93..a0a9bf0f91 100644 --- a/src/libs/qmljs/qmljsscopechain.cpp +++ b/src/libs/qmljs/qmljsscopechain.cpp @@ -30,6 +30,7 @@ #include "qmljsscopechain.h" #include "qmljsbind.h" #include "qmljsevaluate.h" +#include "qmljsmodelmanagerinterface.h" using namespace QmlJS; @@ -310,7 +311,10 @@ void ScopeChain::initializeRootScope() if (!m_document->bind()->isJsLibrary()) { foreach (Document::Ptr otherDoc, snapshot) { foreach (const ImportInfo &import, otherDoc->bind()->imports()) { - if (import.type() == ImportInfo::FileImport && m_document->fileName() == import.path()) { + if ((import.type() == ImportInfo::FileImport && m_document->fileName() == import.path()) + || (import.type() == ImportInfo::QrcFileImport + && ModelManagerInterface::instance()->filesAtQrcPath(import.path()) + .contains(m_document->fileName()))) { QmlComponentChain *component = new QmlComponentChain(otherDoc); componentScopes.insert(otherDoc.data(), component); chain->addInstantiatingComponent(component); diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 50120f9fa4..9956ecab1a 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -362,10 +363,17 @@ public: } else if (importInfo.isValid() && importInfo.type() == ImportInfo::DirectoryImport) { QString path = importInfo.path(); QDir dir(m_doc->path()); + // should probably try to make it relatve to some import path, not to the document path QString relativeDir = dir.relativeFilePath(path); QString name = relativeDir.replace(QLatin1Char('/'), QLatin1Char('.')); if (!name.isEmpty()) typeName.prepend(name + QLatin1Char('.')); + } else if (importInfo.isValid() && importInfo.type() == ImportInfo::QrcDirectoryImport) { + QString path = QrcParser::normalizedQrcDirectoryPath(importInfo.path()); + path = path.mid(1, path.size() - ((path.size() > 1) ? 2 : 1)); + const QString name = path.replace(QLatin1Char('/'), QLatin1Char('.')); + if (!name.isEmpty()) + typeName.prepend(name + QLatin1Char('.')); } } } diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 7e816cf397..c33c1d13cd 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -134,9 +135,15 @@ static inline QString getModuleName(const ScopeChain &scopeChain, const Document } else if (importInfo.isValid() && importInfo.type() == ImportInfo::DirectoryImport) { const QString path = importInfo.path(); const QDir dir(qmlDocument->path()); + // should probably try to make it relatve to some import path, not to the document path QString relativeDir = dir.relativeFilePath(path); const QString name = relativeDir.replace(QLatin1Char('/'), QLatin1Char('.')); return name; + } else if (importInfo.isValid() && importInfo.type() == ImportInfo::QrcDirectoryImport) { + QString path = QrcParser::normalizedQrcDirectoryPath(importInfo.path()); + path = path.mid(1, path.size() - ((path.size() > 1) ? 2 : 1)); + const QString name = path.replace(QLatin1Char('/'), QLatin1Char('.')); + return name; } } return QString(); diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 07e9ec06c1..d2c25d49f7 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include @@ -406,6 +407,114 @@ void ModelManager::removeFiles(const QStringList &files) } } +namespace { +bool pInfoLessThanActive(const ModelManager::ProjectInfo &p1, const ModelManager::ProjectInfo &p2) +{ + QStringList s1 = p1.activeResourceFiles; + QStringList s2 = p2.activeResourceFiles; + if (s1.size() < s2.size()) + return true; + if (s1.size() > s2.size()) + return false; + for (int i = 0; i < s1.size(); ++i) { + if (s1.at(i) < s2.at(i)) + return true; + else if (s1.at(i) > s2.at(i)) + return false; + } + return false; +} + +bool pInfoLessThanAll(const ModelManager::ProjectInfo &p1, const ModelManager::ProjectInfo &p2) +{ + QStringList s1 = p1.allResourceFiles; + QStringList s2 = p2.allResourceFiles; + if (s1.size() < s2.size()) + return true; + if (s1.size() > s2.size()) + return false; + for (int i = 0; i < s1.size(); ++i) { + if (s1.at(i) < s2.at(i)) + return true; + else if (s1.at(i) > s2.at(i)) + return false; + } + return false; +} +} + +QStringList ModelManager::filesAtQrcPath(const QString &path, const QLocale *locale, + ProjectExplorer::Project *project, + QrcResourceSelector resources) +{ + QString normPath = QrcParser::normalizedQrcFilePath(path); + QList pInfos; + if (project) + pInfos.append(projectInfo(project)); + else + pInfos = projectInfos(); + + QStringList res; + QSet pathsChecked; + foreach (const ModelManager::ProjectInfo &pInfo, pInfos) { + QStringList qrcFilePaths; + if (resources == ActiveQrcResources) + qrcFilePaths = pInfo.activeResourceFiles; + else + qrcFilePaths = pInfo.allResourceFiles; + foreach (const QString &qrcFilePath, qrcFilePaths) { + if (pathsChecked.contains(qrcFilePath)) + continue; + pathsChecked.insert(qrcFilePath); + QrcParser::ConstPtr qrcFile = m_qrcCache.parsedPath(qrcFilePath); + if (qrcFile.isNull()) + continue; + qrcFile->collectFilesAtPath(normPath, &res, locale); + } + } + res.sort(); // make the result predictable + return res; +} + +QMap ModelManager::filesInQrcPath(const QString &path, + const QLocale *locale, + ProjectExplorer::Project *project, + bool addDirs, + QrcResourceSelector resources) +{ + QString normPath = QrcParser::normalizedQrcDirectoryPath(path); + QList pInfos; + if (project) { + pInfos.append(projectInfo(project)); + } else { + pInfos = projectInfos(); + if (resources == ActiveQrcResources) // make the result predictable + qSort(pInfos.begin(), pInfos.end(), &pInfoLessThanActive); + else + qSort(pInfos.begin(), pInfos.end(), &pInfoLessThanAll); + } + QMap res; + QSet pathsChecked; + foreach (const ModelManager::ProjectInfo &pInfo, pInfos) { + QStringList qrcFilePaths; + if (resources == ActiveQrcResources) + qrcFilePaths = pInfo.activeResourceFiles; + else + qrcFilePaths = pInfo.allResourceFiles; + foreach (const QString &qrcFilePath, qrcFilePaths) { + if (pathsChecked.contains(qrcFilePath)) + continue; + pathsChecked.insert(qrcFilePath); + QrcParser::ConstPtr qrcFile = m_qrcCache.parsedPath(qrcFilePath); + + if (qrcFile.isNull()) + continue; + qrcFile->collectFilesInPath(normPath, &res, addDirs, locale); + } + } + return res; +} + QList ModelManager::projectInfos() const { QMutexLocker locker(&m_mutex); @@ -462,6 +571,12 @@ void ModelManager::updateProjectInfo(const ProjectInfo &pinfo) } updateSourceFiles(newFiles, false); + // update qrc cache + foreach (const QString &newQrc, pinfo.allResourceFiles) + m_qrcCache.addPath(newQrc); + foreach (const QString &oldQrc, oldInfo.allResourceFiles) + m_qrcCache.removePath(oldQrc); + // dump builtin types if the shipped definitions are probably outdated and the // Qt version ships qmlplugindump if (QtSupport::QtVersionNumber(pinfo.qtVersionString) > QtSupport::QtVersionNumber(4, 8, 5)) @@ -497,6 +612,11 @@ ModelManagerInterface::ProjectInfo ModelManager::projectInfoForPath(QString path void ModelManager::emitDocumentChangedOnDisk(Document::Ptr doc) { emit documentChangedOnDisk(doc); } +void ModelManager::updateQrcFile(const QString &path) +{ + m_qrcCache.updatePath(path); +} + void ModelManager::updateDocument(Document::Ptr doc) { { @@ -560,6 +680,23 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho scannedPaths->insert(importName); } } + } else if (import.type() == ImportInfo::QrcFileImport) { + QStringList importPaths = ModelManagerInterface::instance()->filesAtQrcPath(importName); + foreach (const QString &importPath, importPaths) { + if (! snapshot.document(importPath)) + *importedFiles += importPath; + } + } else if (import.type() == ImportInfo::QrcDirectoryImport) { + QMapIterator dirContents(ModelManagerInterface::instance()->filesInQrcPath(importName)); + while (dirContents.hasNext()) { + dirContents.next(); + if (Document::isQmlLikeOrJsLanguage(Document::guessLanguageFromSuffix(dirContents.key()))) { + foreach (const QString &filePath, dirContents.value()) { + if (! snapshot.document(filePath)) + *importedFiles += filePath; + } + } + } } } } @@ -697,8 +834,11 @@ void ModelManager::parse(QFutureInterface &future, const QString fileName = files.at(i); Document::Language language = languageOfFile(fileName); - if (language == Document::UnknownLanguage) + if (language == Document::UnknownLanguage) { + if (fileName.endsWith(QLatin1String(".qrc"))) + modelManager->updateQrcFile(fileName); continue; + } QString contents; int documentRevision = 0; diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h index 3b0763f904..1c42c03882 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.h +++ b/src/plugins/qmljstools/qmljsmodelmanager.h @@ -33,6 +33,7 @@ #include "qmljstools_global.h" #include +#include #include @@ -41,6 +42,7 @@ #include QT_FORWARD_DECLARE_CLASS(QTimer) +QT_FORWARD_DECLARE_CLASS(QLocale) namespace Core { class MimeType; @@ -50,6 +52,10 @@ namespace CPlusPlus { class CppModelManagerInterface; } +namespace QmlJS { +class QrcParser; +} + namespace QmlJSTools { QMLJSTOOLS_EXPORT QmlJS::Document::Language languageOfFile(const QString &fileName); @@ -77,6 +83,14 @@ public: bool emitDocumentOnDiskChanged); virtual void fileChangedOnDisk(const QString &path); virtual void removeFiles(const QStringList &files); + virtual QStringList filesAtQrcPath(const QString &path, const QLocale *locale = 0, + ProjectExplorer::Project *project = 0, + QrcResourceSelector resources = AllQrcResources); + virtual QMap filesInQrcPath(const QString &path, + const QLocale *locale = 0, + ProjectExplorer::Project *project = 0, + bool addDirs = false, + QrcResourceSelector resources = AllQrcResources); virtual QList projectInfos() const; virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const; @@ -87,6 +101,7 @@ public: void updateDocument(QmlJS::Document::Ptr doc); void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info); void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc); + void updateQrcFile(const QString &path); virtual QStringList importPaths() const; virtual QmlJS::QmlLanguageBundles activeBundles() const; @@ -147,6 +162,7 @@ private: QTimer *m_updateCppQmlTypesTimer; QHash > m_queuedCppDocuments; QFuture m_cppQmlTypesUpdater; + QmlJS::QrcCache m_qrcCache; CppDataHash m_cppDataHash; mutable QMutex m_cppDataMutex; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 92954b6be8..2553c1f25d 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -1886,6 +1886,10 @@ void Qt4ProFileNode::applyEvaluate(EvalResult evalResult, bool async) QLatin1String("OBJECTIVE_HEADERS"), m_projectDir, buildDirectory); newVarValues[UiDirVar] = QStringList() << uiDirPath(m_readerExact); newVarValues[MocDirVar] = QStringList() << mocDirPath(m_readerExact); + newVarValues[ResourceVar] = fileListForVar(m_readerExact, m_readerCumulative, + QLatin1String("RESOURCES"), m_projectDir, buildDirectory); + newVarValues[ExactResourceVar] = fileListForVar(m_readerExact, 0, + QLatin1String("RESOURCES"), m_projectDir, buildDirectory); newVarValues[PkgConfigVar] = m_readerExact->values(QLatin1String("PKGCONFIG")); newVarValues[PrecompiledHeaderVar] = m_readerExact->absoluteFileValues(QLatin1String("PRECOMPILED_HEADER"), diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index c4d01190bb..745b745966 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -86,6 +86,8 @@ enum Qt4Variable { CppSourceVar, ObjCSourceVar, ObjCHeaderVar, + ResourceVar, + ExactResourceVar, UiDirVar, MocDirVar, PkgConfigVar, diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 123dbca22d..b2efd28323 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -627,6 +627,8 @@ void Qt4Project::updateQmlJSCodeModel() bool hasQmlLib = false; foreach (Qt4ProFileNode *node, proFiles) { projectInfo.importPaths.append(node->variableValue(QmlImportPathVar)); + projectInfo.activeResourceFiles.append(node->variableValue(ExactResourceVar)); + projectInfo.allResourceFiles.append(node->variableValue(ResourceVar)); if (!hasQmlLib) { QStringList qtLibs = node->variableValue(QtVar); hasQmlLib = qtLibs.contains(QLatin1String("declarative")) || @@ -645,6 +647,8 @@ void Qt4Project::updateQmlJSCodeModel() setProjectLanguages(pl); projectInfo.importPaths.removeDuplicates(); + projectInfo.activeResourceFiles.removeDuplicates(); + projectInfo.allResourceFiles.removeDuplicates(); setProjectLanguage(ProjectExplorer::Constants::LANG_QMLJS, !projectInfo.sourceFiles.isEmpty()); -- cgit v1.2.1 From bcd8c02aea2e8384293b8dc0e1a69135a088d33c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 2 Jun 2013 19:41:58 +0300 Subject: Git: Prevent or close fixup editor if no local commits are found Change-Id: I546241fb3531cbc542b97d6d0f53382c9225dcf4 Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 15 +++++++++++++++ src/plugins/git/gitclient.h | 1 + src/plugins/git/logchangedialog.cpp | 3 +-- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 747ad6e4cb..f51d2f6d8b 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2521,6 +2521,16 @@ bool GitClient::getCommitData(const QString &workingDirectory, // Run status. Note that it has exitcode 1 if there are no added files. QString output; + if (commitData.commitType == FixupCommit) { + QStringList arguments; + arguments << QLatin1String("HEAD") << QLatin1String("--not") + << QLatin1String("--remotes") << QLatin1String("-n1"); + synchronousLog(repoDirectory, arguments, &output, errorMessage); + if (output.isEmpty()) { + *errorMessage = msgNoCommits(false); + return false; + } + } const StatusResult status = gitStatus(repoDirectory, ShowAll, &output, errorMessage); switch (status) { case StatusChanged: @@ -3066,6 +3076,11 @@ QString GitClient::msgNoChangedFiles() return tr("There are no modified files."); } +QString GitClient::msgNoCommits(bool includeRemote) +{ + return includeRemote ? tr("No commits were found") : tr("No local commits were found"); +} + void GitClient::stashPop(const QString &workingDirectory, const QString &stash) { QStringList arguments(QLatin1String("stash")); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 4b230594b6..02fb6f1675 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -316,6 +316,7 @@ public: void handleMergeConflicts(const QString &workingDir, const QString &commit, const QString &abortCommand); static QString msgNoChangedFiles(); + static QString msgNoCommits(bool includeRemote); static const char *noColorOption; static const char *decorateOption; diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 373e8f37e8..4f11be1d11 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -73,8 +73,7 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, boo return false; if (!m_model->rowCount()) { VcsBase::VcsBaseOutputWindow::instance()->appendError( - includeRemote ? tr("No commits were found") - : tr("No local commits were found")); + GitPlugin::instance()->gitClient()->msgNoCommits(includeRemote)); return false; } selectionModel()->select(m_model->index(0, 0), -- cgit v1.2.1 From 3e022beb1235cf74cc2bbe30711858bf5c47d433 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 2 Jun 2013 23:04:17 +0300 Subject: Git: Move submit highlighter to a separate file Change-Id: I61e07b2abe3b1da1b56935bb3ce528a5f571705f Reviewed-by: Tobias Hunger --- src/plugins/git/git.pro | 6 +- src/plugins/git/git.qbs | 2 + src/plugins/git/giteditor.cpp | 3 +- src/plugins/git/githighlighters.cpp | 108 ++++++++++++++++++++++++++++++ src/plugins/git/githighlighters.h | 60 +++++++++++++++++ src/plugins/git/gitsubmiteditorwidget.cpp | 75 +-------------------- src/plugins/git/gitsubmiteditorwidget.h | 19 ------ 7 files changed, 178 insertions(+), 95 deletions(-) create mode 100644 src/plugins/git/githighlighters.cpp create mode 100644 src/plugins/git/githighlighters.h (limited to 'src') diff --git a/src/plugins/git/git.pro b/src/plugins/git/git.pro index 0366c953e1..2a669e6777 100644 --- a/src/plugins/git/git.pro +++ b/src/plugins/git/git.pro @@ -22,7 +22,8 @@ HEADERS += gitplugin.h \ branchadddialog.h \ logchangedialog.h \ mergetool.h \ - branchcheckoutdialog.h + branchcheckoutdialog.h \ + githighlighters.h SOURCES += gitplugin.cpp \ gitclient.cpp \ @@ -46,7 +47,8 @@ SOURCES += gitplugin.cpp \ branchadddialog.cpp \ logchangedialog.cpp \ mergetool.cpp \ - branchcheckoutdialog.cpp + branchcheckoutdialog.cpp \ + githighlighters.cpp FORMS += settingspage.ui \ gitsubmitpanel.ui \ diff --git a/src/plugins/git/git.qbs b/src/plugins/git/git.qbs index 2f8110f8f2..2fdd1b6b96 100644 --- a/src/plugins/git/git.qbs +++ b/src/plugins/git/git.qbs @@ -42,6 +42,8 @@ QtcPlugin { "gitconstants.h", "giteditor.cpp", "giteditor.h", + "githighlighters.cpp", + "githighlighters.h", "gitplugin.cpp", "gitplugin.h", "gitsettings.cpp", diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index 1819fd7a34..dcec98434b 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -35,11 +35,12 @@ #include "gitsettings.h" #include "gitsubmiteditorwidget.h" #include "gitconstants.h" +#include "githighlighters.h" #include #include #include -#include + #include #include #include diff --git a/src/plugins/git/githighlighters.cpp b/src/plugins/git/githighlighters.cpp new file mode 100644 index 0000000000..d223a5e524 --- /dev/null +++ b/src/plugins/git/githighlighters.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include +#include +#include + +#include + +#include "githighlighters.h" + +namespace Git { +namespace Internal { + +// Retrieve the comment char format from the text editor. +static QTextCharFormat commentFormat() +{ + const TextEditor::FontSettings settings = TextEditor::TextEditorSettings::instance()->fontSettings(); + return settings.toTextCharFormat(TextEditor::C_COMMENT); +} + +GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) : + TextEditor::SyntaxHighlighter(parent) +{ + initialize(); +} + +GitSubmitHighlighter::GitSubmitHighlighter(TextEditor::BaseTextDocument *parent) : + TextEditor::SyntaxHighlighter(parent) +{ + initialize(); +} + +void GitSubmitHighlighter::initialize() +{ + m_commentFormat = commentFormat(); + m_keywordPattern.setPattern(QLatin1String("^[\\w-]+:")); + m_hashChar = QLatin1Char('#'); + QTC_CHECK(m_keywordPattern.isValid()); +} + +void GitSubmitHighlighter::highlightBlock(const QString &text) +{ + // figure out current state + State state = static_cast(previousBlockState()); + if (text.isEmpty()) { + if (state == Header) + state = Other; + setCurrentBlockState(state); + return; + } else if (text.startsWith(m_hashChar)) { + setFormat(0, text.size(), m_commentFormat); + setCurrentBlockState(state); + return; + } else if (state == None) { + state = Header; + } + + setCurrentBlockState(state); + // Apply format. + switch (state) { + case None: + break; + case Header: { + QTextCharFormat charFormat = format(0); + charFormat.setFontWeight(QFont::Bold); + setFormat(0, text.size(), charFormat); + break; + } + case Other: + // Format key words ("Task:") italic + if (m_keywordPattern.indexIn(text, 0, QRegExp::CaretAtZero) == 0) { + QTextCharFormat charFormat = format(0); + charFormat.setFontItalic(true); + setFormat(0, m_keywordPattern.matchedLength(), charFormat); + } + break; + } +} + +} // namespace Internal +} // namespace Git diff --git a/src/plugins/git/githighlighters.h b/src/plugins/git/githighlighters.h new file mode 100644 index 0000000000..98a7f13fcb --- /dev/null +++ b/src/plugins/git/githighlighters.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef GITHIGHLIGHTERS_H +#define GITHIGHLIGHTERS_H + +#include +#include + +namespace Git { +namespace Internal { + +// Highlighter for git submit messages. Make the first line bold, indicates +// comments as such (retrieving the format from the text editor) and marks up +// keywords (words in front of a colon as in 'Task: '). +class GitSubmitHighlighter : public TextEditor::SyntaxHighlighter +{ +public: + explicit GitSubmitHighlighter(QTextEdit *parent); + explicit GitSubmitHighlighter(TextEditor::BaseTextDocument *parent); + void highlightBlock(const QString &text); + + void initialize(); +private: + enum State { None = -1, Header, Other }; + QTextCharFormat m_commentFormat; + QRegExp m_keywordPattern; + QChar m_hashChar; +}; + +} // namespace Internal +} // namespace Git + +#endif // GITHIGHLIGHTERS_H diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index 4e2689ffdc..8d057d4a6d 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -27,19 +27,14 @@ ** ****************************************************************************/ -#include "gitsubmiteditorwidget.h" #include "commitdata.h" +#include "gitsubmiteditorwidget.h" +#include "githighlighters.h" #include "logchangedialog.h" -#include -#include -#include - #include -#include #include -#include #include #include #include @@ -48,72 +43,6 @@ namespace Git { namespace Internal { -// Retrieve the comment char format from the text editor. -static QTextCharFormat commentFormat() -{ - const TextEditor::FontSettings settings = TextEditor::TextEditorSettings::instance()->fontSettings(); - return settings.toTextCharFormat(TextEditor::C_COMMENT); -} - -GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) : - TextEditor::SyntaxHighlighter(parent) -{ - initialize(); -} - -GitSubmitHighlighter::GitSubmitHighlighter(TextEditor::BaseTextDocument *parent) : - TextEditor::SyntaxHighlighter(parent) -{ - initialize(); -} - -void GitSubmitHighlighter::initialize() -{ - m_commentFormat = commentFormat(); - m_keywordPattern.setPattern(QLatin1String("^[\\w-]+:")); - m_hashChar = QLatin1Char('#'); - QTC_CHECK(m_keywordPattern.isValid()); -} - -void GitSubmitHighlighter::highlightBlock(const QString &text) -{ - // figure out current state - State state = static_cast(previousBlockState()); - if (text.isEmpty()) { - if (state == Header) - state = Other; - setCurrentBlockState(state); - return; - } else if (text.startsWith(m_hashChar)) { - setFormat(0, text.size(), m_commentFormat); - setCurrentBlockState(state); - return; - } else if (state == None) { - state = Header; - } - - setCurrentBlockState(state); - // Apply format. - switch (state) { - case None: - break; - case Header: { - QTextCharFormat charFormat = format(0); - charFormat.setFontWeight(QFont::Bold); - setFormat(0, text.size(), charFormat); - break; - } - case Other: - // Format key words ("Task:") italic - if (m_keywordPattern.indexIn(text, 0, QRegExp::CaretAtZero) == 0) { - QTextCharFormat charFormat = format(0); - charFormat.setFontItalic(true); - setFormat(0, m_keywordPattern.matchedLength(), charFormat); - } - break; - } -} - // ------------------ GitSubmitEditorWidget::GitSubmitEditorWidget(QWidget *parent) : VcsBase::SubmitEditorWidget(parent), diff --git a/src/plugins/git/gitsubmiteditorwidget.h b/src/plugins/git/gitsubmiteditorwidget.h index 3872786ebe..7eff3d4c03 100644 --- a/src/plugins/git/gitsubmiteditorwidget.h +++ b/src/plugins/git/gitsubmiteditorwidget.h @@ -93,25 +93,6 @@ private: bool m_isInitialized; }; -// Highlighter for git submit messages. Make the first line bold, indicates -// comments as such (retrieving the format from the text editor) and marks up -// keywords (words in front of a colon as in 'Task: '). - -class GitSubmitHighlighter : public TextEditor::SyntaxHighlighter -{ -public: - explicit GitSubmitHighlighter(QTextEdit *parent); - explicit GitSubmitHighlighter(TextEditor::BaseTextDocument *parent); - void highlightBlock(const QString &text); - - void initialize(); -private: - enum State { None = -1, Header, Other }; - QTextCharFormat m_commentFormat; - QRegExp m_keywordPattern; - QChar m_hashChar; -}; - } // namespace Internal } // namespace Git -- cgit v1.2.1 From 3f1901cb1f42c896d9f256937c5a3a4ceeca4501 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 2 Jun 2013 23:05:51 +0300 Subject: Git: Provide a real highlighter for interactive rebase * Kate highlighter doesn't have enough colors * It works out of the box only on Windows * New editor support links Change-Id: I09bbaef08574660e535ccb86c2c460d5976fc2e3 Reviewed-by: Tobias Hunger --- src/plugins/git/Git.mimetypes.xml | 5 ++++ src/plugins/git/gitconstants.h | 3 ++ src/plugins/git/giteditor.cpp | 12 ++++++-- src/plugins/git/githighlighters.cpp | 56 +++++++++++++++++++++++++++++++++++++ src/plugins/git/githighlighters.h | 29 +++++++++++++++++++ src/plugins/git/gitplugin.cpp | 5 ++++ 6 files changed, 107 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/git/Git.mimetypes.xml b/src/plugins/git/Git.mimetypes.xml index c40c30181a..ae51ec2e9b 100644 --- a/src/plugins/git/Git.mimetypes.xml +++ b/src/plugins/git/Git.mimetypes.xml @@ -6,4 +6,9 @@ + + + Git Commit File + + diff --git a/src/plugins/git/gitconstants.h b/src/plugins/git/gitconstants.h index 35cf961956..ca311cb5f1 100644 --- a/src/plugins/git/gitconstants.h +++ b/src/plugins/git/gitconstants.h @@ -50,6 +50,9 @@ const char C_GIT_DIFF_EDITOR[] = "Git Diff Editor"; const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor"; const char GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Commit Editor"); const char C_GIT_COMMIT_TEXT_EDITOR[] = "Git Commit Editor"; +const char GIT_REBASE_EDITOR_ID[] = "Git Rebase Editor"; +const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Rebase Editor"); +const char C_GIT_REBASE_EDITOR[] = "Git Rebase Editor"; const char C_GITSUBMITEDITOR[] = "Git Submit Editor"; const char GITSUBMITEDITOR_ID[] = "Git Submit Editor"; diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index dcec98434b..165b1e7998 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -232,14 +232,19 @@ void GitEditor::revertChange() void GitEditor::init() { VcsBase::VcsBaseEditorWidget::init(); - if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) + Core::Id editorId = editor()->id(); + if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) new GitSubmitHighlighter(baseTextDocument().data()); + else if (editorId == Git::Constants::GIT_REBASE_EDITOR_ID) + new GitRebaseHighlighter(baseTextDocument().data()); } bool GitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) { bool res = VcsBaseEditorWidget::open(errorString, fileName, realFileName); - if (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) { + Core::Id editorId = editor()->id(); + if (editorId == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID + || editorId == Git::Constants::GIT_REBASE_EDITOR_ID) { QFileInfo fi(fileName); setSource(GitPlugin::instance()->gitClient()->findRepositoryForGitDir(fi.absolutePath())); } @@ -298,7 +303,8 @@ QString GitEditor::revisionSubject(const QTextBlock &inBlock) const bool GitEditor::supportChangeLinks() const { return VcsBaseEditorWidget::supportChangeLinks() - || (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID); + || (editor()->id() == Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID) + || (editor()->id() == Git::Constants::GIT_REBASE_EDITOR_ID); } } // namespace Internal diff --git a/src/plugins/git/githighlighters.cpp b/src/plugins/git/githighlighters.cpp index d223a5e524..2f00c9f2db 100644 --- a/src/plugins/git/githighlighters.cpp +++ b/src/plugins/git/githighlighters.cpp @@ -38,6 +38,8 @@ namespace Git { namespace Internal { +static const char CHANGE_PATTERN[] = "\\b[a-f0-9]{7,40}\\b"; + // Retrieve the comment char format from the text editor. static QTextCharFormat commentFormat() { @@ -104,5 +106,59 @@ void GitSubmitHighlighter::highlightBlock(const QString &text) } } +GitRebaseHighlighter::RebaseAction::RebaseAction(const QString ®exp, + const TextEditor::FontSettings &settings, + TextEditor::TextStyle category) + : exp(regexp) +{ + format = settings.toTextCharFormat(category); +} + +GitRebaseHighlighter::GitRebaseHighlighter(TextEditor::BaseTextDocument *parent) : + TextEditor::SyntaxHighlighter(parent), + m_hashChar(QLatin1Char('#')), + m_changeNumberPattern(QLatin1String(CHANGE_PATTERN)) +{ + const TextEditor::FontSettings settings = TextEditor::TextEditorSettings::instance()->fontSettings(); + m_commentFormat = settings.toTextCharFormat(TextEditor::C_COMMENT); + m_changeFormat = settings.toTextCharFormat(TextEditor::C_DOXYGEN_COMMENT); + m_descFormat = settings.toTextCharFormat(TextEditor::C_STRING); + m_actions << RebaseAction(QLatin1String("^(p|pick)\\b"), settings, TextEditor::C_KEYWORD); + m_actions << RebaseAction(QLatin1String("^(r|reword)\\b"), settings, TextEditor::C_FIELD); + m_actions << RebaseAction(QLatin1String("^(e|edit)\\b"), settings, TextEditor::C_TYPE); + m_actions << RebaseAction(QLatin1String("^(s|squash)\\b"), settings, TextEditor::C_ENUMERATION); + m_actions << RebaseAction(QLatin1String("^(f|fixup)\\b"), settings, TextEditor::C_NUMBER); + m_actions << RebaseAction(QLatin1String("^(x|exec)\\b"), settings, TextEditor::C_LABEL); +} + +void GitRebaseHighlighter::highlightBlock(const QString &text) +{ + if (text.startsWith(m_hashChar)) { + setFormat(0, text.size(), m_commentFormat); + int changeIndex = 0; + while ((changeIndex = m_changeNumberPattern.indexIn(text, changeIndex)) != -1) { + const int changeLen = m_changeNumberPattern.matchedLength(); + setFormat(changeIndex, changeLen, m_changeFormat); + changeIndex += changeLen; + } + return; + } + + foreach (const RebaseAction &action, m_actions) { + if (action.exp.indexIn(text) != -1) { + const int len = action.exp.matchedLength(); + setFormat(0, len, action.format); + const int changeIndex = m_changeNumberPattern.indexIn(text, len); + if (changeIndex != -1) { + const int changeLen = m_changeNumberPattern.matchedLength(); + const int descStart = changeIndex + changeLen + 1; + setFormat(changeIndex, changeLen, m_changeFormat); + setFormat(descStart, text.size() - descStart, m_descFormat); + } + break; + } + } +} + } // namespace Internal } // namespace Git diff --git a/src/plugins/git/githighlighters.h b/src/plugins/git/githighlighters.h index 98a7f13fcb..3d7f6e0621 100644 --- a/src/plugins/git/githighlighters.h +++ b/src/plugins/git/githighlighters.h @@ -33,6 +33,10 @@ #include #include +namespace TextEditor { +class FontSettings; +} + namespace Git { namespace Internal { @@ -54,6 +58,31 @@ private: QChar m_hashChar; }; +// Highlighter for interactive rebase todo. Indicates comments as such +// (retrieving the format from the text editor) and marks up keywords +class GitRebaseHighlighter : public TextEditor::SyntaxHighlighter +{ +public: + explicit GitRebaseHighlighter(TextEditor::BaseTextDocument *parent); + void highlightBlock(const QString &text); + +private: + class RebaseAction + { + public: + mutable QRegExp exp; + QTextCharFormat format; + RebaseAction(const QString ®exp, const TextEditor::FontSettings &settings, + TextEditor::TextStyle category); + }; + QTextCharFormat m_commentFormat; + QTextCharFormat m_changeFormat; + QTextCharFormat m_descFormat; + const QChar m_hashChar; + QRegExp m_changeNumberPattern; + QList m_actions; +}; + } // namespace Internal } // namespace Git diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 8b3774793a..215e9e67d1 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -111,6 +111,11 @@ static const VcsBase::VcsBaseEditorParameters editorParameters[] = { Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME, Git::Constants::C_GIT_COMMIT_TEXT_EDITOR, "text/vnd.qtcreator.git.commit"}, +{ VcsBase::OtherContent, + Git::Constants::GIT_REBASE_EDITOR_ID, + Git::Constants::GIT_REBASE_EDITOR_DISPLAY_NAME, + Git::Constants::C_GIT_REBASE_EDITOR, + "text/vnd.qtcreator.git.rebase"}, }; // Utility to find a parameter set by type -- cgit v1.2.1 From a91219c6363dc2dcc062a984b67dcf46085aca30 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 2 Jun 2013 23:06:55 +0300 Subject: VCS: Fix context menu for custom editors Change-Id: I44718dce73bbcd376d90fdf40f4bb5ab4c57443a Reviewed-by: Tobias Hunger --- src/plugins/vcsbase/vcsbaseeditor.cpp | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 00445b2375..b6d6d15f4d 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -297,14 +297,6 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ { VcsBaseEditorWidget *widget = editorWidget(); switch (type) { - case LogOutput: { // Describe current / Annotate file of current - menu->addSeparator(); - menu->addAction(createCopyRevisionAction(m_currentChange)); - menu->addAction(createDescribeAction(m_currentChange)); - if (widget->isFileLogAnnotateEnabled()) - menu->addAction(createAnnotateAction(m_currentChange, false)); - break; - } case AnnotateOutput: { // Describe current / annotate previous bool currentValid = widget->isValidRevision(m_currentChange); menu->addSeparator(); @@ -321,7 +313,12 @@ void ChangeTextCursorHandler::fillContextMenu(QMenu *menu, EditorContentType typ } break; } - default: + default: // Describe current / Annotate file of current + menu->addSeparator(); + menu->addAction(createCopyRevisionAction(m_currentChange)); + menu->addAction(createDescribeAction(m_currentChange)); + if (widget->isFileLogAnnotateEnabled()) + menu->addAction(createAnnotateAction(m_currentChange, false)); break; } widget->addChangeActions(menu, m_currentChange); @@ -921,17 +918,13 @@ void VcsBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QPointer menu = createStandardContextMenu(); // 'click on change-interaction' - switch (d->m_parameters->type) { - case LogOutput: - case AnnotateOutput: { + if (supportChangeLinks()) { const QTextCursor cursor = cursorForPosition(e->pos()); - Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor); - if (handler != 0) + if (Internal::AbstractTextCursorHandler *handler = d->findTextCursorHandler(cursor)) handler->fillContextMenu(menu, d->m_parameters->type); - // Fall-through for log (might have diff) - if (d->m_parameters->type != LogOutput) - break; } + switch (d->m_parameters->type) { + case LogOutput: // log might have diff case DiffOutput: { menu->addSeparator(); connect(menu->addAction(tr("Send to CodePaster...")), SIGNAL(triggered()), -- cgit v1.2.1 From 5d39fcf7cfe353d442a591290c5ecf843ec1d911 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 3 Jun 2013 07:34:12 +0300 Subject: Git: Better wording for rebase in progress message Change-Id: I13d002773dd81206c70b7eb91727f152d7e84507 Reviewed-by: Petar Perisin Reviewed-by: Leena Miettinen Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index f51d2f6d8b..a9d42f0247 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2313,14 +2313,14 @@ GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &wo void GitClient::continueCommandIfNeeded(const QString &workingDirectory) { - switch (checkCommandInProgress(workingDirectory)) { + CommandInProgress command = checkCommandInProgress(workingDirectory); + switch (command) { case Rebase: - continuePreviousGitCommand(workingDirectory, tr("Continue Rebase"), - tr("Continue rebase?"), tr("Continue"), QLatin1String("rebase")); - break; case RebaseMerge: continuePreviousGitCommand(workingDirectory, tr("Continue Rebase"), - tr("Continue rebase?"), tr("Continue"), QLatin1String("rebase"), false); + tr("Rebase is in progress. What do you want to do?"), + tr("Continue"), QLatin1String("rebase"), + command != RebaseMerge); break; case Revert: continuePreviousGitCommand(workingDirectory, tr("Continue Revert"), -- cgit v1.2.1 From 0e75e5cb612cf2f357e9444de427a1bbb70ae829 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 3 Jun 2013 10:32:45 +0200 Subject: Valgrind: Fix compile Change-Id: I247ba4ba11fc036d0afaa70d98e89eaf2315b60a Reviewed-by: Eike Ziller --- src/plugins/valgrind/memcheckerrorview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index 874c54ea86..3f421b280a 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #include using namespace Valgrind::XmlProtocol; -- cgit v1.2.1 From 9ff6490dfce0d51976e482064ffeba38edc401c1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 3 Jun 2013 11:33:33 +0200 Subject: Save mode visibility in a separate property. Instead of using the actual visibility state of the widget, which might have screwed things up if for some reason the widget itself was not visible the moment settings are saved. Change-Id: I7ae89259dc925f799bca413b537b65e9e689e1b7 Reviewed-by: Jarek Kobus --- src/plugins/coreplugin/modemanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index f1f019be14..894d3af057 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -73,6 +73,7 @@ struct ModeManagerPrivate Context m_addedContexts; int m_oldCurrent; bool m_saveSettingsOnModeChange; + bool m_modeSelectorVisible; }; static ModeManagerPrivate *d; @@ -100,6 +101,8 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow, d->m_actionBar = new Internal::FancyActionBar(modeStack); d->m_modeStack->addCornerWidget(d->m_actionBar); d->m_saveSettingsOnModeChange = false; + d->m_modeSelectorVisible = true; + d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible); connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int))); connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); @@ -339,12 +342,13 @@ void ModeManager::setFocusToCurrentMode() void ModeManager::setModeSelectorVisible(bool visible) { + d->m_modeSelectorVisible = visible; d->m_modeStack->setSelectionWidgetVisible(visible); } bool ModeManager::isModeSelectorVisible() { - return d->m_modeStack->isSelectionWidgetVisible(); + return d->m_modeSelectorVisible; } ModeManager *ModeManager::instance() -- cgit v1.2.1 From db4a8caf321e8a756015a10e2d98895cb7b58156 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 31 May 2013 21:41:50 +0200 Subject: Debugger: Move warning of insufficent python version It was in exactly the wrong branch. Change-Id: I0679c18dc9c049bb89c2cba47cb0762ad81e3024 Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 705fab28b4..f7fdc827fb 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1830,9 +1830,9 @@ void GdbEngine::handleShowVersion(const GdbResponse &response) if (m_gdbVersion > 70100) { // Quick check whether we have python. - showMessage(_("NOTE: CHECK FOR PYTHON SUPPRESSED, VERSION TOO LOW")); postCommand("python print 43", ConsoleCommand, CB(handleHasPython)); } else { + showMessage(_("NOTE: CHECK FOR PYTHON SUPPRESSED, VERSION TOO LOW")); pythonDumpersFailed(); } } -- cgit v1.2.1 From 6d544bc2cad7dec084aa80c9e14a22ba3122166f Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 27 May 2013 11:54:50 +0200 Subject: C++: handle braced return statements in indenter. Task-number: QTCREATORBUG-9314 Change-Id: I59c026cce02b85eeb54f4d10d5c9fb0c59bfe28a Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cppcodeformatter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 1ad33ca026..967bc9321c 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -207,6 +207,8 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) // oops, the expression was a function declaration argument list, hand lbrace/colon to declaration_start leave(); continue; + } else { + turnInto(substatement_open); } break; default: tryExpression(); break; -- cgit v1.2.1 From 078942b767525087700aa4603b606a50c37b9db3 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 3 Jun 2013 12:56:08 +0200 Subject: ProjectExplorerSettingsPage: Do not have a const setter. Change-Id: Ic0a71ce49b9f65894860562b8414772cd839152c Reviewed-by: Eike Ziller Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/projectexplorersettingspage.cpp | 2 +- src/plugins/projectexplorer/projectexplorersettingspage.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp index 1673bfaf64..c008919e8f 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp +++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp @@ -84,7 +84,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const return pes; } -void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &pes) const +void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings &pes) { m_ui.buildProjectBeforeDeployCheckBox->setChecked(pes.buildBeforeDeploy); m_ui.deployProjectBeforeRunCheckBox->setChecked(pes.deployBeforeRun); diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.h b/src/plugins/projectexplorer/projectexplorersettingspage.h index f84d9981bb..a2e40a79c3 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.h +++ b/src/plugins/projectexplorer/projectexplorersettingspage.h @@ -47,7 +47,7 @@ public: explicit ProjectExplorerSettingsWidget(QWidget *parent = 0); ProjectExplorerSettings settings() const; - void setSettings(const ProjectExplorerSettings &s) const; + void setSettings(const ProjectExplorerSettings &s); QString projectsDirectory() const; void setProjectsDirectory(const QString &pd); -- cgit v1.2.1 From 2af8faeb91a4326d5c432a3d10dd03c6f8303b01 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 3 Jun 2013 12:56:49 +0200 Subject: ProjectExplorerSettings: Keep environmentId. Make sure to not change the environmentId when editing something in the settings page. Task-number: QTCREATORBUG-9359 Change-Id: I7fc891cb3a69f08b1c2ea3f963a2deb01ddca9b2 Reviewed-by: Eike Ziller Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/projectexplorer.cpp | 2 ++ src/plugins/projectexplorer/projectexplorersettings.h | 3 ++- src/plugins/projectexplorer/projectexplorersettingspage.cpp | 2 ++ src/plugins/projectexplorer/projectexplorersettingspage.h | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index ff3244c462..bf6afa3cee 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -3018,6 +3018,8 @@ void ProjectExplorerPlugin::setSession(QAction *action) void ProjectExplorerPlugin::setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes) { + QTC_ASSERT(d->m_projectExplorerSettings.environmentId == pes.environmentId, return); + if (d->m_projectExplorerSettings == pes) return; d->m_projectExplorerSettings = pes; diff --git a/src/plugins/projectexplorer/projectexplorersettings.h b/src/plugins/projectexplorer/projectexplorersettings.h index adf2b8a558..507bf4612a 100644 --- a/src/plugins/projectexplorer/projectexplorersettings.h +++ b/src/plugins/projectexplorer/projectexplorersettings.h @@ -81,7 +81,8 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS && p1.useJom == p2.useJom && p1.autorestoreLastSession == p2.autorestoreLastSession && p1.prompToStopRunControl == p2.prompToStopRunControl - && p1.maxAppOutputLines == p2.maxAppOutputLines; + && p1.maxAppOutputLines == p2.maxAppOutputLines + && p1.environmentId == p2.environmentId; } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.cpp b/src/plugins/projectexplorer/projectexplorersettingspage.cpp index c008919e8f..86d4577bb0 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.cpp +++ b/src/plugins/projectexplorer/projectexplorersettingspage.cpp @@ -81,6 +81,7 @@ ProjectExplorerSettings ProjectExplorerSettingsWidget::settings() const pes.useJom = m_ui.jomCheckbox->isChecked(); pes.prompToStopRunControl = m_ui.promptToStopRunControlCheckBox->isChecked(); pes.maxAppOutputLines = m_ui.maxAppOutputBox->value(); + pes.environmentId = m_environmentId; return pes; } @@ -98,6 +99,7 @@ void ProjectExplorerSettingsWidget::setSettings(const ProjectExplorerSettings & m_ui.jomCheckbox->setChecked(pes.useJom); m_ui.promptToStopRunControlCheckBox->setChecked(pes.prompToStopRunControl); m_ui.maxAppOutputBox->setValue(pes.maxAppOutputLines); + m_environmentId = pes.environmentId; } QString ProjectExplorerSettingsWidget::projectsDirectory() const diff --git a/src/plugins/projectexplorer/projectexplorersettingspage.h b/src/plugins/projectexplorer/projectexplorersettingspage.h index a2e40a79c3..75f63dcfb0 100644 --- a/src/plugins/projectexplorer/projectexplorersettingspage.h +++ b/src/plugins/projectexplorer/projectexplorersettingspage.h @@ -34,6 +34,7 @@ #include "ui_projectexplorersettingspage.h" #include +#include namespace ProjectExplorer { namespace Internal { @@ -70,6 +71,7 @@ private: Ui::ProjectExplorerSettingsPageUi m_ui; mutable QString m_searchKeywords; + QUuid m_environmentId; }; class ProjectExplorerSettingsPage : public Core::IOptionsPage -- cgit v1.2.1 From ce4edd7930e5ad245c08a76344669a8f03688c65 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 3 Jun 2013 14:53:56 +0200 Subject: Editors: "Split New Window" --> "Open in New Window" Change-Id: Icbf27edc8b3d7bd73504b449491f70056220c99f Reviewed-by: Leena Miettinen --- src/plugins/coreplugin/editormanager/editormanager.cpp | 4 ++-- src/plugins/coreplugin/editortoolbar.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index a6802a6187..4101fba001 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -381,7 +381,7 @@ EditorManager::EditorManager(QWidget *parent) : mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_splitSideBySideAction, SIGNAL(triggered()), this, SLOT(splitSideBySide())); - d->m_splitNewWindowAction = new QAction(tr("Split New Window"), this); + d->m_splitNewWindowAction = new QAction(tr("Open in New Window"), this); cmd = ActionManager::registerAction(d->m_splitNewWindowAction, Constants::SPLIT_NEW_WINDOW, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,4") : tr("Ctrl+E,4"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); @@ -399,7 +399,7 @@ EditorManager::EditorManager(QWidget *parent) : mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits())); - d->m_gotoNextSplitAction = new QAction(tr("Go to Next Split"), this); + d->m_gotoNextSplitAction = new QAction(tr("Go to Next Split or Window"), this); cmd = ActionManager::registerAction(d->m_gotoNextSplitAction, Constants::GOTO_NEXT_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index ffc9b69d12..900f370e29 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -87,7 +87,7 @@ EditorToolBarPrivate::EditorToolBarPrivate(QWidget *parent, EditorToolBar *q) : m_splitButton(new QToolButton), m_horizontalSplitAction(new QAction(QIcon(QLatin1String(Constants::ICON_SPLIT_HORIZONTAL)), EditorManager::tr("Split"), parent)), m_verticalSplitAction(new QAction(QIcon(QLatin1String(Constants::ICON_SPLIT_VERTICAL)), EditorManager::tr("Split Side by Side"), parent)), - m_splitNewWindowAction(new QAction(EditorManager::tr("Split New Window"), parent)), + m_splitNewWindowAction(new QAction(EditorManager::tr("Open in New Window"), parent)), m_closeSplitButton(new QToolButton), m_activeToolBar(0), m_toolBarPlaceholder(new QWidget), -- cgit v1.2.1 From 10725c086b49fec2a5d0b6c1fc61171fcb2dcacb Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 27 May 2013 11:37:50 +0200 Subject: C++: fix Q_CREATOR_RUN macro handling Moved it from the handleIfDefDirective to the pre-defined macros, so that #if defined() can also see it. Task-number: QTCREATORBUG-9322 Change-Id: Icbecad5c885dd2374b559969c99631c3ddc73844 Reviewed-by: Nikolai Kosjar --- src/libs/cplusplus/pp-engine.cpp | 4 ---- src/plugins/cpptools/cppmodelmanager.cpp | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 77ff055b1b..3643601a85 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1900,8 +1900,6 @@ void Preprocessor::handleEndIfDirective(PPToken *tk, const PPToken £Token) void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk) { - static const QByteArray qCreatorRun("Q_CREATOR_RUN"); - lex(tk); // consume "ifdef" token if (tk->is(T_IDENTIFIER)) { if (checkUndefined && m_state.m_ifLevel == 0) @@ -1922,8 +1920,6 @@ void Preprocessor::handleIfDefDirective(bool checkUndefined, PPToken *tk) } } else if (m_env->isBuiltinMacro(macroName)) { value = true; - } else if (macroName == qCreatorRun) { - value = true; } if (checkUndefined) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index f168e6bfa8..7fa7fc3a38 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -143,6 +143,7 @@ protected: static const char pp_configuration[] = "# 1 \"\"\n" + "#define Q_CREATOR_RUN 1\n" "#define __cplusplus 1\n" "#define __extension__\n" "#define __context__\n" -- cgit v1.2.1 From 34902ab6aa7ffca3567803a26fac2069603bb98b Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 3 Jun 2013 13:31:49 +0200 Subject: Debugger: Improve wording of the "Close buffers on exit" option Change-Id: Icb94fc1123f0b1f675356e9f3c347f25a6c3cb53 Reviewed-by: Leena Miettinen --- src/plugins/debugger/commonoptionspage.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/debugger/commonoptionspage.cpp b/src/plugins/debugger/commonoptionspage.cpp index 0082bdce25..e096037c55 100644 --- a/src/plugins/debugger/commonoptionspage.cpp +++ b/src/plugins/debugger/commonoptionspage.cpp @@ -69,7 +69,11 @@ CommonOptionsPageWidget::CommonOptionsPageWidget checkBoxListSourceFiles->setText(tr("Populate source file view automatically")); checkBoxCloseBuffersOnExit = new QCheckBox(behaviorBox); - checkBoxCloseBuffersOnExit->setText(tr("Close temporary buffers on debugger exit")); + checkBoxCloseBuffersOnExit->setText(tr("Close temporary views on debugger exit")); + checkBoxCloseBuffersOnExit->setText(tr("Stopping and stepping in the debugger " + "will automatically open source or disassembler views associated with the " + "current location. Select this option to automatically close them when " + "the debugger exits.")); checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox); checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit")); -- cgit v1.2.1 From d09f39931fcbd7b38909b564c008737737e5ba3f Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 31 May 2013 17:50:07 +0200 Subject: MiniProjectTargetSelector: Work with no sidebar Fix MiniProjectTargetSelector becoming too small when no sidebar is displayed. Task-number: QTCREATORBUG-9423 Change-Id: I40f9093f7217448c3b29a699aa8e07710127d608 Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/miniprojecttargetselector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 30d44ce554..af399f4862 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -779,7 +779,9 @@ void MiniProjectTargetSelector::doLayout(bool keepSize) m_summaryLabel->move(0, summaryLabelY); // Height to be aligned with side bar button - int alignedWithActionHeight = actionBar->height() - statusBar->height(); + int alignedWithActionHeight = 210; + if (actionBar->isVisible()) + alignedWithActionHeight = actionBar->height() - statusBar->height(); int bottomMargin = 9; int totalHeight = 0; -- cgit v1.2.1 From 76fc97227784ad1e6ce3cbb5a55d36fef16af458 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 3 Jun 2013 14:27:53 +0200 Subject: Debugger: Add specific customization hook for dumper initialization We need to distiguish between start of GDB itself (a.k.a .gdbinit-style customization) and after the dumper machinery is initialized, which is nowadays often delayed until the first stop hook. Change-Id: I40f1e7225c2043b8bcb7d50eef948bb3c9162bb6 Reviewed-by: Leena Miettinen Reviewed-by: hjk --- src/plugins/debugger/debuggeractions.cpp | 5 ++++ src/plugins/debugger/debuggeractions.h | 1 + src/plugins/debugger/gdb/gdbengine.cpp | 7 ++++++ src/plugins/debugger/gdb/gdboptionspage.cpp | 38 ++++++++++++++++++++++------- 4 files changed, 42 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index c84ca969a6..c042217885 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -447,6 +447,11 @@ DebuggerSettings::DebuggerSettings(QSettings *settings) insertItem(GdbStartupCommands, item); item = new SavedAction(this); + item->setSettingsKey(debugModeGroup, QLatin1String("GdbCustomDumperCommands")); + item->setDefaultValue(QString()); + insertItem(GdbCustomDumperCommands, item); + item = new SavedAction(this); + item->setSettingsKey(debugModeGroup, QLatin1String("GdbPostAttachCommands")); item->setDefaultValue(QString()); insertItem(GdbPostAttachCommands, item); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index d98423a76c..2abc5dddf4 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -130,6 +130,7 @@ enum DebuggerActionCode LoadGdbDumpers, AttemptQuickStart, GdbStartupCommands, + GdbCustomDumperCommands, GdbPostAttachCommands, GdbWatchdogTimeout, AutoEnrichParameters, diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index f7fdc827fb..bdacb76708 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1854,6 +1854,12 @@ void GdbEngine::handleHasPython(const GdbResponse &response) void GdbEngine::handlePythonSetup(const GdbResponse &response) { if (response.resultClass == GdbResultDone) { + const QString commands = debuggerCore()->stringSetting(GdbCustomDumperCommands); + if (!commands.isEmpty()) { + postCommand(commands.toLocal8Bit()); + postCommand("bbsetup"); + } + postCommand("python qqStringCutOff = " + debuggerCore()->action(MaximalStringLength)->value().toByteArray(), ConsoleCommand|NonCriticalResponse); @@ -4972,6 +4978,7 @@ void GdbEngine::tryLoadPythonDumpers() postCommand("python execfile('" + dumperSourcePath + "gbridge.py')", ConsoleCommand, CB(handlePythonSetup)); + } void GdbEngine::reloadDebuggingHelpers() diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index e65711ab1e..f88f592d95 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -72,6 +72,8 @@ public: QTextEdit *textEditStartupCommands; QGroupBox *groupBoxPostAttachCommands; QTextEdit *textEditPostAttachCommands; + QGroupBox *groupBoxCustomDumperCommands; + QTextEdit *textEditCustomDumperCommands; //QGroupBox *groupBoxPluginDebugging; //QRadioButton *radioButtonAllPluginBreakpoints; @@ -167,20 +169,21 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) "Note:This feature needs special support from the Linux " "distribution and GDB build and is not everywhere available.

")); - groupBoxStartupCommands = new QGroupBox(this); - groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands")); - groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr( - "

GDB commands entered here will be executed after " - "GDB has been started and the debugging helpers have been initialized.

" - "

You can add commands to load further debugging helpers here, or " - "modify existing ones.

" + QString howToUsePython = GdbOptionsPage::tr( "

To execute simple Python commands, prefix them with \"python\".

" "

To execute sequences of Python commands spanning multiple lines " "prepend the block with \"python\" on a separate line, and append " "\"end\" on a separate line.

" "

To execute arbitrary Python scripts, " - "use python execfile('/path/to/script.py').

" - "")); + "use python execfile('/path/to/script.py').

"); + + groupBoxStartupCommands = new QGroupBox(this); + groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands")); + groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr( + "

GDB commands entered here will be executed after " + "GDB has been started, but before the debugged program is started or " + "attached, and before the debugging helpers are initialized.

%1" + "").arg(howToUsePython)); textEditStartupCommands = new QTextEdit(groupBoxStartupCommands); textEditStartupCommands->setAcceptRichText(false); @@ -199,6 +202,18 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) textEditPostAttachCommands->setAcceptRichText(false); textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip()); + groupBoxCustomDumperCommands = new QGroupBox(this); + groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization")); + groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr( + "

GDB commands entered here will be executed after " + "Qt Creator's debugging helpers have been loaded and fully initialized. " + "You can load additional debugging helpers or modify existing ones here.

" + "%1").arg(howToUsePython)); + + textEditCustomDumperCommands = new QTextEdit(groupBoxStartupCommands); + textEditCustomDumperCommands->setAcceptRichText(false); + textEditCustomDumperCommands->setToolTip(groupBoxStartupCommands->toolTip()); + /* groupBoxPluginDebugging = new QGroupBox(q); groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr( @@ -242,6 +257,9 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands); postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1); + QGridLayout *customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands); + customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1); + //QHBoxLayout *horizontalLayout = new QHBoxLayout(); //horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum)); //horizontalLayout->addWidget(labelSelectedPluginBreakpoints); @@ -251,6 +269,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1); gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1); gridLayout->addWidget(groupBoxPostAttachCommands, 1, 1, 1, 1); + gridLayout->addWidget(groupBoxCustomDumperCommands, 2, 1, 1, 1); //gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1); //gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1); @@ -262,6 +281,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) DebuggerCore *dc = debuggerCore(); group.insert(dc->action(GdbStartupCommands), textEditStartupCommands); + group.insert(dc->action(GdbCustomDumperCommands), textEditCustomDumperCommands); group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands); group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit); group.insert(dc->action(LoadGdbDumpers), checkBoxLoadGdbDumpers); -- cgit v1.2.1 From 3814e262ff35e4d92d9179ac067c0cb858b82281 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 30 May 2013 12:15:22 +0200 Subject: DiffEditor: Rename DiffEditorEditable to DiffEditor More in line with current naming conventions. Change-Id: I63f6677bd12d82f6749032996585d761f1a74fb7 Reviewed-by: Jarek Kobus Reviewed-by: Eike Ziller --- src/plugins/diffeditor/diffeditor.cpp | 231 ++++++++++++++++++++++++++ src/plugins/diffeditor/diffeditor.h | 92 ++++++++++ src/plugins/diffeditor/diffeditor.pro | 4 +- src/plugins/diffeditor/diffeditoreditable.cpp | 231 -------------------------- src/plugins/diffeditor/diffeditoreditable.h | 92 ---------- src/plugins/diffeditor/diffeditorplugin.cpp | 14 +- src/plugins/git/gitclient.cpp | 29 ++-- src/plugins/git/gitclient.h | 4 +- 8 files changed, 348 insertions(+), 349 deletions(-) create mode 100644 src/plugins/diffeditor/diffeditor.cpp create mode 100644 src/plugins/diffeditor/diffeditor.h delete mode 100644 src/plugins/diffeditor/diffeditoreditable.cpp delete mode 100644 src/plugins/diffeditor/diffeditoreditable.h (limited to 'src') diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp new file mode 100644 index 0000000000..eba1eeda3f --- /dev/null +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "diffeditor.h" +#include "diffeditorfile.h" +#include "diffeditorwidget.h" +#include "diffeditorconstants.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace DiffEditor { + +///////////////////////////////// DiffEditor ////////////////////////////////// + +DiffEditor::DiffEditor(DiffEditorWidget *editorWidget) + : IEditor(0), + m_file(new Internal::DiffEditorFile(QLatin1String(Constants::DIFF_EDITOR_MIMETYPE), this)), + m_editorWidget(editorWidget), + m_toolWidget(0), + m_entriesComboBox(0) +{ + setWidget(editorWidget); + connect(m_editorWidget, SIGNAL(navigatedToDiffFile(int)), + this, SLOT(activateEntry(int))); +} + +DiffEditor::~DiffEditor() +{ + delete m_toolWidget; + if (m_widget) + delete m_widget; +} + +bool DiffEditor::createNew(const QString &contents) +{ + Q_UNUSED(contents) + return true; +} + +bool DiffEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) +{ + Q_UNUSED(errorString) + Q_UNUSED(fileName) + Q_UNUSED(realFileName) + return true; +} + +Core::IDocument *DiffEditor::document() +{ + return m_file; +} + +QString DiffEditor::displayName() const +{ + if (m_displayName.isEmpty()) + m_displayName = QCoreApplication::translate("DiffEditor", Constants::DIFF_EDITOR_DISPLAY_NAME); + return m_displayName; +} + +void DiffEditor::setDisplayName(const QString &title) +{ + m_displayName = title; + emit changed(); +} + +Core::Id DiffEditor::id() const +{ + return Constants::DIFF_EDITOR_ID; +} + +static QToolBar *createToolBar(const QWidget *someWidget) +{ + // Create + QToolBar *toolBar = new QToolBar; + toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + const int size = someWidget->style()->pixelMetric(QStyle::PM_SmallIconSize); + toolBar->setIconSize(QSize(size, size)); + + return toolBar; +} + +QWidget *DiffEditor::toolBar() +{ + if (m_toolWidget) + return m_toolWidget; + + // Create + m_toolWidget = createToolBar(m_editorWidget); + + m_entriesComboBox = new QComboBox; + m_entriesComboBox->setMinimumContentsLength(20); + // Make the combo box prefer to expand + QSizePolicy policy = m_entriesComboBox->sizePolicy(); + policy.setHorizontalPolicy(QSizePolicy::Expanding); + m_entriesComboBox->setSizePolicy(policy); + connect(m_entriesComboBox, SIGNAL(activated(int)), + this, SLOT(entryActivated(int))); + m_toolWidget->addWidget(m_entriesComboBox); + + QToolButton *whitespaceButton = new QToolButton(m_toolWidget); + whitespaceButton->setText(tr("Ignore Whitespace")); + whitespaceButton->setCheckable(true); + whitespaceButton->setChecked(true); + connect(whitespaceButton, SIGNAL(clicked(bool)), + m_editorWidget, SLOT(setIgnoreWhitespaces(bool))); + m_toolWidget->addWidget(whitespaceButton); + + QLabel *contextLabel = new QLabel(m_toolWidget); + contextLabel->setText(tr("Context Lines:")); + contextLabel->setMargin(6); + m_toolWidget->addWidget(contextLabel); + + QSpinBox *contextSpinBox = new QSpinBox(m_toolWidget); + contextSpinBox->setRange(-1, 100); + contextSpinBox->setValue(3); + contextSpinBox->setFrame(false); + connect(contextSpinBox, SIGNAL(valueChanged(int)), + m_editorWidget, SLOT(setContextLinesNumber(int))); + m_toolWidget->addWidget(contextSpinBox); + + return m_toolWidget; +} + +void DiffEditor::setDiff(const QList &diffFileList, + const QString &workingDirectory) +{ + m_entriesComboBox->clear(); + const int count = diffFileList.count(); + for (int i = 0; i < count; i++) { + const DiffEditorWidget::DiffFileInfo leftEntry = diffFileList.at(i).leftFileInfo; + const DiffEditorWidget::DiffFileInfo rightEntry = diffFileList.at(i).rightFileInfo; + const QString leftShortFileName = QFileInfo(leftEntry.fileName).fileName(); + const QString rightShortFileName = QFileInfo(rightEntry.fileName).fileName(); + QString itemText; + QString itemToolTip; + if (leftEntry.fileName == rightEntry.fileName) { + itemText = leftShortFileName; + + if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) { + itemToolTip = leftEntry.fileName; + } else { + itemToolTip = tr("[%1] vs. [%2] %3") + .arg(leftEntry.typeInfo, rightEntry.typeInfo, leftEntry.fileName); + } + } else { + if (leftShortFileName == rightShortFileName) { + itemText = leftShortFileName; + } else { + itemText = tr("%1 vs. %2") + .arg(leftShortFileName, rightShortFileName); + } + + if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) { + itemToolTip = tr("%1 vs. %2") + .arg(leftEntry.fileName, rightEntry.fileName); + } else { + itemToolTip = tr("[%1] %2 vs. [%3] %4") + .arg(leftEntry.typeInfo, leftEntry.fileName, rightEntry.typeInfo, rightEntry.fileName); + } + } + m_entriesComboBox->addItem(itemText); + m_entriesComboBox->setItemData(m_entriesComboBox->count() - 1, itemToolTip, Qt::ToolTipRole); + } + updateEntryToolTip(); + m_editorWidget->setDiff(diffFileList, workingDirectory); +} + +void DiffEditor::clear(const QString &message) +{ + m_entriesComboBox->clear(); + updateEntryToolTip(); + m_editorWidget->clear(message); +} + +void DiffEditor::updateEntryToolTip() +{ + const QString &toolTip = m_entriesComboBox->itemData( + m_entriesComboBox->currentIndex(), Qt::ToolTipRole).toString(); + m_entriesComboBox->setToolTip(toolTip); +} + +void DiffEditor::entryActivated(int index) +{ + updateEntryToolTip(); + m_editorWidget->navigateToDiffFile(index); +} + +void DiffEditor::activateEntry(int index) +{ + m_entriesComboBox->blockSignals(true); + m_entriesComboBox->setCurrentIndex(index); + m_entriesComboBox->blockSignals(false); + updateEntryToolTip(); +} + +} // namespace DiffEditor diff --git a/src/plugins/diffeditor/diffeditor.h b/src/plugins/diffeditor/diffeditor.h new file mode 100644 index 0000000000..498a909065 --- /dev/null +++ b/src/plugins/diffeditor/diffeditor.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef DIFFEDITOREDITABLE_H +#define DIFFEDITOREDITABLE_H + +#include "diffeditor_global.h" +#include "diffeditorwidget.h" + +#include +#include + +QT_BEGIN_NAMESPACE +class QToolBar; +class QComboBox; +QT_END_NAMESPACE + +namespace DiffEditor { + +namespace Internal { +class DiffEditorFile; +} + +class DIFFEDITOR_EXPORT DiffEditor : public Core::IEditor +{ + Q_OBJECT +public: + explicit DiffEditor(DiffEditorWidget *editorWidget); + virtual ~DiffEditor(); + +public: + void setDiff(const QList &diffFileList, + const QString &workingDirectory = QString()); + void clear(const QString &message); + + // Core::IEditor + bool createNew(const QString &contents); + bool open(QString *errorString, const QString &fileName, const QString &realFileName); + Core::IDocument *document(); + QString displayName() const; + void setDisplayName(const QString &title); + Core::Id id() const; + bool isTemporary() const { return true; } + DiffEditorWidget *editorWidget() const { return m_editorWidget; } + + QWidget *toolBar(); + +public slots: + void activateEntry(int index); + +private slots: + void entryActivated(int index); + +private: + void updateEntryToolTip(); + + Internal::DiffEditorFile *m_file; + DiffEditorWidget *m_editorWidget; + QToolBar *m_toolWidget; + QComboBox *m_entriesComboBox; + mutable QString m_displayName; +}; + +} // namespace DiffEditor + +#endif // DIFFEDITOREDITABLE_H diff --git a/src/plugins/diffeditor/diffeditor.pro b/src/plugins/diffeditor/diffeditor.pro index 2d6b13fc23..0976171af7 100644 --- a/src/plugins/diffeditor/diffeditor.pro +++ b/src/plugins/diffeditor/diffeditor.pro @@ -3,13 +3,13 @@ include(../../qtcreatorplugin.pri) HEADERS += diffeditor_global.h \ diffeditorconstants.h \ - diffeditoreditable.h \ + diffeditor.h \ diffeditorfile.h \ diffeditorplugin.h \ diffeditorwidget.h \ differ.h -SOURCES += diffeditoreditable.cpp \ +SOURCES += diffeditor.cpp \ diffeditorfile.cpp \ diffeditorplugin.cpp \ diffeditorwidget.cpp \ diff --git a/src/plugins/diffeditor/diffeditoreditable.cpp b/src/plugins/diffeditor/diffeditoreditable.cpp deleted file mode 100644 index 2c348e96b3..0000000000 --- a/src/plugins/diffeditor/diffeditoreditable.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "diffeditoreditable.h" -#include "diffeditorfile.h" -#include "diffeditorwidget.h" -#include "diffeditorconstants.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace DiffEditor { - -///////////////////////////////// DiffEditorEditable ////////////////////////////////// - -DiffEditorEditable::DiffEditorEditable(DiffEditorWidget *editorWidget) - : IEditor(0), - m_file(new Internal::DiffEditorFile(QLatin1String(Constants::DIFF_EDITOR_MIMETYPE), this)), - m_editorWidget(editorWidget), - m_toolWidget(0), - m_entriesComboBox(0) -{ - setWidget(editorWidget); - connect(m_editorWidget, SIGNAL(navigatedToDiffFile(int)), - this, SLOT(activateEntry(int))); -} - -DiffEditorEditable::~DiffEditorEditable() -{ - delete m_toolWidget; - if (m_widget) - delete m_widget; -} - -bool DiffEditorEditable::createNew(const QString &contents) -{ - Q_UNUSED(contents) - return true; -} - -bool DiffEditorEditable::open(QString *errorString, const QString &fileName, const QString &realFileName) -{ - Q_UNUSED(errorString) - Q_UNUSED(fileName) - Q_UNUSED(realFileName) - return true; -} - -Core::IDocument *DiffEditorEditable::document() -{ - return m_file; -} - -QString DiffEditorEditable::displayName() const -{ - if (m_displayName.isEmpty()) - m_displayName = QCoreApplication::translate("DiffEditor", Constants::DIFF_EDITOR_DISPLAY_NAME); - return m_displayName; -} - -void DiffEditorEditable::setDisplayName(const QString &title) -{ - m_displayName = title; - emit changed(); -} - -Core::Id DiffEditorEditable::id() const -{ - return Constants::DIFF_EDITOR_ID; -} - -static QToolBar *createToolBar(const QWidget *someWidget) -{ - // Create - QToolBar *toolBar = new QToolBar; - toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - const int size = someWidget->style()->pixelMetric(QStyle::PM_SmallIconSize); - toolBar->setIconSize(QSize(size, size)); - - return toolBar; -} - -QWidget *DiffEditorEditable::toolBar() -{ - if (m_toolWidget) - return m_toolWidget; - - // Create - m_toolWidget = createToolBar(m_editorWidget); - - m_entriesComboBox = new QComboBox; - m_entriesComboBox->setMinimumContentsLength(20); - // Make the combo box prefer to expand - QSizePolicy policy = m_entriesComboBox->sizePolicy(); - policy.setHorizontalPolicy(QSizePolicy::Expanding); - m_entriesComboBox->setSizePolicy(policy); - connect(m_entriesComboBox, SIGNAL(activated(int)), - this, SLOT(entryActivated(int))); - m_toolWidget->addWidget(m_entriesComboBox); - - QToolButton *whitespaceButton = new QToolButton(m_toolWidget); - whitespaceButton->setText(tr("Ignore Whitespace")); - whitespaceButton->setCheckable(true); - whitespaceButton->setChecked(true); - connect(whitespaceButton, SIGNAL(clicked(bool)), - m_editorWidget, SLOT(setIgnoreWhitespaces(bool))); - m_toolWidget->addWidget(whitespaceButton); - - QLabel *contextLabel = new QLabel(m_toolWidget); - contextLabel->setText(tr("Context Lines:")); - contextLabel->setMargin(6); - m_toolWidget->addWidget(contextLabel); - - QSpinBox *contextSpinBox = new QSpinBox(m_toolWidget); - contextSpinBox->setRange(-1, 100); - contextSpinBox->setValue(3); - contextSpinBox->setFrame(false); - connect(contextSpinBox, SIGNAL(valueChanged(int)), - m_editorWidget, SLOT(setContextLinesNumber(int))); - m_toolWidget->addWidget(contextSpinBox); - - return m_toolWidget; -} - -void DiffEditorEditable::setDiff(const QList &diffFileList, - const QString &workingDirectory) -{ - m_entriesComboBox->clear(); - const int count = diffFileList.count(); - for (int i = 0; i < count; i++) { - const DiffEditorWidget::DiffFileInfo leftEntry = diffFileList.at(i).leftFileInfo; - const DiffEditorWidget::DiffFileInfo rightEntry = diffFileList.at(i).rightFileInfo; - const QString leftShortFileName = QFileInfo(leftEntry.fileName).fileName(); - const QString rightShortFileName = QFileInfo(rightEntry.fileName).fileName(); - QString itemText; - QString itemToolTip; - if (leftEntry.fileName == rightEntry.fileName) { - itemText = leftShortFileName; - - if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) { - itemToolTip = leftEntry.fileName; - } else { - itemToolTip = tr("[%1] vs. [%2] %3") - .arg(leftEntry.typeInfo, rightEntry.typeInfo, leftEntry.fileName); - } - } else { - if (leftShortFileName == rightShortFileName) { - itemText = leftShortFileName; - } else { - itemText = tr("%1 vs. %2") - .arg(leftShortFileName, rightShortFileName); - } - - if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) { - itemToolTip = tr("%1 vs. %2") - .arg(leftEntry.fileName, rightEntry.fileName); - } else { - itemToolTip = tr("[%1] %2 vs. [%3] %4") - .arg(leftEntry.typeInfo, leftEntry.fileName, rightEntry.typeInfo, rightEntry.fileName); - } - } - m_entriesComboBox->addItem(itemText); - m_entriesComboBox->setItemData(m_entriesComboBox->count() - 1, itemToolTip, Qt::ToolTipRole); - } - updateEntryToolTip(); - m_editorWidget->setDiff(diffFileList, workingDirectory); -} - -void DiffEditorEditable::clear(const QString &message) -{ - m_entriesComboBox->clear(); - updateEntryToolTip(); - m_editorWidget->clear(message); -} - -void DiffEditorEditable::updateEntryToolTip() -{ - const QString &toolTip = m_entriesComboBox->itemData( - m_entriesComboBox->currentIndex(), Qt::ToolTipRole).toString(); - m_entriesComboBox->setToolTip(toolTip); -} - -void DiffEditorEditable::entryActivated(int index) -{ - updateEntryToolTip(); - m_editorWidget->navigateToDiffFile(index); -} - -void DiffEditorEditable::activateEntry(int index) -{ - m_entriesComboBox->blockSignals(true); - m_entriesComboBox->setCurrentIndex(index); - m_entriesComboBox->blockSignals(false); - updateEntryToolTip(); -} - -} // namespace DiffEditor diff --git a/src/plugins/diffeditor/diffeditoreditable.h b/src/plugins/diffeditor/diffeditoreditable.h deleted file mode 100644 index 8a0aff264e..0000000000 --- a/src/plugins/diffeditor/diffeditoreditable.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef DIFFEDITOREDITABLE_H -#define DIFFEDITOREDITABLE_H - -#include "diffeditor_global.h" -#include "diffeditorwidget.h" - -#include -#include - -QT_BEGIN_NAMESPACE -class QToolBar; -class QComboBox; -QT_END_NAMESPACE - -namespace DiffEditor { - -namespace Internal { -class DiffEditorFile; -} - -class DIFFEDITOR_EXPORT DiffEditorEditable : public Core::IEditor -{ - Q_OBJECT -public: - explicit DiffEditorEditable(DiffEditorWidget *editorWidget); - virtual ~DiffEditorEditable(); - -public: - void setDiff(const QList &diffFileList, - const QString &workingDirectory = QString()); - void clear(const QString &message); - - // Core::IEditor - bool createNew(const QString &contents); - bool open(QString *errorString, const QString &fileName, const QString &realFileName); - Core::IDocument *document(); - QString displayName() const; - void setDisplayName(const QString &title); - Core::Id id() const; - bool isTemporary() const { return true; } - DiffEditorWidget *editorWidget() const { return m_editorWidget; } - - QWidget *toolBar(); - -public slots: - void activateEntry(int index); - -private slots: - void entryActivated(int index); - -private: - void updateEntryToolTip(); - - Internal::DiffEditorFile *m_file; - DiffEditorWidget *m_editorWidget; - QToolBar *m_toolWidget; - QComboBox *m_entriesComboBox; - mutable QString m_displayName; -}; - -} // namespace DiffEditor - -#endif // DIFFEDITOREDITABLE_H diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index 2fe3618574..7df9f4bb4d 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -28,7 +28,7 @@ ****************************************************************************/ #include "diffeditorplugin.h" -#include "diffeditoreditable.h" +#include "diffeditor.h" #include "diffeditorwidget.h" #include "diffeditorconstants.h" @@ -67,7 +67,7 @@ QString DiffEditorFactory::displayName() const Core::IEditor *DiffEditorFactory::createEditor(QWidget *parent) { DiffEditorWidget *editorWidget = new DiffEditorWidget(parent); - DiffEditorEditable *editor = new DiffEditorEditable(editorWidget); + DiffEditor *editor = new DiffEditor(editorWidget); return editor; } @@ -136,15 +136,15 @@ void DiffEditorPlugin::diff() const Core::Id editorId = Constants::DIFF_EDITOR_ID; //: Editor title QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1).arg(fileName2); - DiffEditorEditable *editorEditable = qobject_cast + DiffEditor *editor = qobject_cast (Core::EditorManager::openEditorWithContents(editorId, &title, QString())); - if (!editorEditable) + if (!editor) return; - Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); - DiffEditorWidget *editorWidget = editorEditable->editorWidget(); + DiffEditorWidget *editorWidget = editor->editorWidget(); const QString text1 = getFileContents(fileName1, editorWidget->codec()); const QString text2 = getFileContents(fileName2, editorWidget->codec()); @@ -157,7 +157,7 @@ void DiffEditorPlugin::diff() QList list; list.append(dfc); - editorEditable->setDiff(list); + editor->setDiff(list); } QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index a9d42f0247..d460e70e29 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -56,8 +56,7 @@ #include #include -#include -#include +#include #include #include @@ -108,7 +107,7 @@ public: } }; - GitDiffHandler(DiffEditor::DiffEditorEditable *editor, + GitDiffHandler(DiffEditor::DiffEditor *editor, const QString &gitPath, const QString &workingDirectory, const QProcessEnvironment &environment, @@ -139,7 +138,7 @@ private: void feedEditor(); QString workingTreeContents(const QString &fileName) const; - QPointer m_editor; + QPointer m_editor; const QString m_gitPath; const QString m_workingDirectory; const QProcessEnvironment m_processEnvironment; @@ -170,7 +169,7 @@ inline bool operator<(const GitDiffHandler::Revision &rev1, const GitDiffHandler return rev1.id < rev2.id; } -GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditorEditable *editor, +GitDiffHandler::GitDiffHandler(DiffEditor::DiffEditor *editor, const QString &gitPath, const QString &workingDirectory, const QProcessEnvironment &environment, @@ -823,7 +822,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis return rc; } -DiffEditor::DiffEditorEditable *GitClient::findExistingDiffEditor(const char *registerDynamicProperty, +DiffEditor::DiffEditor *GitClient::findExistingDiffEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const { Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue); @@ -834,7 +833,7 @@ DiffEditor::DiffEditorEditable *GitClient::findExistingDiffEditor(const char *re Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); outputEditor->createNew(m_msgWait); - return qobject_cast(outputEditor); + return qobject_cast(outputEditor); } /* Create an editor associated to VCS output of a source file/directory @@ -889,10 +888,10 @@ void GitClient::diff(const QString &workingDirectory, const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; QString title = tr("Git Diff"); - DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("originalFileName", workingDirectory); + DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("originalFileName", workingDirectory); if (!editorEditable) { - editorEditable = qobject_cast( + editorEditable = qobject_cast( Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); editorEditable->document()->setProperty("originalFileName", workingDirectory); Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block @@ -977,9 +976,9 @@ void GitClient::diff(const QString &workingDirectory, QString title = tr("Git Diff \"%1\"").arg(fileName); const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName); - DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("originalFileName", sourceFile); + DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("originalFileName", sourceFile); if (!editorEditable) { - editorEditable = qobject_cast( + editorEditable = qobject_cast( Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); editorEditable->document()->setProperty("originalFileName", sourceFile); Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); @@ -1026,9 +1025,9 @@ void GitClient::diffBranch(const QString &workingDirectory, const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; QString title = tr("Git Diff Branch \"%1\"").arg(branchName); - DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("BranchName", branchName); + DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("BranchName", branchName); if (!editorEditable) { - editorEditable = qobject_cast( + editorEditable = qobject_cast( Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); editorEditable->document()->setProperty("BranchName", branchName); Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); @@ -1143,10 +1142,10 @@ void GitClient::show(const QString &source, const QString &id, if (settings()->boolValue(GitSettings::useDiffEditorKey)) { const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; - DiffEditor::DiffEditorEditable *editorEditable = findExistingDiffEditor("show", id); + DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("show", id); if (!editorEditable) { - editorEditable = qobject_cast( + editorEditable = qobject_cast( Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); editorEditable->document()->setProperty("show", id); Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 02fb6f1675..024ed60028 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -61,7 +61,7 @@ namespace Utils { } namespace DiffEditor { - class DiffEditorEditable; + class DiffEditor; } namespace Git { @@ -335,7 +335,7 @@ private: QTextCodec *getSourceCodec(const QString &file) const; VcsBase::VcsBaseEditorWidget *findExistingVCSEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const; - DiffEditor::DiffEditorEditable *findExistingDiffEditor(const char *registerDynamicProperty, + DiffEditor::DiffEditor *findExistingDiffEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const; enum CodecType { CodecSource, CodecLogOutput, CodecNone }; -- cgit v1.2.1 From bde5c5c2c6bdc7cbfc846e1cc671d41328e21f34 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 3 Jun 2013 22:46:39 +0300 Subject: QtLocalPeer: Remove superfluous static member Change-Id: Ib78b8459e742df6d57a52a4f3ebcd3359d8497b1 Reviewed-by: hjk --- src/shared/qtsingleapplication/qtlocalpeer.cpp | 2 +- src/shared/qtsingleapplication/qtlocalpeer.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/shared/qtsingleapplication/qtlocalpeer.cpp b/src/shared/qtsingleapplication/qtlocalpeer.cpp index c1c68938af..07cfc74ed0 100644 --- a/src/shared/qtsingleapplication/qtlocalpeer.cpp +++ b/src/shared/qtsingleapplication/qtlocalpeer.cpp @@ -46,7 +46,7 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0; namespace SharedTools { -const char *QtLocalPeer::ack = "ack"; +static const char ack[] = "ack"; QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId) : QObject(parent), id(appId) diff --git a/src/shared/qtsingleapplication/qtlocalpeer.h b/src/shared/qtsingleapplication/qtlocalpeer.h index e721a05de9..fad6501790 100644 --- a/src/shared/qtsingleapplication/qtlocalpeer.h +++ b/src/shared/qtsingleapplication/qtlocalpeer.h @@ -57,9 +57,6 @@ protected: QString socketName; QLocalServer* server; QtLockedFile lockFile; - -private: - static const char* ack; }; } // namespace SharedTools -- cgit v1.2.1 From c7ea186df9e682a8cd113b927dea1340a4c478b6 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 3 Jun 2013 13:09:40 +0200 Subject: Debugger: Always check for availability of python with GDB Trying to avoid that round-trip on versions that are known to not have it puts us on the mercy of detecting the version, which is unreliable by nature, and bad in practice, as proven by the recent MinGW builds. Change-Id: I122eb03fe0ddcb193ed8d45e672564f7113b662f Reviewed-by: Ray Donnelly Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index bdacb76708..0b007674bc 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1827,14 +1827,7 @@ void GdbEngine::handleShowVersion(const GdbResponse &response) postCommand("set detach-on-fork off", ConsoleCommand); //postCommand("set build-id-verbose 2", ConsoleCommand); - - if (m_gdbVersion > 70100) { - // Quick check whether we have python. - postCommand("python print 43", ConsoleCommand, CB(handleHasPython)); - } else { - showMessage(_("NOTE: CHECK FOR PYTHON SUPPRESSED, VERSION TOO LOW")); - pythonDumpersFailed(); - } + postCommand("python print 43", ConsoleCommand, CB(handleHasPython)); } } -- cgit v1.2.1 From 199c13153c3d4cf62fe1bdbdec9000a585e78594 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 3 Jun 2013 12:32:14 +0200 Subject: Bookmarks: Separate destructive actions. Destructive actions should be separated by separator in menus to avoid mis-clicks, we also did that for e.g. the Build menu. Change-Id: I9dfecefb487d953a1c57ffa41c76a1542dee16c2 Reviewed-by: David Schulz --- src/plugins/bookmarks/bookmarkmanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index dd8929014d..c4a7d4ca64 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -237,9 +237,11 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event) QMenu menu; QAction *moveUp = menu.addAction(tr("Move Up")); QAction *moveDown = menu.addAction(tr("Move Down")); + QAction *editNote = menu.addAction(tr("Edit Note")); + menu.addSeparator(); QAction *remove = menu.addAction(tr("&Remove")); + menu.addSeparator(); QAction *removeAll = menu.addAction(tr("Remove All")); - QAction *editNote = menu.addAction(tr("Edit Note")); m_contextMenuIndex = indexAt(event->pos()); if (!m_contextMenuIndex.isValid()) { -- cgit v1.2.1 From 3a5597ec0001b8b1068b9d74d0c9f14034bf7315 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 30 May 2013 15:30:03 +0200 Subject: QmlDesigner: There is no textColor property in the Button Change-Id: Ic45416d1ad187520dc4771192e621d7e44ee360f Reviewed-by: Thomas Hartmann --- .../qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml index 95101e3599..00c8eaba43 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml @@ -130,12 +130,6 @@ QWidget { } } - ColorGroupBox { - caption: qsTr("Text color") - finished: finishedNotify - backendColor: backendValues.textColor - } - QWidget { layout: HorizontalLayout { Label { -- cgit v1.2.1 From d96535bd234064a3d3009b41a2c7aa85e128555b Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 3 Jun 2013 18:53:44 +0200 Subject: VCS: Clear directory cache when availability of VCSes changes We could have gotten new VCSes or existing ones might have gone, so clear the cache of which VCS manages which directory. Change-Id: I87a1b9c894e2867773ea4df221e463adb14f4ee9 Reviewed-by: Petar Perisin Reviewed-by: Orgad Shaneh --- src/plugins/coreplugin/vcsmanager.cpp | 13 +++++++++++++ src/plugins/coreplugin/vcsmanager.h | 3 +++ src/plugins/vcsbase/vcsbaseplugin.cpp | 3 +++ 3 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index f4839a1dc2..ce8cef68e5 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -106,6 +106,11 @@ public: return result; } + void clearCache() + { + m_cachedMatches.clear(); + } + void resetCache(const QString &dir) { QTC_ASSERT(QDir(dir).isAbsolute(), return); @@ -381,4 +386,12 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa } } +void VcsManager::clearVersionControlCache() +{ + QStringList repoList = d->m_cachedMatches.keys(); + d->clearCache(); + foreach (const QString &repo, repoList) + emit repositoryChanged(repo); +} + } // namespace Core diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h index 103ecb8f09..e8f43623a5 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -95,6 +95,9 @@ public: signals: void repositoryChanged(const QString &repository); +public slots: + void clearVersionControlCache(); + private: VcsManagerPrivate *d; }; diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 7193f0deff..c56f846928 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -549,6 +549,9 @@ void VcsBasePlugin::initializeVcs(Core::IVersionControl *vc) SIGNAL(stateChanged(VcsBase::Internal::State,Core::IVersionControl*)), this, SLOT(slotStateChanged(VcsBase::Internal::State,Core::IVersionControl*))); + // VCSes might have become (un-)available, so clear the VCS directory cache + connect(vc, SIGNAL(configurationChanged()), + Core::ICore::vcsManager(), SLOT(clearVersionControlCache())); } void VcsBasePlugin::extensionsInitialized() -- cgit v1.2.1 From 92392454b74b5f79af5095e4f5725f0d4f57e6f1 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 3 Jun 2013 14:44:36 +0300 Subject: Git: Do not pop stash if a command is in progress Running interactive rebase and choosing edit for a commit causes stash pop when the commit is expected to be edited Change-Id: I37249e8486b609dedba143bd130059444f882303 Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index d460e70e29..aebcb0ebe5 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -648,12 +648,13 @@ public: ~ConflictHandler() { + GitClient *client = GitPlugin::instance()->gitClient(); if (m_commit.isEmpty()) { GitPlugin::instance()->gitVersionControl()->emitRepositoryChanged(m_workingDirectory); - GitPlugin::instance()->gitClient()->endStashScope(m_workingDirectory); + if (client->checkCommandInProgress(m_workingDirectory) != GitClient::NoCommand) + client->endStashScope(m_workingDirectory); } else { - GitPlugin::instance()->gitClient()->handleMergeConflicts( - m_workingDirectory, m_commit, m_command); + client->handleMergeConflicts(m_workingDirectory, m_commit, m_command); } } -- cgit v1.2.1 From 1f447715b032c8d23d5c67a9a6514409f9fcbe4a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 2 Jun 2013 19:43:15 +0300 Subject: Git: Remove double warning for gerrit push Change-Id: I5581521753fa525c6bb9f53725c28f947c8bbd44 Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gerrit/gerritplugin.cpp | 5 +---- src/plugins/git/gerrit/gerritpushdialog.cpp | 29 +++++++++++------------------ src/plugins/git/logchangedialog.cpp | 10 ++++++++++ src/plugins/git/logchangedialog.h | 1 + 4 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index c05af4310c..21ac311c76 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -312,11 +312,8 @@ void GerritPlugin::push() // QScopedPointer is required to delete the dialog when leaving the function GerritPushDialog dialog(topLevel, m_reviewers, Core::ICore::mainWindow()); - if (!dialog.localChangesFound()) { - QMessageBox::warning(Core::ICore::mainWindow(), tr("No Local Changes"), - tr("Change from HEAD appears to be in remote branch already. Aborting.")); + if (!dialog.localChangesFound()) return; - } if (!dialog.valid()) { QMessageBox::warning(Core::ICore::mainWindow(), tr("Initialization Failed"), diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp index c5c52b602f..9dc42192db 100644 --- a/src/plugins/git/gerrit/gerritpushdialog.cpp +++ b/src/plugins/git/gerrit/gerritpushdialog.cpp @@ -50,28 +50,21 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev m_ui->repositoryLabel->setText(tr("Local repository: %1").arg( QDir::toNativeSeparators(workingDir))); - m_ui->commitView->init(workingDir, QString(), false); - Git::Internal::GitClient *gitClient = Git::Internal::GitPlugin::instance()->gitClient(); - QString output; - QString error; - QStringList args; - - args << QLatin1String("--no-color") << QLatin1String("--format=%P") - << QLatin1String("HEAD") << QLatin1String("--not")<< QLatin1String("--remotes"); - - if (!gitClient->synchronousLog(m_workingDir, args, &output) || output.isEmpty()) + if (!m_ui->commitView->init(workingDir, QString(), false)) return; - output.chop(1); - if (output.isEmpty()) { + QString earliestCommit = m_ui->commitView->earliestCommit(); + if (earliestCommit.isEmpty()) return; - } else { - output = output.mid(output.lastIndexOf(QLatin1Char('\n')) + 1); - m_localChangesFound = true; - } - args.clear(); - args << QLatin1String("--remotes") << QLatin1String("--contains") << output; + m_localChangesFound = true; + + Git::Internal::GitClient *gitClient = Git::Internal::GitPlugin::instance()->gitClient(); + QString output; + QString error; + QStringList args; + args << QLatin1String("--remotes") << QLatin1String("--contains") + << earliestCommit + QLatin1Char('^'); if (!gitClient->synchronousBranchCmd(m_workingDir, args, &output, &error)) return; diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp index 4f11be1d11..bb8f444c9e 100644 --- a/src/plugins/git/logchangedialog.cpp +++ b/src/plugins/git/logchangedialog.cpp @@ -96,6 +96,16 @@ int LogChangeWidget::commitIndex() const return -1; } +QString LogChangeWidget::earliestCommit() const +{ + int rows = m_model->rowCount(); + if (rows) { + if (const QStandardItem *item = m_model->item(rows - 1, Sha1Column)) + return item->text(); + } + return QString(); +} + void LogChangeWidget::emitDoubleClicked(const QModelIndex &index) { if (index.isValid()) { diff --git a/src/plugins/git/logchangedialog.h b/src/plugins/git/logchangedialog.h index 4e298519ac..a4790701b4 100644 --- a/src/plugins/git/logchangedialog.h +++ b/src/plugins/git/logchangedialog.h @@ -56,6 +56,7 @@ public: bool includeRemote = true); QString commit() const; int commitIndex() const; + QString earliestCommit() const; signals: void doubleClicked(const QString &commit); -- cgit v1.2.1 From 26142b849bee4e3f8913ad1eeee1eafd97076eeb Mon Sep 17 00:00:00 2001 From: jkobus Date: Mon, 3 Jun 2013 15:17:34 +0200 Subject: DiffEditor: Apply visualize whitespaces according to options Change-Id: I5f7c57479d5342f5457159b14fb6afa087cb988f Reviewed-by: Marcel Krems Reviewed-by: Tobias Hunger --- src/plugins/diffeditor/diffeditorwidget.cpp | 31 ++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/diffeditor/diffeditorwidget.cpp b/src/plugins/diffeditor/diffeditorwidget.cpp index c2579fdec8..0214142790 100644 --- a/src/plugins/diffeditor/diffeditorwidget.cpp +++ b/src/plugins/diffeditor/diffeditorwidget.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -138,6 +139,9 @@ public: void clearAllData(); QTextBlock firstVisibleBlock() const { return SnippetEditorWidget::firstVisibleBlock(); } +public slots: + void setDisplaySettings(const DisplaySettings &ds); + protected: virtual int extraAreaWidth(int *markWidthPtr = 0) const { return BaseTextEditorWidget::extraAreaWidth(markWidthPtr); } BaseTextEditor *createEditor() { return new DiffViewEditorEditable(this); } @@ -174,11 +178,26 @@ private: DiffViewEditorWidget::DiffViewEditorWidget(QWidget *parent) : SnippetEditorWidget(parent), m_lineNumberDigits(1), m_inPaintEvent(false) { - setLineNumbersVisible(true); + DisplaySettings settings = displaySettings(); + settings.m_textWrapping = false; + settings.m_displayLineNumbers = true; + settings.m_highlightCurrentLine = false; + settings.m_displayFoldingMarkers = true; + settings.m_markTextChanges = false; + settings.m_highlightBlocks = false; + SnippetEditorWidget::setDisplaySettings(settings); + setCodeFoldingSupported(true); setFrameStyle(QFrame::NoFrame); } +void DiffViewEditorWidget::setDisplaySettings(const DisplaySettings &ds) +{ + DisplaySettings settings = displaySettings(); + settings.m_visualizeWhitespace = ds.m_visualizeWhitespace; + SnippetEditorWidget::setDisplaySettings(settings); +} + QString DiffViewEditorWidget::lineNumber(int blockNumber) const { if (m_lineNumbers.contains(blockNumber)) @@ -526,21 +545,23 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent) m_leftEditor = new DiffViewEditorWidget(this); m_leftEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_leftEditor->setReadOnly(true); - m_leftEditor->setHighlightCurrentLine(false); - m_leftEditor->setWordWrapMode(QTextOption::NoWrap); connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), m_leftEditor, SLOT(setFontSettings(TextEditor::FontSettings))); m_leftEditor->setFontSettings(settings->fontSettings()); + connect(settings, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), + m_leftEditor, SLOT(setDisplaySettings(TextEditor::DisplaySettings))); + m_leftEditor->setDisplaySettings(settings->displaySettings()); m_leftEditor->setCodeStyle(settings->codeStyle()); m_rightEditor = new DiffViewEditorWidget(this); m_rightEditor->setCornerWidget(toggleSync); m_rightEditor->setReadOnly(true); - m_rightEditor->setHighlightCurrentLine(false); - m_rightEditor->setWordWrapMode(QTextOption::NoWrap); connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), m_rightEditor, SLOT(setFontSettings(TextEditor::FontSettings))); m_rightEditor->setFontSettings(settings->fontSettings()); + connect(settings, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), + m_rightEditor, SLOT(setDisplaySettings(TextEditor::DisplaySettings))); + m_rightEditor->setDisplaySettings(settings->displaySettings()); m_rightEditor->setCodeStyle(settings->codeStyle()); connect(m_leftEditor->verticalScrollBar(), SIGNAL(valueChanged(int)), -- cgit v1.2.1 From 80a7107691643f5df121e383efb1f1975b64c744 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Mon, 3 Jun 2013 23:12:17 +0200 Subject: Git - execute fetch asynchronously Change-Id: Ic2243adaa36444099f834676186331927f3f4588 Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 9 +++------ src/plugins/git/gitclient.h | 2 +- src/plugins/git/gitplugin.cpp | 2 +- src/plugins/git/remotedialog.cpp | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index aebcb0ebe5..ecd0e71f4f 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2839,16 +2839,13 @@ void GitClient::revert(const QStringList &files, bool revertStaging) } } -bool GitClient::synchronousFetch(const QString &workingDirectory, const QString &remote) +void GitClient::fetch(const QString &workingDirectory, const QString &remote) { QStringList arguments(QLatin1String("fetch")); arguments << (remote.isEmpty() ? QLatin1String("--all") : remote); - // Disable UNIX terminals to suppress SSH prompting. - const unsigned flags = VcsBase::VcsBasePlugin::SshPasswordPrompt|VcsBase::VcsBasePlugin::ShowStdOutInLogWindow - |VcsBase::VcsBasePlugin::ShowSuccessMessage; - const Utils::SynchronousProcessResponse resp = synchronousGit(workingDirectory, arguments, flags); - return resp.result == Utils::SynchronousProcessResponse::Finished; + VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } bool GitClient::executeAndHandleConflicts(const QString &workingDirectory, diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 024ed60028..ef0c1ec31a 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -238,7 +238,7 @@ public: bool cloneRepository(const QString &directory, const QByteArray &url); QString vcsGetRepositoryURL(const QString &directory); - bool synchronousFetch(const QString &workingDirectory, const QString &remote); + void fetch(const QString &workingDirectory, const QString &remote); bool synchronousPull(const QString &workingDirectory, bool rebase); bool synchronousPush(const QString &workingDirectory, const QStringList &pushArgs = QStringList()); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 215e9e67d1..3384d7f411 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1075,7 +1075,7 @@ bool GitPlugin::submitEditorAboutToClose() void GitPlugin::fetch() { - m_gitClient->synchronousFetch(currentState().topLevel(), QString()); + m_gitClient->fetch(currentState().topLevel(), QString()); } void GitPlugin::pull() diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp index a027d62bf2..37ebd29421 100644 --- a/src/plugins/git/remotedialog.cpp +++ b/src/plugins/git/remotedialog.cpp @@ -184,7 +184,7 @@ void RemoteDialog::fetchFromRemote() int row = indexList.at(0).row(); const QString remoteName = m_remoteModel->remoteName(row); - m_remoteModel->client()->synchronousFetch(m_remoteModel->workingDirectory(), remoteName); + m_remoteModel->client()->fetch(m_remoteModel->workingDirectory(), remoteName); } void RemoteDialog::updateButtonState() -- cgit v1.2.1 From dd7c2e622e5452d369eb8b0feec9e61df2ac18c5 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Mon, 3 Jun 2013 23:16:49 +0200 Subject: Git - refactor executeGit and remove unnecessary args Change-Id: Idf770a20db66191b4d7fe3a704d31bdce70505c5 Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 10 ++++------ src/plugins/git/gitclient.h | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index ecd0e71f4f..c647d81f61 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1245,7 +1245,7 @@ void GitClient::blame(const QString &workingDirectory, arguments << QLatin1String("--") << fileName; if (!revision.isEmpty()) arguments << revision; - executeGit(workingDirectory, arguments, editor, false, VcsBase::Command::NoReport, lineNumber); + executeGit(workingDirectory, arguments, editor, false, lineNumber); } bool GitClient::synchronousCheckout(const QString &workingDirectory, @@ -2130,15 +2130,13 @@ VcsBase::Command *GitClient::executeGit(const QString &workingDirectory, const QStringList &arguments, VcsBase::VcsBaseEditorWidget* editor, bool useOutputToWindow, - VcsBase::Command::TerminationReportMode tm, - int editorLineNumber, - bool unixTerminalDisabled) + int editorLineNumber) { outputWindow()->appendCommand(workingDirectory, settings()->stringValue(GitSettings::binaryPathKey), arguments); VcsBase::Command *command = createCommand(workingDirectory, editor, useOutputToWindow, editorLineNumber); command->addJob(arguments, settings()->intValue(GitSettings::timeoutKey)); - command->setTerminationReportMode(tm); - command->setUnixTerminalDisabled(unixTerminalDisabled); + command->setTerminationReportMode(VcsBase::Command::NoReport); + command->setUnixTerminalDisabled(false); command->execute(); return command; } diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index ef0c1ec31a..79faf47c4b 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -356,9 +356,7 @@ private: const QStringList &arguments, VcsBase::VcsBaseEditorWidget* editor = 0, bool useOutputToWindow = false, - VcsBase::Command::TerminationReportMode tm = VcsBase::Command::NoReport, - int editorLineNumber = -1, - bool unixTerminalDisabled = false); + int editorLineNumber = -1); // Fully synchronous git execution (QProcess-based). bool fullySynchronousGit(const QString &workingDirectory, -- cgit v1.2.1 From 36bec480ae6ddc1ae0e545e91f21e76b06299a29 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Mon, 3 Jun 2013 23:24:58 +0200 Subject: Git - execute push asynchronously Change-Id: I0d5b0eaf562d30f34f01bcf344791a4ce766bdab Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- src/plugins/git/gerrit/gerritplugin.cpp | 2 +- src/plugins/git/gitclient.cpp | 11 ++++------- src/plugins/git/gitclient.h | 3 +-- src/plugins/git/gitplugin.cpp | 2 +- src/plugins/git/remotedialog.cpp | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 21ac311c76..7522604336 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -350,7 +350,7 @@ void GerritPlugin::push() target += QLatin1Char('/') + topic; args << target; - Git::Internal::GitPlugin::instance()->gitClient()->synchronousPush(topLevel, args); + Git::Internal::GitPlugin::instance()->gitClient()->push(topLevel, args); } // Open or raise the Gerrit dialog window. diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index c647d81f61..1fce5d4c25 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2981,17 +2981,14 @@ void GitClient::subversionLog(const QString &workingDirectory) executeGit(workingDirectory, arguments, editor); } -bool GitClient::synchronousPush(const QString &workingDirectory, const QStringList &pushArgs) +void GitClient::push(const QString &workingDirectory, const QStringList &pushArgs) { - // Disable UNIX terminals to suppress SSH prompting. - const unsigned flags = VcsBase::VcsBasePlugin::SshPasswordPrompt|VcsBase::VcsBasePlugin::ShowStdOutInLogWindow - |VcsBase::VcsBasePlugin::ShowSuccessMessage; QStringList arguments(QLatin1String("push")); if (!pushArgs.isEmpty()) arguments += pushArgs; - const Utils::SynchronousProcessResponse resp = - synchronousGit(workingDirectory, arguments, flags); - return resp.result == Utils::SynchronousProcessResponse::Finished; + + VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true); + connectRepositoryChanged(workingDirectory, cmd); } bool GitClient::synchronousMerge(const QString &workingDirectory, const QString &branch) diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 79faf47c4b..85e422a33f 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -240,8 +240,7 @@ public: QString vcsGetRepositoryURL(const QString &directory); void fetch(const QString &workingDirectory, const QString &remote); bool synchronousPull(const QString &workingDirectory, bool rebase); - bool synchronousPush(const QString &workingDirectory, - const QStringList &pushArgs = QStringList()); + void push(const QString &workingDirectory, const QStringList &pushArgs = QStringList()); bool synchronousMerge(const QString &workingDirectory, const QString &branch); bool canRebase(const QString &workingDirectory) const; bool synchronousRebase(const QString &workingDirectory, diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 3384d7f411..bbc5ef771b 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1103,7 +1103,7 @@ void GitPlugin::push() { const VcsBase::VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - m_gitClient->synchronousPush(state.topLevel()); + m_gitClient->push(state.topLevel()); } void GitPlugin::startMergeTool() diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp index 37ebd29421..d24bc2789c 100644 --- a/src/plugins/git/remotedialog.cpp +++ b/src/plugins/git/remotedialog.cpp @@ -172,7 +172,7 @@ void RemoteDialog::pushToRemote() const int row = indexList.at(0).row(); const QString remoteName = m_remoteModel->remoteName(row); - m_remoteModel->client()->synchronousPush(m_remoteModel->workingDirectory(), + m_remoteModel->client()->push(m_remoteModel->workingDirectory(), QStringList() << remoteName); } -- cgit v1.2.1 From aa0533c969841f530977e89ee96e351d6f1f25eb Mon Sep 17 00:00:00 2001 From: jkobus Date: Mon, 3 Jun 2013 12:32:07 +0200 Subject: Move "Sync Horiz Scroll Bars" corner widget to the toolbar Change-Id: Ie97ae07b02499b4d8d80e006aa77ca3b802f39b3 Reviewed-by: Eike Ziller --- src/plugins/diffeditor/diffeditor.cpp | 11 +++++++++++ src/plugins/diffeditor/diffeditorwidget.cpp | 12 +----------- src/plugins/diffeditor/diffeditorwidget.h | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp index eba1eeda3f..3c89434bc9 100644 --- a/src/plugins/diffeditor/diffeditor.cpp +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -33,6 +33,8 @@ #include "diffeditorconstants.h" #include +#include + #include #include #include @@ -153,6 +155,15 @@ QWidget *DiffEditor::toolBar() m_editorWidget, SLOT(setContextLinesNumber(int))); m_toolWidget->addWidget(contextSpinBox); + QToolButton *toggleSync = new QToolButton(m_toolWidget); + toggleSync->setIcon(QIcon(QLatin1String(Core::Constants::ICON_LINK))); + toggleSync->setCheckable(true); + toggleSync->setChecked(true); + toggleSync->setToolTip(tr("Synchronize Horizontal Scroll Bars")); + connect(toggleSync, SIGNAL(clicked(bool)), + m_editorWidget, SLOT(setHorizontalScrollBarSynchronization(bool))); + m_toolWidget->addWidget(toggleSync); + return m_toolWidget; } diff --git a/src/plugins/diffeditor/diffeditorwidget.cpp b/src/plugins/diffeditor/diffeditorwidget.cpp index 0214142790..31256f3f3a 100644 --- a/src/plugins/diffeditor/diffeditorwidget.cpp +++ b/src/plugins/diffeditor/diffeditorwidget.cpp @@ -533,15 +533,6 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent) { TextEditor::TextEditorSettings *settings = TextEditorSettings::instance(); - QToolButton *toggleSync = new QToolButton(); - toggleSync = new QToolButton; - toggleSync->setText(QLatin1String("S")); - toggleSync->setCheckable(true); - toggleSync->setChecked(m_syncScrollBars); - toggleSync->setToolTip(tr("Synchronize Horizontal Scroll Bars")); - toggleSync->setAutoRaise(true); - connect(toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleScrollBarSynchronization(bool))); - m_leftEditor = new DiffViewEditorWidget(this); m_leftEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_leftEditor->setReadOnly(true); @@ -554,7 +545,6 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent) m_leftEditor->setCodeStyle(settings->codeStyle()); m_rightEditor = new DiffViewEditorWidget(this); - m_rightEditor->setCornerWidget(toggleSync); m_rightEditor->setReadOnly(true); connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), m_rightEditor, SLOT(setFontSettings(TextEditor::FontSettings))); @@ -1423,7 +1413,7 @@ void DiffEditorWidget::rightDocumentSizeChanged() synchronizeFoldings(m_rightEditor, m_leftEditor); } -void DiffEditorWidget::toggleScrollBarSynchronization(bool on) +void DiffEditorWidget::setHorizontalScrollBarSynchronization(bool on) { m_syncScrollBars = on; } diff --git a/src/plugins/diffeditor/diffeditorwidget.h b/src/plugins/diffeditor/diffeditorwidget.h index a5057deab6..8e4973c7f6 100644 --- a/src/plugins/diffeditor/diffeditorwidget.h +++ b/src/plugins/diffeditor/diffeditorwidget.h @@ -86,6 +86,7 @@ public: public slots: void setContextLinesNumber(int lines); void setIgnoreWhitespaces(bool ignore); + void setHorizontalScrollBarSynchronization(bool on); void navigateToDiffFile(int diffFileIndex); signals: @@ -104,7 +105,6 @@ private slots: void rightCursorPositionChanged(); void leftDocumentSizeChanged(); void rightDocumentSizeChanged(); - void toggleScrollBarSynchronization(bool on); private: struct DiffList { -- cgit v1.2.1 From 897ea412c32a207bee16bc5a103b512d7c7c2880 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 4 Jun 2013 10:53:03 +0200 Subject: DiffEditor: Fix context lines spin box layout. Work around a regression in Qt 5 (QTBUG-31538) Also prefer setting left+right margins instead of all margins for the label. Change-Id: I108de101239145295d37002aa989a959d8041c55 Reviewed-by: Jarek Kobus --- src/plugins/diffeditor/diffeditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp index 3c89434bc9..381339e2f3 100644 --- a/src/plugins/diffeditor/diffeditor.cpp +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -144,13 +144,14 @@ QWidget *DiffEditor::toolBar() QLabel *contextLabel = new QLabel(m_toolWidget); contextLabel->setText(tr("Context Lines:")); - contextLabel->setMargin(6); + contextLabel->setContentsMargins(6, 0, 6, 0); m_toolWidget->addWidget(contextLabel); QSpinBox *contextSpinBox = new QSpinBox(m_toolWidget); contextSpinBox->setRange(-1, 100); contextSpinBox->setValue(3); contextSpinBox->setFrame(false); + contextSpinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); // Mac Qt5 connect(contextSpinBox, SIGNAL(valueChanged(int)), m_editorWidget, SLOT(setContextLinesNumber(int))); m_toolWidget->addWidget(contextSpinBox); -- cgit v1.2.1 From d97a7f4067c57154733646726c1969cc63588a50 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 4 Jun 2013 11:45:19 +0200 Subject: Android: Save MakeExtraSearchDirectory in settings This will keep the setting from vanishing after the first time creator is run. Change-Id: Ie3f99cfbe37fc5c242e5388a87edf3f0bdc08a30 Reviewed-by: Daniel Teske --- src/plugins/android/androidconfigurations.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index b0e6dedcf6..3b778896a9 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -206,6 +206,9 @@ void AndroidConfig::save(QSettings &settings) const settings.setValue(PartitionSizeKey, partitionSize); settings.setValue(AutomaticKitCreationKey, automaticKitCreation); settings.setValue(ToolchainHostKey, toolchainHost); + settings.setValue(MakeExtraSearchDirectory, + makeExtraSearchDirectories.isEmpty() ? QString() + : makeExtraSearchDirectories.at(0)); } void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs) -- cgit v1.2.1 From 25dd94808d0fee8ea3aa949d4d9ae17cac5ffd6c Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Mon, 3 Jun 2013 13:47:04 +0200 Subject: QmlProfiler: fix dangling pointer in Engine Task-number: QTCREATORBUG-9391 Change-Id: Ib2ea66bd5694046577a0b5a0e2f611f3ffba0238 Reviewed-by: Kai Koehne --- src/plugins/qmlprofiler/qmlprofilerengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 6914286dc6..f5800869f4 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -61,7 +61,7 @@ class QmlProfilerEngine::QmlProfilerEnginePrivate { public: QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {} - ~QmlProfilerEnginePrivate() { delete m_runner; } + ~QmlProfilerEnginePrivate() { m_runner->disconnect(); delete m_runner; } bool attach(const QString &address, uint port); static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration, @@ -153,6 +153,7 @@ bool QmlProfilerEngine::start() QTC_ASSERT(d->m_profilerState, return false); if (d->m_runner) { + d->m_runner->disconnect(); delete d->m_runner; d->m_runner = 0; } @@ -364,6 +365,7 @@ void QmlProfilerEngine::profilerStateChanged() // (a new one will be created at start) d->m_noDebugOutputTimer.stop(); if (d->m_runner) { + d->m_runner->disconnect(); delete d->m_runner; d->m_runner = 0; } -- cgit v1.2.1 From b0854e3c71803c8397f9bb48b8766c151b6e0edd Mon Sep 17 00:00:00 2001 From: Aurindam Jana Date: Fri, 24 May 2013 16:31:01 +0200 Subject: QmlConsole: Fix bug: Jump to location in editor Since the file path starts with file:/// use QUrl to get local file name. Task-number: QTCREATORBUG-9337 Change-Id: Icf591fdcab8cb626cfbf844c451a2c87c07b853a Reviewed-by: Kai Koehne --- src/plugins/qmljstools/qmlconsoleitemdelegate.cpp | 4 ++++ src/plugins/qmljstools/qmlconsoleview.cpp | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/qmljstools/qmlconsoleitemdelegate.cpp b/src/plugins/qmljstools/qmlconsoleitemdelegate.cpp index c02f00e708..17bcb677a1 100644 --- a/src/plugins/qmljstools/qmlconsoleitemdelegate.cpp +++ b/src/plugins/qmljstools/qmlconsoleitemdelegate.cpp @@ -33,6 +33,7 @@ #include #include #include +#include const char CONSOLE_LOG_BACKGROUND_COLOR[] = "#E8EEF2"; const char CONSOLE_WARNING_BACKGROUND_COLOR[] = "#F6F4EB"; @@ -215,6 +216,9 @@ void QmlConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem if (showFileLineInfo) { // Check for file info QString file = index.data(QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(file); + if (fileUrl.isLocalFile()) + file = fileUrl.toLocalFile(); if (!file.isEmpty()) { QFontMetrics fm(option.font); // Paint FileArea diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index 50d45b1c28..87916e1815 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -226,8 +226,10 @@ void QmlConsoleView::onRowActivated(const QModelIndex &index) return; // See if we have file and line Info - QString filePath = model()->data(index, - QmlConsoleItemModel::FileRole).toString(); + QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(filePath); + if (fileUrl.isLocalFile()) + filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { QFileInfo fi(filePath); if (fi.exists() && fi.isFile() && fi.isReadable()) { @@ -245,6 +247,9 @@ void QmlConsoleView::copyToClipboard(const QModelIndex &index) QString contents = model()->data(index, QmlConsoleItemModel::ExpressionRole).toString(); // See if we have file and line Info QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(filePath); + if (fileUrl.isLocalFile()) + filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { contents = QString(QLatin1String("%1 %2: %3")).arg(contents).arg(filePath).arg( model()->data(index, QmlConsoleItemModel::LineRole).toString()); @@ -260,6 +265,9 @@ bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index) // See if we have file and line Info QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(filePath); + if (fileUrl.isLocalFile()) + filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { QFileInfo fi(filePath); if (fi.exists() && fi.isFile() && fi.isReadable()) -- cgit v1.2.1 From 905d0aee15cfdc00bdd517eebce33fde0a107558 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 29 May 2013 16:35:57 +0200 Subject: Qbs: Seriously speed up the update of the Project Tree after reparse Do not emit an updateNode signal for all existing nodes, but only for those that actually changed state. Change-Id: I0a906833a6879e224df0d4be05d3813b8e130083 Reviewed-by: Daniel Teske --- src/plugins/qbsprojectmanager/qbsnodes.cpp | 95 +++++++++++++++++++----------- src/plugins/qbsprojectmanager/qbsnodes.h | 9 ++- 2 files changed, 66 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp index 0fca740baa..7c0da5b5c4 100644 --- a/src/plugins/qbsprojectmanager/qbsnodes.cpp +++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp @@ -230,6 +230,16 @@ void QbsFileNode::setLine(int l) m_line = l; } +bool QbsFileNode::update(const qbs::CodeLocation &loc) +{ + const QString oldPath = path(); + const int oldLine = line(); + + setPath(loc.fileName()); + setLine(loc.line()); + return (line() != oldLine || path() != oldPath); +} + // --------------------------------------------------------------------------- // QbsBaseProjectNode: // --------------------------------------------------------------------------- @@ -322,19 +332,29 @@ QbsGroupNode::QbsGroupNode(const qbs::GroupData *grp, const QString &productPath grp->location().line()); addFileNodes(QList() << idx, this); - updateQbsGroupData(grp, productPath); + updateQbsGroupData(grp, productPath, true, true); } bool QbsGroupNode::isEnabled() const { - return static_cast(parentFolderNode())->isEnabled() && qbsGroupData()->isEnabled(); + if (!parentFolderNode() || !m_qbsGroupData) + return false; + return static_cast(parentFolderNode())->isEnabled() + && m_qbsGroupData->isEnabled(); } -void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath) +void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath, + bool productWasEnabled, bool productIsEnabled) { + Q_ASSERT(grp); + if (grp == m_qbsGroupData && productPath == m_productPath) return; + bool groupWasEnabled = productWasEnabled && m_qbsGroupData && m_qbsGroupData->isEnabled(); + bool groupIsEnabled = productIsEnabled && grp->isEnabled(); + bool updateExisting = groupWasEnabled != groupIsEnabled; + m_productPath = productPath; m_qbsGroupData = grp; @@ -347,18 +367,17 @@ void QbsGroupNode::updateQbsGroupData(const qbs::GroupData *grp, const QString & if (idx) break; } + if (idx->update(grp->location()) || updateExisting) + idx->emitNodeUpdated(); - // idx not found, which should never happen! - Q_ASSERT(idx); - idx->setPath(grp->location().fileName()); - idx->setLine(grp->location().line()); + setupFiles(this, grp->allFilePaths(), productPath, updateExisting); - setupFiles(this, grp->allFilePaths(), m_productPath); - emitNodeUpdated(); + if (updateExisting) + emitNodeUpdated(); } void QbsGroupNode::setupFiles(QbsBaseProjectNode *root, const QStringList &files, - const QString &productPath) + const QString &productPath, bool updateExisting) { // Build up a tree of nodes: FileTreeNode tree; @@ -376,11 +395,12 @@ void QbsGroupNode::setupFiles(QbsBaseProjectNode *root, const QStringList &files FileTreeNode::reorder(&tree, productPath); FileTreeNode::simplify(&tree); - setupFolder(root, &tree, productPath); + setupFolder(root, &tree, productPath, updateExisting); } void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root, - const FileTreeNode *fileTree, const QString &baseDir) + const FileTreeNode *fileTree, const QString &baseDir, + bool updateExisting) { // We only need to care about FileNodes and FolderNodes here. Everything else is // handled elsewhere. @@ -408,8 +428,9 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root, if (c->isFile()) { ProjectExplorer::FileNode *fn = root->findFile(path); if (fn) { - fn->emitNodeUpdated(); // enabled might have changed filesToRemove.removeOne(fn); + if (updateExisting) + fn->emitNodeUpdated(); } else { fn = new ProjectExplorer::FileNode(path, ProjectExplorer::UnknownFileType, false); filesToAdd.append(fn); @@ -422,10 +443,12 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root, root->projectNode()->addFolderNodes(QList() << fn, root); } else { foldersToRemove.removeOne(fn); + if (updateExisting) + fn->emitNodeUpdated(); } fn->setDisplayName(displayNameFromPath(c->path(), baseDir)); - setupFolder(fn, c, c->path()); + setupFolder(fn, c, c->path(), updateExisting); } } root->projectNode()->removeFileNodes(filesToRemove, root); @@ -442,42 +465,43 @@ QbsProductNode::QbsProductNode(const qbs::ProductData *prd) : m_qbsProductData(0) { setIcon(m_productIcon); + + ProjectExplorer::FileNode *idx = new QbsFileNode(prd->location().fileName(), + ProjectExplorer::ProjectFileType, false, + prd->location().line()); + addFileNodes(QList() << idx, this); + setQbsProductData(prd); } bool QbsProductNode::isEnabled() const { - return qbsProductData()->isEnabled(); + return m_qbsProductData ? m_qbsProductData->isEnabled() : false; } void QbsProductNode::setQbsProductData(const qbs::ProductData *prd) { + Q_ASSERT(prd); if (m_qbsProductData == prd) return; + bool productWasEnabled = m_qbsProductData ? m_qbsProductData->isEnabled() : true; + bool productIsEnabled = prd->isEnabled(); + bool updateExisting = productWasEnabled != productIsEnabled; + setDisplayName(prd->name()); setPath(prd->location().fileName()); const QString &productPath = QFileInfo(prd->location().fileName()).absolutePath(); - // Set Product file node used to jump to the product - QList files = fileNodes(); + // Find the QbsFileNode we added earlier: QbsFileNode *idx = 0; - if (files.isEmpty()) { - idx = new QbsFileNode(prd->location().fileName(), - ProjectExplorer::ProjectFileType, false, - prd->location().line()); - addFileNodes(QList() << idx, this); - } else { - // Find the QbsFileNode we added earlier: - foreach (ProjectExplorer::FileNode *fn, files) { - idx = qobject_cast(fn); - if (idx) { - idx->setPath(prd->location().fileName()); - idx->setLine(prd->location().line()); - break; - } - } + foreach (ProjectExplorer::FileNode *fn, fileNodes()) { + idx = qobject_cast(fn); + if (idx) + break; } + if (idx->update(prd->location()) || updateExisting) + idx->emitNodeUpdated(); QList toAdd; QList toRemove = subProjectNodes(); @@ -485,13 +509,13 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData *prd) foreach (const qbs::GroupData &grp, prd->groups()) { if (grp.name() == prd->name() && grp.location() == prd->location()) { // Set implicit product group right onto this node: - QbsGroupNode::setupFiles(this, grp.allFilePaths(), productPath); + QbsGroupNode::setupFiles(this, grp.allFilePaths(), productPath, updateExisting); continue; } QbsGroupNode *gn = findGroupNode(grp.name()); if (gn) { toRemove.removeOne(gn); - gn->updateQbsGroupData(&grp, productPath); + gn->updateQbsGroupData(&grp, productPath, productWasEnabled, productIsEnabled); } else { gn = new QbsGroupNode(&grp, productPath); toAdd.append(gn); @@ -502,7 +526,8 @@ void QbsProductNode::setQbsProductData(const qbs::ProductData *prd) removeProjectNodes(toRemove); m_qbsProductData = prd; - emitNodeUpdated(); + if (updateExisting) + emitNodeUpdated(); } QList QbsProductNode::runConfigurationsFor(ProjectExplorer::Node *node) diff --git a/src/plugins/qbsprojectmanager/qbsnodes.h b/src/plugins/qbsprojectmanager/qbsnodes.h index 75e7ac88f1..46cd384a95 100644 --- a/src/plugins/qbsprojectmanager/qbsnodes.h +++ b/src/plugins/qbsprojectmanager/qbsnodes.h @@ -59,6 +59,8 @@ public: void setLine(int l); + bool update(const qbs::CodeLocation &loc); + private: int m_line; }; @@ -116,18 +118,19 @@ public: QbsGroupNode(const qbs::GroupData *grp, const QString &productPath); bool isEnabled() const; - void updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath); + void updateQbsGroupData(const qbs::GroupData *grp, const QString &productPath, + bool productWasEnabled, bool productIsEnabled); const qbs::GroupData *qbsGroupData() const { return m_qbsGroupData; } QString productPath() const; static void setupFiles(QbsBaseProjectNode *root, const QStringList &files, - const QString &productPath); + const QString &productPath, bool updateExisting); private: static void setupFolder(ProjectExplorer::FolderNode *folder, - const FileTreeNode *subFileTree, const QString &baseDir); + const FileTreeNode *subFileTree, const QString &baseDir, bool updateExisting); const qbs::GroupData *m_qbsGroupData; QString m_productPath; -- cgit v1.2.1 From 5e5c5bb02b16aa4db5a0bcc6fdef35d8a8b58066 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 3 Jun 2013 12:26:25 +0200 Subject: C++: re-enable quick-fix sorting. Also make sure that "Apply function signature change" gets to the top of the list. Task-number: QTCREATORBUG-9441 Change-Id: Iaf67f8ea9c99ddfc973e610f7e0f4c35b7967629 Reviewed-by: Nikolai Kosjar --- src/plugins/cppeditor/cppquickfixes.cpp | 2 +- src/plugins/texteditor/codeassist/codeassistant.cpp | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index a75d987170..a240d88784 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3696,7 +3696,7 @@ class ApplyDeclDefLinkOperation : public CppQuickFixOperation public: explicit ApplyDeclDefLinkOperation(const CppQuickFixInterface &interface, const QSharedPointer &link) - : CppQuickFixOperation(interface, 10) + : CppQuickFixOperation(interface, 100) , m_link(link) {} diff --git a/src/plugins/texteditor/codeassist/codeassistant.cpp b/src/plugins/texteditor/codeassist/codeassistant.cpp index b4c0f9cb42..8a57304e87 100644 --- a/src/plugins/texteditor/codeassist/codeassistant.cpp +++ b/src/plugins/texteditor/codeassist/codeassistant.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -266,15 +265,8 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason, } } - if (IAssistProposal *newProposal = processor->perform(assistInterface)) { - if (kind == QuickFix) { - TextEditor::BasicProposalItemListModel *proposalModel = - static_cast(newProposal->model()); - proposalModel->setSortingAllowed(false); - } - + if (IAssistProposal *newProposal = processor->perform(assistInterface)) displayProposal(newProposal, reason); - } delete processor; } -- cgit v1.2.1 From b8a2983fd55513b6404e6788fb2d7a97e72c853c Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 3 Jun 2013 14:57:13 +0200 Subject: CppEditor: Fix sorting of quick fixes "Add {public, private, ...} declaration" Change-Id: I43f09042a525a798d95b3365873be24eafd423e9 Reviewed-by: Erik Verbruggen --- src/plugins/cppeditor/cppquickfixes.cpp | 21 +++++++++++---------- .../codeassist/basicproposalitemlistmodel.cpp | 14 -------------- .../codeassist/basicproposalitemlistmodel.h | 1 - 3 files changed, 11 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index a240d88784..2c320ab533 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -2334,8 +2334,8 @@ class InsertDeclOperation: public CppQuickFixOperation public: InsertDeclOperation(const QSharedPointer &interface, const QString &targetFileName, const Class *targetSymbol, - InsertionPointLocator::AccessSpec xsSpec, const QString &decl) - : CppQuickFixOperation(interface, 0) + InsertionPointLocator::AccessSpec xsSpec, const QString &decl, int priority) + : CppQuickFixOperation(interface, priority) , m_targetFileName(targetFileName) , m_targetSymbol(targetSymbol) , m_xsSpec(xsSpec) @@ -2397,10 +2397,11 @@ public: , m_decl(decl) {} TextEditor::QuickFixOperation::Ptr - operator()(InsertionPointLocator::AccessSpec xsSpec) + operator()(InsertionPointLocator::AccessSpec xsSpec, int priority) { return TextEditor::QuickFixOperation::Ptr( - new InsertDeclOperation(m_interface, m_fileName, m_matchingClass, xsSpec, m_decl)); + new InsertDeclOperation(m_interface, m_fileName, m_matchingClass, xsSpec, m_decl, + priority)); } private: @@ -2462,12 +2463,12 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe // Add several possible insertion locations for declaration DeclOperationFactory operation(interface, fileName, matchingClass, decl); - result.append(operation(InsertionPointLocator::Public)); - result.append(operation(InsertionPointLocator::PublicSlot)); - result.append(operation(InsertionPointLocator::Protected)); - result.append(operation(InsertionPointLocator::ProtectedSlot)); - result.append(operation(InsertionPointLocator::Private)); - result.append(operation(InsertionPointLocator::PrivateSlot)); + result.append(operation(InsertionPointLocator::Public, 5)); + result.append(operation(InsertionPointLocator::PublicSlot, 4)); + result.append(operation(InsertionPointLocator::Protected, 3)); + result.append(operation(InsertionPointLocator::ProtectedSlot, 2)); + result.append(operation(InsertionPointLocator::Private, 1)); + result.append(operation(InsertionPointLocator::PrivateSlot, 0)); } } diff --git a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp b/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp index 2c0c1112cc..b6c479b9c8 100644 --- a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp +++ b/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.cpp @@ -118,13 +118,11 @@ struct ContentLessThan } // Anonymous BasicProposalItemListModel::BasicProposalItemListModel() - : m_isSortingAllowed(true) {} BasicProposalItemListModel::BasicProposalItemListModel(const QList &items) : m_currentItems(items) , m_originalItems(items) - , m_isSortingAllowed(true) { mapPersistentIds(); } @@ -141,16 +139,6 @@ void BasicProposalItemListModel::loadContent(const QList &i mapPersistentIds(); } -void BasicProposalItemListModel::setSortingAllowed(bool isAllowed) -{ - m_isSortingAllowed = isAllowed; -} - -bool BasicProposalItemListModel::isSortingAllowed() const -{ - return m_isSortingAllowed; -} - void BasicProposalItemListModel::mapPersistentIds() { for (int i = 0; i < m_originalItems.size(); ++i) @@ -270,8 +258,6 @@ bool BasicProposalItemListModel::isSortable(const QString &prefix) const { Q_UNUSED(prefix); - if (!isSortingAllowed()) - return false; if (m_currentItems.size() < kMaxSort) return true; return false; diff --git a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h b/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h index e9769a192f..9de70b4374 100644 --- a/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h +++ b/src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h @@ -78,7 +78,6 @@ private: QHash m_idByText; QList m_originalItems; - bool m_isSortingAllowed; }; } // TextEditor -- cgit v1.2.1 From bab3b010af548b2fdd401dc90e17d30cfe2abceb Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Mon, 3 Jun 2013 19:58:30 +0200 Subject: Android: fixed updating Java files on Windows. When looking for lines in Java files that are not supported by the selected API level, it didn't take into account that line endings are "\r\n" on Windows. toInt() was failing, trying to convert for example "10\r" to an integer. Change-Id: I35478abd40d5ce4621d2320b3a5f5a3514cf9591 Reviewed-by: Daniel Teske --- src/plugins/android/androidmanager.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 03aa1b56b6..ed2fb8d10f 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -633,19 +633,20 @@ void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString bool modified = false; bool comment = false; for (int i = 0; i < lines.size(); i++) { - if (lines[i].contains("@ANDROID-")) { - commentLines = targetSDKNumber < lines[i].mid(lines[i].lastIndexOf('-') + 1).toInt(); + QByteArray trimmed = lines[i].trimmed(); + if (trimmed.contains("@ANDROID-")) { + commentLines = targetSDKNumber < trimmed.mid(trimmed.lastIndexOf('-') + 1).toInt(); comment = !comment; continue; } if (!comment) continue; if (commentLines) { - if (!lines[i].trimmed().startsWith("//QtCreator")) { + if (!trimmed.startsWith("//QtCreator")) { lines[i] = "//QtCreator " + lines[i]; modified = true; } - } else { if (lines[i].trimmed().startsWith("//QtCreator")) { + } else { if (trimmed.startsWith("//QtCreator")) { lines[i] = lines[i].mid(12); modified = true; } -- cgit v1.2.1 From 8510c2ab2b42c940bf5ffb424fcdf7fc38913fc0 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 3 Jun 2013 18:12:41 +0200 Subject: Git: Try do consolidate code duplication Change-Id: I5ac34d96152d6e4f9abc8f6dd18d1e1eab0bde7f Reviewed-by: Jarek Kobus --- src/plugins/git/gitclient.cpp | 94 +++++++++++++++---------------------------- src/plugins/git/gitclient.h | 5 ++- 2 files changed, 36 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 1fce5d4c25..13ac15ba6a 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -823,20 +823,29 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis return rc; } -DiffEditor::DiffEditor *GitClient::findExistingDiffEditor(const char *registerDynamicProperty, - const QString &dynamicPropertyValue) const +DiffEditor::DiffEditor *GitClient::findExistingOrOpenNewDiffEditor(const char *registerDynamicProperty, + const QString &dynamicPropertyValue, const QString &titlePattern) const { Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue); - if (!outputEditor) - return 0; - - // Exists already - Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); - outputEditor->createNew(m_msgWait); + if (outputEditor) { + // Exists already + Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + outputEditor->createNew(m_msgWait); + } - return qobject_cast(outputEditor); + DiffEditor::DiffEditor *editor = qobject_cast(outputEditor); + if (!editor) { + const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; + QString title = titlePattern; + editor = qobject_cast( + Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); + editor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue); + Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); // should probably go outside this block + } + return editor; } + /* Create an editor associated to VCS output of a source file/directory * (using the file's codec). Makes use of a dynamic property to find an * existing instance and to reuse it (in case, say, 'git diff foo' is @@ -885,21 +894,13 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &unstagedFileNames, const QStringList &stagedFileNames) { - if (settings()->boolValue(GitSettings::useDiffEditorKey)) { - const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; - QString title = tr("Git Diff"); - - DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("originalFileName", workingDirectory); + const QString title = tr("Git Diff"); + const int timeout = settings()->intValue(GitSettings::timeoutKey); - if (!editorEditable) { - editorEditable = qobject_cast( - Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); - editorEditable->document()->setProperty("originalFileName", workingDirectory); - Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block - } + if (settings()->boolValue(GitSettings::useDiffEditorKey)) { + DiffEditor::DiffEditor *editor = findExistingOrOpenNewDiffEditor("originalFileName", workingDirectory, title); - int timeout = settings()->intValue(GitSettings::timeoutKey); - GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), workingDirectory, processEnvironment(), timeout); + GitDiffHandler *handler = new GitDiffHandler(editor, gitBinaryPath(), workingDirectory, processEnvironment(), timeout); if (unstagedFileNames.empty() && stagedFileNames.empty()) { // local repository diff @@ -914,7 +915,6 @@ void GitClient::diff(const QString &workingDirectory, } else { const QString binary = settings()->stringValue(GitSettings::binaryPathKey); const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID; - const QString title = tr("Git Diff"); VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("originalFileName", workingDirectory); if (!editor) { @@ -940,8 +940,6 @@ void GitClient::diff(const QString &workingDirectory, QStringList cmdArgs; cmdArgs << QLatin1String("diff") << QLatin1String(noColorOption); - int timeout = settings()->intValue(GitSettings::timeoutKey); - if (unstagedFileNames.empty() && stagedFileNames.empty()) { QStringList arguments(cmdArgs); arguments << userDiffArgs; @@ -972,27 +970,18 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &diffArgs, const QString &fileName) { + const QString title = tr("Git Diff \"%1\"").arg(fileName); if (settings()->boolValue(GitSettings::useDiffEditorKey)) { - const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; - QString title = tr("Git Diff \"%1\"").arg(fileName); const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName); - - DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("originalFileName", sourceFile); - if (!editorEditable) { - editorEditable = qobject_cast( - Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); - editorEditable->document()->setProperty("originalFileName", sourceFile); - Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); - } + DiffEditor::DiffEditor *editor = findExistingOrOpenNewDiffEditor("originalFileName", sourceFile, title); if (!fileName.isEmpty()) { int timeout = settings()->intValue(GitSettings::timeoutKey); - GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), workingDirectory, processEnvironment(), timeout); + GitDiffHandler *handler = new GitDiffHandler(editor, gitBinaryPath(), workingDirectory, processEnvironment(), timeout); handler->diffFile(fileName); } } else { const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID; - const QString title = tr("Git Diff \"%1\"").arg(fileName); const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName); VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("originalFileName", sourceFile); @@ -1022,24 +1011,16 @@ void GitClient::diffBranch(const QString &workingDirectory, const QStringList &diffArgs, const QString &branchName) { + const QString title = tr("Git Diff Branch \"%1\"").arg(branchName); if (settings()->boolValue(GitSettings::useDiffEditorKey)) { - const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; - QString title = tr("Git Diff Branch \"%1\"").arg(branchName); - - DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("BranchName", branchName); - if (!editorEditable) { - editorEditable = qobject_cast( - Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); - editorEditable->document()->setProperty("BranchName", branchName); - Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); - } + DiffEditor::DiffEditor *editor = + findExistingOrOpenNewDiffEditor("BranchName", branchName, title); int timeout = settings()->intValue(GitSettings::timeoutKey); - GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), workingDirectory, processEnvironment(), timeout); + GitDiffHandler *handler = new GitDiffHandler(editor, gitBinaryPath(), workingDirectory, processEnvironment(), timeout); handler->diffBranch(branchName); } else { const Core::Id editorId = Git::Constants::GIT_DIFF_EDITOR_ID; - const QString title = tr("Git Diff Branch \"%1\"").arg(branchName); const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, QStringList()); VcsBase::VcsBaseEditorWidget *editor = findExistingVCSEditor("BranchName", branchName); @@ -1137,23 +1118,14 @@ void GitClient::show(const QString &source, const QString &id, return; } - QString title = tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name); + const QString title = tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name); const QFileInfo sourceFi(source); const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath(); if (settings()->boolValue(GitSettings::useDiffEditorKey)) { - const Core::Id editorId = DiffEditor::Constants::DIFF_EDITOR_ID; - - DiffEditor::DiffEditor *editorEditable = findExistingDiffEditor("show", id); - - if (!editorEditable) { - editorEditable = qobject_cast( - Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); - editorEditable->document()->setProperty("show", id); - Core::EditorManager::activateEditor(editorEditable, Core::EditorManager::ModeSwitch); // should probably go outside this block - } + DiffEditor::DiffEditor *editor = findExistingOrOpenNewDiffEditor("show", id, title); int timeout = settings()->intValue(GitSettings::timeoutKey); - GitDiffHandler *handler = new GitDiffHandler(editorEditable, gitBinaryPath(), + GitDiffHandler *handler = new GitDiffHandler(editor, gitBinaryPath(), findRepositoryForDirectory(workDir), processEnvironment(), timeout); handler->show(id); diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index 85e422a33f..a280ccc34d 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -334,8 +334,9 @@ private: QTextCodec *getSourceCodec(const QString &file) const; VcsBase::VcsBaseEditorWidget *findExistingVCSEditor(const char *registerDynamicProperty, const QString &dynamicPropertyValue) const; - DiffEditor::DiffEditor *findExistingDiffEditor(const char *registerDynamicProperty, - const QString &dynamicPropertyValue) const; + DiffEditor::DiffEditor *findExistingOrOpenNewDiffEditor(const char *registerDynamicProperty, + const QString &dynamicPropertyValue, + const QString &titlePattern) const; enum CodecType { CodecSource, CodecLogOutput, CodecNone }; VcsBase::VcsBaseEditorWidget *createVcsEditor(const Core::Id &kind, -- cgit v1.2.1 From 42c5149e03a26a5000364bb2b646a130e5058945 Mon Sep 17 00:00:00 2001 From: jkobus Date: Tue, 4 Jun 2013 13:34:53 +0200 Subject: Test change Change-Id: I4b286051da2267ff7130e5cab8dbeeececd07769 Reviewed-by: Jarek Kobus --- src/plugins/helloworld/helloworldplugin.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 25d64aeb46..cff58dfa44 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -29,6 +29,7 @@ #include "helloworldplugin.h" + #include #include #include -- cgit v1.2.1 From cacc6b2971db200ca70ce689f22cf386f14973a2 Mon Sep 17 00:00:00 2001 From: jkobus Date: Tue, 4 Jun 2013 13:37:08 +0200 Subject: Revert 27aa0e89c9ee9f0d28acea13b72d73b36b7a469f Change-Id: Ib0615de8dec6fa7d50ec1901e42ebe6c3c9b98e8 Reviewed-by: Jarek Kobus --- src/plugins/helloworld/helloworldplugin.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index cff58dfa44..25d64aeb46 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -29,7 +29,6 @@ #include "helloworldplugin.h" - #include #include #include -- cgit v1.2.1 From ca291fbc7ba860b1856b45eff5a02daa56a39d65 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 2 May 2013 14:55:56 +0200 Subject: C++: fix functionAt(), moved it, and added test. Thanks to Jesper K. Pedersen for the fix! Change-Id: Ie49c3352e26a9632b1500596b00d559bfe932dff Reviewed-by: Nikolai Kosjar --- src/libs/cplusplus/CppDocument.cpp | 51 ++++++++++++++++++++++++++ src/libs/cplusplus/CppDocument.h | 1 + src/plugins/cpptools/abstracteditorsupport.cpp | 28 +++----------- 3 files changed, 58 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index ee6d7f3a9d..84092fc93d 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -464,6 +464,57 @@ void Document::setGlobalNamespace(Namespace *globalNamespace) _globalNamespace = globalNamespace; } +/*! + * Extract the function name including scope at the given position. + * + * Note that a function (scope) starts at the name of that function, not at the return type. The + * implication is that this method will return an empty string when the line/column is on the + * return type. + * + * \param line the line number, starting with line 1 + * \param column the column number, starting with column 1 + */ +QString Document::functionAt(int line, int column) const +{ + if (line < 1 || column < 1) + return QString(); + + CPlusPlus::Symbol *symbol = lastVisibleSymbolAt(line, column); + if (!symbol) + return QString(); + + // Find the enclosing function scope (which might be several levels up, or we might be standing + // on it) + Scope *scope; + if (symbol->isScope()) + scope = symbol->asScope(); + else + scope = symbol->enclosingScope(); + + while (scope && !scope->isFunction() ) + scope = scope->enclosingScope(); + + if (!scope) + return QString(); + + // We found the function scope, extract its name. + const Overview o; + QString rc = o.prettyName(scope->name()); + + // Prepend namespace "Foo::Foo::foo()" up to empty root namespace + for (const Symbol *owner = scope->enclosingNamespace(); + owner; owner = owner->enclosingNamespace()) { + const QString name = o.prettyName(owner->name()); + if (name.isEmpty()) { + break; + } else { + rc.prepend(QLatin1String("::")); + rc.prepend(name); + } + } + return rc; +} + Scope *Document::scopeAt(unsigned line, unsigned column) { FindScopeAt findScopeAt(_translationUnit, line, column); diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index 589e2b9503..b9a58f547f 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -99,6 +99,7 @@ public: QList definedMacros() const { return _definedMacros; } + QString functionAt(int line, int column) const; Symbol *lastVisibleSymbolAt(unsigned line, unsigned column = 0) const; Scope *scopeAt(unsigned line, unsigned column = 0); diff --git a/src/plugins/cpptools/abstracteditorsupport.cpp b/src/plugins/cpptools/abstracteditorsupport.cpp index 6410473e34..cdbd86f342 100644 --- a/src/plugins/cpptools/abstracteditorsupport.cpp +++ b/src/plugins/cpptools/abstracteditorsupport.cpp @@ -55,29 +55,13 @@ QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelM const QString &fileName, int line, int column) { - const CPlusPlus::Snapshot snapshot = modelManager->snapshot(); - const CPlusPlus::Document::Ptr document = snapshot.document(fileName); - if (!document) + if (!modelManager) return QString(); - if (const CPlusPlus::Symbol *symbol = document->lastVisibleSymbolAt(line, column)) - if (const CPlusPlus::Scope *scope = symbol->enclosingScope()) - if (const CPlusPlus::Scope *functionScope = scope->enclosingFunction()) - if (const CPlusPlus::Symbol *function = functionScope) { - const CPlusPlus::Overview o; - QString rc = o.prettyName(function->name()); - // Prepend namespace "Foo::Foo::foo()" up to empty root namespace - for (const CPlusPlus::Symbol *owner = function->enclosingNamespace(); - owner; owner = owner->enclosingNamespace()) { - const QString name = o.prettyName(owner->name()); - if (name.isEmpty()) { - break; - } else { - rc.prepend(QLatin1String("::")); - rc.prepend(name); - } - } - return rc; - } + + const CPlusPlus::Snapshot snapshot = modelManager->snapshot(); + if (const CPlusPlus::Document::Ptr document = snapshot.document(fileName)) + return document->functionAt(line, column); + return QString(); } -- cgit v1.2.1 From 571234786a3ff7e8e3a9220f12d22a9f74f7a53c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 May 2013 17:12:11 +0200 Subject: don't unnecessarily use QFileInfo::filePath() just directly use the filename we constructed it from. Change-Id: Ia428a2cb4b192fea6bde62dfbf35361bcfc4b21e Reviewed-by: Daniel Teske --- src/shared/proparser/qmakebuiltins.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 6e2cd8afcd..00f476cb51 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -303,12 +303,12 @@ QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::Open return ReturnFalse; } QString errStr; - if (!doWriteFile(qfi.filePath(), mode, contents, &errStr)) { + if (!doWriteFile(fn, mode, contents, &errStr)) { evalError(fL1S("Cannot write %1file %2: %3.") - .arg(ctx, QDir::toNativeSeparators(qfi.filePath()), errStr)); + .arg(ctx, QDir::toNativeSeparators(fn), errStr)); return ReturnFalse; } - m_parser->discardFileFromCache(qfi.filePath()); + m_parser->discardFileFromCache(fn); return ReturnTrue; } -- cgit v1.2.1 From 66802ef8bf7989dc025e34bf91d93576189c483c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 29 May 2013 20:18:51 +0200 Subject: implement simple VFS to support caching during project parsing this tremendously speeds up loading of qt 5.1 based projects (including qt itself) under mac os, as these look up the sdk dynamically, and use caching to avoid doing that in every subproject. Change-Id: I833253f81c3159056fab2ff888f293b36cc2ef56 Reviewed-by: Daniel Teske --- src/plugins/qt4projectmanager/qt4nodes.cpp | 4 +- src/plugins/qt4projectmanager/qt4project.cpp | 19 ++- src/plugins/qt4projectmanager/qt4project.h | 4 + src/plugins/qtsupport/baseqtversion.cpp | 6 +- src/plugins/qtsupport/profilereader.cpp | 6 +- src/plugins/qtsupport/profilereader.h | 2 +- src/plugins/qtsupport/qtversionfactory.cpp | 7 +- src/shared/proparser/profileevaluator.cpp | 4 +- src/shared/proparser/profileevaluator.h | 4 +- src/shared/proparser/proparser.pri | 2 + src/shared/proparser/qmakebuiltins.cpp | 43 +------ src/shared/proparser/qmakeevaluator.cpp | 21 ++-- src/shared/proparser/qmakeevaluator.h | 3 +- src/shared/proparser/qmakeparser.cpp | 24 ++-- src/shared/proparser/qmakeparser.h | 4 +- src/shared/proparser/qmakevfs.cpp | 178 +++++++++++++++++++++++++++ src/shared/proparser/qmakevfs.h | 73 +++++++++++ 17 files changed, 325 insertions(+), 79 deletions(-) create mode 100644 src/shared/proparser/qmakevfs.cpp create mode 100644 src/shared/proparser/qmakevfs.h (limited to 'src') diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 2553c1f25d..26568c4dd6 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -1135,8 +1136,9 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, lines = contents.split(QLatin1Char('\n')); } + QMakeVfs vfs; QtSupport::ProMessageHandler handler; - QMakeParser parser(0, &handler); + QMakeParser parser(0, &vfs, &handler); includeFile = parser.parsedProBlock(contents, m_projectFilePath, 1); } diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index b2efd28323..aa81184031 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include #include +#include #include #include @@ -344,6 +346,7 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) : m_nodesWatcher(new Internal::Qt4NodesWatcher(this)), m_fileInfo(new Qt4ProjectFile(fileName, this)), m_projectFiles(new Qt4ProjectFiles), + m_qmakeVfs(new QMakeVfs), m_qmakeGlobals(0), m_asyncUpdateFutureInterface(0), m_pendingEvaluateFuturesCount(0), @@ -358,6 +361,10 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) : m_asyncUpdateTimer.setSingleShot(true); m_asyncUpdateTimer.setInterval(3000); connect(&m_asyncUpdateTimer, SIGNAL(timeout()), this, SLOT(asyncUpdate())); + + connect(ProjectExplorerPlugin::instance()->buildManager(), + SIGNAL(buildQueueFinished(bool)), + SLOT(buildFinished(bool))); } Qt4Project::~Qt4Project() @@ -365,6 +372,7 @@ Qt4Project::~Qt4Project() m_codeModelFuture.cancel(); m_asyncUpdateState = ShuttingDown; m_manager->unregisterProject(this); + delete m_qmakeVfs; delete m_projectFiles; m_cancelEvaluate = true; // Deleting the root node triggers a few things, make sure rootProjectNode @@ -847,6 +855,9 @@ void Qt4Project::asyncUpdate() { if (debug) qDebug()<<"async update, timer expired, doing now"; + + m_qmakeVfs->invalidateCache(); + Q_ASSERT(!m_asyncUpdateFutureInterface); m_asyncUpdateFutureInterface = new QFutureInterface(); @@ -877,6 +888,12 @@ void Qt4Project::asyncUpdate() m_asyncUpdateState = AsyncUpdateInProgress; } +void Qt4Project::buildFinished(bool success) +{ + if (success) + m_qmakeVfs->invalidateContents(); +} + ProjectExplorer::IProjectManager *Qt4Project::projectManager() const { return m_manager; @@ -1002,7 +1019,7 @@ QtSupport::ProFileReader *Qt4Project::createProFileReader(const Qt4ProFileNode * } ++m_qmakeGlobalsRefCnt; - QtSupport::ProFileReader *reader = new QtSupport::ProFileReader(m_qmakeGlobals); + QtSupport::ProFileReader *reader = new QtSupport::ProFileReader(m_qmakeGlobals, m_qmakeVfs); reader->setOutputDir(qt4ProFileNode->buildDir()); diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 2f40208153..a4bb93b1b3 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE class ProFileGlobals; +class QMakeVfs; QT_END_NAMESPACE namespace ProjectExplorer { class DeploymentData; } @@ -158,6 +159,7 @@ protected: private slots: void asyncUpdate(); + void buildFinished(bool success); void activeTargetWasChanged(); @@ -198,6 +200,8 @@ private: // cached lists of all of files Internal::Qt4ProjectFiles *m_projectFiles; + QMakeVfs *m_qmakeVfs; + // cached data during project rescan ProFileGlobals *m_qmakeGlobals; int m_qmakeGlobalsRefCnt; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 093123caa8..fcb447bf82 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -36,6 +36,7 @@ #include "qtversionmanager.h" #include "profilereader.h" +#include #include #include #include @@ -780,12 +781,13 @@ void BaseQtVersion::ensureMkSpecParsed() const if (mkspecPath().isEmpty()) return; + QMakeVfs vfs; ProFileGlobals option; option.setProperties(versionInfo()); ProMessageHandler msgHandler(true); ProFileCacheManager::instance()->incRefCount(); - QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler); - ProFileEvaluator evaluator(&option, &parser, &msgHandler); + QMakeParser parser(ProFileCacheManager::instance()->cache(), &vfs, &msgHandler); + ProFileEvaluator evaluator(&option, &parser, &vfs, &msgHandler); evaluator.loadNamedSpec(mkspecPath().toString(), false); parseMkSpec(&evaluator); diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp index b538c0e6cc..747c4f14ff 100644 --- a/src/plugins/qtsupport/profilereader.cpp +++ b/src/plugins/qtsupport/profilereader.cpp @@ -65,9 +65,9 @@ void ProMessageHandler::fileMessage(const QString &) } -ProFileReader::ProFileReader(ProFileGlobals *option) - : QMakeParser(ProFileCacheManager::instance()->cache(), this) - , ProFileEvaluator(option, this, this) +ProFileReader::ProFileReader(ProFileGlobals *option, QMakeVfs *vfs) + : QMakeParser(ProFileCacheManager::instance()->cache(), vfs, this) + , ProFileEvaluator(option, this, vfs, this) , m_ignoreLevel(0) { } diff --git a/src/plugins/qtsupport/profilereader.h b/src/plugins/qtsupport/profilereader.h index 2ba4c99aa6..3bd8a914b8 100644 --- a/src/plugins/qtsupport/profilereader.h +++ b/src/plugins/qtsupport/profilereader.h @@ -69,7 +69,7 @@ class QTSUPPORT_EXPORT ProFileReader : public ProMessageHandler, public QMakePar Q_OBJECT public: - ProFileReader(ProFileGlobals *option); + ProFileReader(ProFileGlobals *option, QMakeVfs *vfs); ~ProFileReader(); QList includeFiles() const; diff --git a/src/plugins/qtsupport/qtversionfactory.cpp b/src/plugins/qtsupport/qtversionfactory.cpp index 7ff99b6ff4..cac661f629 100644 --- a/src/plugins/qtsupport/qtversionfactory.cpp +++ b/src/plugins/qtsupport/qtversionfactory.cpp @@ -31,6 +31,8 @@ #include "profilereader.h" #include "baseqtversion.h" +#include + #include #include @@ -61,12 +63,13 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN return 0; Utils::FileName mkspec = BaseQtVersion::mkspecFromVersionInfo(versionInfo); + QMakeVfs vfs; ProFileGlobals globals; globals.setProperties(versionInfo); ProMessageHandler msgHandler(true); ProFileCacheManager::instance()->incRefCount(); - QMakeParser parser(ProFileCacheManager::instance()->cache(), &msgHandler); - ProFileEvaluator evaluator(&globals, &parser, &msgHandler); + QMakeParser parser(ProFileCacheManager::instance()->cache(), &vfs, &msgHandler); + ProFileEvaluator evaluator(&globals, &parser, &vfs, &msgHandler); evaluator.loadNamedSpec(mkspec.toString(), false); QList factories = ExtensionSystem::PluginManager::getObjects(); diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 47012d99fd..c955851928 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -43,9 +43,9 @@ void ProFileEvaluator::initialize() QMakeEvaluator::initStatics(); } -ProFileEvaluator::ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, +ProFileEvaluator::ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, QMakeVfs *vfs, QMakeHandler *handler) - : d(new QMakeEvaluator(option, parser, handler)) + : d(new QMakeEvaluator(option, parser, vfs, handler)) { } diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h index a172536411..8d6fec86c3 100644 --- a/src/shared/proparser/profileevaluator.h +++ b/src/shared/proparser/profileevaluator.h @@ -40,6 +40,7 @@ QT_BEGIN_NAMESPACE +class QMakeVfs; class QMakeParser; class QMakeEvaluator; class QMakeHandler; @@ -65,7 +66,8 @@ public: // Call this from a concurrency-free context static void initialize(); - ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, QMakeHandler *handler); + ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, QMakeVfs *vfs, + QMakeHandler *handler); ~ProFileEvaluator(); ProFileEvaluator::TemplateType templateType() const; diff --git a/src/shared/proparser/proparser.pri b/src/shared/proparser/proparser.pri index 900151d75f..a3667e5291 100644 --- a/src/shared/proparser/proparser.pri +++ b/src/shared/proparser/proparser.pri @@ -14,6 +14,7 @@ HEADERS += \ profileevaluator.h \ proitems.h \ prowriter.h \ + qmakevfs.h \ ioutils.h SOURCES += \ @@ -24,6 +25,7 @@ SOURCES += \ qmakebuiltins.cpp \ proitems.cpp \ prowriter.cpp \ + qmakevfs.cpp \ ioutils.cpp RESOURCES += proparser.qrc diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 00f476cb51..eb58632c84 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -32,6 +32,7 @@ #include "qmakeevaluator_p.h" #include "qmakeglobals.h" #include "qmakeparser.h" +#include "qmakevfs.h" #include "ioutils.h" #include @@ -269,41 +270,12 @@ quoteValue(const ProString &val) return ret; } -static bool -doWriteFile(const QString &name, QIODevice::OpenMode mode, const QString &contents, QString *errStr) -{ - QByteArray bytes = contents.toLocal8Bit(); - QFile cfile(name); - if (!(mode & QIODevice::Append) && cfile.open(QIODevice::ReadOnly | QIODevice::Text)) { - if (cfile.readAll() == bytes) - return true; - cfile.close(); - } - if (!cfile.open(mode | QIODevice::WriteOnly | QIODevice::Text)) { - *errStr = cfile.errorString(); - return false; - } - cfile.write(bytes); - cfile.close(); - if (cfile.error() != QFile::NoError) { - *errStr = cfile.errorString(); - return false; - } - return true; -} - QMakeEvaluator::VisitReturn QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode, const QString &contents) { - QFileInfo qfi(fn); - if (!QDir::current().mkpath(qfi.path())) { - evalError(fL1S("Cannot create %1directory %2.") - .arg(ctx, QDir::toNativeSeparators(qfi.path()))); - return ReturnFalse; - } QString errStr; - if (!doWriteFile(fn, mode, contents, &errStr)) { + if (!m_vfs->writeFile(fn, mode, contents, &errStr)) { evalError(fL1S("Cannot write %1file %2: %3.") .arg(ctx, QDir::toNativeSeparators(fn), errStr)); return ReturnFalse; @@ -1413,6 +1385,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } const QString &file = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1))); + // Don't use VFS here: + // - it supports neither listing nor even directories + // - it's unlikely that somebody would test for files they created themselves if (IoUtils::exists(file)) return ReturnTrue; int slsh = file.lastIndexOf(QLatin1Char('/')); @@ -1444,7 +1419,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( evalError(fL1S("write_file(name, [content var, [append]]) requires one to three arguments.")); return ReturnFalse; } -#ifdef PROEVALUATOR_FULL QIODevice::OpenMode mode = QIODevice::Truncate; QString contents; if (args.count() >= 2) { @@ -1456,9 +1430,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( mode = QIODevice::Append; } return writeFile(QString(), resolvePath(args.at(0).toQString(m_tmp1)), mode, contents); -#else - return ReturnTrue; -#endif } case T_TOUCH: { if (args.count() != 2) { @@ -1510,7 +1481,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( evalError(fL1S("cache(var, [set|add|sub] [transient] [super], [srcvar]) requires one to three arguments.")); return ReturnFalse; } -#ifdef PROEVALUATOR_FULL bool persist = true; bool super = false; enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet; @@ -1636,9 +1606,6 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( fn = m_cachefile; } return writeFile(fL1S("cache "), fn, QIODevice::Append, varstr); -#else - return ReturnTrue; -#endif } default: evalError(fL1S("Function '%1' is not implemented.").arg(function.toQString(m_tmp1))); diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 9ba0d70b16..5a750adbd0 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -32,6 +32,7 @@ #include "qmakeglobals.h" #include "qmakeparser.h" +#include "qmakevfs.h" #include "ioutils.h" #include @@ -162,13 +163,13 @@ const ProKey &QMakeEvaluator::map(const ProKey &var) } -QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, - QMakeParser *parser, QMakeHandler *handler) +QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, QMakeVfs *vfs, + QMakeHandler *handler) : #ifdef PROEVALUATOR_DEBUG m_debugLevel(option->debugLevel), #endif - m_option(option), m_parser(parser), m_handler(handler) + m_option(option), m_parser(parser), m_handler(handler), m_vfs(vfs) { // So that single-threaded apps don't have to call initialize() for now. initStatics(); @@ -1049,7 +1050,7 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) superdir = m_outputDir; forever { QString superfile = superdir + QLatin1String("/.qmake.super"); - if (IoUtils::exists(superfile)) { + if (m_vfs->exists(superfile)) { m_superfile = QDir::cleanPath(superfile); break; } @@ -1064,10 +1065,10 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) QString dir = m_outputDir; forever { conffile = sdir + QLatin1String("/.qmake.conf"); - if (!IoUtils::exists(conffile)) + if (!m_vfs->exists(conffile)) conffile.clear(); cachefile = dir + QLatin1String("/.qmake.cache"); - if (!IoUtils::exists(cachefile)) + if (!m_vfs->exists(cachefile)) cachefile.clear(); if (!conffile.isEmpty() || !cachefile.isEmpty()) { if (dir != sdir) @@ -1158,7 +1159,7 @@ bool QMakeEvaluator::loadSpec() m_hostBuild ? m_option->qmakespec : m_option->xqmakespec); { - QMakeEvaluator evaluator(m_option, m_parser, m_handler); + QMakeEvaluator evaluator(m_option, m_parser, m_vfs, m_handler); if (!m_superfile.isEmpty()) { valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); if (evaluator.evaluateFile( @@ -1315,7 +1316,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( locker.unlock(); #endif - QMakeEvaluator *baseEval = new QMakeEvaluator(m_option, m_parser, m_handler); + QMakeEvaluator *baseEval = new QMakeEvaluator(m_option, m_parser, m_vfs, m_handler); baseEnv->evaluator = baseEval; baseEval->m_superfile = m_superfile; baseEval->m_conffile = m_conffile; @@ -1810,7 +1811,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile( #endif return ok; } else { - if (!(flags & LoadSilent) && !IoUtils::exists(fileName)) + if (!(flags & LoadSilent) && !m_vfs->exists(fileName)) evalError(fL1S("WARNING: Include file %1 not found").arg(fileName)); return ReturnFalse; } @@ -1893,7 +1894,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile( QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto( const QString &fileName, ProValueMap *values, LoadFlags flags) { - QMakeEvaluator visitor(m_option, m_parser, m_handler); + QMakeEvaluator visitor(m_option, m_parser, m_vfs, m_handler); visitor.m_caller = this; visitor.m_outputDir = m_outputDir; visitor.m_featureRoots = m_featureRoots; diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index 63d34e8f76..4d2e7c7693 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -96,7 +96,7 @@ public: static void initStatics(); static void initFunctionStatics(); - QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, + QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, QMakeVfs *vfs, QMakeHandler *handler); ~QMakeEvaluator(); @@ -282,6 +282,7 @@ public: QMakeGlobals *m_option; QMakeParser *m_parser; QMakeHandler *m_handler; + QMakeVfs *m_vfs; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeEvaluator::LoadFlags) diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index ae0fdd0fac..9dd10ac448 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -29,6 +29,7 @@ #include "qmakeparser.h" +#include "qmakevfs.h" #include "ioutils.h" using namespace QMakeInternal; @@ -130,9 +131,10 @@ void QMakeParser::initialize() statics.strLITERAL_WHITESPACE = QLatin1String("LITERAL_WHITESPACE"); } -QMakeParser::QMakeParser(ProFileCache *cache, QMakeParserHandler *handler) +QMakeParser::QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler *handler) : m_cache(cache) , m_handler(handler) + , m_vfs(vfs) { // So that single-threaded apps don't have to call initialize() for now. initialize(); @@ -218,24 +220,14 @@ void QMakeParser::discardFileFromCache(const QString &fileName) bool QMakeParser::read(ProFile *pro) { - QFile file(pro->fileName()); - if (!file.open(QIODevice::ReadOnly)) { - if (m_handler && IoUtils::exists(pro->fileName())) + QString content; + QString errStr; + if (!m_vfs->readFile(pro->fileName(), &content, &errStr)) { + if (m_handler && m_vfs->exists(pro->fileName())) m_handler->message(QMakeParserHandler::ParserIoError, - fL1S("Cannot read %1: %2").arg(pro->fileName(), file.errorString())); + fL1S("Cannot read %1: %2").arg(pro->fileName(), errStr)); return false; } - - QByteArray bcont = file.readAll(); - if (bcont.startsWith("\xef\xbb\xbf")) { - // UTF-8 BOM will cause subtle errors - m_handler->message(QMakeParserHandler::ParserIoError, - fL1S("Unexpected UTF-8 BOM in %1").arg(pro->fileName())); - return false; - } - QString content(QString::fromLocal8Bit(bcont)); - bcont.clear(); - file.close(); return read(pro, content, 1, FullGrammar); } diff --git a/src/shared/proparser/qmakeparser.h b/src/shared/proparser/qmakeparser.h index 6fc599f617..87cd8c2244 100644 --- a/src/shared/proparser/qmakeparser.h +++ b/src/shared/proparser/qmakeparser.h @@ -67,6 +67,7 @@ public: }; class ProFileCache; +class QMakeVfs; class QMAKE_EXPORT QMakeParser { @@ -74,7 +75,7 @@ public: // Call this from a concurrency-free context static void initialize(); - QMakeParser(ProFileCache *cache, QMakeParserHandler *handler); + QMakeParser(ProFileCache *cache, QMakeVfs *vfs, QMakeParserHandler *handler); enum SubGrammar { FullGrammar, TestGrammar, ValueGrammar }; // fileName is expected to be absolute and cleanPath()ed. @@ -163,6 +164,7 @@ private: ProFileCache *m_cache; QMakeParserHandler *m_handler; + QMakeVfs *m_vfs; // This doesn't help gcc 3.3 ... template friend class QTypeInfo; diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp new file mode 100644 index 0000000000..69373c4a9e --- /dev/null +++ b/src/shared/proparser/qmakevfs.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "qmakevfs.h" + +#include "ioutils.h" +using namespace QMakeInternal; + +#include +#include +#include + +#define fL1S(s) QString::fromLatin1(s) + +QMakeVfs::QMakeVfs() +#ifndef PROEVALUATOR_FULL + : m_magicMissing(fL1S("missing")) + , m_magicExisting(fL1S("existing")) +#endif +{ +} + +bool QMakeVfs::writeFile(const QString &fn, QIODevice::OpenMode mode, const QString &contents, + QString *errStr) +{ +#ifndef PROEVALUATOR_FULL +# ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&m_mutex); +# endif + QString *cont = &m_files[fn]; + if (mode & QIODevice::Append) + *cont += contents; + else + *cont = contents; + Q_UNUSED(errStr) + return true; +#else + QFileInfo qfi(fn); + if (!QDir::current().mkpath(qfi.path())) { + *errStr = fL1S("Cannot create parent directory"); + return false; + } + QByteArray bytes = contents.toLocal8Bit(); + QFile cfile(fn); + if (!(mode & QIODevice::Append) && cfile.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (cfile.readAll() == bytes) + return true; + cfile.close(); + } + if (!cfile.open(mode | QIODevice::WriteOnly | QIODevice::Text)) { + *errStr = cfile.errorString(); + return false; + } + cfile.write(bytes); + cfile.close(); + if (cfile.error() != QFile::NoError) { + *errStr = cfile.errorString(); + return false; + } + return true; +#endif +} + +bool QMakeVfs::readFile(const QString &fn, QString *contents, QString *errStr) +{ +#ifndef PROEVALUATOR_FULL +# ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&m_mutex); +# endif + QHash::ConstIterator it = m_files.constFind(fn); + if (it != m_files.constEnd()) { + if (it->constData() == m_magicMissing.constData()) { + *errStr = fL1S("No such file or directory"); + return false; + } + if (it->constData() != m_magicExisting.constData()) { + *contents = *it; + return true; + } + } +#endif + + QFile file(fn); + if (!file.open(QIODevice::ReadOnly)) { +#ifndef PROEVALUATOR_FULL + if (!IoUtils::exists(fn)) { + m_files[fn] = m_magicMissing; + *errStr = fL1S("No such file or directory"); + } else +#endif + *errStr = file.errorString(); + return false; + } +#ifndef PROEVALUATOR_FULL + m_files[fn] = m_magicExisting; +#endif + + QByteArray bcont = file.readAll(); + if (bcont.startsWith("\xef\xbb\xbf")) { + // UTF-8 BOM will cause subtle errors + *errStr = fL1S("Unexpected UTF-8 BOM"); + return false; + } + *contents = QString::fromLocal8Bit(bcont); + return true; +} + +bool QMakeVfs::exists(const QString &fn) +{ +#ifndef PROEVALUATOR_FULL +# ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&m_mutex); +# endif + QHash::ConstIterator it = m_files.constFind(fn); + if (it != m_files.constEnd()) + return it->constData() != m_magicMissing.constData(); +#endif + bool ex = IoUtils::exists(fn); +#ifndef PROEVALUATOR_FULL + m_files[fn] = ex ? m_magicExisting : m_magicMissing; +#endif + return ex; +} + +#ifndef PROEVALUATOR_FULL +// This should be called when the sources may have changed (e.g., VCS update). +void QMakeVfs::invalidateCache() +{ +# ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&m_mutex); +# endif + QHash::Iterator it = m_files.begin(), eit = m_files.end(); + while (it != eit) { + if (it->constData() == m_magicMissing.constData() + ||it->constData() == m_magicExisting.constData()) + it = m_files.erase(it); + else + ++it; + } +} + +// This should be called when generated files may have changed (e.g., actual build). +void QMakeVfs::invalidateContents() +{ +# ifdef PROEVALUATOR_THREAD_SAFE + QMutexLocker locker(&m_mutex); +# endif + m_files.clear(); +} +#endif + +QT_END_NAMESPACE diff --git a/src/shared/proparser/qmakevfs.h b/src/shared/proparser/qmakevfs.h new file mode 100644 index 0000000000..045765a362 --- /dev/null +++ b/src/shared/proparser/qmakevfs.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMAKEVFS_H +#define QMAKEVFS_H + +#include "qmake_global.h" + +# include +#ifndef PROEVALUATOR_FULL +# include +# include +# ifdef PROEVALUATOR_THREAD_SAFE +# include +# endif +#endif + +QT_BEGIN_NAMESPACE + +class QMAKE_EXPORT QMakeVfs +{ +public: + QMakeVfs(); + + bool writeFile(const QString &fn, QIODevice::OpenMode mode, const QString &contents, QString *errStr); + bool readFile(const QString &fn, QString *contents, QString *errStr); + bool exists(const QString &fn); + +#ifndef PROEVALUATOR_FULL + void invalidateCache(); + void invalidateContents(); +#endif + +private: +#ifndef PROEVALUATOR_FULL +# ifdef PROEVALUATOR_THREAD_SAFE + QMutex m_mutex; +# endif + QHash m_files; + QString m_magicMissing; + QString m_magicExisting; +#endif +}; + +QT_END_NAMESPACE + +#endif // QMAKEVFS_H -- cgit v1.2.1 From 12652c20711fd29dcba62b8d5ba71c077d8bd06c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 31 May 2013 20:04:31 +0200 Subject: minor optimization: don't concatenate strings needlessly Change-Id: Iddec1a818ff9f3ad8b12491100883e433e4b8246 Reviewed-by: Daniel Teske --- src/shared/proparser/ioutils.cpp | 5 +++++ src/shared/proparser/ioutils.h | 1 + src/shared/proparser/qmakeevaluator.cpp | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp index 6706f80bee..79a336fa1d 100644 --- a/src/shared/proparser/ioutils.cpp +++ b/src/shared/proparser/ioutils.cpp @@ -76,6 +76,11 @@ bool IoUtils::isRelativePath(const QString &path) return true; } +QStringRef IoUtils::pathName(const QString &fileName) +{ + return fileName.leftRef(fileName.lastIndexOf(QLatin1Char('/')) + 1); +} + QStringRef IoUtils::fileName(const QString &fileName) { return fileName.midRef(fileName.lastIndexOf(QLatin1Char('/')) + 1); diff --git a/src/shared/proparser/ioutils.h b/src/shared/proparser/ioutils.h index 865e4a7511..e4773ca50d 100644 --- a/src/shared/proparser/ioutils.h +++ b/src/shared/proparser/ioutils.h @@ -52,6 +52,7 @@ public: static bool exists(const QString &fileName) { return fileType(fileName) != FileNotFound; } static bool isRelativePath(const QString &fileName); static bool isAbsolutePath(const QString &fileName) { return !isRelativePath(fileName); } + static QStringRef pathName(const QString &fileName); // Requires normalized path static QStringRef fileName(const QString &fileName); // Requires normalized path static QString resolvePath(const QString &baseDir, const QString &fileName); static QString shellQuoteUnix(const QString &arg); diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 5a750adbd0..fea9ba2b4c 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1845,8 +1845,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile( int start_root = 0; QString currFn = currentFileName(); if (IoUtils::fileName(currFn) == IoUtils::fileName(fn)) { + QStringRef currPath = IoUtils::pathName(currFn); for (int root = 0; root < m_featureRoots.size(); ++root) - if (currFn == m_featureRoots.at(root) + fn) { + if (currPath == m_featureRoots.at(root)) { start_root = root + 1; break; } -- cgit v1.2.1 From fa27cd79e05aed4ebd16d5648480cc7d48fefd43 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 3 Jun 2013 19:08:10 +0200 Subject: cache results of feature search looking up the same files in the same locations over and over again is a rather significant waste. in particular, looking up the CONFIG flags that don't correspond with features has a measurable impact on qt creator's project loading time. Task-number: QTCREATORBUG-9154 Change-Id: Ibae3d8b7797e706a6416a7d45c77734ab1281b51 Reviewed-by: Daniel Teske --- src/shared/proparser/qmakeevaluator.cpp | 66 +++++++++++++++++++++------------ src/shared/proparser/qmakeevaluator.h | 20 +++++++++- 2 files changed, 62 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index fea9ba2b4c..067384a682 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -1482,7 +1482,7 @@ void QMakeEvaluator::updateFeaturePaths() foreach (const QString &root, feature_roots) if (IoUtils::exists(root)) ret << root; - m_featureRoots = ret; + m_featureRoots = new QMakeFeatureRoots(ret); } ProString QMakeEvaluator::propertyValue(const ProKey &name) const @@ -1840,35 +1840,55 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFeatureFile( if (!fn.endsWith(QLatin1String(".prf"))) fn += QLatin1String(".prf"); - if (m_featureRoots.isEmpty()) + if (!m_featureRoots) updateFeaturePaths(); - int start_root = 0; +#ifdef PROEVALUATOR_THREAD_SAFE + m_featureRoots->mutex.lock(); +#endif QString currFn = currentFileName(); - if (IoUtils::fileName(currFn) == IoUtils::fileName(fn)) { - QStringRef currPath = IoUtils::pathName(currFn); - for (int root = 0; root < m_featureRoots.size(); ++root) - if (currPath == m_featureRoots.at(root)) { - start_root = root + 1; - break; + if (IoUtils::fileName(currFn) != IoUtils::fileName(fn)) + currFn.clear(); + // Null values cannot regularly exist in the hash, so they indicate that the value still + // needs to be determined. Failed lookups are represented via non-null empty strings. + QString *fnp = &m_featureRoots->cache[qMakePair(fn, currFn)]; + if (fnp->isNull()) { + int start_root = 0; + const QStringList &paths = m_featureRoots->paths; + if (!currFn.isEmpty()) { + QStringRef currPath = IoUtils::pathName(currFn); + for (int root = 0; root < paths.size(); ++root) + if (currPath == paths.at(root)) { + start_root = root + 1; + break; + } + } + for (int root = start_root; root < paths.size(); ++root) { + QString fname = paths.at(root) + fn; + if (IoUtils::exists(fname)) { + fn = fname; + goto cool; } - } - for (int root = start_root; root < m_featureRoots.size(); ++root) { - QString fname = m_featureRoots.at(root) + fn; - if (IoUtils::exists(fname)) { - fn = fname; - goto cool; } - } #ifdef QMAKE_BUILTIN_PRFS - fn.prepend(QLatin1String(":/qmake/features/")); - if (QFileInfo(fn).exists()) - goto cool; + fn.prepend(QLatin1String(":/qmake/features/")); + if (QFileInfo(fn).exists()) + goto cool; #endif - if (!silent) - evalError(fL1S("Cannot find feature %1").arg(fileName)); - return ReturnFalse; + fn = QLatin1String(""); // Indicate failed lookup. See comment above. - cool: + cool: + *fnp = fn; + } else { + fn = *fnp; + } +#ifdef PROEVALUATOR_THREAD_SAFE + m_featureRoots->mutex.unlock(); +#endif + if (fn.isEmpty()) { + if (!silent) + evalError(fL1S("Cannot find feature %1").arg(fileName)); + return ReturnFalse; + } ProStringList &already = valuesRef(ProKey("QMAKE_INTERNAL_INCLUDED_FEATURES")); ProString afn(fn); if (already.contains(afn)) { diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index 4d2e7c7693..188b8c05ce 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -43,9 +43,13 @@ #include #include #include +#include #ifndef QT_BOOTSTRAPPED # include #endif +#ifdef PROEVALUATOR_THREAD_SAFE +# include +#endif QT_BEGIN_NAMESPACE @@ -71,6 +75,20 @@ public: virtual void doneWithEval(ProFile *parent) = 0; }; +typedef QPair QMakeFeatureKey; // key, parent +typedef QHash QMakeFeatureHash; + +class QMAKE_EXPORT QMakeFeatureRoots : public QSharedData +{ +public: + QMakeFeatureRoots(const QStringList &_paths) : paths(_paths) {} + const QStringList paths; + mutable QMakeFeatureHash cache; +#ifdef PROEVALUATOR_THREAD_SAFE + mutable QMutex mutex; +#endif +}; + // We use a QLinkedList based stack instead of a QVector based one (QStack), so that // the addresses of value maps stay constant. The qmake generators rely on that. class QMAKE_EXPORT ProValueMapStack : public QLinkedList @@ -271,7 +289,7 @@ public: QStringList m_qmakepath; QStringList m_qmakefeatures; QStringList m_mkspecPaths; - QStringList m_featureRoots; + QExplicitlySharedDataPointer m_featureRoots; ProString m_dirSep; ProFunctionDefs m_functionDefs; ProStringList m_returnValue; -- cgit v1.2.1 From 28df27d924bb407791a76de8159c9ffa6efde283 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 3 Jun 2013 19:22:23 +0200 Subject: update m_featureRoots less aggressively MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it's not necessary to immediately re-calculate the roots after assigning QMAKE_PLATFORM - it's sufficient to do it on-demand, so merely invalidate them. this avoids that we re-calculate them multiple times without ever using them in between while processing specs with distributed platform assignments. Change-Id: If508594764811b96a577fc81c5ded34ab0453148 Reviewed-by: Tor Arne Vestbø --- src/shared/proparser/qmakeevaluator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 067384a682..db6af6f730 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -922,7 +922,7 @@ void QMakeEvaluator::visitProVariable( if (varName == statics.strTEMPLATE) setTemplate(); else if (varName == statics.strQMAKE_PLATFORM) - updateFeaturePaths(); + m_featureRoots = 0; #ifdef PROEVALUATOR_FULL else if (varName == statics.strREQUIRES) checkRequirements(values(varName)); @@ -1146,6 +1146,7 @@ bool QMakeEvaluator::loadSpecInternal() #endif valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespec); m_qmakespecName = IoUtils::fileName(m_qmakespec).toString(); + // This also ensures that m_featureRoots is valid. if (evaluateFeatureFile(QLatin1String("spec_post.prf")) != ReturnTrue) return false; // The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it -- cgit v1.2.1 From 1738ff64a6b8efa571567a9ed58716b895a931b3 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 May 2013 12:18:34 +0200 Subject: CppEditor: Fix moving definitions * Move initializer lists completely * Respect whitespace as it is Task-number: QTCREATORBUG-9462 Task-number: QTCREATORBUG-9463 Change-Id: Id9c41394b4aa55b0a85957286ab42f2ce8966c08 Reviewed-by: Erik Verbruggen --- src/plugins/cppeditor/cppeditorplugin.h | 3 +- src/plugins/cppeditor/cppquickfix_test.cpp | 135 ++++++++++++++++++++++------- src/plugins/cppeditor/cppquickfixes.cpp | 21 ++--- 3 files changed, 116 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h index 239e6dc844..64c19e3130 100644 --- a/src/plugins/cppeditor/cppeditorplugin.h +++ b/src/plugins/cppeditor/cppeditorplugin.h @@ -178,7 +178,8 @@ private slots: void test_quickfix_MoveFuncDefOutside_MemberFuncOutsideWithNs(); void test_quickfix_MoveFuncDefOutside_FreeFuncToCpp(); void test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS(); - void test_quickfix_MoveFuncDefOutside_CtorWithInitialization(); + void test_quickfix_MoveFuncDefOutside_CtorWithInitialization1(); + void test_quickfix_MoveFuncDefOutside_CtorWithInitialization2(); void test_quickfix_MoveFuncDefToDecl_MemberFunc(); void test_quickfix_MoveFuncDefToDecl_MemberFuncOutside(); diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 74e64c8766..66aa48fd47 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -1310,7 +1310,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp() // Header File original = "class Foo {\n" - " inline int numbe@r() const {\n" + " inline int numbe@r() const\n" + " {\n" " return 5;\n" " }\n" "\n" @@ -1332,7 +1333,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCpp() "#include \"file.h\"\n" "\n" "\n" - "int Foo::number() const {\n" + "int Foo::number() const\n" + "{\n" " return 5;\n" "}\n" "\n"; @@ -1348,7 +1350,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutside() { QByteArray original = "class Foo {\n" - " inline int numbe@r() const {\n" + " inline int numbe@r() const\n" + " {\n" " return 5;\n" " }\n" "};"; @@ -1357,7 +1360,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutside() " inline int number() const;\n" "};\n" "\n" - "int Foo::number() const {\n" + "int Foo::number() const\n" + "{\n" " return 5;\n" "}" "\n\n"; @@ -1378,7 +1382,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNS() original = "namespace MyNs {\n" "class Foo {\n" - " inline int numbe@r() const {\n" + " inline int numbe@r() const\n" + " {\n" " return 5;\n" " }\n" "};\n" @@ -1399,7 +1404,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNS() "#include \"file.h\"\n" "\n" "\n" - "int MyNs::Foo::number() const {\n" + "int MyNs::Foo::number() const\n" + "{\n" " return 5;\n" "}\n" "\n"; @@ -1421,7 +1427,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNSUsing() original = "namespace MyNs {\n" "class Foo {\n" - " inline int numbe@r() const {\n" + " inline int numbe@r() const\n" + " {\n" " return 5;\n" " }\n" "};\n" @@ -1444,7 +1451,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncToCppNSUsing() "using namespace MyNs;\n" "\n" "\n" - "int Foo::number() const {\n" + "int Foo::number() const\n" + "{\n" " return 5;\n" "}\n" "\n"; @@ -1461,7 +1469,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutsideWithNs() QByteArray original = "namespace MyNs {\n" "class Foo {\n" - " inline int numbe@r() const {\n" + " inline int numbe@r() const\n" + " {\n" " return 5;\n" " }\n" "};}"; @@ -1471,7 +1480,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutsideWithNs() " inline int number() const;\n" "};\n" "\n" - "int Foo::number() const {\n" + "int Foo::number() const\n" + "{\n" " return 5;\n" "}" "\n}\n"; @@ -1490,7 +1500,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCpp() // Header File original = - "int numbe@r() const {\n" + "int numbe@r() const\n" + "{\n" " return 5;\n" "}\n"; expected = @@ -1506,7 +1517,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCpp() "#include \"file.h\"\n" "\n" "\n" - "int number() const {\n" + "int number() const\n" + "{\n" " return 5;\n" "}\n" "\n"; @@ -1527,7 +1539,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS() // Header File original = "namespace MyNamespace {\n" - "int numbe@r() const {\n" + "int numbe@r() const\n" + "{\n" " return 5;\n" "}\n" "}\n"; @@ -1546,7 +1559,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS() "#include \"file.h\"\n" "\n" "\n" - "int MyNamespace::number() const {\n" + "int MyNamespace::number() const\n" + "{\n" " return 5;\n" "}\n" "\n"; @@ -1558,7 +1572,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_FreeFuncToCppNS() } /// Check: Move Ctor with member initialization list (QTCREATORBUG-9157). -void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_CtorWithInitialization() +void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_CtorWithInitialization1() { QList testFiles; QByteArray original; @@ -1597,6 +1611,51 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_CtorWithInitialization() data.run(&factory); } +/// Check: Move Ctor with member initialization list (QTCREATORBUG-9462). +void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_CtorWithInitialization2() +{ + QList testFiles; + QByteArray original; + QByteArray expected; + + // Header File + original = + "class Foo\n" + "{\n" + "public:\n" + " Fo@o() : member(2)\n" + " {\n" + " }\n" + "\n" + " int member;\n" + "};"; + + expected = + "class Foo\n" + "{\n" + "public:\n" + " Foo();\n" + "\n" + " int member;\n" + "};\n"; + testFiles << TestDocument::create(original, expected, QLatin1String("file.h")); + + // Source File + original ="#include \"file.h\"\n"; + expected = + "#include \"file.h\"\n" + "\n" + "Foo::Foo() : member(2)\n" + "{\n" + "}\n" + "\n"; + testFiles << TestDocument::create(original, expected, QLatin1String("file.cpp")); + + MoveFuncDefOutside factory; + TestCase data(testFiles); + data.run(&factory); +} + /// Check: revert test_quickfix_MoveFuncDefOutside_MemberFuncToCpp() void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFunc() { @@ -1605,8 +1664,14 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFunc() QByteArray expected; // Header File - original = "class Foo {inline int number() const;};\n"; - expected = "class Foo {inline int number() const {return 5;}};\n\n"; + original = + "class Foo {\n" + " inline int number() const;\n" + "};\n"; + expected = + "class Foo {\n" + " inline int number() const {return 5;}\n" + "};\n\n"; testFiles << TestDocument::create(original, expected, QLatin1String("file.h")); // Source File @@ -1632,13 +1697,15 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFuncOutside() " inline int number() const;\n" "};\n" "\n" - "int Foo::num@ber() const {\n" + "int Foo::num@ber() const\n" + "{\n" " return 5;\n" "}\n"; QByteArray expected = "class Foo {\n" - " inline int number() const {\n" + " inline int number() const\n" + " {\n" " return 5;\n" " }\n" "};\n" @@ -1666,7 +1733,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFuncToCppNS() expected = "namespace MyNs {\n" "class Foo {\n" - " inline int number() const {\n" + " inline int number() const\n" + " {\n" " return 5;\n" " }\n" "};\n" @@ -1677,7 +1745,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFuncToCppNS() original = "#include \"file.h\"\n" "\n" - "int MyNs::Foo::num@ber() const {\n" + "int MyNs::Foo::num@ber() const\n" + "{\n" " return 5;\n" "}\n"; expected = "#include \"file.h\"\n\n\n\n"; @@ -1705,7 +1774,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFuncToCppNSUsing() expected = "namespace MyNs {\n" "class Foo {\n" - " inline int number() const {\n" + " inline int number() const\n" + " {\n" " return 5;\n" " }\n" "};\n" @@ -1717,7 +1787,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFuncToCppNSUsing() "#include \"file.h\"\n" "using namespace MyNs;\n" "\n" - "int Foo::num@ber() const {\n" + "int Foo::num@ber() const\n" + "{\n" " return 5;\n" "}\n"; expected = @@ -1740,14 +1811,16 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_MemberFuncOutsideWithNs() " inline int number() const;\n" "};\n" "\n" - "int Foo::numb@er() const {\n" + "int Foo::numb@er() const\n" + "{\n" " return 5;\n" "}" "\n}\n"; QByteArray expected = "namespace MyNs {\n" "class Foo {\n" - " inline int number() const {\n" + " inline int number() const\n" + " {\n" " return 5;\n" " }\n" "};\n\n\n}\n\n"; @@ -1767,7 +1840,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_FreeFuncToCpp() // Header File original = "int number() const;\n"; expected = - "int number() const {\n" + "int number() const\n" + "{\n" " return 5;\n" "}\n\n"; testFiles << TestDocument::create(original, expected, QLatin1String("file.h")); @@ -1777,7 +1851,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_FreeFuncToCpp() "#include \"file.h\"\n" "\n" "\n" - "int numb@er() const {\n" + "int numb@er() const\n" + "{\n" " return 5;\n" "}\n"; expected = "#include \"file.h\"\n\n\n\n\n"; @@ -1802,7 +1877,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_FreeFuncToCppNS() "}\n"; expected = "namespace MyNamespace {\n" - "int number() const {\n" + "int number() const\n" + "{\n" " return 5;\n" "}\n" "}\n\n"; @@ -1812,7 +1888,8 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_FreeFuncToCppNS() original = "#include \"file.h\"\n" "\n" - "int MyNamespace::nu@mber() const {\n" + "int MyNamespace::nu@mber() const\n" + "{\n" " return 5;\n" "}\n"; expected = diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 2c320ab533..095e596ad3 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3816,13 +3816,10 @@ public: // construct definition const QString funcDec = getDefinitionSignature(assistInterface(), m_func, toFile, scopeAtInsertPos); - QString textFuncBody; - if (m_funcDef->ctor_initializer) - textFuncBody = fromFile->textOf(m_funcDef->ctor_initializer) + QLatin1Char(' '); - textFuncBody += fromFile->textOf(m_funcDef->function_body); - QString funcDef = QString::fromLatin1("\n%1 %2\n") - .arg(funcDec) - .arg(textFuncBody); + QString funcDef = QLatin1String("\n") + funcDec; + const int startPosition = fromFile->endOf(m_funcDef->declarator); + const int endPosition = fromFile->endOf(m_funcDef->function_body); + funcDef += fromFile->textOf(startPosition, endPosition) + QLatin1String("\n"); if (m_cppFileName.isEmpty() || !m_insideHeader) funcDef = QLatin1String("\n") + funcDef; @@ -3840,7 +3837,7 @@ public: headerTarget.remove(fromFile->range(m_funcDef)); } else { QString textFuncDecl = fromFile->textOf(m_funcDef); - textFuncDecl.remove(-textFuncBody.length(), textFuncBody.length()); + textFuncDecl.truncate(startPosition - fromFile->startOf(m_funcDef)); textFuncDecl = textFuncDecl.trimmed() + QLatin1String(";"); headerTarget.replace(fromFile->range(m_funcDef), textFuncDecl); } @@ -3945,12 +3942,10 @@ public: CppRefactoringFilePtr fromFile = refactoring.file(m_fromFileName); CppRefactoringFilePtr toFile = refactoring.file(m_toFileName); ChangeSet::Range fromRange = fromFile->range(m_funcAST); - const QString definitionText = fromFile->textOf(m_funcAST->function_body); - QString wholeFunctionText = m_declarationText; - if (m_funcAST->ctor_initializer) - wholeFunctionText += QLatin1Char(' ') + fromFile->textOf(m_funcAST->ctor_initializer); - wholeFunctionText += QLatin1Char(' ') + definitionText; + const QString wholeFunctionText = m_declarationText + + fromFile->textOf(fromFile->endOf(m_funcAST->declarator), + fromFile->endOf(m_funcAST->function_body)); // Replace declaration with function and delete old definition Utils::ChangeSet toTarget; -- cgit v1.2.1 From cc1b66f1cc7971a67fada98a375e3ad241ec981c Mon Sep 17 00:00:00 2001 From: Lorenz Haas Date: Thu, 30 May 2013 17:32:15 +0200 Subject: CppTools: Open InsertionPointLocator::methodDefinition for symbols Remove restricted use of declarations and add an option to define if SymbolFinder should be used to find a matching definition for symbol. Change-Id: If5cf5b11926e116766dd60dd3726b4fcf2e1c9f5 Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/insertionpointlocator.cpp | 15 +++++++++------ src/plugins/cpptools/insertionpointlocator.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp index 08d9722086..f7118a2cfe 100644 --- a/src/plugins/cpptools/insertionpointlocator.cpp +++ b/src/plugins/cpptools/insertionpointlocator.cpp @@ -363,7 +363,7 @@ public: : ASTVisitor(translationUnit) {} - void operator()(Declaration *decl, unsigned *line, unsigned *column) + void operator()(Symbol *decl, unsigned *line, unsigned *column) { // default to end of file _bestToken.maybeSet(-1, translationUnit()->ast()->lastToken()); @@ -470,7 +470,7 @@ static Declaration *isNonVirtualFunctionDeclaration(Symbol *s) return declaration; } -static InsertionLocation nextToSurroundingDefinitions(Declaration *declaration, const CppRefactoringChanges &changes) +static InsertionLocation nextToSurroundingDefinitions(Symbol *declaration, const CppRefactoringChanges &changes) { InsertionLocation noResult; Class *klass = declaration->enclosingClass(); @@ -545,15 +545,18 @@ static InsertionLocation nextToSurroundingDefinitions(Declaration *declaration, return InsertionLocation(QString::fromUtf8(definitionFunction->fileName()), prefix, suffix, line, column); } -QList InsertionPointLocator::methodDefinition(Declaration *declaration) const +QList InsertionPointLocator::methodDefinition(Symbol *declaration, + bool useSymbolFinder) const { QList result; if (!declaration) return result; - CppTools::SymbolFinder symbolFinder; - if (symbolFinder.findMatchingDefinition(declaration, m_refactoringChanges.snapshot(), true)) - return result; + if (useSymbolFinder) { + CppTools::SymbolFinder symbolFinder; + if (symbolFinder.findMatchingDefinition(declaration, m_refactoringChanges.snapshot(), true)) + return result; + } const InsertionLocation location = nextToSurroundingDefinitions(declaration, m_refactoringChanges); if (location.isValid()) { diff --git a/src/plugins/cpptools/insertionpointlocator.h b/src/plugins/cpptools/insertionpointlocator.h index da9799744b..f5ea46d26d 100644 --- a/src/plugins/cpptools/insertionpointlocator.h +++ b/src/plugins/cpptools/insertionpointlocator.h @@ -98,7 +98,8 @@ public: const CPlusPlus::Class *clazz, AccessSpec xsSpec) const; - QList methodDefinition(CPlusPlus::Declaration *declaration) const; + QList methodDefinition(CPlusPlus::Symbol *declaration, + bool useSymbolFinder = true) const; private: CppRefactoringChanges m_refactoringChanges; -- cgit v1.2.1 From b90c26bd55d8842e160b74f47e4c4b3112844d82 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 3 Jun 2013 15:58:08 +0200 Subject: QmlDesigner: Add plugin directory to the exported directories Change-Id: If230176bc7e96476e2f748d850a5a4c93b57cafa Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/qmldesigner_dependencies.pri | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/qmldesigner/qmldesigner_dependencies.pri b/src/plugins/qmldesigner/qmldesigner_dependencies.pri index d341b0e0f6..654b5cb1c6 100644 --- a/src/plugins/qmldesigner/qmldesigner_dependencies.pri +++ b/src/plugins/qmldesigner/qmldesigner_dependencies.pri @@ -10,6 +10,7 @@ QTC_PLUGIN_DEPENDS += \ qtsupport \ projectexplorer INCLUDEPATH *= \ + $$PWD \ $$PWD/../../../share/qtcreator/qml/qmlpuppet/interfaces \ $$PWD/designercore \ $$PWD/designercore/include \ -- cgit v1.2.1 From 093c937c4fa37f4a9c31a9705e103717d691d3bf Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 3 Jun 2013 15:59:22 +0200 Subject: QmlDesigner: Export DesignDocument Change-Id: I3aa1217c990ae36a43b269d8177fc5566b1c9dea Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/components/integration/designdocument.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 69ede61ee4..62604686b4 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -59,7 +59,7 @@ class CrumbleBarInfo; class ViewManager; class QmlModelView; -class DesignDocument: public QObject +class QMLDESIGNERCORE_EXPORT DesignDocument: public QObject { Q_OBJECT public: -- cgit v1.2.1 From 4ca80b15773ab7ed0e74c89777a1005a75bb6c57 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 4 Jun 2013 17:58:50 +0200 Subject: QmlDesigner: Add panning for the formeditor You can now pan if you drag the mouse around with the middle mouse button. Change-Id: I70e1666c542406b126214c2b9b8b56193bcbcf76 Reviewed-by: Thomas Hartmann --- .../formeditor/formeditorgraphicsview.cpp | 42 +++++++++++++++++++++- .../components/formeditor/formeditorgraphicsview.h | 6 +++- 2 files changed, 46 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp index 04484561dc..cf7cd7770a 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp @@ -31,11 +31,13 @@ #include #include +#include namespace QmlDesigner { FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) : - QGraphicsView(parent) + QGraphicsView(parent), + m_isPanning(false) { setTransformationAnchor(QGraphicsView::AnchorUnderMouse); setResizeAnchor(QGraphicsView::AnchorViewCenter); @@ -74,6 +76,44 @@ void FormEditorGraphicsView::wheelEvent(QWheelEvent *event) } +void FormEditorGraphicsView::mousePressEvent(QMouseEvent *event) +{ + if (event->buttons().testFlag(Qt::MiddleButton)) { + m_isPanning = true; + m_panStartX = event->x(); + m_panStartY = event->y(); + setCursor(Qt::ClosedHandCursor); + event->accept(); + } else { + QGraphicsView::mousePressEvent(event); + } +} + +void FormEditorGraphicsView::mouseMoveEvent(QMouseEvent *event) +{ + if (m_isPanning) { + horizontalScrollBar()->setValue(horizontalScrollBar()->value() - (event->x() - m_panStartX)); + verticalScrollBar()->setValue(verticalScrollBar()->value() - (event->y() - m_panStartY)); + m_panStartX = event->x(); + m_panStartY = event->y(); + event->accept(); + }else { + QGraphicsView::mouseMoveEvent(event); + } +} + +void FormEditorGraphicsView::mouseReleaseEvent(QMouseEvent *event) +{ + if (m_isPanning) { + + m_isPanning = false; + setCursor(Qt::ArrowCursor); + event->accept(); + }else { + QGraphicsView::mouseReleaseEvent(event); + } +} + void FormEditorGraphicsView::setRootItemRect(const QRectF &rect) { m_rootItemRect = rect; diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h index dd29d41e18..8b53691f0f 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h @@ -46,8 +46,12 @@ public: protected: void drawBackground(QPainter *painter, const QRectF &rect); void wheelEvent(QWheelEvent *event); - + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); private: + bool m_isPanning; + int m_panStartX, m_panStartY; QRectF m_rootItemRect; }; -- cgit v1.2.1 From 808afcfbb2d03220cab4d85a51c82c8c2737bfbe Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Tue, 7 May 2013 19:32:33 +0200 Subject: Git - made Clean List support submodules Change-Id: I106420e8492d64451eee3648800ce57a4de2bfb9 Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 13ac15ba6a..6596c2a413 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2029,7 +2029,6 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString & // Retrieve list of files to be cleaned bool GitClient::cleanList(const QString &workingDirectory, const QString &flag, QStringList *files, QString *errorMessage) { - files->clear(); QStringList args; args << QLatin1String("clean") << QLatin1String("--dry-run") << flag; QByteArray outputText; @@ -2052,6 +2051,15 @@ bool GitClient::synchronousCleanList(const QString &workingDirectory, QStringLis { bool res = cleanList(workingDirectory, QLatin1String("-df"), files, errorMessage); res &= cleanList(workingDirectory, QLatin1String("-dXf"), ignoredFiles, errorMessage); + + SubmoduleDataMap submodules = submoduleList(workingDirectory); + foreach (const SubmoduleData &submodule, submodules) { + if (submodule.ignore != QLatin1String("all") + && submodule.ignore != QLatin1String("dirty")) { + res &= synchronousCleanList(workingDirectory + QLatin1Char('/') + submodule.dir, + files, ignoredFiles, errorMessage); + } + } return res; } -- cgit v1.2.1 From 45e6edaf3ad77e020403606d385afd83f3b31264 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Tue, 4 Jun 2013 23:04:43 +0200 Subject: Git - fix bug with empty working directory in ChangeSelectionDialog and also remove unnedded command. Change-Id: I6c20f2061fc3628693d80ad01fe23c1a835ca127 Reviewed-by: Orgad Shaneh --- src/plugins/git/changeselectiondialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 4f0e483750..cc5dc40b22 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -157,7 +157,7 @@ void ChangeSelectionDialog::chooseWorkingDirectory() QString ChangeSelectionDialog::workingDirectory() const { - if (!QDir(m_workingDirEdit->text()).exists()) + if (m_workingDirEdit->text().isEmpty() || !QDir(m_workingDirEdit->text()).exists()) return QString(); return GitPlugin::instance()->gitClient()-> @@ -230,7 +230,6 @@ void ChangeSelectionDialog::recalculateDetails() QString workingDir = workingDirectory(); QPalette palette = m_workingDirEdit->palette(); if (workingDir.isEmpty()) { - m_workingDirEdit->palette(); m_detailsText->setPlainText(tr("Error: Bad working directory.")); palette.setColor(QPalette::Text, Qt::red); m_workingDirEdit->setPalette(palette); -- cgit v1.2.1 From 046fd0523d2ef5efb14e05898116c12ce8979a70 Mon Sep 17 00:00:00 2001 From: Petar Perisin Date: Tue, 4 Jun 2013 22:41:58 +0200 Subject: Git - remove unnecessary member m_createRepositoryAction Change-Id: I3b3f72c5699e63f3f273b1564ea0a093b6c9725b Reviewed-by: Orgad Shaneh --- src/plugins/git/gitplugin.cpp | 6 +++--- src/plugins/git/gitplugin.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index bbc5ef771b..594edf057f 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -657,9 +657,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) // -------------- gitContainer->addSeparator(globalcontext); - m_createRepositoryAction = new QAction(tr("Create Repository..."), this); - Core::Command *createRepositoryCommand = Core::ActionManager::registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext); - connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); + QAction *repositoryAction = new QAction(tr("Create Repository..."), this); + Core::Command *createRepositoryCommand = Core::ActionManager::registerAction(repositoryAction, "Git.CreateRepository", globalcontext); + connect(repositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); gitContainer->addAction(createRepositoryCommand); if (0) { diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 05cbc2575d..c7ff4a9e4a 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -202,7 +202,6 @@ private: static GitPlugin *m_instance; Locator::CommandLocator *m_commandLocator; - QAction *m_createRepositoryAction; QAction *m_submitCurrentAction; QAction *m_diffSelectedFilesAction; -- cgit v1.2.1 From 9d0346a373ac379d7d002e267ff856eb85cd0e07 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 4 Jun 2013 17:35:11 +0200 Subject: diffeditor: Fix qbs build Change-Id: Ia657fbe20f51657295bfe657a88dab58c668c3f1 Reviewed-by: Jarek Kobus --- src/plugins/diffeditor/diffeditor.qbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/diffeditor/diffeditor.qbs b/src/plugins/diffeditor/diffeditor.qbs index 1b1d5fd974..e4afa534f4 100644 --- a/src/plugins/diffeditor/diffeditor.qbs +++ b/src/plugins/diffeditor/diffeditor.qbs @@ -14,8 +14,8 @@ QtcPlugin { files: [ "diffeditor_global.h", "diffeditorconstants.h", - "diffeditoreditable.cpp", - "diffeditoreditable.h", + "diffeditor.cpp", + "diffeditor.h", "diffeditorfile.cpp", "diffeditorfile.h", "diffeditorplugin.cpp", -- cgit v1.2.1 From f99ce422b475c000e1bbdadf13da232dd54d9cca Mon Sep 17 00:00:00 2001 From: jkobus Date: Tue, 4 Jun 2013 16:06:18 +0200 Subject: Remove unused code Change-Id: Icc4bb2648fc4e18e95216012ce08365940a80937 Reviewed-by: Tobias Hunger --- src/plugins/git/gitplugin.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 594edf057f..1f0cc2d097 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -118,13 +118,6 @@ static const VcsBase::VcsBaseEditorParameters editorParameters[] = { "text/vnd.qtcreator.git.rebase"}, }; -// Utility to find a parameter set by type -static inline const VcsBase::VcsBaseEditorParameters *findType(int ie) -{ - const VcsBase::EditorContentType et = static_cast(ie); - return VcsBase::VcsBaseEditorWidget::findType(editorParameters, sizeof(editorParameters)/sizeof(VcsBase::VcsBaseEditorParameters), et); -} - Q_DECLARE_METATYPE(Git::Internal::GitClientMemberFunc) using namespace Git; -- cgit v1.2.1 From 7c8db79817ed436176f6055b5c6f8ccf6df16c4c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 31 May 2013 12:52:53 +0200 Subject: Switch less often to edit mode This change * Removes IMode::type, ModeManager::activateModeType, and IEditor::preferredModeType, and adds IEditor::isDesignModePreferred instead * Adapts the mode switching code in EditorManager to handle multiple windows, for example switching to edit mode should only happen if the editor/view is in the main window. Otherwise the editor window should be raised and focused * Renames EditorManager::NoActivate --> DoNotChangeCurrentEditor * Reverts the EditorManager::ModeSwitch logic to switch mode or make the current editor visible by default, introducing DoNotMakeVisible flag instead * Fixes a few instances where EditorManager::ModeSwitch should have been used One non-trivial problem left: If you open a .ui file and switch to an external editor window, edit mode is activated, because the current editor no longer is a .ui file, which means that the design mode gets deactivated. Change-Id: I76c5c2391eb4090143b778fb103acff3a5a1ff41 Reviewed-by: David Schulz --- src/plugins/analyzerbase/analyzermanager.cpp | 1 - src/plugins/bazaar/bazaarplugin.cpp | 4 +- src/plugins/clearcase/clearcaseplugin.cpp | 14 +++--- src/plugins/coreplugin/basefilewizard.cpp | 2 +- src/plugins/coreplugin/designmode.cpp | 1 - src/plugins/coreplugin/documentmanager.cpp | 2 +- src/plugins/coreplugin/editmode.cpp | 1 - .../coreplugin/editormanager/editormanager.cpp | 55 ++++++++++------------ .../coreplugin/editormanager/editormanager.h | 5 +- .../coreplugin/editormanager/editorview.cpp | 12 ++--- src/plugins/coreplugin/editormanager/ieditor.h | 2 +- .../coreplugin/editormanager/openeditorsview.cpp | 2 +- .../coreplugin/editormanager/openeditorswindow.cpp | 5 +- src/plugins/coreplugin/editortoolbar.cpp | 2 +- src/plugins/coreplugin/imode.h | 3 -- src/plugins/coreplugin/mainwindow.cpp | 6 +-- src/plugins/coreplugin/modemanager.cpp | 23 ++------- src/plugins/coreplugin/modemanager.h | 1 - src/plugins/cpaster/cpasterplugin.cpp | 2 +- src/plugins/cppeditor/cppeditor.cpp | 2 +- src/plugins/cpptools/cppcurrentdocumentfilter.cpp | 3 +- src/plugins/cpptools/cppfilesettingspage.cpp | 3 +- src/plugins/cpptools/cppfindreferences.cpp | 7 +-- src/plugins/cpptools/cpplocatorfilter.cpp | 3 +- src/plugins/cpptools/cpptoolsplugin.cpp | 3 +- src/plugins/cvs/cvsplugin.cpp | 13 +++-- src/plugins/debugger/debuggerplugin.cpp | 1 - src/plugins/debugger/qml/qmlinspectoradapter.cpp | 3 +- src/plugins/designer/formeditorw.cpp | 2 +- src/plugins/designer/formwindoweditor.cpp | 4 +- src/plugins/designer/formwindoweditor.h | 2 +- src/plugins/designer/qtcreatorintegration.cpp | 4 +- src/plugins/diffeditor/diffeditorplugin.cpp | 2 +- src/plugins/diffeditor/diffeditorwidget.cpp | 2 +- src/plugins/git/gitclient.cpp | 8 ++-- src/plugins/git/gitplugin.cpp | 3 +- src/plugins/helloworld/helloworldplugin.cpp | 1 - src/plugins/locator/basefilefilter.cpp | 2 +- src/plugins/locator/filesystemfilter.cpp | 2 +- src/plugins/locator/opendocumentsfilter.cpp | 2 +- src/plugins/madde/maemopackagecreationwidget.cpp | 3 +- src/plugins/mercurial/mercurialplugin.cpp | 3 +- src/plugins/perforce/perforceplugin.cpp | 7 ++- .../projectexplorer/foldernavigationwidget.cpp | 2 +- src/plugins/projectexplorer/projectexplorer.cpp | 3 +- src/plugins/projectexplorer/projecttreewidget.cpp | 2 +- .../components/formeditor/formeditorcrumblebar.cpp | 3 +- .../components/integration/designdocument.cpp | 2 +- .../components/navigator/navigatorview.cpp | 3 +- src/plugins/qmldesigner/designersettings.cpp | 10 +--- src/plugins/qmldesigner/designersettings.h | 1 - src/plugins/qmldesigner/designmodewidget.cpp | 6 ++- src/plugins/qmldesigner/qmldesignerconstants.h | 2 - src/plugins/qmljseditor/qmljseditoreditable.cpp | 39 ++------------- src/plugins/qmljseditor/qmljseditoreditable.h | 2 +- src/plugins/qmljseditor/qmljsfindreferences.cpp | 6 +-- src/plugins/qmljstools/qmljsfunctionfilter.cpp | 3 +- .../qt4projectmanager/qt4projectmanager.cpp | 3 +- .../wizards/abstractmobileappwizard.cpp | 2 +- .../qtsupport/gettingstartedwelcomepage.cpp | 2 +- src/plugins/qtsupport/qtoutputformatter.cpp | 2 +- src/plugins/subversion/subversionplugin.cpp | 13 +++-- src/plugins/texteditor/basefilefind.cpp | 7 +-- src/plugins/texteditor/basetexteditor.cpp | 3 +- src/plugins/texteditor/linenumberfilter.cpp | 4 +- src/plugins/texteditor/refactoringchanges.cpp | 2 +- src/plugins/texteditor/texteditorplugin.cpp | 2 +- src/plugins/vcsbase/cleandialog.cpp | 2 +- src/plugins/vcsbase/vcsbaseclient.cpp | 2 +- src/plugins/vcsbase/vcsbaseeditor.cpp | 2 +- src/plugins/vcsbase/vcsbaseoutputwindow.cpp | 2 +- src/plugins/vcsbase/vcsbaseplugin.cpp | 4 +- src/plugins/vcsbase/vcsbasesubmiteditor.cpp | 3 +- src/plugins/welcome/welcomeplugin.cpp | 1 - 74 files changed, 135 insertions(+), 233 deletions(-) (limited to 'src') diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 919b5b2a10..5101e20854 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -102,7 +102,6 @@ public: setIcon(QIcon(QLatin1String(":/images/analyzer_mode.png"))); setPriority(P_MODE_ANALYZE); setId(MODE_ANALYZE); - setType(MODE_EDIT_TYPE); } ~AnalyzerMode() diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp index ebf104bc97..3614e74529 100644 --- a/src/plugins/bazaar/bazaarplugin.cpp +++ b/src/plugins/bazaar/bazaarplugin.cpp @@ -540,9 +540,7 @@ void BazaarPlugin::showCommitWidget(const QListappendError(tr("Unable to create an editor for the commit.")); return; diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index d7614bf67e..ee881e3e4b 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -687,9 +687,7 @@ QString ClearCasePlugin::ccGetFileActivity(const QString &workingDir, const QStr ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString &fileName, bool isUcm) { Core::IEditor *editor = - Core::EditorManager::openEditor(fileName, - Constants::CLEARCASECHECKINEDITOR_ID, - Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID); ClearCaseSubmitEditor *submitEditor = qobject_cast(editor); QTC_CHECK(submitEditor); submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction); @@ -932,7 +930,7 @@ void ClearCasePlugin::ccDiffWithPred(const QString &workingDir, const QStringLis // Show in the same editor if diff has been executed before if (Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { existingEditor->createNew(result); - Core::EditorManager::activateEditor(existingEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(existingEditor); setDiffBaseDirectory(existingEditor, workingDir); return; } @@ -1192,7 +1190,7 @@ void ClearCasePlugin::history(const QString &workingDir, const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::LogOutput, workingDir, files); if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(response.stdOut); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("cc history %1").arg(id); const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files); @@ -1305,7 +1303,7 @@ void ClearCasePlugin::vcsAnnotate(const QString &workingDir, const QString &file if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(res); VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("cc annotate %1").arg(id); Core::IEditor *newEditor = showOutputInEditor(title, res, VcsBase::AnnotateOutput, source, codec); @@ -1341,7 +1339,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr) const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, source, QStringList(), changeNr); if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(description); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("cc describe %1").arg(id); Core::IEditor *newEditor = showOutputInEditor(title, description, VcsBase::DiffOutput, source, codec); @@ -1413,7 +1411,7 @@ Core::IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const Q if (codec) e->setCodec(codec); Core::IEditor *ie = e->editor(); - Core::EditorManager::activateEditor(ie, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(ie); return ie; } diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp index cd6bbc1441..d0c9d91718 100644 --- a/src/plugins/coreplugin/basefilewizard.cpp +++ b/src/plugins/coreplugin/basefilewizard.cpp @@ -650,7 +650,7 @@ bool BaseFileWizard::postGenerateOpenEditors(const GeneratedFiles &l, QString *e { foreach (const Core::GeneratedFile &file, l) { if (file.attributes() & Core::GeneratedFile::OpenEditorAttribute) { - if (!Core::EditorManager::openEditor(file.path(), file.editorId(), Core::EditorManager::ModeSwitch )) { + if (!Core::EditorManager::openEditor(file.path(), file.editorId())) { if (errorMessage) *errorMessage = tr("Failed to open an editor for '%1'.").arg(QDir::toNativeSeparators(file.path())); return false; diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp index 47f1734954..a591d995fc 100644 --- a/src/plugins/coreplugin/designmode.cpp +++ b/src/plugins/coreplugin/designmode.cpp @@ -120,7 +120,6 @@ DesignMode::DesignMode() setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Design.png"))); setPriority(Constants::P_MODE_DESIGN); setId(Constants::MODE_DESIGN); - setType(Constants::MODE_DESIGN_TYPE); ExtensionSystem::PluginManager::addObject(d->m_coreListener); diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index cee77d0225..7229797394 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -1382,7 +1382,7 @@ void DocumentManager::executeOpenWithMenuAction(QAction *action) return; } - EditorManager::openEditor(entry.fileName, entry.editorFactory->id(), EditorManager::ModeSwitch); + EditorManager::openEditor(entry.fileName, entry.editorFactory->id()); return; } if (entry.externalEditor) diff --git a/src/plugins/coreplugin/editmode.cpp b/src/plugins/coreplugin/editmode.cpp index 77ddd25ae7..1a6072e978 100644 --- a/src/plugins/coreplugin/editmode.cpp +++ b/src/plugins/coreplugin/editmode.cpp @@ -55,7 +55,6 @@ EditMode::EditMode() : setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Edit.png"))); setPriority(Constants::P_MODE_EDIT); setId(Constants::MODE_EDIT); - setType(Constants::MODE_EDIT_TYPE); m_rightSplitWidgetLayout->setSpacing(0); m_rightSplitWidgetLayout->setMargin(0); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 4101fba001..47f64a2d60 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -698,15 +698,15 @@ void EditorManager::splitNewWindow(Internal::EditorView *view) context->setContext(Context(Constants::C_EDITORMANAGER)); context->setWidget(splitter); ICore::addContextObject(context); + m_instance->d->m_root.append(splitter); + m_instance->d->m_rootContext.append(context); + connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*))); splitter->show(); ICore::raiseWindow(splitter); if (newEditor) m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory); else splitter->view()->setFocus(); - m_instance->d->m_root.append(splitter); - m_instance->d->m_rootContext.append(context); - connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*))); m_instance->updateActions(); } @@ -1049,15 +1049,15 @@ bool EditorManager::closeEditors(const QList &editorsToClose, bool ask if (!newCurrent) newCurrent = pickUnusedEditor(); if (newCurrent) { - activateEditor(view, newCurrent, NoActivate); + activateEditor(view, newCurrent, DoNotChangeCurrentEditor); } else { QModelIndex idx = d->m_editorModel->firstRestoredEditor(); if (idx.isValid()) { - activateEditorForIndex(view, idx, NoActivate); + activateEditorForIndex(view, idx, DoNotChangeCurrentEditor); } else { const QList editors = d->m_editorModel->editors(); if (!editors.isEmpty()) - activateEditor(view, editors.last(), NoActivate); + activateEditor(view, editors.last(), DoNotChangeCurrentEditor); } } } @@ -1112,11 +1112,11 @@ void EditorManager::closeDuplicate(Core::IEditor *editor) if (!newCurrent) newCurrent = pickUnusedEditor(); if (newCurrent) { - activateEditor(view, newCurrent, NoActivate); + activateEditor(view, newCurrent, DoNotChangeCurrentEditor); } else { QModelIndex idx = d->m_editorModel->firstRestoredEditor(); if (idx.isValid()) - activateEditorForIndex(view, idx, NoActivate); + activateEditorForIndex(view, idx, DoNotChangeCurrentEditor); } } @@ -1221,13 +1221,22 @@ Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, C editor = placeEditor(view, editor); - if (!(flags & NoActivate)) { + if (!(flags & DoNotChangeCurrentEditor)) { setCurrentEditor(editor, (flags & IgnoreNavigationHistory)); - if (flags & ModeSwitch) - switchToPreferedMode(); - if (isVisible()) { - editor->widget()->setFocus(); - ICore::raiseWindow(editor->widget()); + if (!(flags & DoNotMakeVisible)) { + // switch to design mode? + if (editor->isDesignModePreferred()) { + ModeManager::activateMode(Core::Constants::MODE_DESIGN); + ModeManager::setFocusToCurrentMode(); + } else { + int rootIndex; + findRoot(view, &rootIndex); + if (rootIndex == 0) // main window --> we might need to switch mode + if (!editor->widget()->isVisible()) + ModeManager::activateMode(Core::Constants::MODE_EDIT); + editor->widget()->setFocus(); + ICore::raiseWindow(editor->widget()); + } } } return editor; @@ -1572,22 +1581,6 @@ QStringList EditorManager::getOpenFileNames() const } -/// Empty mode == figure out the correct mode from the editor -/// forcePrefered = true, switch to the mode even if the editor is visible in another mode -/// forcePrefered = false, only switch if it is not visible -void EditorManager::switchToPreferedMode() -{ - Id preferedMode; - // Figure out preferred mode for editor - if (d->m_currentEditor) - preferedMode = d->m_currentEditor->preferredModeType(); - - if (!preferedMode.isValid()) - preferedMode = Id(Constants::MODE_EDIT_TYPE); - - ModeManager::activateModeType(preferedMode); -} - IEditor *EditorManager::openEditorWithContents(const Id &editorId, QString *titlePattern, const QString &contents) @@ -2191,7 +2184,7 @@ bool EditorManager::restoreState(const QByteArray &state) continue; QFileInfo rfi(autoSaveName(fileName)); if (rfi.exists() && fi.lastModified() < rfi.lastModified()) - openEditor(fileName, id); + openEditor(fileName, id, DoNotMakeVisible); else d->m_editorModel->addRestoredEditor(fileName, displayName, id); } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index b3bae535e4..38cb29cf88 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -107,9 +107,9 @@ public: static EditorToolBar *createToolBar(QWidget *parent = 0); enum OpenEditorFlag { - NoActivate = 1, + DoNotChangeCurrentEditor = 1, IgnoreNavigationHistory = 2, - ModeSwitch = 4, + DoNotMakeVisible = 4, CanContainLineNumber = 8, OpenInOtherSplit = 16 }; @@ -278,7 +278,6 @@ private: static void splitNewWindow(Internal::EditorView *view); IEditor *pickUnusedEditor() const; void addDocumentToRecentFiles(IDocument *document); - void switchToPreferedMode(); void updateAutoSave(); void setCloseSplitEnabled(Internal::SplitterOrView *splitterOrView, bool enable); void updateMakeWritableWarning(); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 30cbb9c023..6bd6009b3d 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -299,7 +299,7 @@ IEditor *EditorView::currentEditor() const void EditorView::listSelectionActivated(int index) { QAbstractItemModel *model = EditorManager::instance()->openedEditorsModel(); - EditorManager::instance()->activateEditorForIndex(this, model->index(index, 0), Core::EditorManager::ModeSwitch); + EditorManager::instance()->activateEditorForIndex(this, model->index(index, 0)); } void EditorView::splitHorizontally() @@ -465,11 +465,11 @@ void EditorView::goBackInNavigationHistory() IEditor *editor = 0; if (location.document) { editor = em->activateEditorForDocument(this, location.document, - EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch); + EditorManager::IgnoreNavigationHistory); } if (!editor) { editor = em->openEditor(this, location.fileName, location.id, - EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch); + EditorManager::IgnoreNavigationHistory); if (!editor) { m_navigationHistory.removeAt(m_currentNavigationHistoryPosition); continue; @@ -492,7 +492,7 @@ void EditorView::goForwardInNavigationHistory() IEditor *editor = 0; if (location.document) { editor = em->activateEditorForDocument(this, location.document, - EditorManager::IgnoreNavigationHistory | EditorManager::ModeSwitch); + EditorManager::IgnoreNavigationHistory); } if (!editor) { editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory); @@ -784,13 +784,13 @@ void SplitterOrView::restoreState(const QByteArray &state) if (!QFile::exists(fileName)) return; IEditor *e = em->openEditor(view(), fileName, Id::fromString(id), Core::EditorManager::IgnoreNavigationHistory - | Core::EditorManager::NoActivate); + | Core::EditorManager::DoNotChangeCurrentEditor); if (!e) { QModelIndex idx = em->openedEditorsModel()->firstRestoredEditor(); if (idx.isValid()) em->activateEditorForIndex(view(), idx, Core::EditorManager::IgnoreNavigationHistory - | Core::EditorManager::NoActivate); + | Core::EditorManager::DoNotChangeCurrentEditor); } if (e) { diff --git a/src/plugins/coreplugin/editormanager/ieditor.h b/src/plugins/coreplugin/editormanager/ieditor.h index d420313136..f2c64f7a9b 100644 --- a/src/plugins/coreplugin/editormanager/ieditor.h +++ b/src/plugins/coreplugin/editormanager/ieditor.h @@ -68,7 +68,7 @@ public: virtual QWidget *toolBar() = 0; - virtual Id preferredModeType() const { return Id(); } + virtual bool isDesignModePreferred() const { return false; } signals: void changed(); diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp index 9a46246846..0b6dacba5b 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp @@ -189,7 +189,7 @@ void OpenEditorsWidget::handleClicked(const QModelIndex &index) void OpenEditorsWidget::activateEditor(const QModelIndex &index) { selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); - EditorManager::instance()->activateEditorForIndex(index, EditorManager::ModeSwitch); + EditorManager::instance()->activateEditorForIndex(index); } void OpenEditorsWidget::closeEditor(const QModelIndex &index) diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index e7caecf711..1367c799a5 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -225,11 +225,10 @@ void OpenEditorsWindow::selectEditor(QTreeWidgetItem *item) return; if (IDocument *document = item->data(0, Qt::UserRole).value()) { EditorView *view = item->data(0, Qt::UserRole+1).value(); - EditorManager::instance()->activateEditorForDocument(view, document, EditorManager::ModeSwitch); + EditorManager::instance()->activateEditorForDocument(view, document); } else { if (!EditorManager::openEditor( - item->toolTip(0), item->data(0, Qt::UserRole+2).value(), - Core::EditorManager::ModeSwitch)) { + item->toolTip(0), item->data(0, Qt::UserRole+2).value())) { EditorManager::instance()->openedEditorsModel()->removeEditor(item->toolTip(0)); delete item; } diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index 900f370e29..9fd7e2ca82 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -311,7 +311,7 @@ void EditorToolBar::changeActiveEditor(int row) { EditorManager *em = ICore::editorManager(); QAbstractItemModel *model = d->m_editorList->model(); - em->activateEditorForIndex(model->index(row, 0), EditorManager::ModeSwitch); + em->activateEditorForIndex(model->index(row, 0)); } void EditorToolBar::listContextMenu(QPoint pos) diff --git a/src/plugins/coreplugin/imode.h b/src/plugins/coreplugin/imode.h index 232b0bf51f..ea9de058a2 100644 --- a/src/plugins/coreplugin/imode.h +++ b/src/plugins/coreplugin/imode.h @@ -49,7 +49,6 @@ public: QIcon icon() const { return m_icon; } int priority() const { return m_priority; } Id id() const { return m_id; } - Id type() const { return m_type; } bool isEnabled() const; void setEnabled(bool enabled); @@ -57,7 +56,6 @@ public: void setIcon(const QIcon &icon) { m_icon = icon; } void setPriority(int priority) { m_priority = priority; } void setId(Id id) { m_id = id; } - void setType(Id type) { m_type = type; } signals: void enabledStateChanged(bool enabled); @@ -67,7 +65,6 @@ private: QIcon m_icon; int m_priority; Id m_id; - Id m_type; bool m_isEnabled; }; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 64f90435a6..6ae0d92318 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -861,8 +861,6 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesF } } else { QFlags emFlags; - if (flags & ICore::SwitchMode) - emFlags = EditorManager::ModeSwitch; if (flags & ICore::CanContainLineNumbers) emFlags |= EditorManager::CanContainLineNumber; IEditor *editor = EditorManager::openEditor(absoluteFilePath, Id(), emFlags); @@ -1005,7 +1003,7 @@ void MainWindow::openFileWith() if (isExternal) EditorManager::openExternalEditor(fileName, editorId); else - EditorManager::openEditor(fileName, editorId, Core::EditorManager::ModeSwitch); + EditorManager::openEditor(fileName, editorId); } } @@ -1289,7 +1287,7 @@ void MainWindow::openRecentFile() { if (const QAction *action = qobject_cast(sender())) { const DocumentManager::RecentFile file = action->data().value(); - EditorManager::openEditor(file.first, file.second, EditorManager::ModeSwitch); + EditorManager::openEditor(file.first, file.second); } } diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 894d3af057..b278f08c48 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -150,21 +150,6 @@ IMode *ModeManager::mode(Id id) return 0; } -void ModeManager::activateModeType(Id type) -{ - if (currentMode() && currentMode()->type() == type) - return; - int index = -1; - for (int i = 0; i < d->m_modes.count(); ++i) { - if (d->m_modes.at(i)->type() == type) { - index = i; - break; - } - } - if (index != -1) - d->m_modeStack->setCurrentIndex(index); -} - void ModeManager::slotActivateMode(int id) { m_instance->activateMode(Id::fromUniqueIdentifier(id)); @@ -333,10 +318,10 @@ void ModeManager::setFocusToCurrentMode() QWidget *widget = mode->widget(); if (widget) { QWidget *focusWidget = widget->focusWidget(); - if (focusWidget) - focusWidget->setFocus(); - else - widget->setFocus(); + if (!focusWidget) + focusWidget = widget; + focusWidget->setFocus(); + ICore::raiseWindow(focusWidget); } } diff --git a/src/plugins/coreplugin/modemanager.h b/src/plugins/coreplugin/modemanager.h index caf17cada0..f053f98d9f 100644 --- a/src/plugins/coreplugin/modemanager.h +++ b/src/plugins/coreplugin/modemanager.h @@ -65,7 +65,6 @@ public: static void addProjectSelector(QAction *action); static void addWidget(QWidget *widget); - static void activateModeType(Id type); static void activateMode(Id id); static void setFocusToCurrentMode(); static bool isModeSelectorVisible(); diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index 2d1409c5e9..12102111d1 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -380,7 +380,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription, const QString fileName = saver.fileName(); m_fetchedSnippets.push_back(fileName); // Open editor with title. - Core::IEditor *editor = EditorManager::openEditor(fileName, Core::Id(), EditorManager::ModeSwitch); + Core::IEditor *editor = EditorManager::openEditor(fileName); QTC_ASSERT(editor, return); editor->setDisplayName(titleDescription); } diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index e49af606fa..ae80aa425e 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1992,7 +1992,7 @@ bool CPPEditorWidget::openCppEditorAt(const Link &link, bool inNextSplit) if (!link.hasValidTarget()) return false; - Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::ModeSwitch; + Core::EditorManager::OpenEditorFlags flags; if (inNextSplit) flags |= Core::EditorManager::OpenInOtherSplit; return Core::EditorManager::openEditorAt(link.targetFileName, diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index b26042d0a6..e7aa07ac90 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -110,8 +110,7 @@ QList CppCurrentDocumentFilter::matchesFor(QFutureInterfac void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const { ModelItemInfo info = qvariant_cast(selection.internalData); - Core::EditorManager::openEditorAt(info.fileName, info.line, info.column, - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(info.fileName, info.line, info.column); } void CppCurrentDocumentFilter::refresh(QFutureInterface &future) diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index c0ebe30a33..1c0c49904d 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -305,8 +305,7 @@ void CppFileSettingsWidget::slotEdit() setLicenseTemplatePath(path); } // Edit (now) existing file with C++ - Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID, - Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID); } // --------------- CppFileSettingsPage diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index f27d92081d..bcf590c0d9 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -510,12 +510,9 @@ void CppFindReferences::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), - item.lineNumber, item.textMarkPos, - Core::Id(), - Core::EditorManager::ModeSwitch); + item.lineNumber, item.textMarkPos); } else { - Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text), - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text)); } } diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index e2ea80f0d2..0117a7d981 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -177,8 +177,7 @@ QList CppLocatorFilter::matchesFor(QFutureInterface(selection.internalData); - Core::EditorManager::openEditorAt(info.fileName, info.line, info.column, - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(info.fileName, info.line, info.column); } void CppLocatorFilter::reset() diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index af579bb5a7..93b2a80482 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -164,8 +164,7 @@ void CppToolsPlugin::switchHeaderSourceInNextSplit() QString otherFile = correspondingHeaderOrSource( Core::EditorManager::currentEditor()->document()->fileName()); if (!otherFile.isEmpty()) - Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit - | Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit); } static QStringList findFilesInProject(const QString &name, diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index b3cadb5e17..85ffd0a65c 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -592,7 +592,7 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p) const QString tag = VcsBaseEditorWidget::editorTag(DiffOutput, p.workingDir, p.files); if (IEditor *existingEditor = VcsBaseEditorWidget::locateEditorByTag(tag)) { existingEditor->createNew(output); - EditorManager::activateEditor(existingEditor, EditorManager::ModeSwitch); + EditorManager::activateEditor(existingEditor); setDiffBaseDirectory(existingEditor, p.workingDir); return; } @@ -615,8 +615,7 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p) CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName) { - IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID, - EditorManager::ModeSwitch); + IEditor *editor = EditorManager::openEditor(fileName, Constants::CVSCOMMITEDITOR_ID); CvsSubmitEditor *submitEditor = qobject_cast(editor); QTC_CHECK(submitEditor); submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction); @@ -861,7 +860,7 @@ void CvsPlugin::filelog(const QString &workingDir, const QString tag = VcsBaseEditorWidget::editorTag(LogOutput, workingDir, files); if (Core::IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(response.stdOut); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("cvs log %1").arg(id); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, LogOutput, source, codec); @@ -1004,7 +1003,7 @@ void CvsPlugin::annotate(const QString &workingDir, const QString &file, if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(response.stdOut); VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber); - EditorManager::activateEditor(editor, EditorManager::ModeSwitch); + EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("cvs annotate %1").arg(id); IEditor *newEditor = showOutputInEditor(title, response.stdOut, AnnotateOutput, source, codec); @@ -1199,7 +1198,7 @@ bool CvsPlugin::describe(const QString &repositoryPath, const QString commitId = entries.front().revisions.front().commitId; if (IEditor *editor = VcsBaseEditorWidget::locateEditorByTag(commitId)) { editor->createNew(output); - EditorManager::activateEditor(editor, EditorManager::ModeSwitch); + EditorManager::activateEditor(editor); setDiffBaseDirectory(editor, repositoryPath); } else { const QString title = QString::fromLatin1("cvs describe %1").arg(commitId); @@ -1285,7 +1284,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp if (codec) e->setCodec(codec); IEditor *ie = e->editor(); - EditorManager::activateEditor(ie, EditorManager::ModeSwitch); + EditorManager::activateEditor(ie); return ie; } diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 4dca818a7c..aada6367c9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -508,7 +508,6 @@ public: setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Debug.png"))); setPriority(85); setId(MODE_DEBUG); - setType(CC::MODE_EDIT_TYPE); } ~DebugMode() diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp index b167f344cd..20d9219b6a 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp +++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp @@ -472,8 +472,7 @@ void QmlInspectorAdapter::jumpToObjectDefinitionInEditor( { const QString fileName = m_engine->toFileInProject(objSource.url()); - Core::EditorManager::openEditorAt(fileName, objSource.lineNumber(), - 0, Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(fileName, objSource.lineNumber()); if (debugId != -1 && debugId != m_currentSelectedDebugId) { m_currentSelectedDebugId = debugId; m_currentSelectedDebugName = agent()->displayName(debugId); diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 5bedf6a41c..e435c95cdb 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -912,7 +912,7 @@ void FormEditorW::switchSourceForm() { const QString fileToOpen = otherFile(); if (!fileToOpen.isEmpty()) - Core::EditorManager::openEditor(fileToOpen, Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(fileToOpen); } } // namespace Internal diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index 6ed794e19c..d6234089ee 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -259,9 +259,9 @@ TextEditor::PlainTextEditor *FormWindowEditor::textEditor() return &d->m_textEditor; } -Core::Id FormWindowEditor::preferredModeType() const +bool FormWindowEditor::isDesignModePreferred() const { - return Core::Id(Core::Constants::MODE_DESIGN_TYPE); + return true; } } // namespace Designer diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index 05f8f786fa..a04f417d16 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -81,7 +81,7 @@ public: virtual QWidget *toolBar(); - virtual Core::Id preferredModeType() const; + virtual bool isDesignModePreferred() const; // For uic code model support QString contents() const; diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 1fbb5a9d2c..956c1bc51d 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -270,7 +270,9 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line) static inline ITextEditor *editableAt(const QString &fileName, int line, int column) { - return qobject_cast(Core::EditorManager::openEditorAt(fileName, line, column)); + return qobject_cast(Core::EditorManager::openEditorAt(fileName, line, column, + Core::Id(), + Core::EditorManager::DoNotMakeVisible)); } static void addDeclaration(const Snapshot &snapshot, diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index 7df9f4bb4d..6ca9090f03 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -142,7 +142,7 @@ void DiffEditorPlugin::diff() if (!editor) return; - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); DiffEditorWidget *editorWidget = editor->editorWidget(); diff --git a/src/plugins/diffeditor/diffeditorwidget.cpp b/src/plugins/diffeditor/diffeditorwidget.cpp index 31256f3f3a..4bce0b3466 100644 --- a/src/plugins/diffeditor/diffeditorwidget.cpp +++ b/src/plugins/diffeditor/diffeditorwidget.cpp @@ -374,7 +374,7 @@ void DiffViewEditorWidget::jumpToOriginalFile(const QTextCursor &cursor) const QDir dir(m_workingDirectory); const QString fileName = dir.absoluteFilePath(it.value().fileName); - Core::IEditor *ed = Core::EditorManager::openEditor(fileName, Core::Id(), Core::EditorManager::ModeSwitch); + Core::IEditor *ed = Core::EditorManager::openEditor(fileName); if (TextEditor::ITextEditor *editor = qobject_cast(ed)) editor->gotoLine(lineNr, position); } diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 6596c2a413..45bcf40495 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -816,7 +816,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis return 0; // Exists already - Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(outputEditor); outputEditor->createNew(m_msgWait); rc = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor); @@ -829,7 +829,7 @@ DiffEditor::DiffEditor *GitClient::findExistingOrOpenNewDiffEditor(const char *r Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue); if (outputEditor) { // Exists already - Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(outputEditor); outputEditor->createNew(m_msgWait); } @@ -840,7 +840,7 @@ DiffEditor::DiffEditor *GitClient::findExistingOrOpenNewDiffEditor(const char *r editor = qobject_cast( Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait)); editor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); // should probably go outside this block + Core::EditorManager::activateEditor(editor); // should probably go outside this block } return editor; } @@ -881,7 +881,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id, } rc->setForceReadOnly(true); - Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(outputEditor); if (configWidget) rc->setConfigurationWidget(configWidget); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 1f0cc2d097..1520e34ce2 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -975,8 +975,7 @@ void GitPlugin::updateVersionWarning() Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd) { - Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID, - Core::EditorManager::ModeSwitch); + Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::GITSUBMITEDITOR_ID); GitSubmitEditor *submitEditor = qobject_cast(editor); QTC_ASSERT(submitEditor, return 0); setSubmitEditor(submitEditor); diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 25d64aeb46..ea781f4026 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -60,7 +60,6 @@ public: setIcon(QIcon()); setPriority(0); setId("HelloWorld.HelloWorldMode"); - setType("HelloWorld.HelloWorldMode"); setContextHelpId(QString()); } }; diff --git a/src/plugins/locator/basefilefilter.cpp b/src/plugins/locator/basefilefilter.cpp index 14166a5bdf..8cd2a96e40 100644 --- a/src/plugins/locator/basefilefilter.cpp +++ b/src/plugins/locator/basefilefilter.cpp @@ -100,7 +100,7 @@ QList BaseFileFilter::matchesFor(QFutureInterface &future) void OpenDocumentsFilter::accept(FilterEntry selection) const { EditorManager::openEditor(selection.internalData.toString(), Id(), - EditorManager::ModeSwitch | EditorManager::CanContainLineNumber); + EditorManager::CanContainLineNumber); } diff --git a/src/plugins/madde/maemopackagecreationwidget.cpp b/src/plugins/madde/maemopackagecreationwidget.cpp index 0511985bb0..90a1661d25 100644 --- a/src/plugins/madde/maemopackagecreationwidget.cpp +++ b/src/plugins/madde/maemopackagecreationwidget.cpp @@ -263,8 +263,7 @@ void MaemoPackageCreationWidget::editDebianFile() void MaemoPackageCreationWidget::editFile(const QString &filePath) { - Core::EditorManager::openEditor(filePath, Core::Id(), - Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(filePath); } } // namespace Internal diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index e53009f4b4..12db4d74c5 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -558,8 +558,7 @@ void MercurialPlugin::showCommitWidget(const QList &s } Core::IEditor *editor = Core::EditorManager::openEditor(saver.fileName(), - Constants::COMMIT_ID, - Core::EditorManager::ModeSwitch); + Constants::COMMIT_ID); if (!editor) { outputWindow->appendError(tr("Unable to create an editor for the commit.")); return; diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 70c573c883..8fd5957c80 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -649,8 +649,7 @@ void PerforcePlugin::startSubmitProject() Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames) { - Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::PERFORCE_SUBMIT_EDITOR_ID, - Core::EditorManager::ModeSwitch); + Core::IEditor *editor = Core::EditorManager::openEditor(fileName, Constants::PERFORCE_SUBMIT_EDITOR_ID); PerforceSubmitEditor *submitEditor = static_cast(editor); setSubmitEditor(submitEditor); submitEditor->restrictToProjectFiles(depotFileNames); @@ -1180,7 +1179,7 @@ Core::IEditor *PerforcePlugin::showOutputInEditor(const QString &title, const QS if (codec) e->setCodec(codec); Core::IEditor *ie = e->editor(); - Core::EditorManager::activateEditor(ie, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(ie); return ie; } @@ -1262,7 +1261,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p) if (existingEditor) { existingEditor->createNew(result.stdOut); - Core::EditorManager::activateEditor(existingEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(existingEditor); return; } // Create new editor diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 0d498a4f7a..09a069eae4 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -261,7 +261,7 @@ void FolderNavigationWidget::openItem(const QModelIndex &srcIndex) return; } // Open file. - Core::EditorManager::openEditor(m_fileSystemModel->filePath(srcIndex), Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(m_fileSystemModel->filePath(srcIndex)); } void FolderNavigationWidget::setCurrentTitle(QString dirName, const QString &fullPath) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e89ce94967..d25442b026 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -265,7 +265,6 @@ public: setIcon(QIcon(QLatin1String(":/fancyactionbar/images/mode_Project.png"))); setPriority(Constants::P_MODE_SESSION); setId(Constants::MODE_SESSION); - setType(Core::Id()); setContextHelpId(QLatin1String("Managing Projects")); } }; @@ -2873,7 +2872,7 @@ void ProjectExplorerPlugin::removeProject() void ProjectExplorerPlugin::openFile() { QTC_ASSERT(d->m_currentNode, return); - Core::EditorManager::openEditor(d->m_currentNode->path(), Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(d->m_currentNode->path()); } void ProjectExplorerPlugin::searchOnFileSystem() diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 51f77f56d5..2df69b1bd6 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -372,7 +372,7 @@ void ProjectTreeWidget::openItem(const QModelIndex &mainIndex) Node *node = m_model->nodeForIndex(mainIndex); if (node->nodeType() != FileNodeType) return; - IEditor *editor = EditorManager::openEditor(node->path(), Id(), EditorManager::ModeSwitch); + IEditor *editor = EditorManager::openEditor(node->path()); if (node->line() >= 0) editor->gotoLine(node->line()); } diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorcrumblebar.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorcrumblebar.cpp index a90b169458..d9e22c9bb9 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorcrumblebar.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorcrumblebar.cpp @@ -120,7 +120,8 @@ void FormEditorCrumbleBar::onCrumblePathElementClicked(const QVariant &data) } else { crumblePath()->popElement(); nextFileIsCalledInternally(); - Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName); + Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName, Core::Id(), + Core::EditorManager::DoNotMakeVisible); if (!clickedCrumbleBarInfo.componentId.isEmpty()) { currentDesignDocument()->changeToSubComponent( currentDesignDocument()->rewriterView()->modelNodeForId(clickedCrumbleBarInfo.componentId)); diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 63c54a28e0..9a93b93a01 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -309,7 +309,7 @@ void DesignDocument::changeToSubComponent(const ModelNode &componentNode) void DesignDocument::changeToExternalSubComponent(const QString &fileName) { - Core::EditorManager::openEditor(fileName); + Core::EditorManager::openEditor(fileName, Core::Id(), Core::EditorManager::DoNotMakeVisible); } void DesignDocument::goIntoSelectedComponent() diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index 61ee53a083..deec645b3e 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -289,7 +289,8 @@ void NavigatorView::changeToComponent(const QModelIndex &index) if (index.isValid() && m_treeModel->data(index, Qt::UserRole).isValid()) { ModelNode doubleClickNode = m_treeModel->nodeForIndex(index); if (doubleClickNode.metaInfo().isFileComponent()) - Core::EditorManager::openEditor(doubleClickNode.metaInfo().componentFileName()); + Core::EditorManager::openEditor(doubleClickNode.metaInfo().componentFileName(), + Core::Id(), Core::EditorManager::DoNotMakeVisible); } } diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 029e5e082a..874587a64c 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -35,8 +35,7 @@ using namespace QmlDesigner; DesignerSettings::DesignerSettings() - : openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT), - itemSpacing(0), + : itemSpacing(0), containerPadding(0), canvasWidth(10000), canvasHeight(10000), @@ -50,9 +49,6 @@ void DesignerSettings::fromSettings(QSettings *settings) { settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP)); settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP)); - openDesignMode = settings->value( - QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), - bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool(); itemSpacing = settings->value( QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(6)).toInt(); containerPadding = settings->value( @@ -76,7 +72,6 @@ void DesignerSettings::toSettings(QSettings *settings) const { settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP)); settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP)); - settings->setValue(QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTAINERPADDING_KEY), containerPadding); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CANVASWIDTH_KEY), canvasWidth); @@ -92,8 +87,7 @@ void DesignerSettings::toSettings(QSettings *settings) const bool DesignerSettings::equals(const DesignerSettings &other) const { - return openDesignMode == other.openDesignMode - && containerPadding == other.containerPadding + return containerPadding == other.containerPadding && canvasWidth == other.canvasWidth && canvasHeight == other.canvasHeight && warningsInDesigner == other.warningsInDesigner diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index d38927a19b..a42d47155a 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -47,7 +47,6 @@ public: void toSettings(QSettings *) const; bool equals(const DesignerSettings &other) const; - bool openDesignMode; int itemSpacing; int containerPadding; int canvasWidth; diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index d01ae232b5..b8df512dc7 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -451,7 +451,8 @@ void DesignModeWidget::toolBarOnGoBackClicked() if (m_navigatorHistoryCounter > 0) { --m_navigatorHistoryCounter; m_keepNavigatorHistory = true; - Core::EditorManager::openEditor(m_navigatorHistory.at(m_navigatorHistoryCounter)); + Core::EditorManager::openEditor(m_navigatorHistory.at(m_navigatorHistoryCounter), + Core::Id(), Core::EditorManager::DoNotMakeVisible); m_keepNavigatorHistory = false; } } @@ -461,7 +462,8 @@ void DesignModeWidget::toolBarOnGoForwardClicked() if (m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1)) { ++m_navigatorHistoryCounter; m_keepNavigatorHistory = true; - Core::EditorManager::openEditor(m_navigatorHistory.at(m_navigatorHistoryCounter)); + Core::EditorManager::openEditor(m_navigatorHistory.at(m_navigatorHistoryCounter), + Core::Id(), Core::EditorManager::DoNotMakeVisible); m_keepNavigatorHistory = false; } } diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h index b083ee8291..366eef4449 100644 --- a/src/plugins/qmldesigner/qmldesignerconstants.h +++ b/src/plugins/qmldesigner/qmldesignerconstants.h @@ -53,7 +53,6 @@ const char GO_INTO_COMPONENT[] = "QmlDesigner.GoIntoComponent"; // This setting is also accessed by the QMlJsEditor. const char QML_SETTINGS_GROUP[] = "QML"; const char QML_DESIGNER_SETTINGS_GROUP[] = "Designer"; -const char QML_OPENDESIGNMODE_SETTINGS_KEY[] = "OpenDesignMode"; const char QML_ITEMSPACING_KEY[] = "ItemSpacing"; const char QML_CONTAINERPADDING_KEY[] = "ContainerPadding"; const char QML_CANVASWIDTH_KEY[] = "CanvasWidth"; @@ -64,7 +63,6 @@ const char QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY[] = "WarnAboutQtQuickFeatures const char QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickDesignerFeaturesInCodeEditor"; const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; -enum { QML_OPENDESIGNMODE_DEFAULT = 0 }; // 0 for text mode, 1 for design mode const char SETTINGS_CATEGORY_QML_ICON[] = ":/core/images/category_qml.png"; diff --git a/src/plugins/qmljseditor/qmljseditoreditable.cpp b/src/plugins/qmljseditor/qmljseditoreditable.cpp index ee75f356c1..8af4f1a5cb 100644 --- a/src/plugins/qmljseditor/qmljseditoreditable.cpp +++ b/src/plugins/qmljseditor/qmljseditoreditable.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -52,41 +51,13 @@ QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditorWidget *editor) m_context.add(ProjectExplorer::Constants::LANG_QMLJS); } -// Use preferred mode from Bauhaus settings -static bool openInDesignMode() -{ - static bool bauhausDetected = false; - static bool bauhausPresent = false; - // Check if Bauhaus is loaded, that is, a Design mode widget is - // registered for the QML mime type. - if (!bauhausDetected) { - if (const Core::IMode *dm = Core::ModeManager::mode(Core::Constants::MODE_DESIGN)) - if (const Core::DesignMode *designMode = qobject_cast(dm)) - bauhausPresent = designMode->registeredMimeTypes().contains(QLatin1String(QmlJSTools::Constants::QML_MIMETYPE)); - bauhausDetected = true; - } - if (!bauhausPresent) - return false; - - return bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT); -} - -Core::Id QmlJSEditorEditable::preferredModeType() const +bool QmlJSEditorEditable::isDesignModePreferred() const { + // stay in design mode if we are there Core::IMode *mode = Core::ModeManager::currentMode(); - if (mode && (mode->type() == Core::Constants::MODE_DESIGN_TYPE - || mode->type() == Core::Constants::MODE_EDIT_TYPE)) - { - return mode->type(); - } - - // if we are in other mode than edit or design, use the hard-coded default. - // because the editor opening decision is modal, it would be confusing to - // have the user also access to this failsafe setting. - if (editorWidget()->mimeType() == QLatin1String(QmlJSTools::Constants::QML_MIMETYPE) - && openInDesignMode()) - return Core::Id(Core::Constants::MODE_DESIGN_TYPE); - return Core::Id(); + if (mode && mode->id() == Core::Constants::MODE_DESIGN) + return true; + return false; } void QmlJSEditorEditable::setTextCodec(QTextCodec *codec, TextCodecReason reason) diff --git a/src/plugins/qmljseditor/qmljseditoreditable.h b/src/plugins/qmljseditor/qmljseditoreditable.h index ac7d161588..07550c50e4 100644 --- a/src/plugins/qmljseditor/qmljseditoreditable.h +++ b/src/plugins/qmljseditor/qmljseditoreditable.h @@ -49,7 +49,7 @@ public: Core::Id id() const; bool isTemporary() const { return false; } bool open(QString *errorString, const QString &fileName, const QString &realFileName); - Core::Id preferredModeType() const; + bool isDesignModePreferred() const; void setTextCodec(QTextCodec *codec, TextCodecReason = TextCodecOtherReason); const Utils::CommentDefinition *commentDefinition() const; diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index e5aa05c2e7..af0d7b461b 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -985,11 +985,9 @@ void FindReferences::openEditor(const Find::SearchResultItem &item) { if (item.path.size() > 0) { Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), - item.lineNumber, item.textMarkPos, Core::Id(), - Core::EditorManager::ModeSwitch); + item.lineNumber, item.textMarkPos); } else { - Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text), - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text)); } } diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.cpp b/src/plugins/qmljstools/qmljsfunctionfilter.cpp index 13710f5dd0..33c1eb9356 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.cpp +++ b/src/plugins/qmljstools/qmljsfunctionfilter.cpp @@ -111,6 +111,5 @@ QList FunctionFilter::matchesFor(QFutureInterface(selection.internalData); - Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column, - Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column); } diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index 33926d2363..b3d2c3d0d9 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -247,7 +247,8 @@ void Qt4Manager::addLibrary(const QString &fileName, ProFileEditorWidget *editor editable = editor->editor(); } else { editable = qobject_cast - (Core::EditorManager::openEditor(fileName, Qt4ProjectManager::Constants::PROFILE_EDITOR_ID)); + (Core::EditorManager::openEditor(fileName, Qt4ProjectManager::Constants::PROFILE_EDITOR_ID, + Core::EditorManager::DoNotMakeVisible)); } if (!editable) return; diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp index d7ca07f3a1..a6c5d62a8e 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp @@ -283,7 +283,7 @@ bool AbstractMobileAppWizard::postGenerateFiles(const QWizard *w, if (success) { const QString fileToOpen = fileToOpenPostGeneration(); if (!fileToOpen.isEmpty()) { - Core::EditorManager::openEditor(fileToOpen, Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(fileToOpen); ProjectExplorer::ProjectExplorerPlugin::instance()->setCurrentFile(0, fileToOpen); } } diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index c40aebeb04..0ad1763da3 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -431,7 +431,7 @@ void ExamplesWelcomePage::openProject(const QString &projectFile, const QStringL Core::ICore::openFiles(filesToOpen); if (project->needsConfiguration()) project->configureAsExampleProject(platforms); - Core::ModeManager::activateModeType(Core::Constants::MODE_EDIT_TYPE); + Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); if (help.isValid()) Core::ICore::helpManager()->handleHelpRequest(help.toString() + QLatin1String("?view=split")); } diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index 82d0dcc891..1c4ffd624d 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -234,7 +234,7 @@ void QtOutputFormatter::handleLink(const QString &href) if (!fileName.isEmpty()) { fileName = m_projectFinder.findFile(QUrl::fromLocalFile(fileName)); - Core::EditorManager::openEditorAt(fileName, line, 0); + Core::EditorManager::openEditorAt(fileName, line); return; } } diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 4251930b63..5d03160596 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -589,7 +589,7 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet // Show in the same editor if diff has been executed before if (Core::IEditor *existingEditor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { existingEditor->createNew(response.stdOut); - Core::EditorManager::activateEditor(existingEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(existingEditor); setDiffBaseDirectory(existingEditor, p.workingDir); return; } @@ -613,8 +613,7 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName) { Core::IEditor *editor = Core::EditorManager::openEditor(fileName, - Constants::SUBVERSIONCOMMITEDITOR_ID, - Core::EditorManager::ModeSwitch); + Constants::SUBVERSIONCOMMITEDITOR_ID); SubversionSubmitEditor *submitEditor = qobject_cast(editor); QTC_CHECK(submitEditor); setSubmitEditor(submitEditor); @@ -901,7 +900,7 @@ void SubversionPlugin::filelog(const QString &workingDir, const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::LogOutput, workingDir, files); if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(response.stdOut); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("svn log %1").arg(id); const QString source = VcsBase::VcsBaseEditorWidget::getSource(workingDir, files); @@ -979,7 +978,7 @@ void SubversionPlugin::vcsAnnotate(const QString &workingDir, const QString &fil if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(response.stdOut); VcsBase::VcsBaseEditorWidget::gotoLineOfEditor(editor, lineNumber); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("svn annotate %1").arg(id); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VcsBase::AnnotateOutput, source, codec); @@ -1044,7 +1043,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) const QString tag = VcsBase::VcsBaseEditorWidget::editorTag(VcsBase::DiffOutput, source, QStringList(), changeNr); if (Core::IEditor *editor = VcsBase::VcsBaseEditorWidget::locateEditorByTag(tag)) { editor->createNew(description); - Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(editor); } else { const QString title = QString::fromLatin1("svn describe %1#%2").arg(fi.fileName(), changeNr); Core::IEditor *newEditor = showOutputInEditor(title, description, VcsBase::DiffOutput, source, codec); @@ -1189,7 +1188,7 @@ Core::IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const if (codec) e->setCodec(codec); Core::IEditor *ie = e->editor(); - Core::EditorManager::activateEditor(ie, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(ie); return ie; } diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index baf1318dc1..250eae2ddc 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -312,12 +312,9 @@ void BaseFileFind::openEditor(const Find::SearchResultItem &item) if (item.path.size() > 0) { openedEditor = Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()), item.lineNumber, - item.textMarkPos, - Core::Id(), - Core::EditorManager::ModeSwitch); + item.textMarkPos); } else { - openedEditor = Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text), - Core::Id(), Core::EditorManager::ModeSwitch); + openedEditor = Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text)); } if (d->m_currentFindSupport) d->m_currentFindSupport->clearResults(); diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index ab343d4ad4..a9aa9e97dd 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -4899,8 +4899,7 @@ bool BaseTextEditorWidget::openLink(const Link &link, bool inNextSplit) return true; } - return Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn, - Core::Id(), Core::EditorManager::ModeSwitch); + return Core::EditorManager::openEditorAt(link.targetFileName, link.targetLine, link.targetColumn); } void BaseTextEditorWidget::updateLink(QMouseEvent *e) diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp index bec075131d..b6dd394cea 100644 --- a/src/plugins/texteditor/linenumberfilter.cpp +++ b/src/plugins/texteditor/linenumberfilter.cpp @@ -97,9 +97,7 @@ void LineNumberFilter::accept(FilterEntry selection) const data.first = currLine; } editor->gotoLine(data.first, data.second); - editor->widget()->setFocus(); - ICore::raiseWindow(editor->widget()); - Core::ModeManager::activateModeType(Id(Core::Constants::MODE_EDIT_TYPE)); + Core::EditorManager::activateEditor(editor); } } diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index 8ca3a3cc8d..e8b73f582a 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -136,7 +136,7 @@ BaseTextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bo { Core::EditorManager::OpenEditorFlags flags = Core::EditorManager::IgnoreNavigationHistory; if (!activate) - flags |= Core::EditorManager::NoActivate; + flags |= Core::EditorManager::DoNotChangeCurrentEditor; if (line != -1) { // openEditorAt uses a 1-based line and a 0-based column! column -= 1; diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index e47a350424..ce2da09161 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -137,7 +137,7 @@ void ScratchFileWizard::createFile() file.setAutoRemove(false); QTC_ASSERT(file.open(), return; ); file.close(); - Core::EditorManager::openEditor(file.fileName(), Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(file.fileName()); } // ExtensionSystem::PluginInterface diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp index ed8a46bd78..b5366102ae 100644 --- a/src/plugins/vcsbase/cleandialog.cpp +++ b/src/plugins/vcsbase/cleandialog.cpp @@ -279,7 +279,7 @@ void CleanDialog::slotDoubleClicked(const QModelIndex &index) if (const QStandardItem *item = d->m_filesModel->itemFromIndex(index)) if (!item->data(Internal::isDirectoryRole).toBool()) { const QString fname = item->data(Internal::fileNameRole).toString(); - Core::EditorManager::openEditor(fname, Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(fname); } } diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 059dff26c0..bf4b8ce6e1 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -576,7 +576,7 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(Core::Id kind, QStr } baseEditor->setForceReadOnly(true); - Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(outputEditor); return baseEditor; } diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index b6d6d15f4d..321cca7e32 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -1115,7 +1115,7 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor) if (!exists) return; - Core::IEditor *ed = Core::EditorManager::openEditor(fileName, Core::Id(), Core::EditorManager::ModeSwitch); + Core::IEditor *ed = Core::EditorManager::openEditor(fileName); if (TextEditor::ITextEditor *editor = qobject_cast(ed)) editor->gotoLine(chunkStart + lineCount); } diff --git a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp index 3728253f55..9dd32497ed 100644 --- a/src/plugins/vcsbase/vcsbaseoutputwindow.cpp +++ b/src/plugins/vcsbase/vcsbaseoutputwindow.cpp @@ -189,7 +189,7 @@ void OutputWindowPlainTextEdit::contextMenuEvent(QContextMenuEvent *event) } if (action == openAction) { const QString fileName = action->data().toString(); - Core::EditorManager::openEditor(fileName, Core::Id(), Core::EditorManager::ModeSwitch); + Core::EditorManager::openEditor(fileName); } } delete menu; diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index c56f846928..9022b65c21 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -691,9 +691,7 @@ bool VcsBasePlugin::raiseSubmitEditor() const { if (!d->m_submitEditor) return false; - Core::EditorManager::activateEditor( - d->m_submitEditor, - Core::EditorManager::IgnoreNavigationHistory | Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(d->m_submitEditor, Core::EditorManager::IgnoreNavigationHistory); return true; } diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index d71c8866f9..b4c7e3e2d5 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -573,8 +573,7 @@ VcsBaseSubmitEditor::PromptSubmitResult { SubmitEditorWidget *submitWidget = static_cast(this->widget()); - Core::EditorManager::activateEditor( - this, Core::EditorManager::IgnoreNavigationHistory | Core::EditorManager::ModeSwitch); + Core::EditorManager::activateEditor(this, Core::EditorManager::IgnoreNavigationHistory); QString errorMessage; QMessageBox::StandardButton answer = QMessageBox::Yes; diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 36c53cda76..8e5b1ddfa9 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -143,7 +143,6 @@ WelcomeMode::WelcomeMode() : setIcon(qtLogo); setPriority(Core::Constants::P_MODE_WELCOME); setId(Core::Constants::MODE_WELCOME); - setType(Core::Constants::MODE_WELCOME_TYPE); setContextHelpId(QLatin1String("Qt Creator Manual")); setContext(Core::Context(Core::Constants::C_WELCOME_MODE)); -- cgit v1.2.1 From 506b4ca9a802d8dd27d20d7dc5df34c9af53dfb9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Jun 2013 09:39:11 +0200 Subject: tr()-Fixes. Change-Id: Ie4645f3a3c82d18099dd154293d242ab07b1e5fc Reviewed-by: Christian Stenger --- src/plugins/coreplugin/variablemanager.cpp | 2 +- src/plugins/debugger/gdb/gdboptionspage.cpp | 2 +- src/plugins/debugger/qml/qmlengine.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/coreplugin/variablemanager.cpp b/src/plugins/coreplugin/variablemanager.cpp index 3af6ab709f..06146712ae 100644 --- a/src/plugins/coreplugin/variablemanager.cpp +++ b/src/plugins/coreplugin/variablemanager.cpp @@ -308,7 +308,7 @@ void VariableManager::registerFileVariables(const QByteArray &prefix, const QStr { registerVariable(prefix + kFilePathPostfix, tr("%1: Full path including file name.").arg(heading)); registerVariable(prefix + kPathPostfix, tr("%1: Full path excluding file name.").arg(heading)); - registerVariable(prefix + kFileNamePostfix, tr("%1: File name without including path.").arg(heading)); + registerVariable(prefix + kFileNamePostfix, tr("%1: File name without path.").arg(heading)); registerVariable(prefix + kFileBaseNamePostfix, tr("%1: File base name without path and suffix.").arg(heading)); } diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index f88f592d95..578b402739 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -183,7 +183,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent) "

GDB commands entered here will be executed after " "GDB has been started, but before the debugged program is started or " "attached, and before the debugging helpers are initialized.

%1" - "").arg(howToUsePython)); + "").arg(howToUsePython)); textEditStartupCommands = new QTextEdit(groupBoxStartupCommands); textEditStartupCommands->setAcceptRichText(false); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index d3384f6472..323f196ad9 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -632,7 +632,7 @@ void QmlEngine::notifyEngineRemoteServerRunning(const QByteArray &serverChannel, if (ok) startParameters().qmlServerPort = qmlPort; else - qWarning() << tr("QML debugging port not set! Unable to convert %1 to unsigned int.").arg(QString::fromLatin1(serverChannel)); + qWarning() << tr("QML debugging port not set: Unable to convert %1 to unsigned int.").arg(QString::fromLatin1(serverChannel)); DebuggerEngine::notifyEngineRemoteServerRunning(serverChannel, pid); notifyEngineSetupOk(); -- cgit v1.2.1 From 81fc8ff2109149eee203dd8148c14a7ffd9f4695 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 5 Jun 2013 08:43:52 +0300 Subject: Doc: Remove \fn lines adjacent to functions They are unneeded, some of them are unmaintained Change-Id: I0ad87e152d8e2328b486b2f904f7cf9613004afe Reviewed-by: Eike Ziller --- src/libs/extensionsystem/plugindetailsview.cpp | 3 -- src/libs/extensionsystem/pluginerrorview.cpp | 3 -- src/libs/extensionsystem/pluginmanager.cpp | 59 +--------------------- src/libs/extensionsystem/pluginspec.cpp | 52 ------------------- src/libs/qmldebug/qpacketprotocol.cpp | 2 - src/libs/qmljs/parser/qmlerror.cpp | 1 - src/libs/qmljs/persistenttrie.cpp | 4 -- src/libs/utils/savedaction.cpp | 2 - src/libs/zeroconf/servicebrowser.cpp | 2 - .../coreplugin/actionmanager/actioncontainer.cpp | 2 - src/plugins/coreplugin/documentmanager.cpp | 30 ----------- .../coreplugin/progressmanager/futureprogress.cpp | 8 --- src/plugins/debugger/gdb/gdbengine.cpp | 2 - src/plugins/debugger/watchwindow.cpp | 7 +-- src/plugins/find/searchresultwindow.cpp | 28 ---------- src/plugins/locator/locatorplugin.cpp | 4 -- src/plugins/projectexplorer/projectexplorer.cpp | 2 - src/plugins/projectexplorer/runconfiguration.cpp | 9 ++-- src/plugins/projectexplorer/session.cpp | 2 - src/plugins/texteditor/syntaxhighlighter.cpp | 2 - 20 files changed, 7 insertions(+), 217 deletions(-) (limited to 'src') diff --git a/src/libs/extensionsystem/plugindetailsview.cpp b/src/libs/extensionsystem/plugindetailsview.cpp index ca3c267cea..cb9e792443 100644 --- a/src/libs/extensionsystem/plugindetailsview.cpp +++ b/src/libs/extensionsystem/plugindetailsview.cpp @@ -46,7 +46,6 @@ using namespace ExtensionSystem; /*! - \fn PluginDetailsView::PluginDetailsView(QWidget *parent) Constructs a new view with given \a parent widget. */ PluginDetailsView::PluginDetailsView(QWidget *parent) @@ -57,7 +56,6 @@ PluginDetailsView::PluginDetailsView(QWidget *parent) } /*! - \fn PluginDetailsView::~PluginDetailsView() \internal */ PluginDetailsView::~PluginDetailsView() @@ -66,7 +64,6 @@ PluginDetailsView::~PluginDetailsView() } /*! - \fn void PluginDetailsView::update(PluginSpec *spec) Reads the given \a spec and displays its values in this PluginDetailsView. */ diff --git a/src/libs/extensionsystem/pluginerrorview.cpp b/src/libs/extensionsystem/pluginerrorview.cpp index 7d4c9e825a..81d3c63f1b 100644 --- a/src/libs/extensionsystem/pluginerrorview.cpp +++ b/src/libs/extensionsystem/pluginerrorview.cpp @@ -46,7 +46,6 @@ using namespace ExtensionSystem; /*! - \fn PluginErrorView::PluginErrorView(QWidget *parent) Constructs a new error view with given \a parent widget. */ PluginErrorView::PluginErrorView(QWidget *parent) @@ -57,7 +56,6 @@ PluginErrorView::PluginErrorView(QWidget *parent) } /*! - \fn PluginErrorView::~PluginErrorView() \internal */ PluginErrorView::~PluginErrorView() @@ -66,7 +64,6 @@ PluginErrorView::~PluginErrorView() } /*! - \fn void PluginErrorView::update(PluginSpec *spec) Reads the given \a spec and displays its state and error information in this PluginErrorView. */ diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index 69b5131793..19680cb603 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -245,7 +245,6 @@ static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two) PluginManager *PluginManager::m_instance = 0; /*! - \fn PluginManager *PluginManager::instance() Get the unique plugin manager instance. */ PluginManager *PluginManager::instance() @@ -254,7 +253,6 @@ PluginManager *PluginManager::instance() } /*! - \fn PluginManager::PluginManager() Create a plugin manager. Should be done only once per application. */ PluginManager::PluginManager() @@ -264,7 +262,6 @@ PluginManager::PluginManager() } /*! - \fn PluginManager::~PluginManager() \internal */ PluginManager::~PluginManager() @@ -274,7 +271,6 @@ PluginManager::~PluginManager() } /*! - \fn void PluginManager::addObject(QObject *obj) Add the given object \a obj to the object pool, so it can be retrieved again from the pool by type. The plugin manager does not do any memory management - added objects must be removed from the pool and deleted manually by whoever is responsible for the object. @@ -291,7 +287,6 @@ void PluginManager::addObject(QObject *obj) } /*! - \fn void PluginManager::removeObject(QObject *obj) Emits aboutToRemoveObject() and removes the object \a obj from the object pool. \sa PluginManager::addObject() */ @@ -301,7 +296,6 @@ void PluginManager::removeObject(QObject *obj) } /*! - \fn QList PluginManager::allObjects() const Retrieve the list of all objects in the pool, unfiltered. Usually clients do not need to call this. \sa PluginManager::getObject() @@ -313,7 +307,6 @@ QList PluginManager::allObjects() } /*! - \fn void PluginManager::loadPlugins() Tries to load all the plugins that were previously found when setting the plugin search paths. The plugin specs of the plugins can be used to retrieve error and state information about individual plugins. @@ -327,7 +320,6 @@ void PluginManager::loadPlugins() } /*! - \fn bool PluginManager::hasError() const Returns true if any plugin has errors even though it is enabled. Most useful to call after loadPlugins(). */ @@ -342,7 +334,6 @@ bool PluginManager::hasError() } /*! - \fn void PluginManager::shutdown() Shuts down and deletes all plugins. */ void PluginManager::shutdown() @@ -351,7 +342,6 @@ void PluginManager::shutdown() } /*! - \fn QStringList PluginManager::pluginPaths() const The list of paths were the plugin manager searches for plugins. \sa setPluginPaths() @@ -362,7 +352,6 @@ QStringList PluginManager::pluginPaths() } /*! - \fn void PluginManager::setPluginPaths(const QStringList &paths) Sets the plugin search paths, i.e. the file system paths where the plugin manager looks for plugin descriptions. All given \a paths and their sub directory trees are searched for plugin xml description files. @@ -376,7 +365,6 @@ void PluginManager::setPluginPaths(const QStringList &paths) } /*! - \fn QString PluginManager::fileExtension() const The file extension of plugin description files. The default is "xml". @@ -388,7 +376,6 @@ QString PluginManager::fileExtension() } /*! - \fn void PluginManager::setFileExtension(const QString &extension) Sets the file extension of plugin description files. The default is "xml". At the moment this must be called before setPluginPaths() is called. @@ -439,7 +426,6 @@ void PluginManager::writeSettings() } /*! - \fn QStringList PluginManager::arguments() const The arguments left over after parsing (Neither startup nor plugin arguments). Typically, this will be the list of files to open. */ @@ -449,7 +435,6 @@ QStringList PluginManager::arguments() } /*! - \fn QList PluginManager::plugins() const List of all plugin specifications that have been found in the plugin search paths. This list is valid directly after the setPluginPaths() call. The plugin specifications contain the information from the plugins' xml description files @@ -468,9 +453,9 @@ QHash PluginManager::pluginCollections() return m_instance->d->pluginCategories; } -/*! - \fn QString PluginManager::serializedArguments() const +static const char argumentKeywordC[] = ":arguments"; +/*! Serialize plugin options and arguments for sending in a single string via QtSingleApplication: ":myplugin|-option1|-option2|:arguments|argument1|argument2", @@ -478,9 +463,6 @@ QHash PluginManager::pluginCollections() \sa setPluginPaths() */ - -static const char argumentKeywordC[] = ":arguments"; - QString PluginManager::serializedArguments() { const QChar separator = QLatin1Char('|'); @@ -532,8 +514,6 @@ static QStringList subList(const QStringList &in, const QString &key) } /*! - \fn PluginManager::remoteArguments(const QString &argument, QObject *socket) - Parses the options encoded by serializedArguments() const and passes them on to the respective plugins along with the arguments. @@ -562,7 +542,6 @@ void PluginManager::remoteArguments(const QString &serializedArgument, QObject * } /*! - \fn bool PluginManager::parseOptions(const QStringList &args, const QMap &appOptions, QMap *foundAppOptions, QString *errorString) Takes the list of command line options in \a args and parses them. The plugin manager itself might process some options itself directly (-noload ), and adds options that are registered by plugins to their plugin specs. @@ -611,8 +590,6 @@ static inline void formatOption(QTextStream &str, } /*! - \fn static PluginManager::formatOptions(QTextStream &str, int optionIndentation, int descriptionIndentation) - Format the startup options of the plugin manager for command line help. */ @@ -638,8 +615,6 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d } /*! - \fn PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation) const - Format the plugin options of the plugin specs for command line help. */ @@ -660,11 +635,8 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, } /*! - \fn PluginManager::formatPluginVersions(QTextStream &str) const - Format the version of the plugin specs for command line help. */ - void PluginManager::formatPluginVersions(QTextStream &str) { const PluginSpecSet::const_iterator cend = m_instance->d->pluginSpecs.constEnd(); @@ -747,7 +719,6 @@ void PluginManager::startTests() } /*! - * \fn bool PluginManager::runningTests() const * \internal */ bool PluginManager::testRunRequested() @@ -756,7 +727,6 @@ bool PluginManager::testRunRequested() } /*! - * \fn QString PluginManager::testDataDirectory() const * \internal */ QString PluginManager::testDataDirectory() @@ -772,8 +742,6 @@ QString PluginManager::testDataDirectory() } /*! - \fn void PluginManager::profilingReport(const char *what, const PluginSpec *spec = 0) - Create a profiling entry showing the elapsed time if profiling is activated. */ @@ -784,8 +752,6 @@ void PluginManager::profilingReport(const char *what, const PluginSpec *spec) /*! - \fn void PluginManager::loadQueue() - Returns a list of plugins in load order. */ QList PluginManager::loadQueue() @@ -796,7 +762,6 @@ QList PluginManager::loadQueue() //============PluginManagerPrivate=========== /*! - \fn PluginSpec *PluginManagerPrivate::createSpec() \internal */ PluginSpec *PluginManagerPrivate::createSpec() @@ -805,7 +770,6 @@ PluginSpec *PluginManagerPrivate::createSpec() } /*! - \fn void PluginManagerPrivate::setSettings(QSettings *settings) \internal */ void PluginManagerPrivate::setSettings(QSettings *s) @@ -830,7 +794,6 @@ void PluginManagerPrivate::setGlobalSettings(QSettings *s) } /*! - \fn PluginSpecPrivate *PluginManagerPrivate::privateSpec(PluginSpec *spec) \internal */ PluginSpecPrivate *PluginManagerPrivate::privateSpec(PluginSpec *spec) @@ -859,7 +822,6 @@ void PluginManagerPrivate::nextDelayedInitialize() } /*! - \fn PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) \internal */ PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) : @@ -876,7 +838,6 @@ PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) : /*! - \fn PluginManagerPrivate::~PluginManagerPrivate() \internal */ PluginManagerPrivate::~PluginManagerPrivate() @@ -886,7 +847,6 @@ PluginManagerPrivate::~PluginManagerPrivate() } /*! - \fn void PluginManagerPrivate::writeSettings() \internal */ void PluginManagerPrivate::writeSettings() @@ -907,7 +867,6 @@ void PluginManagerPrivate::writeSettings() } /*! - \fn void PluginManagerPrivate::readSettings() \internal */ void PluginManagerPrivate::readSettings() @@ -921,7 +880,6 @@ void PluginManagerPrivate::readSettings() } /*! - \fn void PluginManagerPrivate::stopAll() \internal */ void PluginManagerPrivate::stopAll() @@ -938,7 +896,6 @@ void PluginManagerPrivate::stopAll() } /*! - \fn void PluginManagerPrivate::deleteAll() \internal */ void PluginManagerPrivate::deleteAll() @@ -952,7 +909,6 @@ void PluginManagerPrivate::deleteAll() } /*! - \fn void PluginManagerPrivate::addObject(QObject *obj) \internal */ void PluginManagerPrivate::addObject(QObject *obj) @@ -984,7 +940,6 @@ void PluginManagerPrivate::addObject(QObject *obj) } /*! - \fn void PluginManagerPrivate::removeObject(QObject *obj) \internal */ void PluginManagerPrivate::removeObject(QObject *obj) @@ -1008,7 +963,6 @@ void PluginManagerPrivate::removeObject(QObject *obj) } /*! - \fn void PluginManagerPrivate::loadPlugins() \internal */ void PluginManagerPrivate::loadPlugins() @@ -1039,7 +993,6 @@ void PluginManagerPrivate::loadPlugins() } /*! - \fn void PluginManagerPrivate::shutdown() \internal */ void PluginManagerPrivate::shutdown() @@ -1055,7 +1008,6 @@ void PluginManagerPrivate::shutdown() } /*! - \fn void PluginManagerPrivate::asyncShutdownFinished() \internal */ void PluginManagerPrivate::asyncShutdownFinished() @@ -1068,7 +1020,6 @@ void PluginManagerPrivate::asyncShutdownFinished() } /*! - \fn void PluginManagerPrivate::loadQueue() \internal */ QList PluginManagerPrivate::loadQueue() @@ -1082,7 +1033,6 @@ QList PluginManagerPrivate::loadQueue() } /*! - \fn bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList &queue, QList &circularityCheckQueue) \internal */ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList &queue, @@ -1125,7 +1075,6 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList &queu } /*! - \fn void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destState) \internal */ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destState) @@ -1192,7 +1141,6 @@ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destSt } /*! - \fn void PluginManagerPrivate::setPluginPaths(const QStringList &paths) \internal */ void PluginManagerPrivate::setPluginPaths(const QStringList &paths) @@ -1203,7 +1151,6 @@ void PluginManagerPrivate::setPluginPaths(const QStringList &paths) } /*! - \fn void PluginManagerPrivate::readPluginPaths() \internal */ void PluginManagerPrivate::readPluginPaths() @@ -1361,7 +1308,6 @@ void PluginManagerPrivate::profilingSummary() const } /*! - \fn void PluginManager::getObjectByName(const QString &name) const \brief Retrieves one object with a given name from the object pool. \sa addObject() */ @@ -1378,7 +1324,6 @@ QObject *PluginManager::getObjectByName(const QString &name) } /*! - \fn void PluginManager::getObjectByClassName(const QString &className) const Retrieves one object inheriting a class with a given name from the object pool. \sa addObject() */ diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 87a70d09c2..c9ccce4ce2 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -145,7 +145,6 @@ using namespace ExtensionSystem; using namespace ExtensionSystem::Internal; /*! - \fn uint qHash(const ExtensionSystem::PluginDependency &value) \internal */ uint ExtensionSystem::qHash(const ExtensionSystem::PluginDependency &value) @@ -154,7 +153,6 @@ uint ExtensionSystem::qHash(const ExtensionSystem::PluginDependency &value) } /*! - \fn bool PluginDependency::operator==(const PluginDependency &other) const \internal */ bool PluginDependency::operator==(const PluginDependency &other) const @@ -163,7 +161,6 @@ bool PluginDependency::operator==(const PluginDependency &other) const } /*! - \fn PluginSpec::PluginSpec() \internal */ PluginSpec::PluginSpec() @@ -172,7 +169,6 @@ PluginSpec::PluginSpec() } /*! - \fn PluginSpec::~PluginSpec() \internal */ PluginSpec::~PluginSpec() @@ -182,7 +178,6 @@ PluginSpec::~PluginSpec() } /*! - \fn QString PluginSpec::name() const The plugin name. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::name() const @@ -191,7 +186,6 @@ QString PluginSpec::name() const } /*! - \fn QString PluginSpec::version() const The plugin version. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::version() const @@ -200,7 +194,6 @@ QString PluginSpec::version() const } /*! - \fn QString PluginSpec::compatVersion() const The plugin compatibility version. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::compatVersion() const @@ -209,7 +202,6 @@ QString PluginSpec::compatVersion() const } /*! - \fn QString PluginSpec::vendor() const The plugin vendor. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::vendor() const @@ -218,7 +210,6 @@ QString PluginSpec::vendor() const } /*! - \fn QString PluginSpec::copyright() const The plugin copyright. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::copyright() const @@ -227,7 +218,6 @@ QString PluginSpec::copyright() const } /*! - \fn QString PluginSpec::license() const The plugin license. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::license() const @@ -236,7 +226,6 @@ QString PluginSpec::license() const } /*! - \fn QString PluginSpec::description() const The plugin description. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::description() const @@ -245,7 +234,6 @@ QString PluginSpec::description() const } /*! - \fn QString PluginSpec::url() const The plugin url where you can find more information about the plugin. This is valid after the PluginSpec::Read state is reached. */ QString PluginSpec::url() const @@ -254,7 +242,6 @@ QString PluginSpec::url() const } /*! - \fn QString PluginSpec::category() const The category that the plugin belongs to. Categories are groups of plugins which allow for keeping them together in the UI. Returns an empty string if the plugin does not belong to a category. */ @@ -264,7 +251,6 @@ QString PluginSpec::category() const } /*! - \fn bool PluginSpec::isExperimental() const Returns if the plugin has its experimental flag set. */ bool PluginSpec::isExperimental() const @@ -283,7 +269,6 @@ bool PluginSpec::isDisabledByDefault() const } /*! - \fn bool PluginSpec::isEnabledInSettings() const Returns if the plugin should be loaded at startup. True by default The user can change it from the Plugin settings. Note: That this function returns true even if a plugin is disabled because @@ -295,7 +280,6 @@ bool PluginSpec::isEnabledInSettings() const } /*! - \fn bool PluginSpec::isEffectivelyEnabled() const Returns if the plugin is loaded at startup. \see PluginSpec::isEnabled */ @@ -307,7 +291,6 @@ bool PluginSpec::isEffectivelyEnabled() const } /*! - \fn bool PluginSpec::isDisabledIndirectly() const Returns true if loading was not done due to user unselecting this plugin or its dependencies. */ bool PluginSpec::isDisabledIndirectly() const @@ -316,7 +299,6 @@ bool PluginSpec::isDisabledIndirectly() const } /*! - \fn bool PluginSpec::isForceEnabled() const Returns if the plugin is enabled via the -load option on the command line. */ bool PluginSpec::isForceEnabled() const @@ -325,7 +307,6 @@ bool PluginSpec::isForceEnabled() const } /*! - \fn bool PluginSpec::isForceDisabled() const Returns if the plugin is disabled via the -noload option on the command line. */ bool PluginSpec::isForceDisabled() const @@ -334,7 +315,6 @@ bool PluginSpec::isForceDisabled() const } /*! - \fn QList PluginSpec::dependencies() const The plugin dependencies. This is valid after the PluginSpec::Read state is reached. */ QList PluginSpec::dependencies() const @@ -343,7 +323,6 @@ QList PluginSpec::dependencies() const } /*! - \fn PluginSpec::PluginArgumentDescriptions PluginSpec::argumentDescriptions() const Returns a list of descriptions of command line arguments the plugin processes. */ @@ -353,7 +332,6 @@ PluginSpec::PluginArgumentDescriptions PluginSpec::argumentDescriptions() const } /*! - \fn QString PluginSpec::location() const The absolute path to the directory containing the plugin xml description file this PluginSpec corresponds to. */ @@ -363,7 +341,6 @@ QString PluginSpec::location() const } /*! - \fn QString PluginSpec::filePath() const The absolute path to the plugin xml description file (including the file name) this PluginSpec corresponds to. */ @@ -373,7 +350,6 @@ QString PluginSpec::filePath() const } /*! - \fn QStringList PluginSpec::arguments() const Command line arguments specific to that plugin. Set at startup */ @@ -383,7 +359,6 @@ QStringList PluginSpec::arguments() const } /*! - \fn void PluginSpec::setArguments(const QStringList &arguments) Set the command line arguments specific to that plugin to \a arguments. */ @@ -393,7 +368,6 @@ void PluginSpec::setArguments(const QStringList &arguments) } /*! - \fn PluginSpec::addArgument(const QString &argument) Adds \a argument to the command line arguments specific to that plugin. */ @@ -404,7 +378,6 @@ void PluginSpec::addArgument(const QString &argument) /*! - \fn PluginSpec::State PluginSpec::state() const The state in which the plugin currently is. See the description of the PluginSpec::State enum for details. */ @@ -414,7 +387,6 @@ PluginSpec::State PluginSpec::state() const } /*! - \fn bool PluginSpec::hasError() const Returns whether an error occurred while reading/starting the plugin. */ bool PluginSpec::hasError() const @@ -423,7 +395,6 @@ bool PluginSpec::hasError() const } /*! - \fn QString PluginSpec::errorString() const Detailed, possibly multi-line, error description in case of an error. */ QString PluginSpec::errorString() const @@ -432,7 +403,6 @@ QString PluginSpec::errorString() const } /*! - \fn bool PluginSpec::provides(const QString &pluginName, const QString &version) const Returns if this plugin can be used to fill in a dependency of the given \a pluginName and \a version. @@ -444,7 +414,6 @@ bool PluginSpec::provides(const QString &pluginName, const QString &version) con } /*! - \fn IPlugin *PluginSpec::plugin() const The corresponding IPlugin instance, if the plugin library has already been successfully loaded, i.e. the PluginSpec::Loaded state is reached. */ @@ -454,7 +423,6 @@ IPlugin *PluginSpec::plugin() const } /*! - \fn QList PluginSpec::dependencySpecs() const Returns the list of dependencies, already resolved to existing plugin specs. Valid if PluginSpec::Resolved state is reached. @@ -493,7 +461,6 @@ namespace { const char ARGUMENT_PARAMETER[] = "parameter"; } /*! - \fn PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec) \internal */ PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec) @@ -512,7 +479,6 @@ PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec) } /*! - \fn bool PluginSpecPrivate::read(const QString &fileName) \internal */ bool PluginSpecPrivate::read(const QString &fileName) @@ -590,7 +556,6 @@ void PluginSpec::setForceDisabled(bool value) } /*! - \fn bool PluginSpecPrivate::reportError(const QString &err) \internal */ bool PluginSpecPrivate::reportError(const QString &err) @@ -626,7 +591,6 @@ static inline QString msgUnexpectedToken() } /*! - \fn void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader) \internal */ void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader) @@ -702,10 +666,8 @@ void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader) } /*! - \fn void PluginSpecPrivate::readArgumentDescriptions(QXmlStreamReader &reader) \internal */ - void PluginSpecPrivate::readArgumentDescriptions(QXmlStreamReader &reader) { QString element; @@ -736,7 +698,6 @@ void PluginSpecPrivate::readArgumentDescriptions(QXmlStreamReader &reader) } /*! - \fn void PluginSpecPrivate::readArgumentDescription(QXmlStreamReader &reader) \internal */ void PluginSpecPrivate::readArgumentDescription(QXmlStreamReader &reader) @@ -766,7 +727,6 @@ bool PluginSpecPrivate::readBooleanValue(QXmlStreamReader &reader, const char *k } /*! - \fn void PluginSpecPrivate::readDependencies(QXmlStreamReader &reader) \internal */ void PluginSpecPrivate::readDependencies(QXmlStreamReader &reader) @@ -799,7 +759,6 @@ void PluginSpecPrivate::readDependencies(QXmlStreamReader &reader) } /*! - \fn void PluginSpecPrivate::readDependencyEntry(QXmlStreamReader &reader) \internal */ void PluginSpecPrivate::readDependencyEntry(QXmlStreamReader &reader) @@ -834,7 +793,6 @@ void PluginSpecPrivate::readDependencyEntry(QXmlStreamReader &reader) } /*! - \fn bool PluginSpecPrivate::provides(const QString &pluginName, const QString &pluginVersion) const \internal */ bool PluginSpecPrivate::provides(const QString &pluginName, const QString &pluginVersion) const @@ -845,7 +803,6 @@ bool PluginSpecPrivate::provides(const QString &pluginName, const QString &plugi } /*! - \fn QRegExp &PluginSpecPrivate::versionRegExp() \internal */ QRegExp &PluginSpecPrivate::versionRegExp() @@ -854,7 +811,6 @@ QRegExp &PluginSpecPrivate::versionRegExp() return reg; } /*! - \fn bool PluginSpecPrivate::isValidVersion(const QString &version) \internal */ bool PluginSpecPrivate::isValidVersion(const QString &version) @@ -863,7 +819,6 @@ bool PluginSpecPrivate::isValidVersion(const QString &version) } /*! - \fn int PluginSpecPrivate::versionCompare(const QString &version1, const QString &version2) \internal */ int PluginSpecPrivate::versionCompare(const QString &version1, const QString &version2) @@ -888,7 +843,6 @@ int PluginSpecPrivate::versionCompare(const QString &version1, const QString &ve } /*! - \fn bool PluginSpecPrivate::resolveDependencies(const QList &specs) \internal */ bool PluginSpecPrivate::resolveDependencies(const QList &specs) @@ -956,7 +910,6 @@ void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled() } /*! - \fn bool PluginSpecPrivate::loadLibrary() \internal */ bool PluginSpecPrivate::loadLibrary() @@ -1013,7 +966,6 @@ bool PluginSpecPrivate::loadLibrary() } /*! - \fn bool PluginSpecPrivate::initializePlugin() \internal */ bool PluginSpecPrivate::initializePlugin() @@ -1043,7 +995,6 @@ bool PluginSpecPrivate::initializePlugin() } /*! - \fn bool PluginSpecPrivate::initializeExtensions() \internal */ bool PluginSpecPrivate::initializeExtensions() @@ -1068,7 +1019,6 @@ bool PluginSpecPrivate::initializeExtensions() } /*! - \fn bool PluginSpecPrivate::delayedInitialize() \internal */ bool PluginSpecPrivate::delayedInitialize() @@ -1086,7 +1036,6 @@ bool PluginSpecPrivate::delayedInitialize() } /*! - \fn bool PluginSpecPrivate::stop() \internal */ IPlugin::ShutdownFlag PluginSpecPrivate::stop() @@ -1098,7 +1047,6 @@ IPlugin::ShutdownFlag PluginSpecPrivate::stop() } /*! - \fn bool PluginSpecPrivate::kill() \internal */ void PluginSpecPrivate::kill() diff --git a/src/libs/qmldebug/qpacketprotocol.cpp b/src/libs/qmldebug/qpacketprotocol.cpp index d9aa7493a9..4bc56c2173 100644 --- a/src/libs/qmldebug/qpacketprotocol.cpp +++ b/src/libs/qmldebug/qpacketprotocol.cpp @@ -265,8 +265,6 @@ QPacketAutoSend QPacketProtocol::send() } /*! - \fn void QPacketProtocol::send(const QPacket & packet) - Transmit the \a packet. */ void QPacketProtocol::send(const QPacket & p) diff --git a/src/libs/qmljs/parser/qmlerror.cpp b/src/libs/qmljs/parser/qmlerror.cpp index cd81100d1e..b097eea812 100644 --- a/src/libs/qmljs/parser/qmlerror.cpp +++ b/src/libs/qmljs/parser/qmlerror.cpp @@ -237,7 +237,6 @@ QString QmlError::toString() const /*! \relates QmlError - \fn QDebug operator<<(QDebug debug, const QmlError &error) Outputs a human readable version of \a error to \a debug. */ diff --git a/src/libs/qmljs/persistenttrie.cpp b/src/libs/qmljs/persistenttrie.cpp index 75db9b5e8b..15bed733fe 100644 --- a/src/libs/qmljs/persistenttrie.cpp +++ b/src/libs/qmljs/persistenttrie.cpp @@ -642,8 +642,6 @@ Trie Trie::replaceF(const QHash &replacements) const } /*! - \fn int matchStrength(const QString &searchStr, const QString &str) - Returns a number defining how well the serachStr matches str. Quite simplistic, looks only at the first match, and prefers contiguos @@ -692,8 +690,6 @@ public: } /*! - \fn QStringList matchingStrengthSort(const QString &searchStr, QStringList &res) - returns a number defining the matching strength of res to the given searchStr */ QStringList matchStrengthSort(const QString &searchStr, QStringList &res) diff --git a/src/libs/utils/savedaction.cpp b/src/libs/utils/savedaction.cpp index 953c161365..11a908280f 100644 --- a/src/libs/utils/savedaction.cpp +++ b/src/libs/utils/savedaction.cpp @@ -191,8 +191,6 @@ QString SavedAction::toString() const } /*! - \fn QAction *SavedAction::updatedAction(const QString &text) - Adjust the \c text() of the underlying action. This can be used to update the item shortly before e.g. a menu is shown. diff --git a/src/libs/zeroconf/servicebrowser.cpp b/src/libs/zeroconf/servicebrowser.cpp index 0dd8accf4f..b1e8eebfb5 100644 --- a/src/libs/zeroconf/servicebrowser.cpp +++ b/src/libs/zeroconf/servicebrowser.cpp @@ -289,8 +289,6 @@ Service::~Service() } /*! - \fn QString Service::networkInterface() - Returns the interface on which the service is reachable. */ QNetworkInterface Service::networkInterface() const diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp index bbc804740d..c5e23db1bc 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp @@ -290,8 +290,6 @@ void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *m } /*! - * \fn Command *ActionContainer::addSeparator(const Context &context, const Id &group, QAction **outSeparator) - * * Adds a separator to the end of the given \a group to the action container, which is enabled * for a given \a context. The created separator action is returned through \a outSeparator. * diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 7229797394..e9ef06e595 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -273,8 +273,6 @@ static void addFileInfo(IDocument *document) } /*! - \fn bool DocumentManager::addFiles(const QList &documents, bool addWatcher) - Adds a list of IDocument's to the collection. If \a addWatcher is true (the default), the files are added to a file system watcher that notifies the file manager about file changes. @@ -362,7 +360,6 @@ static void dump() */ /*! - \fn void DocumentManager::renamedFile(const QString &from, const QString &to) \brief Tells the file manager that a file has been renamed on disk from within Qt Creator. Needs to be called right after the actual renaming on disk (i.e. before the file system @@ -406,8 +403,6 @@ void DocumentManager::fileNameChanged(const QString &oldName, const QString &new } /*! - \fn bool DocumentManager::addFile(IDocument *document, bool addWatcher) - Adds a IDocument object to the collection. If \a addWatcher is true (the default), the file is added to a file system watcher that notifies the file manager about file changes. @@ -426,8 +421,6 @@ void DocumentManager::documentDestroyed(QObject *obj) } /*! - \fn bool DocumentManager::removeFile(IDocument *document) - Removes a IDocument object from the collection. Returns true if the file specified by \a document had the addWatcher argument to addDocument() set. @@ -466,7 +459,6 @@ void DocumentManager::checkForNewFileName() } /*! - \fn QString DocumentManager::fixFileName(const QString &fileName, FixMode fixmode) Returns a guaranteed cleaned path in native form. If the file exists, it will either be a cleaned absolute file path (fixmode == KeepLinks), or a cleaned canonical file path (fixmode == ResolveLinks). @@ -490,8 +482,6 @@ QString DocumentManager::fixFileName(const QString &fileName, FixMode fixmode) } /*! - \fn QList DocumentManager::modifiedFiles() const - Returns the list of IDocument's that have been modified. */ QList DocumentManager::modifiedDocuments() @@ -512,8 +502,6 @@ QList DocumentManager::modifiedDocuments() } /*! - \fn void DocumentManager::expectFileChange(const QString &fileName) - Any subsequent change to \a fileName is treated as a expected file change. \see DocumentManager::unexpectFileChange(const QString &fileName) @@ -538,8 +526,6 @@ static void updateExpectedState(const QString &fileName) } /*! - \fn void DocumentManager::unexpectFileChange(const QString &fileName) - Any change to \a fileName are unexpected again. \see DocumentManager::expectFileChange(const QString &fileName) @@ -561,8 +547,6 @@ void DocumentManager::unexpectFileChange(const QString &fileName) updateExpectedState(fixedResolvedName); } -/*! - \fn QList DocumentManager::saveModifiedFilesSilently(const QList &documents) Tries to save the files listed in \a documents. The \a cancelled argument is set to true if the user cancelled the dialog. Returns the files that could not be saved. If the files @@ -575,8 +559,6 @@ QList DocumentManager::saveModifiedDocumentsSilently(const QList DocumentManager::saveModifiedFiles(const QList &documents, bool *cancelled, const QString &message, const QString &alwaysSaveMessage, bool *alwaysSave) - Asks the user whether to save the files listed in \a documents . Opens a dialog with the given \a message, and a additional text that should be used to ask if the user wants to enabled automatic save @@ -758,8 +740,6 @@ QString DocumentManager::getSaveFileNameWithExtension(const QString &title, cons } /*! - \fn QString DocumentManager::getSaveAsFileName(IDocument *document, const QString &filter, QString *selectedFilter) - Asks the user for a new file name (Save File As) for /arg document. */ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QString &filter, QString *selectedFilter) @@ -794,10 +774,6 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr } /*! - \fn QStringList DocumentManager::getOpenFileNames(const QString &filters, - const QString pathIn, - QString *selectedFilter) - Asks the user for a set of file names to be opened. The \a filters and \a selectedFilter parameters is interpreted like in QFileDialog::getOpenFileNames(), \a pathIn specifies a path to open the dialog @@ -1078,8 +1054,6 @@ void DocumentManager::syncWithEditor(const QList &context) } /*! - \fn void DocumentManager::addToRecentFiles(const QString &fileName, const QString &editorId) - Adds the \a fileName to the list of recent files. Associates the file to be reopened with an editor of the given \a editorId, if possible. \a editorId defaults to the empty id, which means to let the system figure out @@ -1103,8 +1077,6 @@ void DocumentManager::addToRecentFiles(const QString &fileName, const Id &editor } /*! - \fn void DocumentManager::clearRecentFiles() - Clears the list of recent files. Should only be called by the core plugin when the user chooses to clear it. */ @@ -1114,8 +1086,6 @@ void DocumentManager::clearRecentFiles() } /*! - \fn QStringList DocumentManager::recentFiles() const - Returns the list of recent files. */ QList DocumentManager::recentFiles() diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp index 917c3b3ec5..da6a6a1dcd 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp @@ -145,7 +145,6 @@ FutureProgress::FutureProgress(QWidget *parent) : } /*! - \fn FutureProgress::~FutureProgress() \internal */ FutureProgress::~FutureProgress() @@ -155,7 +154,6 @@ FutureProgress::~FutureProgress() } /*! - \fn void FutureProgress::setWidget(QWidget *widget) Sets the \a widget to show below the progress bar. This will be destroyed when the progress indicator is destroyed. Default is to show no widget below the progress indicator. @@ -172,7 +170,6 @@ void FutureProgress::setWidget(QWidget *widget) } /*! - \fn void FutureProgress::setTitle(const QString &title) Changes the \a title of the progress indicator. */ void FutureProgress::setTitle(const QString &title) @@ -181,7 +178,6 @@ void FutureProgress::setTitle(const QString &title) } /*! - \fn QString FutureProgress::title() const Returns the title of the progress indicator. */ QString FutureProgress::title() const @@ -268,7 +264,6 @@ void FutureProgress::setProgressText(const QString &text) } /*! - \fn void FutureProgress::setFuture(const QFuture &future) \internal */ void FutureProgress::setFuture(const QFuture &future) @@ -277,7 +272,6 @@ void FutureProgress::setFuture(const QFuture &future) } /*! - \fn QFuture FutureProgress::future() const Returns a QFuture object that represents this running task. */ QFuture FutureProgress::future() const @@ -286,7 +280,6 @@ QFuture FutureProgress::future() const } /*! - \fn void FutureProgress::mousePressEvent(QMouseEvent *event) \internal */ void FutureProgress::mousePressEvent(QMouseEvent *event) @@ -304,7 +297,6 @@ void FutureProgress::paintEvent(QPaintEvent *) } /*! - \fn bool FutureProgress::hasError() const Returns the error state of this progress indicator. */ bool FutureProgress::hasError() const diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 0b007674bc..e8f80920f3 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2412,7 +2412,6 @@ void GdbEngine::handleExecuteReturn(const GdbResponse &response) } /*! - \fn void Debugger::Internal::GdbEngine::setTokenBarrier() \brief Discard the results of all pending watch-updating commands. This method is called at the beginning of all step/next/finish etc. @@ -2420,7 +2419,6 @@ void GdbEngine::handleExecuteReturn(const GdbResponse &response) If non-watch-updating commands with call-backs are still in the pipe, it will complain. */ - void GdbEngine::setTokenBarrier() { //QTC_ASSERT(m_nonDiscardableCount == 0, /**/); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index a250660763..43106b36aa 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -232,9 +232,9 @@ static int memberVariableRecursion(const QAbstractItemModel *model, return childCount; } -/*! - \fn variableMemoryMarkup() +typedef QList MemoryMarkupList; +/*! \brief Creates markup for a variable in the memory view. Marks the visible children with alternating colors in the parent, that is, for @@ -272,9 +272,6 @@ static int memberVariableRecursion(const QAbstractItemModel *model, \sa Debugger::Internal::MemoryViewWidget */ - -typedef QList MemoryMarkupList; - static MemoryMarkupList variableMemoryMarkup(const QAbstractItemModel *model, const QModelIndex &modelIndex, diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 1a45816174..cda06a6464 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -265,7 +265,6 @@ using namespace Find::Internal; SearchResultWindow *SearchResultWindow::m_instance = 0; /*! - \fn SearchResultWindow::SearchResultWindow() \internal */ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) @@ -305,7 +304,6 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) } /*! - \fn SearchResultWindow::~SearchResultWindow() \internal */ SearchResultWindow::~SearchResultWindow() @@ -318,7 +316,6 @@ SearchResultWindow::~SearchResultWindow() } /*! - \fn SearchResultWindow *SearchResultWindow::instance() \brief Returns the single shared instance of the Search Results window. */ SearchResultWindow *SearchResultWindow::instance() @@ -327,7 +324,6 @@ SearchResultWindow *SearchResultWindow::instance() } /*! - \fn void SearchResultWindow::visibilityChanged(bool) \internal */ void SearchResultWindow::visibilityChanged(bool visible) @@ -337,7 +333,6 @@ void SearchResultWindow::visibilityChanged(bool visible) } /*! - \fn QWidget *SearchResultWindow::outputWidget(QWidget *) \internal */ QWidget *SearchResultWindow::outputWidget(QWidget *) @@ -346,7 +341,6 @@ QWidget *SearchResultWindow::outputWidget(QWidget *) } /*! - \fn QList SearchResultWindow::toolBarWidgets() const \internal */ QList SearchResultWindow::toolBarWidgets() const @@ -413,7 +407,6 @@ SearchResult *SearchResultWindow::startNewSearch(const QString &label, } /*! - \fn void SearchResultWindow::clearContents() \brief Clears the current contents in the search result window. */ void SearchResultWindow::clearContents() @@ -434,7 +427,6 @@ void SearchResultWindow::clearContents() } /*! - \fn bool SearchResultWindow::hasFocus() \internal */ bool SearchResultWindow::hasFocus() const @@ -443,7 +435,6 @@ bool SearchResultWindow::hasFocus() const } /*! - \fn bool SearchResultWindow::canFocus() \internal */ bool SearchResultWindow::canFocus() const @@ -454,7 +445,6 @@ bool SearchResultWindow::canFocus() const } /*! - \fn void SearchResultWindow::setFocus() \internal */ void SearchResultWindow::setFocus() @@ -466,7 +456,6 @@ void SearchResultWindow::setFocus() } /*! - \fn void SearchResultWindow::setTextEditorFont(const QFont &font) \internal */ void SearchResultWindow::setTextEditorFont(const QFont &font, @@ -497,7 +486,6 @@ void SearchResultWindow::openNewSearchPanel() } /*! - \fn void SearchResultWindow::handleExpandCollapseToolButton(bool checked) \internal */ void SearchResultWindow::handleExpandCollapseToolButton(bool checked) @@ -515,7 +503,6 @@ void SearchResultWindow::handleExpandCollapseToolButton(bool checked) } /*! - \fn void SearchResultWindow::readSettings() \internal */ void SearchResultWindow::readSettings() @@ -527,7 +514,6 @@ void SearchResultWindow::readSettings() } /*! - \fn void SearchResultWindow::writeSettings() \internal */ void SearchResultWindow::writeSettings() @@ -539,7 +525,6 @@ void SearchResultWindow::writeSettings() } /*! - \fn int SearchResultWindow::priorityInStatusBar() const \internal */ int SearchResultWindow::priorityInStatusBar() const @@ -548,7 +533,6 @@ int SearchResultWindow::priorityInStatusBar() const } /*! - \fn bool SearchResultWindow::canNext() \internal */ bool SearchResultWindow::canNext() const @@ -559,7 +543,6 @@ bool SearchResultWindow::canNext() const } /*! - \fn bool SearchResultWindow::canPrevious() \internal */ bool SearchResultWindow::canPrevious() const @@ -568,7 +551,6 @@ bool SearchResultWindow::canPrevious() const } /*! - \fn void SearchResultWindow::goToNext() \internal */ void SearchResultWindow::goToNext() @@ -579,7 +561,6 @@ void SearchResultWindow::goToNext() } /*! - \fn void SearchResultWindow::goToPrev() \internal */ void SearchResultWindow::goToPrev() @@ -590,7 +571,6 @@ void SearchResultWindow::goToPrev() } /*! - \fn bool SearchResultWindow::canNavigate() \internal */ bool SearchResultWindow::canNavigate() const @@ -599,7 +579,6 @@ bool SearchResultWindow::canNavigate() const } /*! - \fn SearchResult::SearchResult(SearchResultWidget *widget) \internal */ SearchResult::SearchResult(SearchResultWidget *widget) @@ -620,7 +599,6 @@ SearchResult::SearchResult(SearchResultWidget *widget) } /*! - \fn void SearchResult::setUserData(const QVariant &data) \brief Attach some random \a data to this search, that you can use later. \sa userData() @@ -631,7 +609,6 @@ void SearchResult::setUserData(const QVariant &data) } /*! - \fn void SearchResult::userData() \brief Return the data that was attached to this search by calling setUserData(). \sa setUserData() @@ -642,7 +619,6 @@ QVariant SearchResult::userData() const } /*! - \fn QString SearchResult::textToReplace() const \brief Returns the text that should replace the text in search results. */ QString SearchResult::textToReplace() const @@ -661,7 +637,6 @@ void SearchResult::setSearchAgainSupported(bool supported) } /*! - \fn void SearchResult::addResult(const QString &fileName, int lineNumber, const QString &rowText, int searchTermStart, int searchTermLength, const QVariant &userData) \brief Adds a single result line to the search results. The \a fileName, \a lineNumber and \a rowText are shown in the result line. @@ -681,7 +656,6 @@ void SearchResult::addResult(const QString &fileName, int lineNumber, const QStr } /*! - \fn void SearchResult::addResults(const QList &items, SearchResult::AddMode mode) \brief Adds all of the given search result \a items to the search results window. @@ -694,7 +668,6 @@ void SearchResult::addResults(const QList &items, AddMode mode } /*! - \fn void SearchResult::finishSearch() \brief Notifies the search result window that the current search has finished, and the UI should reflect that. */ @@ -704,7 +677,6 @@ void SearchResult::finishSearch(bool canceled) } /*! - \fn void SearchResult::setTextToReplace(const QString &textToReplace) \brief Sets the value in the UI element that allows the user to type the text that should replace text in search results to \a textToReplace. */ diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index caa5102f0b..e7758facbe 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -211,8 +211,6 @@ void LocatorPlugin::saveSettings() } /*! - \fn QList LocatorPlugin::filters() - Return all filters, including the ones created by the user. */ QList LocatorPlugin::filters() @@ -221,8 +219,6 @@ QList LocatorPlugin::filters() } /*! - \fn QList LocatorPlugin::customFilters() - This returns a subset of all the filters, that contains only the filters that have been created by the user at some point (maybe in a previous session). */ diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index d25442b026..d2098f02ef 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1521,8 +1521,6 @@ static inline QStringList projectFileGlobs() } /*! - \fn void ProjectExplorerPlugin::restoreSession() - This method is connected to the ICore::coreOpened signal. If there was no session explicitly loaded, it creates an empty new default session and puts the list of recent projects and sessions diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 725d2b1132..8f0bf410a9 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -104,6 +104,9 @@ bool ProcessHandle::equals(const ProcessHandle &rhs) const } +/*! + \brief Returns the widget used to configure this run configuration. Ownership is transferred to the caller +*/ RunConfigWidget *IRunConfigurationAspect::createConfigurationWidget() { return 0; @@ -200,12 +203,6 @@ bool RunConfiguration::ensureConfigured(QString *errorMessage) } -/*! - \fn virtual QWidget *ProjectExplorer::RunConfiguration::createConfigurationWidget() - - \brief Returns the widget used to configure this run configuration. Ownership is transferred to the caller -*/ - BuildConfiguration *RunConfiguration::activeBuildConfiguration() const { if (!target()) diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 445db5f031..cb493df466 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -373,8 +373,6 @@ bool SessionManager::save() } /*! - \fn bool SessionManager::closeAllProjects() - Closes all projects */ void SessionManager::closeAllProjects() diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index ed75207816..de9c5acd09 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -553,8 +553,6 @@ void SyntaxHighlighter::applyFormatToSpaces(const QString &text, const QTextChar } /*! - \fn QTextCharFormat SyntaxHighlighter::format(int position) const - Returns the format at \a position inside the syntax highlighter's current text block. */ -- cgit v1.2.1 From 277fa49d282b997386f309abfc5a0de6014ca989 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 5 Jun 2013 11:09:56 +0300 Subject: Fix compilation Change-Id: I269013c06dd540309b95cf1411bbc3571df2c5b5 Reviewed-by: Orgad Shaneh --- src/plugins/coreplugin/documentmanager.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index e9ef06e595..540e2fa7d2 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -548,6 +548,7 @@ void DocumentManager::unexpectFileChange(const QString &fileName) } +/*! Tries to save the files listed in \a documents. The \a cancelled argument is set to true if the user cancelled the dialog. Returns the files that could not be saved. If the files listed in documents have no write permissions an additional dialog will be prompted to -- cgit v1.2.1 From c6cbc97a5c94cc49d550058d72cb6c39c14ff806 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 4 Jun 2013 18:00:42 +0200 Subject: FileSaver: Do not rollback if we never opened the file This will silence some warnings about removing files with empty filenames which we get due to trying to remove a file we never managed to open. Calling finalize() unconditionally is the right thing to do here as that processes and/or displays on error message to the user if there is any. Change-Id: Ibe7d07233f2c2698e53a7ad21041bc5cc4fcac0e Reviewed-by: Oswald Buddenhagen --- src/libs/utils/fileutils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index d5193bdad8..06b8936e82 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -373,10 +373,12 @@ bool FileSaver::finalize() return FileSaverBase::finalize(); SaveFile *sf = static_cast(m_file); - if (m_hasError) - sf->rollback(); - else + if (m_hasError) { + if (sf->isOpen()) + sf->rollback(); + } else { setResult(sf->commit()); + } delete sf; m_file = 0; return !m_hasError; -- cgit v1.2.1 From 8cd56cf68d29fbf968f80d940962ce9f2d107fd7 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 4 Jun 2013 18:01:47 +0200 Subject: Make sure to call FileSaver::finalize We may leak resources otherwise. Change-Id: Ic09f58bd47cbf283e22f17f2c3393ca03c5dfacf Reviewed-by: Oswald Buddenhagen --- src/libs/utils/textfileformat.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/libs/utils/textfileformat.cpp b/src/libs/utils/textfileformat.cpp index c4c33cd652..62f22bb964 100644 --- a/src/libs/utils/textfileformat.cpp +++ b/src/libs/utils/textfileformat.cpp @@ -289,13 +289,11 @@ bool TextFileFormat::writeFile(const QString &fileName, QString plainText, QStri } Utils::FileSaver saver(fileName, fileMode); - if (saver.hasError()) { - *errorString = saver.errorString(); - return false; + if (!saver.hasError()) { + if (hasUtf8Bom && codec->name() == "UTF-8") + saver.write("\xef\xbb\xbf", 3); + saver.write(codec->fromUnicode(plainText)); } - if (hasUtf8Bom && codec->name() == "UTF-8") - saver.write("\xef\xbb\xbf", 3); - saver.write(codec->fromUnicode(plainText)); const bool ok = saver.finalize(errorString); if (debug) qDebug().nospace() << Q_FUNC_INFO << fileName << ' ' << *this << ' ' << plainText.size() -- cgit v1.2.1 From cd028ac14f0f16d214d911f5f81e9664d3693082 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 4 Jun 2013 18:02:49 +0200 Subject: Do not pass a file that we know to be broken to QTextStream Change-Id: I1a593af642c70ca7a0654163e7a32d405a1c2aa6 Reviewed-by: Oswald Buddenhagen --- src/plugins/valgrind/suppressiondialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp index b235bdf0e4..8e1a4c25a4 100644 --- a/src/plugins/valgrind/suppressiondialog.cpp +++ b/src/plugins/valgrind/suppressiondialog.cpp @@ -203,9 +203,11 @@ void SuppressionDialog::accept() QTC_ASSERT(!m_suppressionEdit->toPlainText().trimmed().isEmpty(), return); Utils::FileSaver saver(path, QIODevice::Append); - QTextStream stream(saver.file()); - stream << m_suppressionEdit->toPlainText(); - saver.setResult(&stream); + if (!saver.hasError()) { + QTextStream stream(saver.file()); + stream << m_suppressionEdit->toPlainText(); + saver.setResult(&stream); + } if (!saver.finalize(this)) return; -- cgit v1.2.1 From fef85f745f471e6910c14f1389429d2ac9fc6600 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 5 Jun 2013 11:57:24 +0200 Subject: QmlDesigner.PropertyEditor: Adding lookup rules for different versions The property editor will now try to find a pane for the specific version first. Example: If we have a QtQuick.Item 2.0 We first look for: QtQuick/ItemPane_2_0.qml And then fallback to: QtQuick/ItemPane.qml The same does apply for the specifics file. Task-number: QTCREATORBUG-8681 Change-Id: If210998780073295f168169d2fc424288d3bd6a0 Reviewed-by: Thomas Hartmann --- .../components/propertyeditor/propertyeditor.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 1d071692e2..abcf340489 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -1087,6 +1087,22 @@ QString PropertyEditor::locateQmlFile(const NodeMetaInfo &info, const QString &r static QDir resourcesDir(resourcePropertyEditorPath); QDir importDir(info.importDirectoryPath() + QLatin1String(Constants::QML_DESIGNER_SUBFOLDER)); + const QString versionString = QLatin1String("_") + QString::number(info.majorVersion()) + + QLatin1String("_") + + QString::number(info.minorVersion()); + + QString relativePathWithoutEnding = relativePath; + relativePathWithoutEnding.chop(4); + const QString relativePathWithVersion = relativePathWithoutEnding + versionString + QLatin1String(".qml"); + + //Check for qml files with versions first + if (importDir.exists(relativePathWithVersion)) + return importDir.absoluteFilePath(relativePathWithVersion); + if (fileSystemDir.exists(relativePathWithVersion)) + return fileSystemDir.absoluteFilePath(relativePathWithVersion); + if (resourcesDir.exists(relativePathWithVersion)) + return resourcesDir.absoluteFilePath(relativePathWithVersion); + if (importDir.exists(relativePath)) return importDir.absoluteFilePath(relativePath); if (fileSystemDir.exists(relativePath)) -- cgit v1.2.1 From 1b3e5269440849b24bd276b8dae4fb00101aab78 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 5 Jun 2013 11:59:20 +0200 Subject: QmlDesigner.PropertyEditor: use F3 to reload property panes F3 is still free in Qt Creator Change-Id: I0588e467a5f7c60ee621c472614be6003d5fe2dd Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index abcf340489..ec1dc09cff 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -343,7 +343,7 @@ PropertyEditor::PropertyEditor(QWidget *parent) : m_setupCompleted(false), m_singleShotTimer(new QTimer(this)) { - m_updateShortcut = new QShortcut(QKeySequence("F5"), m_stackedWidget); + m_updateShortcut = new QShortcut(QKeySequence("F3"), m_stackedWidget); connect(m_updateShortcut, SIGNAL(activated()), this, SLOT(reloadQml())); m_stackedWidget->setStyleSheet( -- cgit v1.2.1 From 34022107f0ace8edd7160bf45dd408e4e67027dd Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 4 Jun 2013 12:42:52 +0200 Subject: QmlDesigner.PropertyEditor: Add generic QtObject pane This patch adds a generic property editor pane for QtObject. Objects derived from QtObject get an auto generated property editor for their additional properties or can use the specfics mechanism to define a custom one. Task-number: QTCREATORBUG-9451 Change-Id: I730b19e4e417f3f4d4ee6cdf2b3f3ef32f8c1f94 Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index ec1dc09cff..f4a12681a4 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -952,7 +952,7 @@ void PropertyEditor::scriptFunctionsChanged(const ModelNode &node, const QString void PropertyEditor::select(const ModelNode &node) { - if (QmlItemNode(node).isValid()) + if (QmlObjectNode(node).isValid()) m_selectedNode = node; else m_selectedNode = ModelNode(); -- cgit v1.2.1 From d931583008bb12ceecb07b7634ae6a85508ab6ec Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 4 Jun 2013 17:59:22 +0200 Subject: QmlDesigner: Double click in the form editor only for the left mouse button Change-Id: I130bacab8d94ddc5b8544a1b74d662059f976aca Reviewed-by: Thomas Hartmann --- .../components/formeditor/abstractformeditortool.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp index 7b67273fb8..56688e1c53 100644 --- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.cpp @@ -209,11 +209,13 @@ void AbstractFormEditorTool::mouseReleaseEvent(const QList & /*i } } -void AbstractFormEditorTool::mouseDoubleClickEvent(const QList &itemList, QGraphicsSceneMouseEvent *) +void AbstractFormEditorTool::mouseDoubleClickEvent(const QList &itemList, QGraphicsSceneMouseEvent *event) { - FormEditorItem *formEditorItem = topFormEditorItem(itemList); - if (formEditorItem) - view()->changeToCustomTool(formEditorItem->qmlItemNode().modelNode()); + if (event->button() == Qt::LeftButton) { + FormEditorItem *formEditorItem = topFormEditorItem(itemList); + if (formEditorItem) + view()->changeToCustomTool(formEditorItem->qmlItemNode().modelNode()); + } } void AbstractFormEditorTool::showContextMenu(QGraphicsSceneMouseEvent *event) -- cgit v1.2.1 From 8140a87f9afea74a451dc1f47bf0470a5cd7f8a7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Jun 2013 12:11:08 +0200 Subject: QmlJsTools: Compile fix for Qt 4. Change-Id: Ifaa78943be52d821bfbc3f32fb3fc914cf2d4315 Reviewed-by: Oswald Buddenhagen --- src/plugins/qmljstools/qmlconsoleview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index 85ba23444c..872b4ae867 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -44,6 +44,7 @@ #include #include #include +#include using namespace QmlJS; -- cgit v1.2.1 From 2ee83d4c9e1166a81d1d7025674f9e201e3c8460 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 4 Jun 2013 23:33:32 +0300 Subject: Git: Fix stash pop on end of a continuous command Broken in 92392454b74b5f79af5095e4f5725f0d4f57e6f1 Change-Id: I4e3d3b1c2fbec66c5471baedf1996529b852b868 Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 45bcf40495..3201097c6b 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -651,7 +651,7 @@ public: GitClient *client = GitPlugin::instance()->gitClient(); if (m_commit.isEmpty()) { GitPlugin::instance()->gitVersionControl()->emitRepositoryChanged(m_workingDirectory); - if (client->checkCommandInProgress(m_workingDirectory) != GitClient::NoCommand) + if (client->checkCommandInProgress(m_workingDirectory) == GitClient::NoCommand) client->endStashScope(m_workingDirectory); } else { client->handleMergeConflicts(m_workingDirectory, m_commit, m_command); -- cgit v1.2.1 From 63cf15b180980754b6ffea13bfd509ebfd06a69a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 5 Jun 2013 08:12:52 +0300 Subject: Git: Start interactive rebase in topLevel Change-Id: I99edfed36b12942e64ee1947a46eddd1ca08b9ba Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gitplugin.cpp | 14 ++++++++------ src/plugins/vcsbase/vcsbaseplugin.cpp | 9 --------- src/plugins/vcsbase/vcsbaseplugin.h | 1 - 3 files changed, 8 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 1520e34ce2..38a88b1bc3 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -788,17 +788,19 @@ void GitPlugin::resetRepository() void GitPlugin::startRebase() { - QString workingDirectory = currentState().currentDirectoryOrTopLevel(); - if (workingDirectory.isEmpty() || !m_gitClient->canRebase(workingDirectory)) + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + const QString topLevel = state.topLevel(); + if (topLevel.isEmpty() || !m_gitClient->canRebase(topLevel)) return; - if (!m_gitClient->beginStashScope(workingDirectory, QLatin1String("Rebase-i"))) + if (!m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i"))) return; LogChangeDialog dialog(false); dialog.setWindowTitle(tr("Interactive Rebase")); - if (dialog.runDialog(workingDirectory, QString(), false)) - m_gitClient->interactiveRebase(workingDirectory, dialog.commit(), false); + if (dialog.runDialog(topLevel, QString(), false)) + m_gitClient->interactiveRebase(topLevel, dialog.commit(), false); else - m_gitClient->endStashScope(workingDirectory); + m_gitClient->endStashScope(topLevel); } void GitPlugin::startChangeRelatedAction() diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 9022b65c21..c572e5d542 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -405,15 +405,6 @@ QString VcsBasePluginState::topLevel() const return hasFile() ? data->m_state.currentFileTopLevel : data->m_state.currentProjectTopLevel; } -QString VcsBasePluginState::currentDirectoryOrTopLevel() const -{ - if (hasFile()) - return data->m_state.currentFileDirectory; - else if (data->m_state.hasProject()) - return data->m_state.currentProjectTopLevel; - return QString(); -} - bool VcsBasePluginState::equals(const Internal::State &rhs) const { return data->m_state.equals(rhs); diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index 630f1d907a..092d4be727 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -102,7 +102,6 @@ public: // the file one. QString topLevel() const; - QString currentDirectoryOrTopLevel() const; bool equals(const VcsBasePluginState &rhs) const; friend VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state); -- cgit v1.2.1 From 465654b83a3011728af78ee91228616d732d9a5a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 5 Jun 2013 08:16:52 +0300 Subject: Git: Add Reset to locator Change-Id: I81b52b8f349cfd5e9d67bd48b0be32c48e5b2f8e Reviewed-by: Petar Perisin Reviewed-by: Tobias Hunger --- src/plugins/git/gitplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 38a88b1bc3..2ffba4f0bc 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -435,7 +435,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) createRepositoryAction(localRepositoryMenu, tr("Reset..."), Core::Id("Git.Reset"), - globalcontext, false, SLOT(resetRepository())); + globalcontext, true, SLOT(resetRepository())); createRepositoryAction(localRepositoryMenu, tr("Interactive Rebase..."), Core::Id("Git.InteractiveRebase"), -- cgit v1.2.1 From e967049f5b68ff3e8f0170afaa6508c3147f5656 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 5 Jun 2013 13:41:47 +0200 Subject: ProjectWizard: Prevent crash on changes to VCS settings The ProjectExtension kept a pointer to a page which is destroyed once the wizard is done and accessed it whenever VCS settings were touched. Task-number: QTCREATORBUG-9412 Change-Id: Iabe33d877a3d614ab7470c5e11fe26f7de1bb69c Reviewed-by: Friedemann Kleint --- src/plugins/projectexplorer/projectfilewizardextension.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index f95da9ebb4..428a51783a 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -177,7 +177,7 @@ struct ProjectWizardContext QList versionControls; QList activeVersionControls; QList projects; - ProjectWizardPage *page; + QPointer page; // this is managed by the wizard! bool repositoryExists; // Is VCS 'add' sufficient, or should a repository be created? QString commonDirectory; const Core::IWizard *wizard; @@ -195,7 +195,7 @@ void ProjectWizardContext::clear() activeVersionControls.clear(); projects.clear(); commonDirectory.clear(); - page = 0; + page.clear(); repositoryExists = false; wizard = 0; } @@ -329,6 +329,9 @@ void ProjectFileWizardExtension::firstExtensionPageShown( void ProjectFileWizardExtension::initializeVersionControlChoices() { + if (m_context->page.isNull()) + return; + // Figure out version control situation: // 1) Directory is managed and VCS supports "Add" -> List it // 2) Directory is managed and VCS does not support "Add" -> None available -- cgit v1.2.1 From f5200167ed9c573dd70835aa8f52395f0dc22e6e Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 5 Jun 2013 11:26:46 +0200 Subject: Debugger: Work on LLDB dumpers 54 passed, 122 failed (lldb 300.99/gcc) Change-Id: I71e1666c542406b126214c2b9b8b56193bcbcf76 Reviewed-by: hjk --- src/plugins/debugger/lldb/lldbengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 5a07e40e34..1e0d7bbd58 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -699,7 +699,7 @@ void LldbEngine::updateLocals() { WatchHandler *handler = watchHandler(); - requestUpdateWatchers(); + //requestUpdateWatchers(); Command cmd("updateData"); cmd.arg("expanded", handler->expansionRequests()); @@ -741,7 +741,7 @@ void LldbEngine::updateLocals() // } const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty(); - cmd.arg("passexeptions", alwaysVerbose); + cmd.arg("passexceptions", alwaysVerbose); cmd.arg("fancy", debuggerCore()->boolSetting(UseDebuggingHelpers)); cmd.arg("autoderef", debuggerCore()->boolSetting(AutoDerefPointers)); cmd.arg("dyntype", debuggerCore()->boolSetting(UseDynamicType)); -- cgit v1.2.1 From ea3ac259d0c38a793768345cfa9197ea77d56842 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Jun 2013 14:04:07 +0200 Subject: ProjectExplorer: Compile fix for Qt 4. Introduced by e967049f5b68ff3e8f0170afaa6508c3147f5656 . Change-Id: I11f9b76f50e2343d499c7df4bd4cdd98cdb6be10 Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/projectfilewizardextension.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index 428a51783a..b1ffbec7ac 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -52,6 +52,7 @@ #include #include +#include #include #include #include @@ -195,7 +196,7 @@ void ProjectWizardContext::clear() activeVersionControls.clear(); projects.clear(); commonDirectory.clear(); - page.clear(); + page = 0; repositoryExists = false; wizard = 0; } -- cgit v1.2.1