Merge remote-tracking branch 'origin/3.2'

Change-Id: Ifa095e8503bc9bf47389d34251301cae67a944f8
This commit is contained in:
Eike Ziller
2014-07-11 16:08:17 +02:00
127 changed files with 1960 additions and 1579 deletions

3
README
View File

@@ -20,9 +20,10 @@ Prerequisites:
* Qt 5.3.1 or later (with restrictions also Qt 4.8.x) * Qt 5.3.1 or later (with restrictions also Qt 4.8.x)
* On Windows: * On Windows:
- ActiveState Active Perl - ActiveState Active Perl
- MinGW or Visual Studio 2010 or later - MinGW with g++ 4.5 or Visual Studio 2010 or later
- jom - jom
* On Mac OS X: latest Xcode * On Mac OS X: latest Xcode
* On Linux: g++ 4.5 or later
The installed toolchains have to match the one Qt was compiled with. The installed toolchains have to match the one Qt was compiled with.

17
dist/changes-3.2.0 vendored
View File

@@ -80,6 +80,7 @@ Qbs Projects
Generic Projects Generic Projects
Debugging Debugging
* Fixed tooltip expansion behavior (QTCREATORBUG-11404)
* Changed default of "Load system GDB pretty printer" option back to "off" * Changed default of "Load system GDB pretty printer" option back to "off"
* Added option to disable automatic centering on currently debugged * Added option to disable automatic centering on currently debugged
line in editor line in editor
@@ -135,13 +136,27 @@ C++ Support
* Fixed indentation of concatenated strings * Fixed indentation of concatenated strings
* Fixed pointer typedef resolving (QTCREATORBUG-10021) * Fixed pointer typedef resolving (QTCREATORBUG-10021)
* Fixed scroll wheel behavior in editor's symbols dropdown * Fixed scroll wheel behavior in editor's symbols dropdown
* Fixed encoding issues (QTCREATORBUG-7356)
* Fixed that some wizards were ignoring configured file extensions * Fixed that some wizards were ignoring configured file extensions
(QTCREATORBUG-12309) (QTCREATORBUG-12309)
* Fixed parsing of trailing type-specifier * Fixed parsing of trailing type-specifier
* Fixed parsing of expressions like vector<int>{1} * Fixed parsing of expressions like vector<int>{1}
* Fixed generating getters and setters for variables with * Fixed generating getters and setters for variables with
'm' and 'm_' prefixes 'm' and 'm_' prefixes
* Fixed that "using namespace" did not highlight class in including files (QTCREATORBUG-12357)
* Fixed include paths handling (QTCREATORBUG-11599)
* Fixed corner cases for "Create Getter and Setter Member Functions" refactoring action
(QTCREATORBUG-12244)
* Fixed parsing of expressions like vector<int>{1}
* Fixed completion for template with default argument
(QTCREATORBUG-12606, QTCREATORBUG-12605)
* Improved lambda support
* Fixed local uses, completion and find usages for parameters
* Fixed "duplicate data type in declaration" warning (QTCREATORBUG-12521)
* Improved infrastructure for Clang integration
* Reworked indexing data structure
* Started to clean up C++ editor
* Added support for UTF-8 in the lexer (QTCREATORBUG-7356)
* Added support for C99 designated initializers
QML Support QML Support
* Fixed handling of properties that start with underscore (QTCREATORBUG-12214) * Fixed handling of properties that start with underscore (QTCREATORBUG-12214)

View File

@@ -132,7 +132,7 @@
\image qtcreator-togglebookmark.png \image qtcreator-togglebookmark.png
To add a note to a bookmark, right-click the bookmark and select To add a note to a bookmark, right-click the bookmark and select
\gui{Edit Bookmark Note}. To view the note, move the mouse pointer over the \gui{Edit Bookmark}. To view the note, move the mouse pointer over the
bookmark. bookmark.
To go to previous bookmark in the current session, press \key{Ctrl+,}. To go to previous bookmark in the current session, press \key{Ctrl+,}.

View File

@@ -28,44 +28,47 @@ OTHER_FILES += dist/copyright_template.txt \
$$files(scripts/*.sh) \ $$files(scripts/*.sh) \
$$files(scripts/*.pl) $$files(scripts/*.pl)
qmake_cache = $$targetPath($$IDE_BUILD_TREE/.qmake.cache) minQtVersion(5, 0, 0):exists(src/shared/qbs/qbs.pro) {
!equals(QMAKE_HOST.os, Windows) { # Make sure the qbs dll ends up alongside the Creator executable.
maybe_quote = "\"" QBS_DLLDESTDIR = $${IDE_BUILD_TREE}/bin
maybe_backslash = "\\" cache(QBS_DLLDESTDIR)
} QBS_DESTDIR = $${IDE_LIBRARY_PATH}
system("echo $${maybe_quote}$${LITERAL_HASH} config for qmake$${maybe_quote} > $$qmake_cache") cache(QBS_DESTDIR)
# Make sure the qbs dll ends up alongside the Creator executable. QBSLIBDIR = $${IDE_LIBRARY_PATH}
exists(src/shared/qbs/qbs.pro) { cache(QBSLIBDIR)
system("echo QBS_DLLDESTDIR = $${IDE_BUILD_TREE}/bin >> $$qmake_cache") QBS_INSTALL_PREFIX = $${QTC_PREFIX}
system("echo QBS_DESTDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache") cache(QBS_INSTALL_PREFIX)
system("echo QBSLIBDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache") QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator
system("echo QBS_INSTALL_PREFIX = $${QTC_PREFIX} >> $$qmake_cache") cache(QBS_LIB_INSTALL_DIR)
system("echo QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache")
QBS_RESOURCES_BUILD_DIR = $${IDE_DATA_PATH}/qbs QBS_RESOURCES_BUILD_DIR = $${IDE_DATA_PATH}/qbs
system("echo QBS_RESOURCES_BUILD_DIR = $${maybe_backslash}\"$${QBS_RESOURCES_BUILD_DIR}$${maybe_backslash}\" >> $$qmake_cache") cache(QBS_RESOURCES_BUILD_DIR)
system("echo QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs >> $$qmake_cache") QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs
cache(QBS_RESOURCES_INSTALL_DIR)
macx { macx {
QBS_PLUGINS_BUILD_DIR = $${IDE_LIBRARY_PATH} QBS_PLUGINS_BUILD_DIR = $${IDE_LIBRARY_PATH}
system("echo QBS_APPS_RPATH_DIR = @loader_path/../PlugIns >> $$qmake_cache") QBS_APPS_RPATH_DIR = @loader_path/../PlugIns
} else { } else {
QBS_PLUGINS_BUILD_DIR = $${IDE_BUILD_TREE}/$${IDE_LIBRARY_BASENAME}/qtcreator QBS_PLUGINS_BUILD_DIR = $${IDE_BUILD_TREE}/$${IDE_LIBRARY_BASENAME}/qtcreator
system("echo QBS_APPS_RPATH_DIR = '\\\$\\\$ORIGIN/../'/lib/qtcreator >> $$qmake_cache") QBS_APPS_RPATH_DIR = \\\$\\\$ORIGIN/../$$IDE_LIBRARY_BASENAME/qtcreator
} }
system("echo QBS_PLUGINS_BUILD_DIR = $${maybe_backslash}\"$${QBS_PLUGINS_BUILD_DIR}$${maybe_backslash}\" >> $$qmake_cache") cache(QBS_PLUGINS_BUILD_DIR)
system("echo QBS_PLUGINS_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache") cache(QBS_APPS_RPATH_DIR)
system("echo QBS_LIBRARY_DIRNAME = $${IDE_LIBRARY_BASENAME} >> $$qmake_cache") QBS_PLUGINS_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator
cache(QBS_PLUGINS_INSTALL_DIR)
QBS_LIBRARY_DIRNAME = $${IDE_LIBRARY_BASENAME}
cache(QBS_LIBRARY_DIRNAME)
QBS_APPS_DESTDIR = $${IDE_BIN_PATH} QBS_APPS_DESTDIR = $${IDE_BIN_PATH}
system("echo QBS_APPS_DESTDIR = $${maybe_backslash}\"$${QBS_APPS_DESTDIR}$${maybe_backslash}\">> $$qmake_cache") cache(QBS_APPS_DESTDIR)
system("echo QBS_APPS_INSTALL_DIR = $${QTC_PREFIX}/bin >> $$qmake_cache") QBS_APPS_INSTALL_DIR = $${QTC_PREFIX}/bin
cache(QBS_APPS_INSTALL_DIR)
QBS_RELATIVE_PLUGINS_PATH = $$relative_path($$QBS_PLUGINS_BUILD_DIR, $$QBS_APPS_DESTDIR$$) QBS_RELATIVE_PLUGINS_PATH = $$relative_path($$QBS_PLUGINS_BUILD_DIR, $$QBS_APPS_DESTDIR$$)
system("echo QBS_RELATIVE_PLUGINS_PATH = $${QBS_RELATIVE_PLUGINS_PATH}" >> $$qmake_cache) cache(QBS_RELATIVE_PLUGINS_PATH)
QBS_RELATIVE_SEARCH_PATH = $$relative_path($$QBS_RESOURCES_BUILD_DIR, $$QBS_APPS_DESTDIR) QBS_RELATIVE_SEARCH_PATH = $$relative_path($$QBS_RESOURCES_BUILD_DIR, $$QBS_APPS_DESTDIR)
system("echo QBS_RELATIVE_SEARCH_PATH = $${QBS_RELATIVE_SEARCH_PATH}" >> $$qmake_cache) cache(QBS_RELATIVE_SEARCH_PATH)
system("echo CONFIG += qbs_no_dev_install >> $$qmake_cache") QBS_CONFIG_ADDITION = qbs_no_dev_install
cache(CONFIG, add, QBS_CONFIG_ADDITION)
} }
_QMAKE_CACHE_ = $$qmake_cache # Qt 4 support prevents us from using cache(), so tell Qt 5 about the cache
contains(QT_ARCH, i386): ARCHITECTURE = x86 contains(QT_ARCH, i386): ARCHITECTURE = x86
else: ARCHITECTURE = $$QT_ARCH else: ARCHITECTURE = $$QT_ARCH

View File

@@ -2218,6 +2218,26 @@ def qdump__QXmlAttributes(d, value):
qdump__QList(d, value["attList"]) qdump__QList(d, value["attList"])
def qdump__QXmlStreamStringRef(d, value):
s = value["m_string"]
data, size, alloc = d.stringData(s)
data += 2 * int(value["m_position"])
size = int(value["m_size"])
s = d.readMemory(data, 2 * size)
d.putValue(s, Hex4EncodedLittleEndian)
d.putPlainChildren(value)
def qdump__QXmlStreamAttribute(d, value):
s = value["m_name"]["m_string"]
data, size, alloc = d.stringData(s)
data += 2 * int(value["m_name"]["m_position"])
size = int(value["m_name"]["m_size"])
s = d.readMemory(data, 2 * size)
d.putValue(s, Hex4EncodedLittleEndian)
d.putPlainChildren(value)
####################################################################### #######################################################################
# #
# V4 # V4

View File

@@ -94,6 +94,8 @@ static bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName)
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {
QHash<EnumerationName, int> ObjectNodeInstance::m_enumationValueHash;
ObjectNodeInstance::ObjectNodeInstance(QObject *object) ObjectNodeInstance::ObjectNodeInstance(QObject *object)
: m_object(object), : m_object(object),
m_metaObject(0), m_metaObject(0),
@@ -477,7 +479,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
QVariant fixedValue = fixResourcePaths(value); QVariant fixedValue = fixResourcePaths(value);
if (value.canConvert<Enumeration>()) if (value.canConvert<Enumeration>())
fixedValue = QVariant::fromValue(value.value<Enumeration>().nameToString()); fixedValue = enumationValue(value.value<Enumeration>());
QVariant oldValue = property.read(); QVariant oldValue = property.read();
if (oldValue.type() == QVariant::Url) { if (oldValue.type() == QVariant::Url) {
@@ -1325,6 +1327,39 @@ void ObjectNodeInstance::doComponentCompleteRecursive(QObject *object, NodeInsta
} }
} }
static QHash<EnumerationName, int> enumationValuesFromMetaEnum(const QMetaEnum &metaEnum)
{
QHash<EnumerationName, int> enumationValues;
for (int index = 0; index < metaEnum.keyCount(); index++) {
EnumerationName enumerationName = EnumerationName(metaEnum.scope()) + "." + metaEnum.key(index);
enumationValues.insert(enumerationName, metaEnum.value(index));
}
return enumationValues;
}
static QHash<EnumerationName, int> collectEnumationValues(const Enumeration &enumeration)
{
QHash<EnumerationName, int> enumationValues;
EnumerationName enumerationScope = enumeration.scope();
const QMetaObject *metaObject = QMetaType::metaObjectForType(QMetaType::type(enumerationScope.data()));
if (metaObject) {
int enumeratorCount = metaObject->enumeratorOffset() + metaObject->enumeratorCount();
for (int index = metaObject->enumeratorOffset(); index < enumeratorCount; index++)
enumationValues.unite(enumationValuesFromMetaEnum(metaObject->enumerator(index)));
}
return enumationValues;
}
QVariant ObjectNodeInstance::enumationValue(const Enumeration &enumeration)
{
EnumerationName enumerationName = enumeration.toEnumerationName();
if (!m_enumationValueHash.contains(enumerationName))
m_enumationValueHash.unite(collectEnumationValues(enumeration));
return QVariant::fromValue(m_enumationValueHash.value(enumerationName));
}
ObjectNodeInstance::Pointer ObjectNodeInstance::parentInstance() const ObjectNodeInstance::Pointer ObjectNodeInstance::parentInstance() const
{ {
QObject *parentHolder = parent(); QObject *parentHolder = parent();

View File

@@ -38,6 +38,8 @@
#include <QSharedPointer> #include <QSharedPointer>
#include <QWeakPointer> #include <QWeakPointer>
#include "enumeration.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGraphicsItem; class QGraphicsItem;
class QQmlContext; class QQmlContext;
@@ -200,6 +202,7 @@ protected:
QVariant convertSpecialCharacter(const QVariant& value) const; QVariant convertSpecialCharacter(const QVariant& value) const;
static QObject *parentObject(QObject *object); static QObject *parentObject(QObject *object);
static void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer); static void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
static QVariant enumationValue(const Enumeration &enumeration);
private: private:
QHash<PropertyName, QVariant> m_resetValueHash; QHash<PropertyName, QVariant> m_resetValueHash;
@@ -217,6 +220,7 @@ private:
qint32 m_instanceId; qint32 m_instanceId;
bool m_deleteHeldInstance; bool m_deleteHeldInstance;
bool m_isInLayoutable; bool m_isInLayoutable;
static QHash<EnumerationName, int> m_enumationValueHash;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -76,7 +76,7 @@ QString Enumeration::toString() const
return QString::fromUtf8(m_enumerationName); return QString::fromUtf8(m_enumerationName);
} }
QString Enumeration::nameToString() QString Enumeration::nameToString() const
{ {
return QString::fromUtf8(name()); return QString::fromUtf8(name());
} }

View File

@@ -55,7 +55,7 @@ public:
EnumerationName name() const; EnumerationName name() const;
EnumerationName toEnumerationName() const; EnumerationName toEnumerationName() const;
QString toString() const; QString toString() const;
QString nameToString(); QString nameToString() const;
private: private:
EnumerationName m_enumerationName; EnumerationName m_enumerationName;

View File

@@ -1095,20 +1095,24 @@ Function *Bind::lambdaDeclarator(LambdaDeclaratorAST *ast)
Function *fun = control()->newFunction(0, 0); Function *fun = control()->newFunction(0, 0);
fun->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin()); fun->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin());
fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd()); fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
FullySpecifiedType type;
if (ast->trailing_return_type) if (ast->trailing_return_type)
_type = this->trailingReturnType(ast->trailing_return_type, _type); type = this->trailingReturnType(ast->trailing_return_type, type);
fun->setReturnType(_type);
ast->symbol = fun; ast->symbol = fun;
// unsigned lparen_token = ast->lparen_token; // unsigned lparen_token = ast->lparen_token;
FullySpecifiedType type;
this->parameterDeclarationClause(ast->parameter_declaration_clause, ast->lparen_token, fun); this->parameterDeclarationClause(ast->parameter_declaration_clause, ast->lparen_token, fun);
// unsigned rparen_token = ast->rparen_token; // unsigned rparen_token = ast->rparen_token;
for (SpecifierListAST *it = ast->attributes; it; it = it->next) { for (SpecifierListAST *it = ast->attributes; it; it = it->next) {
type = this->specifier(it->value, type); type = this->specifier(it->value, type);
} }
// unsigned mutable_token = ast->mutable_token; // unsigned mutable_token = ast->mutable_token;
_type = this->exceptionSpecification(ast->exception_specification, type); type = this->exceptionSpecification(ast->exception_specification, type);
if (!type.isValid())
type.setType(control()->voidType());
fun->setReturnType(type);
return fun; return fun;
} }

View File

@@ -29,6 +29,8 @@
#include "plugindetailsview.h" #include "plugindetailsview.h"
#include "ui_plugindetailsview.h" #include "ui_plugindetailsview.h"
#include "pluginmanager.h"
#include "pluginspec.h" #include "pluginspec.h"
#include <QDir> #include <QDir>
@@ -86,7 +88,10 @@ void PluginDetailsView::update(PluginSpec *spec)
m_ui->copyright->setText(spec->copyright()); m_ui->copyright->setText(spec->copyright());
m_ui->license->setText(spec->license()); m_ui->license->setText(spec->license());
const QRegExp platforms = spec->platformSpecification(); const QRegExp platforms = spec->platformSpecification();
m_ui->platforms->setText(platforms.isEmpty() ? tr("All") : platforms.pattern()); const QString pluginPlatformString = platforms.isEmpty() ? tr("All") : platforms.pattern();
const QString platformString = tr("%1 (current: \"%2\")").arg(pluginPlatformString,
PluginManager::platformName());
m_ui->platforms->setText(platformString);
QStringList depStrings; QStringList depStrings;
foreach (const PluginDependency &dep, spec->dependencies()) { foreach (const PluginDependency &dep, spec->dependencies()) {
QString depString = dep.name; QString depString = dep.name;

View File

@@ -1377,11 +1377,20 @@ void PluginManagerPrivate::profilingSummary() const
static inline QString getPlatformName() static inline QString getPlatformName()
{ {
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
QString result = QLatin1String("Mac OS"); if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_0) {
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_0) QString result = QLatin1String("OS X");
result += QLatin1String(" 10.") + QString::number(QSysInfo::MacintoshVersion - QSysInfo::MV_10_0); result += QLatin1String(" 10.") + QString::number(QSysInfo::MacintoshVersion - QSysInfo::MV_10_0);
return result; return result;
} else {
return QLatin1String("Mac OS");
}
#elif defined(Q_OS_UNIX) #elif defined(Q_OS_UNIX)
QString base;
# ifdef Q_OS_LINUX
base = QLatin1String("Linux");
# else
base = QLatin1String("Unix");
# endif // Q_OS_LINUX
QFile osReleaseFile(QLatin1String("/etc/os-release")); // Newer Linuxes QFile osReleaseFile(QLatin1String("/etc/os-release")); // Newer Linuxes
if (osReleaseFile.open(QIODevice::ReadOnly)) { if (osReleaseFile.open(QIODevice::ReadOnly)) {
QString name; QString name;
@@ -1398,22 +1407,10 @@ static inline QString getPlatformName()
if (!name.isEmpty()) { if (!name.isEmpty()) {
if (!version.isEmpty()) if (!version.isEmpty())
name += QLatin1Char(' ') + version; name += QLatin1Char(' ') + version;
return name; return base + QLatin1String(" (") + name + QLatin1Char(')');
} }
} }
QFile issueFile(QLatin1String("/etc/issue")); // Older Linuxes return base;
if (issueFile.open(QIODevice::ReadOnly)) {
QByteArray issue = issueFile.readAll();
const int end = issue.lastIndexOf(" \\n");
if (end >= 0)
issue.truncate(end);
return QString::fromLatin1(issue).trimmed();
}
# ifdef Q_OS_LINUX
return QLatin1String("Linux");
# else
return QLatin1String("Unix");
# endif // Q_OS_LINUX
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
QString result = QLatin1String("Windows"); QString result = QLatin1String("Windows");
switch (QSysInfo::WindowsVersion) { switch (QSysInfo::WindowsVersion) {

View File

@@ -25,23 +25,6 @@ for(l, SUBDIRS) {
SUBDIRS += \ SUBDIRS += \
utils/process_stub.pro utils/process_stub.pro
minQtVersion(5, 0, 0) {
QBS_DIRS = \
corelib \
qtprofilesetup \
apps \
../shared/qbs/src/plugins \
../shared/qbs/static.pro
corelib.subdir = ../shared/qbs/src/lib/corelib
qtprofilesetup.subdir = ../shared/qbs/src/lib/qtprofilesetup
qtprofilesetup.depends = corelib
apps.subdir = ../shared/qbs/src/app
apps.depends = qtprofilesetup
exists(../shared/qbs/qbs.pro): SUBDIRS += $$QBS_DIRS
TR_EXCLUDE = $$QBS_DIRS
}
win32:SUBDIRS += utils/process_ctrlc_stub.pro win32:SUBDIRS += utils/process_ctrlc_stub.pro
# Windows: Compile Qt Creator CDB extension if Debugging tools can be detected. # Windows: Compile Qt Creator CDB extension if Debugging tools can be detected.

View File

@@ -36,7 +36,12 @@
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
#include <QDateTime> #include <QDateTime>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMessageBox> #include <QMessageBox>
#include <QMimeData>
#include <QTimer>
#include <QUrl>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> #include <qt_windows.h>
@@ -679,6 +684,72 @@ FileName &FileName::appendString(QChar str)
return *this; return *this;
} }
static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0)
{
if (files)
files->clear();
// Extract dropped files from Mime data.
if (!d->hasUrls())
return false;
const QList<QUrl> urls = d->urls();
if (urls.empty())
return false;
// Try to find local files
bool hasFiles = false;
const QList<QUrl>::const_iterator cend = urls.constEnd();
for (QList<QUrl>::const_iterator it = urls.constBegin(); it != cend; ++it) {
const QString fileName = it->toLocalFile();
if (!fileName.isEmpty()) {
hasFiles = true;
if (files)
files->push_back(fileName);
else
break; // No result list, sufficient for checking
}
}
return hasFiles;
}
FileDropSupport::FileDropSupport(QWidget *parentWidget)
: QObject(parentWidget)
{
QTC_ASSERT(parentWidget, return);
parentWidget->setAcceptDrops(true);
parentWidget->installEventFilter(this);
}
bool FileDropSupport::eventFilter(QObject *obj, QEvent *event)
{
Q_UNUSED(obj)
if (event->type() == QEvent::DragEnter) {
auto dee = static_cast<QDragEnterEvent *>(event);
if (isDesktopFileManagerDrop(dee->mimeData()))
event->accept();
else
event->ignore();
} else if (event->type() == QEvent::Drop) {
auto de = static_cast<QDropEvent *>(event);
QStringList tempFiles;
if (isDesktopFileManagerDrop(de->mimeData(), &tempFiles)) {
event->accept();
bool needToScheduleEmit = m_files.isEmpty();
m_files.append(tempFiles);
if (needToScheduleEmit) // otherwise we already have a timer pending
QTimer::singleShot(0, this, SLOT(emitFilesDropped()));
} else {
event->ignore();
}
}
return false;
}
void FileDropSupport::emitFilesDropped()
{
QTC_ASSERT(!m_files.isEmpty(), return);
emit filesDropped(m_files);
m_files.clear();
}
} // namespace Utils } // namespace Utils
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@@ -35,6 +35,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QXmlStreamWriter> // Mac. #include <QXmlStreamWriter> // Mac.
#include <QMetaType> #include <QMetaType>
#include <QStringList>
namespace Utils {class FileName; } namespace Utils {class FileName; }
@@ -192,6 +193,26 @@ private:
bool m_autoRemove; bool m_autoRemove;
}; };
class QTCREATOR_UTILS_EXPORT FileDropSupport : public QObject
{
Q_OBJECT
public:
FileDropSupport(QWidget *parentWidget);
signals:
void filesDropped(const QStringList &files);
protected:
bool eventFilter(QObject *obj, QEvent *event);
private slots:
void emitFilesDropped();
private:
QStringList m_files;
};
} // namespace Utils } // namespace Utils
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@@ -0,0 +1,81 @@
/****************************************************************************
**
** Copyright (C) 2014 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 "proxycredentialsdialog.h"
#include "ui_proxycredentialsdialog.h"
#include <utils/networkaccessmanager.h>
#include <QNetworkProxy>
using namespace Utils;
/*!
\class Utils::ProxyCredentialsDialog
Dialog for asking the user about proxy credentials (username, password).
*/
ProxyCredentialsDialog::ProxyCredentialsDialog(const QNetworkProxy &proxy, QWidget *parent) :
QDialog(parent),
ui(new Ui::ProxyCredentialsDialog)
{
ui->setupUi(this);
setUserName(proxy.user());
setPassword(proxy.password());
const QString proxyString = QString::fromLatin1("%1:%2").arg(proxy.hostName()).arg(proxy.port());
ui->infotext->setText(ui->infotext->text().arg(proxyString));
}
ProxyCredentialsDialog::~ProxyCredentialsDialog()
{
delete ui;
}
QString ProxyCredentialsDialog::userName() const
{
return ui->usernameLineEdit->text();
}
void ProxyCredentialsDialog::setUserName(const QString &username)
{
ui->usernameLineEdit->setText(username);
}
QString ProxyCredentialsDialog::password() const
{
return ui->passwordLineEdit->text();
}
void ProxyCredentialsDialog::setPassword(const QString &passwd)
{
ui->passwordLineEdit->setText(passwd);
}

View File

@@ -27,22 +27,37 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef MACFULLSCREEN_H #ifndef PROXYCREDENTIALSDIALOG_H
#define MACFULLSCREEN_H #define PROXYCREDENTIALSDIALOG_H
#include "mainwindow.h" #include "utils_global.h"
#include <QDialog>
namespace Core { QT_FORWARD_DECLARE_CLASS(QNetworkProxy)
namespace Internal {
namespace MacFullScreen {
bool supportsFullScreen(); namespace Utils {
// adds fullscreen button to window for lion
void addFullScreen(Core::Internal::MainWindow *window);
void toggleFullScreen(Core::Internal::MainWindow *window);
} // MacFullScreen namespace Ui {
} // Internal class ProxyCredentialsDialog;
} // Core }
#endif // MACFULLSCREEN_H class QTCREATOR_UTILS_EXPORT ProxyCredentialsDialog : public QDialog
{
Q_OBJECT
public:
explicit ProxyCredentialsDialog(const QNetworkProxy &proxy, QWidget *parent = 0);
~ProxyCredentialsDialog();
QString userName() const;
void setUserName(const QString &username);
QString password() const;
void setPassword(const QString &passwd);
private:
Ui::ProxyCredentialsDialog *ui;
};
} // namespace Utils
#endif // PROXYCREDENTIALSDIALOG_H

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Utils::ProxyCredentialsDialog</class>
<widget class="QDialog" name="Utils::ProxyCredentialsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>279</width>
<height>114</height>
</rect>
</property>
<property name="windowTitle">
<string>Proxy Credentials</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="infotext">
<property name="text">
<string>The proxy %1 requires a username and password.</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="usernameLabel">
<property name="text">
<string>Username:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="usernameLineEdit">
<property name="placeholderText">
<string>Username</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="passwordLabel">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="passwordLineEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>Password</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Utils::ProxyCredentialsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Utils::ProxyCredentialsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -89,7 +89,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/completinglineedit.cpp \ $$PWD/completinglineedit.cpp \
$$PWD/winutils.cpp \ $$PWD/winutils.cpp \
$$PWD/itemviews.cpp \ $$PWD/itemviews.cpp \
$$PWD/treeviewcombobox.cpp $$PWD/treeviewcombobox.cpp \
$$PWD/proxycredentialsdialog.cpp
win32:SOURCES += $$PWD/consoleprocess_win.cpp win32:SOURCES += $$PWD/consoleprocess_win.cpp
else:SOURCES += $$PWD/consoleprocess_unix.cpp else:SOURCES += $$PWD/consoleprocess_unix.cpp
@@ -185,10 +186,12 @@ HEADERS += \
$$PWD/treeviewcombobox.h \ $$PWD/treeviewcombobox.h \
$$PWD/scopedswap.h \ $$PWD/scopedswap.h \
$$PWD/algorithm.h \ $$PWD/algorithm.h \
$$PWD/QtConcurrentTools $$PWD/QtConcurrentTools \
$$PWD/proxycredentialsdialog.h
FORMS += $$PWD/filewizardpage.ui \ FORMS += $$PWD/filewizardpage.ui \
$$PWD/projectintropage.ui \ $$PWD/projectintropage.ui \
$$PWD/newclasswidget.ui $$PWD/newclasswidget.ui \
$$PWD/proxycredentialsdialog.ui
RESOURCES += $$PWD/utils.qrc RESOURCES += $$PWD/utils.qrc

View File

@@ -136,6 +136,9 @@ QtcLibrary {
"projectnamevalidatinglineedit.h", "projectnamevalidatinglineedit.h",
"proxyaction.cpp", "proxyaction.cpp",
"proxyaction.h", "proxyaction.h",
"proxycredentialsdialog.cpp",
"proxycredentialsdialog.h",
"proxycredentialsdialog.ui",
"qtcassert.cpp", "qtcassert.cpp",
"qtcassert.h", "qtcassert.h",
"qtcolorbutton.cpp", "qtcolorbutton.cpp",

View File

@@ -52,8 +52,7 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(Core::Id id) const; QString displayNameForId(Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id); ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;

View File

@@ -44,8 +44,7 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(Core::Id id) const; QString displayNameForId(Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id); ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const; bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;

View File

@@ -44,8 +44,7 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(Core::Id id) const; QString displayNameForId(Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id); ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canRestore(ProjectExplorer::BuildStepList *parent, bool canRestore(ProjectExplorer::BuildStepList *parent,

View File

@@ -44,8 +44,7 @@ public:
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const; QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(Core::Id id) const; QString displayNameForId(Core::Id id) const;
bool canCreate(ProjectExplorer::BuildStepList *parent, bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
const Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id); ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canRestore(ProjectExplorer::BuildStepList *parent, bool canRestore(ProjectExplorer::BuildStepList *parent,

View File

@@ -51,6 +51,7 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
@@ -148,6 +149,7 @@ void ArtisticStyle::formatFile()
if (m_settings->version() > ArtisticStyleSettings::Version_2_03) { if (m_settings->version() > ArtisticStyleSettings::Version_2_03) {
command.setProcessing(Command::PipeProcessing); command.setProcessing(Command::PipeProcessing);
command.setPipeAddsNewline(true); command.setPipeAddsNewline(true);
command.setReturnsCRLF(Utils::HostOsInfo::isWindowsHost());
} else { } else {
command.addOption(QLatin1String("%file")); command.addOption(QLatin1String("%file"));
} }

View File

@@ -198,9 +198,14 @@ QString BeautifierPlugin::format(const QString &text, const Command &command,
return QString(); return QString();
} }
if (command.pipeAddsNewline()) { const bool addsNewline = command.pipeAddsNewline();
const bool returnsCRLF = command.returnsCRLF();
if (addsNewline || returnsCRLF) {
QString formatted = QString::fromUtf8(process.readAllStandardOutput()); QString formatted = QString::fromUtf8(process.readAllStandardOutput());
if (addsNewline)
formatted.remove(QRegExp(QLatin1String("(\\r\\n|\\n)$"))); formatted.remove(QRegExp(QLatin1String("(\\r\\n|\\n)$")));
if (returnsCRLF)
formatted.replace(QLatin1String("\r\n"), QLatin1String("\n"));
return formatted; return formatted;
} }
return QString::fromUtf8(process.readAllStandardOutput()); return QString::fromUtf8(process.readAllStandardOutput());

View File

@@ -37,6 +37,7 @@
#include <QFutureInterface> #include <QFutureInterface>
#include <QPlainTextEdit> #include <QPlainTextEdit>
#include <QPointer>
#include <QSignalMapper> #include <QSignalMapper>
namespace Core { class IEditor; } namespace Core { class IEditor; }

View File

@@ -35,6 +35,7 @@ namespace Internal {
Command::Command() Command::Command()
: m_processing(FileProcessing) : m_processing(FileProcessing)
, m_pipeAddsNewline(false) , m_pipeAddsNewline(false)
, m_returnsCRLF(false)
{ {
} }
@@ -78,5 +79,16 @@ void Command::setPipeAddsNewline(bool pipeAddsNewline)
m_pipeAddsNewline = pipeAddsNewline; m_pipeAddsNewline = pipeAddsNewline;
} }
bool Command::returnsCRLF() const
{
return m_returnsCRLF;
}
void Command::setReturnsCRLF(bool returnsCRLF)
{
m_returnsCRLF = returnsCRLF;
}
} // namespace Internal } // namespace Internal
} // namespace Beautifier } // namespace Beautifier

View File

@@ -58,11 +58,15 @@ public:
bool pipeAddsNewline() const; bool pipeAddsNewline() const;
void setPipeAddsNewline(bool pipeAddsNewline); void setPipeAddsNewline(bool pipeAddsNewline);
bool returnsCRLF() const;
void setReturnsCRLF(bool returnsCRLF);
private: private:
QString m_executable; QString m_executable;
QStringList m_options; QStringList m_options;
Processing m_processing; Processing m_processing;
bool m_pipeAddsNewline; bool m_pipeAddsNewline;
bool m_returnsCRLF;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -57,6 +57,14 @@ void Bookmark::updateLineNumber(int line)
} }
} }
void Bookmark::move(int line)
{
if (line != lineNumber()) {
BaseTextMark::move(line);
m_manager->updateBookmark(this);
}
}
void Bookmark::updateBlock(const QTextBlock &block) void Bookmark::updateBlock(const QTextBlock &block)
{ {
if (m_lineText != block.text()) { if (m_lineText != block.text()) {

View File

@@ -44,6 +44,7 @@ public:
Bookmark(const QString &fileName, int lineNumber, BookmarkManager *manager); Bookmark(const QString &fileName, int lineNumber, BookmarkManager *manager);
void updateLineNumber(int lineNumber); void updateLineNumber(int lineNumber);
void move(int line);
void updateBlock(const QTextBlock &block); void updateBlock(const QTextBlock &block);
void updateFileName(const QString &fileName); void updateFileName(const QString &fileName);
void setNote(const QString &note); void setNote(const QString &note);

View File

@@ -45,15 +45,18 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/checkablemessagebox.h> #include <utils/checkablemessagebox.h>
#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QAction> #include <QAction>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QDebug>
#include <QDialog>
#include <QDialogButtonBox>
#include <QDir>
#include <QFileInfo>
#include <QFormLayout>
#include <QLineEdit>
#include <QMenu> #include <QMenu>
#include <QPainter> #include <QPainter>
#include <QInputDialog> #include <QSpinBox>
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*) Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
@@ -243,7 +246,7 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
QMenu menu; QMenu menu;
QAction *moveUp = menu.addAction(tr("Move Up")); QAction *moveUp = menu.addAction(tr("Move Up"));
QAction *moveDown = menu.addAction(tr("Move Down")); QAction *moveDown = menu.addAction(tr("Move Down"));
QAction *editNote = menu.addAction(tr("Edit Note")); QAction *edit = menu.addAction(tr("&Edit"));
menu.addSeparator(); menu.addSeparator();
QAction *remove = menu.addAction(tr("&Remove")); QAction *remove = menu.addAction(tr("&Remove"));
menu.addSeparator(); menu.addSeparator();
@@ -254,7 +257,7 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
moveUp->setEnabled(false); moveUp->setEnabled(false);
moveDown->setEnabled(false); moveDown->setEnabled(false);
remove->setEnabled(false); remove->setEnabled(false);
editNote->setEnabled(false); edit->setEnabled(false);
} }
if (model()->rowCount() == 0) if (model()->rowCount() == 0)
@@ -268,8 +271,8 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
this, SLOT(removeFromContextMenu())); this, SLOT(removeFromContextMenu()));
connect(removeAll, SIGNAL(triggered()), connect(removeAll, SIGNAL(triggered()),
this, SLOT(removeAll())); this, SLOT(removeAll()));
connect(editNote, SIGNAL(triggered()), connect(edit, SIGNAL(triggered()),
m_manager, SLOT(editNote())); m_manager, SLOT(edit()));
menu.exec(mapToGlobal(event->pos())); menu.exec(mapToGlobal(event->pos()));
} }
@@ -673,27 +676,39 @@ void BookmarkManager::moveDown()
saveBookmarks(); saveBookmarks();
} }
void BookmarkManager::editNote(const QString &fileName, int lineNumber) void BookmarkManager::edit(const QString &fileName, int lineNumber)
{ {
Bookmark *b = findBookmark(fileName, lineNumber); Bookmark *b = findBookmark(fileName, lineNumber);
QModelIndex current = selectionModel()->currentIndex(); QModelIndex current = selectionModel()->currentIndex();
selectionModel()->setCurrentIndex(current.sibling(m_bookmarksList.indexOf(b), 0), selectionModel()->setCurrentIndex(current.sibling(m_bookmarksList.indexOf(b), 0),
QItemSelectionModel::Select | QItemSelectionModel::Clear); QItemSelectionModel::Select | QItemSelectionModel::Clear);
editNote(); edit();
} }
void BookmarkManager::editNote() void BookmarkManager::edit()
{ {
QModelIndex current = selectionModel()->currentIndex(); QModelIndex current = selectionModel()->currentIndex();
Bookmark *b = m_bookmarksList.at(current.row()); Bookmark *b = m_bookmarksList.at(current.row());
bool inputOk = false; QDialog dlg;
QString noteText = QInputDialog::getText(0, tr("Edit Note"), dlg.setWindowTitle(tr("Edit Bookmark"));
tr("Note text:"), QLineEdit::Normal, auto layout = new QFormLayout(&dlg);
b->note(), &inputOk); auto noteEdit = new QLineEdit(b->note());
if (inputOk) { noteEdit->setMinimumWidth(300);
b->updateNote(noteText.replace(QLatin1Char('\t'), QLatin1Char(' '))); auto lineNumberSpinbox = new QSpinBox;
lineNumberSpinbox->setRange(1, INT_MAX);
lineNumberSpinbox->setValue(b->lineNumber());
lineNumberSpinbox->setMaximumWidth(100);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), &dlg, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), &dlg, SLOT(reject()));
layout->addRow(tr("Note text:"), noteEdit);
layout->addRow(tr("Line number:"), lineNumberSpinbox);
layout->addWidget(buttonBox);
if (dlg.exec() == QDialog::Accepted) {
b->move(lineNumberSpinbox->value());
b->updateNote(noteEdit->text().replace(QLatin1Char('\t'), QLatin1Char(' ')));
emit dataChanged(current, current); emit dataChanged(current, current);
saveBookmarks(); saveBookmarks();
} }

View File

@@ -97,8 +97,8 @@ public slots:
void prev(); void prev();
void moveUp(); void moveUp();
void moveDown(); void moveDown();
void editNote(); void edit();
void editNote(const QString &fileName, int lineNumber); void edit(const QString &fileName, int lineNumber);
bool gotoBookmark(Bookmark *bookmark); bool gotoBookmark(Bookmark *bookmark);
signals: signals:

View File

@@ -105,7 +105,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
cmd = Core::ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext); cmd = Core::ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext);
mbm->addAction(cmd); mbm->addAction(cmd);
m_editNoteAction = new QAction(tr("Edit Bookmark Note"), this); m_editBookmarkAction = new QAction(tr("Edit Bookmark"), this);
m_bookmarkManager = new BookmarkManager; m_bookmarkManager = new BookmarkManager;
@@ -114,7 +114,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
connect(m_nextAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(next())); connect(m_nextAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(next()));
connect(m_docPrevAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(prevInDocument())); connect(m_docPrevAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(prevInDocument()));
connect(m_docNextAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(nextInDocument())); connect(m_docNextAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(nextInDocument()));
connect(m_editNoteAction, SIGNAL(triggered()), this, SLOT(bookmarkEditNoteActionTriggered())); connect(m_editBookmarkAction, SIGNAL(triggered()), this, SLOT(editBookmarkActionTriggered()));
connect(m_bookmarkManager, SIGNAL(updateActions(int)), this, SLOT(updateActions(int))); connect(m_bookmarkManager, SIGNAL(updateActions(int)), this, SLOT(updateActions(int)));
updateActions(m_bookmarkManager->state()); updateActions(m_bookmarkManager->state());
addAutoReleasedObject(new BookmarkViewFactory(m_bookmarkManager)); addAutoReleasedObject(new BookmarkViewFactory(m_bookmarkManager));
@@ -189,7 +189,7 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
menu->addAction(m_bookmarkMarginAction); menu->addAction(m_bookmarkMarginAction);
if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber)) if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber))
menu->addAction(m_editNoteAction); menu->addAction(m_editBookmarkAction);
} }
void BookmarksPlugin::bookmarkMarginActionTriggered() void BookmarksPlugin::bookmarkMarginActionTriggered()
@@ -198,9 +198,9 @@ void BookmarksPlugin::bookmarkMarginActionTriggered()
m_bookmarkMarginActionLineNumber); m_bookmarkMarginActionLineNumber);
} }
void BookmarksPlugin::bookmarkEditNoteActionTriggered() void BookmarksPlugin::editBookmarkActionTriggered()
{ {
m_bookmarkManager->editNote(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber); m_bookmarkManager->edit(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber);
} }
Q_EXPORT_PLUGIN(BookmarksPlugin) Q_EXPORT_PLUGIN(BookmarksPlugin)

View File

@@ -70,7 +70,7 @@ private slots:
void requestContextMenu(TextEditor::ITextEditor *editor, void requestContextMenu(TextEditor::ITextEditor *editor,
int lineNumber, QMenu *menu); int lineNumber, QMenu *menu);
void bookmarkMarginActionTriggered(); void bookmarkMarginActionTriggered();
void bookmarkEditNoteActionTriggered(); void editBookmarkActionTriggered();
private: private:
static BookmarksPlugin *m_instance; static BookmarksPlugin *m_instance;
@@ -81,7 +81,7 @@ private:
QAction *m_nextAction; QAction *m_nextAction;
QAction *m_docPrevAction; QAction *m_docPrevAction;
QAction *m_docNextAction; QAction *m_docNextAction;
QAction *m_editNoteAction; QAction *m_editBookmarkAction;
QAction *m_bookmarkMarginAction; QAction *m_bookmarkMarginAction;
int m_bookmarkMarginActionLineNumber; int m_bookmarkMarginActionLineNumber;

View File

@@ -20,7 +20,6 @@ QtcPlugin {
] ]
files: [ files: [
"CMakeProjectManager.mimetypes.xml",
"cmakebuildconfiguration.cpp", "cmakebuildconfiguration.cpp",
"cmakebuildconfiguration.h", "cmakebuildconfiguration.h",
"cmakebuildinfo.h", "cmakebuildinfo.h",

View File

@@ -224,10 +224,8 @@ win32 {
LIBS += -lole32 -luser32 LIBS += -lole32 -luser32
} }
else:macx { else:macx {
HEADERS += macfullscreen.h
OBJECTIVE_SOURCES += \ OBJECTIVE_SOURCES += \
progressmanager/progressmanager_mac.mm \ progressmanager/progressmanager_mac.mm
macfullscreen.mm
LIBS += -framework AppKit LIBS += -framework AppKit
} }
else:unix { else:unix {

View File

@@ -37,8 +37,8 @@
#include <coreplugin/infobar.h> #include <coreplugin/infobar.h>
#include <coreplugin/minisplitter.h> #include <coreplugin/minisplitter.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
@@ -118,6 +118,10 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
m_container->addWidget(empty); m_container->addWidget(empty);
m_widgetEditorMap.insert(empty, 0); m_widgetEditorMap.insert(empty, 0);
auto dropSupport = new Utils::FileDropSupport(this);
connect(dropSupport, SIGNAL(filesDropped(QStringList)),
this, SLOT(openDroppedFiles(QStringList)));
updateNavigatorActions(); updateNavigatorActions();
} }
@@ -330,6 +334,17 @@ void EditorView::closeSplit()
EditorManager::updateActions(); EditorManager::updateActions();
} }
void EditorView::openDroppedFiles(const QStringList &files)
{
const int count = files.size();
for (int i = 0; i < count; ++i) {
EditorManager::openEditor(this, files.at(i), Id(),
i < count - 1 ? EditorManager::DoNotChangeCurrentEditor
| EditorManager::DoNotMakeVisible
: EditorManager::NoFlags);
}
}
void EditorView::setParentSplitterOrView(SplitterOrView *splitterOrView) void EditorView::setParentSplitterOrView(SplitterOrView *splitterOrView)
{ {
m_parentSplitterOrView = splitterOrView; m_parentSplitterOrView = splitterOrView;

View File

@@ -115,6 +115,7 @@ private slots:
void splitVertically(); void splitVertically();
void splitNewWindow(); void splitNewWindow();
void closeSplit(); void closeSplit();
void openDroppedFiles(const QStringList &files);
private: private:
friend class SplitterOrView; // for setParentSplitterOrView friend class SplitterOrView; // for setParentSplitterOrView

View File

@@ -1,114 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2014 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 "macfullscreen.h"
#include <AppKit/NSView.h>
#include <AppKit/NSWindow.h>
#include <Foundation/NSNotification.h>
#include <QSysInfo>
#include <qglobal.h>
enum {
Qtc_NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7)
};
static NSString *Qtc_NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification";
static NSString *Qtc_NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification";
@interface WindowObserver : NSObject {
Core::Internal::MainWindow *window;
}
- (id)initWithMainWindow:(Core::Internal::MainWindow *)w;
- (void)notifyDidEnterFullScreen:(NSNotification *)notification;
- (void)notifyDidExitFullScreen:(NSNotification *)notification;
@end
@implementation WindowObserver
- (id)initWithMainWindow:(Core::Internal::MainWindow *)w
{
if ((self = [self init])) {
window = w;
}
return self;
}
- (void)notifyDidEnterFullScreen:(NSNotification *)notification
{
Q_UNUSED(notification)
window->setIsFullScreen(true);
}
- (void)notifyDidExitFullScreen:(NSNotification* )notification
{
Q_UNUSED(notification)
window->setIsFullScreen(false);
}
@end
static WindowObserver *observer = nil;
using namespace Core::Internal;
bool MacFullScreen::supportsFullScreen()
{
return QSysInfo::MacintoshVersion >= QSysInfo::MV_LION;
}
void MacFullScreen::addFullScreen(MainWindow *window)
{
if (supportsFullScreen()) {
NSView *nsview = (NSView *) window->winId();
NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:Qtc_NSWindowCollectionBehaviorFullScreenPrimary];
if (observer == nil)
observer = [[WindowObserver alloc] initWithMainWindow:window];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:observer selector:@selector(notifyDidEnterFullScreen:)
name:Qtc_NSWindowDidEnterFullScreenNotification object:nswindow];
[nc addObserver:observer selector:@selector(notifyDidExitFullScreen:)
name:Qtc_NSWindowDidExitFullScreenNotification object:nswindow];
}
}
void MacFullScreen::toggleFullScreen(MainWindow *window)
{
if (supportsFullScreen()) {
NSView *nsview = (NSView *) window->winId();
NSWindow *nswindow = [nsview window];
[nswindow performSelector:@selector(toggleFullScreen:) withObject: nil];
}
}

View File

@@ -55,10 +55,6 @@
#include "externaltoolmanager.h" #include "externaltoolmanager.h"
#include "editormanager/systemeditor.h" #include "editormanager/systemeditor.h"
#if defined(Q_OS_MAC)
#include "macfullscreen.h"
#endif
#include <app/app_version.h> #include <app/app_version.h>
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
@@ -74,6 +70,7 @@
#include <coreplugin/progressmanager/progressmanager_p.h> #include <coreplugin/progressmanager/progressmanager_p.h>
#include <coreplugin/progressmanager/progressview.h> #include <coreplugin/progressmanager/progressview.h>
#include <coreplugin/settingsdatabase.h> #include <coreplugin/settingsdatabase.h>
#include <utils/fileutils.h>
#include <utils/historycompleter.h> #include <utils/historycompleter.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -87,7 +84,6 @@
#include <QTimer> #include <QTimer>
#include <QUrl> #include <QUrl>
#include <QDir> #include <QDir>
#include <QMimeData>
#include <QApplication> #include <QApplication>
#include <QCloseEvent> #include <QCloseEvent>
@@ -211,11 +207,10 @@ MainWindow::MainWindow() :
//signal(SIGINT, handleSigInt); //signal(SIGINT, handleSigInt);
statusBar()->setProperty("p_styled", true); statusBar()->setProperty("p_styled", true);
setAcceptDrops(true);
#if defined(Q_OS_MAC) auto dropSupport = new Utils::FileDropSupport(this);
MacFullScreen::addFullScreen(this); connect(dropSupport, SIGNAL(filesDropped(QStringList)),
#endif this, SLOT(openDroppedFiles(QStringList)));
} }
void MainWindow::setSidebarVisible(bool visible) void MainWindow::setSidebarVisible(bool visible)
@@ -241,12 +236,19 @@ void MainWindow::setOverrideColor(const QColor &color)
m_overrideColor = color; m_overrideColor = color;
} }
void MainWindow::setIsFullScreen(bool fullScreen) void MainWindow::updateFullScreenAction()
{ {
if (fullScreen) if (isFullScreen()) {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(tr("Exit Full Screen")); m_toggleFullScreenAction->setText(tr("Exit Full Screen"));
else else
m_toggleFullScreenAction->setChecked(true);
} else {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(tr("Enter Full Screen")); m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
else
m_toggleFullScreenAction->setChecked(false);
}
} }
bool MainWindow::isNewItemDialogRunning() const bool MainWindow::isNewItemDialogRunning() const
@@ -386,61 +388,10 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept(); event->accept();
} }
// Check for desktop file manager file drop events void MainWindow::openDroppedFiles(const QStringList &files)
static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0)
{ {
if (files)
files->clear();
// Extract dropped files from Mime data.
if (!d->hasUrls())
return false;
const QList<QUrl> urls = d->urls();
if (urls.empty())
return false;
// Try to find local files
bool hasFiles = false;
const QList<QUrl>::const_iterator cend = urls.constEnd();
for (QList<QUrl>::const_iterator it = urls.constBegin(); it != cend; ++it) {
const QString fileName = it->toLocalFile();
if (!fileName.isEmpty()) {
hasFiles = true;
if (files)
files->push_back(fileName);
else
break; // No result list, sufficient for checking
}
}
return hasFiles;
}
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (isDesktopFileManagerDrop(event->mimeData()) && m_filesToOpenDelayed.isEmpty())
event->accept();
else
event->ignore();
}
void MainWindow::dropEvent(QDropEvent *event)
{
QStringList files;
if (isDesktopFileManagerDrop(event->mimeData(), &files)) {
event->accept();
m_filesToOpenDelayed.append(files);
QTimer::singleShot(50, this, SLOT(openDelayedFiles()));
} else {
event->ignore();
}
}
void MainWindow::openDelayedFiles()
{
if (m_filesToOpenDelayed.isEmpty())
return;
raiseWindow(); raiseWindow();
openFiles(m_filesToOpenDelayed, ICore::SwitchMode); openFiles(files, ICore::SwitchMode);
m_filesToOpenDelayed.clear();
} }
IContext *MainWindow::currentContextObject() const IContext *MainWindow::currentContextObject() const
@@ -700,11 +651,23 @@ void MainWindow::registerDefaultActions()
cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext); cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized())); connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
// Window separator
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
} }
// Full Screen Action
m_toggleFullScreenAction = new QAction(this);
m_toggleFullScreenAction->setMenuRole(QAction::NoRole);
m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
updateFullScreenAction();
cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
if (Utils::HostOsInfo::isMacHost())
cmd->setAttribute(Command::CA_UpdateText);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
if (UseMacShortcuts)
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
// Show Sidebar Action // Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this); tr("Show Sidebar"), this);
@@ -724,25 +687,6 @@ void MainWindow::registerDefaultActions()
connect(m_toggleModeSelectorAction, SIGNAL(triggered(bool)), ModeManager::instance(), SLOT(setModeSelectorVisible(bool))); connect(m_toggleModeSelectorAction, SIGNAL(triggered(bool)), ModeManager::instance(), SLOT(setModeSelectorVisible(bool)));
mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS); mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS);
#if defined(Q_OS_MAC)
const QString fullScreenActionText(tr("Enter Full Screen"));
bool supportsFullScreen = MacFullScreen::supportsFullScreen();
#else
const QString fullScreenActionText(tr("Full Screen"));
bool supportsFullScreen = true;
#endif
if (supportsFullScreen) {
// Full Screen Action
m_toggleFullScreenAction = new QAction(fullScreenActionText, this);
m_toggleFullScreenAction->setMenuRole(QAction::NoRole);
m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
cmd->setAttribute(Command::CA_UpdateText); /* for Mac */
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
}
// Window->Views // Window->Views
ActionContainer *mviews = ActionManager::createMenu(Constants::M_WINDOW_VIEWS); ActionContainer *mviews = ActionManager::createMenu(Constants::M_WINDOW_VIEWS);
mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS); mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS);
@@ -969,10 +913,8 @@ void MainWindow::changeEvent(QEvent *e)
qDebug() << "main window state changed to minimized=" << minimized; qDebug() << "main window state changed to minimized=" << minimized;
m_minimizeAction->setEnabled(!minimized); m_minimizeAction->setEnabled(!minimized);
m_zoomAction->setEnabled(!minimized); m_zoomAction->setEnabled(!minimized);
} else {
bool isFullScreen = (windowState() & Qt::WindowFullScreen) != 0;
m_toggleFullScreenAction->setChecked(isFullScreen);
} }
updateFullScreenAction();
} }
} }
@@ -1179,25 +1121,13 @@ QPrinter *MainWindow::printer() const
return m_printer; return m_printer;
} }
void MainWindow::setFullScreen(bool on) void MainWindow::toggleFullScreen()
{ {
#if defined(Q_OS_MAC) if (isFullScreen()) {
Q_UNUSED(on)
MacFullScreen::toggleFullScreen(this);
#else
if (bool(windowState() & Qt::WindowFullScreen) == on)
return;
if (on) {
setWindowState(windowState() | Qt::WindowFullScreen);
//statusBar()->hide();
//menuBar()->hide();
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen); setWindowState(windowState() & ~Qt::WindowFullScreen);
//menuBar()->show(); } else {
//statusBar()->show(); setWindowState(windowState() | Qt::WindowFullScreen);
} }
#endif
} }
// Display a warning with an additional button to open // Display a warning with an additional button to open

View File

@@ -107,7 +107,7 @@ public:
void setOverrideColor(const QColor &color); void setOverrideColor(const QColor &color);
void setIsFullScreen(bool fullScreen); void updateFullScreenAction();
bool isNewItemDialogRunning() const; bool isNewItemDialogRunning() const;
@@ -119,7 +119,7 @@ public slots:
void newFile(); void newFile();
void openFileWith(); void openFileWith();
void exit(); void exit();
void setFullScreen(bool on); void toggleFullScreen();
void showNewItemDialog(const QString &title, void showNewItemDialog(const QString &title,
const QList<IWizardFactory *> &factories, const QList<IWizardFactory *> &factories,
@@ -137,8 +137,6 @@ public slots:
protected: protected:
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
private slots: private slots:
void openFile(); void openFile();
@@ -151,7 +149,7 @@ private slots:
void updateFocusWidget(QWidget *old, QWidget *now); void updateFocusWidget(QWidget *old, QWidget *now);
void setSidebarVisible(bool visible); void setSidebarVisible(bool visible);
void destroyVersionDialog(); void destroyVersionDialog();
void openDelayedFiles(); void openDroppedFiles(const QStringList &files);
void restoreWindowState(); void restoreWindowState();
void newItemDialogFinished(); void newItemDialogFinished();
@@ -213,8 +211,6 @@ private:
QToolButton *m_toggleSideBarButton; QToolButton *m_toggleSideBarButton;
QColor m_overrideColor; QColor m_overrideColor;
QStringList m_filesToOpenDelayed;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -1194,6 +1194,39 @@ void CppEditorPlugin::test_quickfix_data()
<< CppQuickFixFactoryPtr(new OptimizeForLoop) << CppQuickFixFactoryPtr(new OptimizeForLoop)
<< _("void foo() {fo@r (int i = 0; i < -3; ++i) {}}\n") << _("void foo() {fo@r (int i = 0; i < -3; ++i) {}}\n")
<< _(); << _();
QTest::newRow("InsertQtPropertyMembers")
<< CppQuickFixFactoryPtr(new InsertQtPropertyMembers)
<< _("struct XmarksTheSpot {\n"
" @Q_PROPERTY(int it READ getIt WRITE setIt NOTIFY itChanged)\n"
"};\n"
)
<< _("struct XmarksTheSpot {\n"
" Q_PROPERTY(int it READ getIt WRITE setIt NOTIFY itChanged)\n"
"\n"
"public:\n"
" int getIt() const\n"
" {\n"
" return m_it;\n"
" }\n"
"\n"
"public slots:\n"
" void setIt(int arg)\n"
" {\n"
" if (m_it == arg)\n"
" return;\n"
"\n"
" m_it = arg;\n"
" emit itChanged(arg);\n"
" }\n"
"\n"
"signals:\n"
" void itChanged(int arg);\n"
"\n"
"private:\n"
" int m_it;\n"
"};\n"
);
} }
void CppEditorPlugin::test_quickfix() void CppEditorPlugin::test_quickfix()

View File

@@ -3953,8 +3953,8 @@ public:
if (m_signalName.isEmpty()) { if (m_signalName.isEmpty()) {
setter << m_storageName << " = arg;\n}\n"; setter << m_storageName << " = arg;\n}\n";
} else { } else {
setter << "if (" << m_storageName << " != arg) {\n" << m_storageName setter << "if (" << m_storageName << " == arg)\nreturn;\n\n"
<< " = arg;\nemit " << m_signalName << "(arg);\n}\n}\n"; << m_storageName << " = arg;\nemit " << m_signalName << "(arg);\n}\n";
} }
InsertionLocation setterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::PublicSlot); InsertionLocation setterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::PublicSlot);
QTC_ASSERT(setterLoc.isValid(), return); QTC_ASSERT(setterLoc.isValid(), return);

View File

@@ -47,6 +47,7 @@
#include <cplusplus/CppDocument.h> #include <cplusplus/CppDocument.h>
#include <cplusplus/TranslationUnit.h> #include <cplusplus/TranslationUnit.h>
#include <QApplication>
#include <QDebug> #include <QDebug>
#include <QTextDocument> #include <QTextDocument>
#include <QtTest> #include <QtTest>
@@ -54,6 +55,7 @@
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
#define MSKIP_SINGLE(x) QSKIP(x) #define MSKIP_SINGLE(x) QSKIP(x)
#else #else
#include <QtTest/qtestkeyboard.h>
#define MSKIP_SINGLE(x) QSKIP(x, SkipSingle) #define MSKIP_SINGLE(x) QSKIP(x, SkipSingle)
#endif #endif

View File

@@ -447,8 +447,7 @@ void CdbEngine::syncVerboseLog(bool verboseLog)
postCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet"), 0); postCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet"), 0);
} }
bool CdbEngine::setToolTipExpression(const QPoint &mousePos, bool CdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor,
const DebuggerToolTipContext &contextIn) const DebuggerToolTipContext &contextIn)
{ {
if (debug) if (debug)
@@ -469,10 +468,7 @@ bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
if (!localVariable) if (!localVariable)
return false; return false;
context.iname = localVariable->iname; context.iname = localVariable->iname;
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget; DebuggerToolTipManager::showToolTip(context, this);
tw->setContext(context);
tw->acquireEngine(this);
DebuggerToolTipManager::showToolTip(mousePos, tw);
return true; return true;
} }
@@ -1972,8 +1968,10 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
foreach (const WatchData &wd, watchData) foreach (const WatchData &wd, watchData)
nsp << wd.toString() <<'\n'; nsp << wd.toString() <<'\n';
} }
if (flags & LocalsUpdateForNewFrame) if (flags & LocalsUpdateForNewFrame) {
emit stackFrameCompleted(); emit stackFrameCompleted();
DebuggerToolTipManager::updateEngine(this);
}
} else { } else {
showMessage(QString::fromLatin1(reply->errorMessage), LogWarning); showMessage(QString::fromLatin1(reply->errorMessage), LogWarning);
} }

View File

@@ -76,7 +76,7 @@ public:
// Factory function that returns 0 if the debug engine library cannot be found. // Factory function that returns 0 if the debug engine library cannot be found.
virtual bool setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
const DebuggerToolTipContext &ctx); const DebuggerToolTipContext &ctx);
virtual void setupEngine(); virtual void setupEngine();
virtual void setupInferior(); virtual void setupInferior();

View File

@@ -76,8 +76,6 @@ private:
QCheckBox *checkBoxKeepEditorStationaryWhileStepping; QCheckBox *checkBoxKeepEditorStationaryWhileStepping;
QLabel *labelMaximalStackDepth; QLabel *labelMaximalStackDepth;
QSpinBox *spinBoxMaximalStackDepth; QSpinBox *spinBoxMaximalStackDepth;
QSpinBox *spinBoxMaximalStringLength;
QSpinBox *spinBoxDisplayStringLimit;
DebuggerSourcePathMappingWidget *sourcesMappingWidget; DebuggerSourcePathMappingWidget *sourcesMappingWidget;
const QSharedPointer<Utils::SavedActionSet> m_group; const QSharedPointer<Utils::SavedActionSet> m_group;

View File

@@ -60,7 +60,6 @@ class BreakHandler;
class SnapshotHandler; class SnapshotHandler;
class Symbol; class Symbol;
class Section; class Section;
class DebuggerToolTipManager;
class GlobalDebuggerOptions; class GlobalDebuggerOptions;
enum TestCases enum TestCases
@@ -120,7 +119,6 @@ public:
virtual QStringList stringListSetting(int code) const = 0; virtual QStringList stringListSetting(int code) const = 0;
virtual void setThreads(const QStringList &list, int index) = 0; virtual void setThreads(const QStringList &list, int index) = 0;
virtual DebuggerToolTipManager *toolTipManager() const = 0;
virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const = 0; virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const = 0;
static QTreeView *inspectorView(); static QTreeView *inspectorView();

View File

@@ -35,6 +35,7 @@
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "debuggerstartparameters.h" #include "debuggerstartparameters.h"
#include "debuggertooltipmanager.h"
#include "breakhandler.h" #include "breakhandler.h"
#include "disassembleragent.h" #include "disassembleragent.h"
@@ -1176,11 +1177,16 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
if (!forced && !isAllowedTransition(oldState, state)) if (!forced && !isAllowedTransition(oldState, state))
qDebug() << "*** UNEXPECTED STATE TRANSITION: " << this << msg; qDebug() << "*** UNEXPECTED STATE TRANSITION: " << this << msg;
if (state == EngineRunRequested) {
DebuggerToolTipManager::registerEngine(this);
}
if (state == DebuggerFinished) { if (state == DebuggerFinished) {
// Give up ownership on claimed breakpoints. // Give up ownership on claimed breakpoints.
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
foreach (BreakpointModelId id, handler->engineBreakpointIds(this)) foreach (BreakpointModelId id, handler->engineBreakpointIds(this))
handler->notifyBreakpointReleased(id); handler->notifyBreakpointReleased(id);
DebuggerToolTipManager::deregisterEngine(this);
} }
showMessage(msg, LogDebug); showMessage(msg, LogDebug);
@@ -1355,8 +1361,8 @@ DebuggerRunControl *DebuggerEngine::runControl() const
return d->runControl(); return d->runControl();
} }
bool DebuggerEngine::setToolTipExpression bool DebuggerEngine::setToolTipExpression(TextEditor::ITextEditor *,
(const QPoint &, TextEditor::ITextEditor *, const DebuggerToolTipContext &) const DebuggerToolTipContext &)
{ {
return false; return false;
} }

View File

@@ -143,8 +143,8 @@ public:
const DebuggerStartParameters &startParameters() const; const DebuggerStartParameters &startParameters() const;
DebuggerStartParameters &startParameters(); DebuggerStartParameters &startParameters();
virtual bool setToolTipExpression(const QPoint & mousePos, virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const Internal::DebuggerToolTipContext &); const Internal::DebuggerToolTipContext &);
virtual void updateWatchData(const Internal::WatchData &data, virtual void updateWatchData(const Internal::WatchData &data,
const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags()); const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());

View File

@@ -1202,7 +1202,6 @@ public slots:
bool parseArguments(const QStringList &args, QString *errorMessage); bool parseArguments(const QStringList &args, QString *errorMessage);
void parseCommandLineArguments(); void parseCommandLineArguments();
DebuggerToolTipManager *toolTipManager() const { return m_toolTipManager; }
QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const { return m_globalDebuggerOptions; } QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const { return m_globalDebuggerOptions; }
void updateQmlActions() { void updateQmlActions() {
@@ -2526,7 +2525,7 @@ void DebuggerPluginPrivate::sessionLoaded()
{ {
m_breakHandler->loadSessionData(); m_breakHandler->loadSessionData();
dummyEngine()->watchHandler()->loadSessionData(); dummyEngine()->watchHandler()->loadSessionData();
m_toolTipManager->loadSessionData(); DebuggerToolTipManager::loadSessionData();
} }
void DebuggerPluginPrivate::aboutToUnloadSession() void DebuggerPluginPrivate::aboutToUnloadSession()
@@ -2537,8 +2536,8 @@ void DebuggerPluginPrivate::aboutToUnloadSession()
void DebuggerPluginPrivate::aboutToSaveSession() void DebuggerPluginPrivate::aboutToSaveSession()
{ {
dummyEngine()->watchHandler()->saveSessionData(); dummyEngine()->watchHandler()->saveSessionData();
m_toolTipManager->saveSessionData();
m_breakHandler->saveSessionData(); m_breakHandler->saveSessionData();
DebuggerToolTipManager::saveSessionData();
} }
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout) void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)

View File

@@ -38,7 +38,6 @@
#include "debuggerrunconfigurationaspect.h" #include "debuggerrunconfigurationaspect.h"
#include "debuggerstartparameters.h" #include "debuggerstartparameters.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "debuggertooltipmanager.h"
#include "breakhandler.h" #include "breakhandler.h"
#include "shared/peutils.h" #include "shared/peutils.h"
@@ -136,9 +135,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
QString errorMessage; QString errorMessage;
d->m_engine = DebuggerRunControlFactory::createEngine(sp.masterEngineType, sp, &errorMessage); d->m_engine = DebuggerRunControlFactory::createEngine(sp.masterEngineType, sp, &errorMessage);
if (d->m_engine) { if (!d->m_engine) {
DebuggerToolTipManager::registerEngine(d->m_engine);
} else {
debuggingFinished(); debuggingFinished();
Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), errorMessage); Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), errorMessage);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -32,47 +32,37 @@
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include <QDate>
#include <QPointer>
#include <QTreeView> #include <QTreeView>
#include <QPointer>
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include <QDate>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QVBoxLayout;
class QToolButton;
class QStandardItemModel;
class QToolBar;
class QDebug; class QDebug;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core { class IEditor; }
class IEditor;
class IMode;
}
namespace TextEditor { class ITextEditor; } namespace TextEditor { class ITextEditor; }
namespace Debugger { namespace Debugger {
class DebuggerEngine; class DebuggerEngine;
namespace Internal { namespace Internal {
class DraggableLabel;
class DebuggerToolTipEditor;
class DebuggerToolTipContext class DebuggerToolTipContext
{ {
public: public:
DebuggerToolTipContext(); DebuggerToolTipContext();
static DebuggerToolTipContext fromEditor(Core::IEditor *ed, int pos); bool isValid() const { return !expression.isEmpty(); }
bool isValid() const { return !fileName.isEmpty(); } bool matchesFrame(const QString &frameFile, const QString &frameFunction) const;
bool isSame(const DebuggerToolTipContext &other) const;
QString fileName; QString fileName;
int position; int position;
int line; int line;
int column; int column;
QString function; //!< Optional function. This must be set by the engine as it is language-specific. QString function; //!< Optional function. This must be set by the engine as it is language-specific.
QString engineType;
QDate creationDate;
QPoint mousePosition; QPoint mousePosition;
QString expression; QString expression;
@@ -84,81 +74,6 @@ typedef QList<DebuggerToolTipContext> DebuggerToolTipContexts;
QDebug operator<<(QDebug, const DebuggerToolTipContext &); QDebug operator<<(QDebug, const DebuggerToolTipContext &);
class DebuggerToolTipTreeView;
class DebuggerToolTipWidget : public QWidget
{
Q_OBJECT
public:
bool isPinned() const { return m_isPinned; }
explicit DebuggerToolTipWidget(QWidget *parent = 0);
bool engineAcquired() const { return m_engineAcquired; }
QString fileName() const { return m_context.fileName; }
QString function() const { return m_context.function; }
int position() const { return m_context.position; }
// Check for a match at position.
bool matches(const QString &fileName,
const QString &engineType = QString(),
const QString &function= QString()) const;
const DebuggerToolTipContext &context() const { return m_context; }
void setContext(const DebuggerToolTipContext &c) { m_context = c; }
QString engineType() const { return m_engineType; }
void setEngineType(const QString &e) { m_engineType = e; }
QDate creationDate() const { return m_creationDate; }
void setCreationDate(const QDate &d) { m_creationDate = d; }
static DebuggerToolTipWidget *loadSessionData(QXmlStreamReader &r);
static QString treeModelClipboardContents(const QAbstractItemModel *m);
public slots:
void saveSessionData(QXmlStreamWriter &w) const;
void acquireEngine(Debugger::DebuggerEngine *engine);
void releaseEngine();
void copy();
bool positionShow(const DebuggerToolTipEditor &pe);
void pin();
private slots:
void slotDragged(const QPoint &p);
void toolButtonClicked();
private:
bool m_isPinned;
QToolButton *m_toolButton;
private:
static DebuggerToolTipWidget *loadSessionDataI(QXmlStreamReader &r);
void doAcquireEngine(Debugger::DebuggerEngine *engine);
void doReleaseEngine();
void doSaveSessionData(QXmlStreamWriter &w) const;
void doLoadSessionData(QXmlStreamReader &r);
QString clipboardContents() const;
DraggableLabel *m_titleLabel;
bool m_engineAcquired;
QString m_engineType;
DebuggerToolTipContext m_context;
QDate m_creationDate;
QPoint m_offset; //!< Offset to text cursor position (user dragging).
private:
QAbstractItemModel *swapModel(QAbstractItemModel *newModel);
static void restoreTreeModel(QXmlStreamReader &r, QStandardItemModel *m);
int m_debuggerModel;
DebuggerToolTipTreeView *m_treeView;
QStandardItemModel *m_defaultModel;
};
class DebuggerToolTipTreeView : public QTreeView class DebuggerToolTipTreeView : public QTreeView
{ {
Q_OBJECT Q_OBJECT
@@ -168,16 +83,14 @@ public:
QAbstractItemModel *swapModel(QAbstractItemModel *model); QAbstractItemModel *swapModel(QAbstractItemModel *model);
QSize sizeHint() const { return m_size; } QSize sizeHint() const { return m_size; }
int computeHeight(const QModelIndex &index) const;
public slots: private slots:
void computeSize(); void computeSize();
void expandNode(const QModelIndex &idx); void expandNode(const QModelIndex &idx);
void collapseNode(const QModelIndex &idx); void collapseNode(const QModelIndex &idx);
void handleItemIsExpanded(const QModelIndex &sourceIdx);
private: private:
void init(QAbstractItemModel *model); int computeHeight(const QModelIndex &index) const;
QSize m_size; QSize m_size;
}; };
@@ -191,35 +104,40 @@ public:
~DebuggerToolTipManager(); ~DebuggerToolTipManager();
static void registerEngine(DebuggerEngine *engine); static void registerEngine(DebuggerEngine *engine);
static void deregisterEngine(DebuggerEngine *engine);
static void updateEngine(DebuggerEngine *engine);
static bool hasToolTips(); static bool hasToolTips();
// Collect all expressions of DebuggerTreeViewToolTipWidget // Collect all expressions of DebuggerTreeViewToolTipWidget
static DebuggerToolTipContexts treeWidgetExpressions(const QString &fileName, static DebuggerToolTipContexts treeWidgetExpressions(DebuggerEngine *engine,
const QString &engineType = QString(), const QString &fileName, const QString &function = QString());
const QString &function= QString());
static void showToolTip(const QPoint &p, DebuggerToolTipWidget *); static void showToolTip(const DebuggerToolTipContext &context,
DebuggerEngine *engine);
virtual bool eventFilter(QObject *, QEvent *); virtual bool eventFilter(QObject *, QEvent *);
static bool debug(); static QString treeModelClipboardContents(const QAbstractItemModel *model);
public slots: public slots:
void debugModeEntered(); void debugModeEntered();
void leavingDebugMode(); void leavingDebugMode();
void sessionAboutToChange(); void sessionAboutToChange();
void loadSessionData(); static void loadSessionData();
void saveSessionData(); static void saveSessionData();
static void closeAllToolTips(); static void closeAllToolTips();
void hide(); static void hide();
private slots: private slots:
void slotUpdateVisibleToolTips(); static void slotUpdateVisibleToolTips();
void slotDebuggerStateChanged(Debugger::DebuggerState); void slotDebuggerStateChanged(Debugger::DebuggerState);
void slotStackFrameCompleted();
void slotEditorOpened(Core::IEditor *); void slotEditorOpened(Core::IEditor *);
void slotTooltipOverrideRequested(TextEditor::ITextEditor *editor, void slotTooltipOverrideRequested(TextEditor::ITextEditor *editor,
const QPoint &point, int pos, bool *handled); const QPoint &point, int pos, bool *handled);
private:
bool tryHandleToolTipOverride(TextEditor::ITextEditor *editor,
const QPoint &point, int pos);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -3629,42 +3629,30 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response)
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
void GdbEngine::showToolTip() //void GdbEngine::showToolTip()
{ //{
if (m_toolTipContext.isNull()) // const QString expression = m_toolTipContext.expression;
return; // if (DebuggerToolTipManager::debug())
const QString expression = m_toolTipContext->expression; // qDebug() << "GdbEngine::showToolTip " << expression << m_toolTipContext.iname << m_toolTipContext;
if (DebuggerToolTipManager::debug())
qDebug() << "GdbEngine::showToolTip " << expression << m_toolTipContext->iname << (*m_toolTipContext);
if (m_toolTipContext->iname.startsWith("tooltip") // if (m_toolTipContext.iname.startsWith("tooltip")
&& (!debuggerCore()->boolSetting(UseToolTipsInMainEditor) // && (!debuggerCore()->boolSetting(UseToolTipsInMainEditor)
|| !watchHandler()->isValidToolTip(m_toolTipContext->iname))) { // || !watchHandler()->isValidToolTip(m_toolTipContext.iname))) {
watchHandler()->removeData(m_toolTipContext->iname); // watchHandler()->removeData(m_toolTipContext.iname);
return; // return;
} // }
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget; // DebuggerToolTipManager::showToolTip(m_toolTipContext, this);
tw->setContext(*m_toolTipContext); //}
tw->acquireEngine(this);
DebuggerToolTipManager::showToolTip(m_toolTipContext->mousePosition, tw);
// Prevent tooltip from re-occurring (classic GDB, QTCREATORBUG-4711).
m_toolTipContext.reset();
}
QString GdbEngine::tooltipExpression() const
{
return m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression;
}
void GdbEngine::resetLocation() void GdbEngine::resetLocation()
{ {
m_toolTipContext.reset(); m_toolTipContext.expression.clear();
DebuggerEngine::resetLocation(); DebuggerEngine::resetLocation();
} }
bool GdbEngine::setToolTipExpression(const QPoint &mousePos, bool GdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &contextIn) const DebuggerToolTipContext &context)
{ {
if (state() != InferiorStopOk || !isCppEditor(editor)) { if (state() != InferiorStopOk || !isCppEditor(editor)) {
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED " //qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED "
@@ -3672,46 +3660,13 @@ bool GdbEngine::setToolTipExpression(const QPoint &mousePos,
return false; return false;
} }
DebuggerToolTipContext context = contextIn; m_toolTipContext = context;
int line, column; // qDebug() << "GdbEngine::setToolTipExpression2 " << exp << m_toolTipContext;
QString exp = fixCppExpression(cppExpressionAt(editor, context.position, &line, &column, &context.function));
if (exp.isEmpty())
return false;
// Prefer a filter on an existing local variable if it can be found.
QByteArray iname;
if (const WatchData *localVariable = watchHandler()->findCppLocalVariable(exp)) {
exp = QLatin1String(localVariable->exp);
iname = localVariable->iname;
} else {
iname = tooltipIName(exp);
}
if (DebuggerToolTipManager::debug())
qDebug() << "GdbEngine::setToolTipExpression1 " << exp << iname << context;
// Same expression: Display synchronously.
if (!m_toolTipContext.isNull() && m_toolTipContext->expression == exp) {
showToolTip();
return true;
}
m_toolTipContext.reset(new DebuggerToolTipContext(context));
m_toolTipContext->mousePosition = mousePos;
m_toolTipContext->expression = exp;
m_toolTipContext->iname = iname;
// Local variable: Display synchronously.
if (iname.startsWith("local")) {
showToolTip();
return true;
}
if (DebuggerToolTipManager::debug())
qDebug() << "GdbEngine::setToolTipExpression2 " << exp << (*m_toolTipContext);
UpdateParameters params; UpdateParameters params;
params.tryPartial = true; params.tryPartial = true;
params.tooltipOnly = true; params.tooltipOnly = true;
params.varList = iname; params.varList = context.iname;
updateLocalsPython(params); updateLocalsPython(params);
return true; return true;
} }
@@ -3777,7 +3732,12 @@ void GdbEngine::rebuildWatchModel()
showMessage(LogWindow::logTimeStamp(), LogMiscInput); showMessage(LogWindow::logTimeStamp(), LogMiscInput);
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput); showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
showStatusMessage(tr("Finished retrieving data"), 400); showStatusMessage(tr("Finished retrieving data"), 400);
showToolTip();
if (m_toolTipContext.isValid()) {
DebuggerToolTipManager::showToolTip(m_toolTipContext, this);
m_toolTipContext = DebuggerToolTipContext();
}
DebuggerToolTipManager::updateEngine(this);
} }
void GdbEngine::handleVarAssign(const GdbResponse &) void GdbEngine::handleVarAssign(const GdbResponse &)
@@ -4879,9 +4839,9 @@ void GdbEngine::updateLocalsPython(const UpdateParameters &params)
// Re-create tooltip items that are not filters on existing local variables in // Re-create tooltip items that are not filters on existing local variables in
// the tooltip model. // the tooltip model.
DebuggerToolTipContexts toolTips = DebuggerToolTipContexts toolTips =
DebuggerToolTipManager::treeWidgetExpressions(fileName, objectName(), function); DebuggerToolTipManager::treeWidgetExpressions(this, fileName, function);
const QString currentExpression = tooltipExpression(); const QString currentExpression = m_toolTipContext.expression;
if (!currentExpression.isEmpty()) { if (!currentExpression.isEmpty()) {
int currentIndex = -1; int currentIndex = -1;
for (int i = 0; i < toolTips.size(); ++i) { for (int i = 0; i < toolTips.size(); ++i) {
@@ -5019,8 +4979,10 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
//PENDING_DEBUG("\n\n .... AND TRIGGERS MODEL UPDATE\n"); //PENDING_DEBUG("\n\n .... AND TRIGGERS MODEL UPDATE\n");
rebuildWatchModel(); rebuildWatchModel();
//} //}
if (!partial) if (!partial) {
emit stackFrameCompleted(); emit stackFrameCompleted();
DebuggerToolTipManager::updateEngine(this);
}
} else { } else {
showMessage(_("DUMPER FAILED: " + response.toString())); showMessage(_("DUMPER FAILED: " + response.toString()));
} }

View File

@@ -34,6 +34,7 @@
#include <debugger/watchhandler.h> #include <debugger/watchhandler.h>
#include <debugger/watchutils.h> #include <debugger/watchutils.h>
#include <debugger/debuggertooltipmanager.h>
#include <coreplugin/id.h> #include <coreplugin/id.h>
@@ -406,8 +407,8 @@ protected:
// //
// Watch specific stuff // Watch specific stuff
// //
virtual bool setToolTipExpression(const QPoint &mousePos, virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &); const DebuggerToolTipContext &);
virtual void assignValueInDebugger(const WatchData *data, virtual void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value); const QString &expr, const QVariant &value);
@@ -467,8 +468,7 @@ protected:
void showExecutionError(const QString &message); void showExecutionError(const QString &message);
static QByteArray tooltipIName(const QString &exp); static QByteArray tooltipIName(const QString &exp);
QString tooltipExpression() const; DebuggerToolTipContext m_toolTipContext;
QScopedPointer<DebuggerToolTipContext> m_toolTipContext;
// For short-circuiting stack and thread list evaluation. // For short-circuiting stack and thread list evaluation.
bool m_stackNeeded; bool m_stackNeeded;

View File

@@ -36,6 +36,9 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/variablechooser.h> #include <coreplugin/variablechooser.h>
#include <utils/fancylineedit.h>
#include <utils/pathchooser.h>
#include <QCheckBox> #include <QCheckBox>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
@@ -62,33 +65,6 @@ class GdbOptionsPageWidget : public QWidget
{ {
public: public:
explicit GdbOptionsPageWidget(QWidget *parent = 0); explicit GdbOptionsPageWidget(QWidget *parent = 0);
QGroupBox *groupBoxGeneral;
QSpinBox *spinBoxGdbWatchdogTimeout;
QCheckBox *checkBoxSkipKnownFrames;
QCheckBox *checkBoxUseMessageBoxForSignals;
QCheckBox *checkBoxAdjustBreakpointLocations;
QCheckBox *checkBoxUseDynamicType;
QCheckBox *checkBoxLoadGdbInit;
QCheckBox *checkBoxLoadGdbDumpers;
QCheckBox *checkBoxIntelFlavor;
QCheckBox *checkBoxIdentifyDebugInfoPackages;
QGroupBox *groupBoxStartupCommands;
QTextEdit *textEditStartupCommands;
QGroupBox *groupBoxPostAttachCommands;
QTextEdit *textEditPostAttachCommands;
QGroupBox *groupBoxCustomDumperCommands;
QTextEdit *textEditCustomDumperCommands;
QLineEdit *extraDumperFile;
//QGroupBox *groupBoxPluginDebugging;
//QRadioButton *radioButtonAllPluginBreakpoints;
//QRadioButton *radioButtonSelectedPluginBreakpoints;
//QRadioButton *radioButtonNoPluginBreakpoints;
//QLabel *labelSelectedPluginBreakpoints;
//QLineEdit *lineEditSelectedPluginBreakpointsPattern;
Utils::SavedActionSet group; Utils::SavedActionSet group;
}; };
@@ -97,10 +73,10 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
{ {
(void) new VariableChooser(this); (void) new VariableChooser(this);
groupBoxGeneral = new QGroupBox(this); auto groupBoxGeneral = new QGroupBox(this);
groupBoxGeneral->setTitle(GdbOptionsPage::tr("General")); groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));
QLabel *labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral); auto labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral);
labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:")); labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:"));
labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr( labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr(
"The number of seconds Qt Creator will wait before it terminates\n" "The number of seconds Qt Creator will wait before it terminates\n"
@@ -109,7 +85,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"loading big libraries or listing source files takes much longer than\n" "loading big libraries or listing source files takes much longer than\n"
"that on slow machines. In this case, the value should be increased.")); "that on slow machines. In this case, the value should be increased."));
spinBoxGdbWatchdogTimeout = new QSpinBox(groupBoxGeneral); auto spinBoxGdbWatchdogTimeout = new QSpinBox(groupBoxGeneral);
spinBoxGdbWatchdogTimeout->setToolTip(labelGdbWatchdogTimeout->toolTip()); spinBoxGdbWatchdogTimeout->setToolTip(labelGdbWatchdogTimeout->toolTip());
spinBoxGdbWatchdogTimeout->setSuffix(GdbOptionsPage::tr("sec")); spinBoxGdbWatchdogTimeout->setSuffix(GdbOptionsPage::tr("sec"));
spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight); spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight);
@@ -118,7 +94,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
spinBoxGdbWatchdogTimeout->setSingleStep(20); spinBoxGdbWatchdogTimeout->setSingleStep(20);
spinBoxGdbWatchdogTimeout->setValue(20); spinBoxGdbWatchdogTimeout->setValue(20);
checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral); auto checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral);
checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping")); checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping"));
checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr( checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>" "<html><head/><body><p>"
@@ -127,14 +103,14 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"counting code is skipped, and a single <i>Step Into</i> for a signal\n" "counting code is skipped, and a single <i>Step Into</i> for a signal\n"
"emission ends up directly in the slot connected to it.")); "emission ends up directly in the slot connected to it."));
checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral); auto checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr( checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr(
"Show a message box when receiving a signal")); "Show a message box when receiving a signal"));
checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr( checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr(
"Displays a message box as soon as your application\n" "Displays a message box as soon as your application\n"
"receives a signal like SIGSEGV during debugging.")); "receives a signal like SIGSEGV during debugging."));
checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral); auto checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr( checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr(
"Adjust breakpoint locations")); "Adjust breakpoint locations"));
checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr( checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr(
@@ -144,32 +120,32 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"This option reflects such temporary change by moving the breakpoint\n" "This option reflects such temporary change by moving the breakpoint\n"
"markers in the source code editor.")); "markers in the source code editor."));
checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral); auto checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
checkBoxUseDynamicType->setText(GdbOptionsPage::tr( checkBoxUseDynamicType->setText(GdbOptionsPage::tr(
"Use dynamic object type for display")); "Use dynamic object type for display"));
checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr( checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr(
"Specifies whether the dynamic or the static type of objects will be " "Specifies whether the dynamic or the static type of objects will be "
"displayed. Choosing the dynamic type might be slower.")); "displayed. Choosing the dynamic type might be slower."));
checkBoxLoadGdbInit = new QCheckBox(groupBoxGeneral); auto checkBoxLoadGdbInit = new QCheckBox(groupBoxGeneral);
checkBoxLoadGdbInit->setText(GdbOptionsPage::tr("Load .gdbinit file on startup")); checkBoxLoadGdbInit->setText(GdbOptionsPage::tr("Load .gdbinit file on startup"));
checkBoxLoadGdbInit->setToolTip(GdbOptionsPage::tr( checkBoxLoadGdbInit->setToolTip(GdbOptionsPage::tr(
"Allows or inhibits reading the user's default\n" "Allows or inhibits reading the user's default\n"
".gdbinit file on debugger startup.")); ".gdbinit file on debugger startup."));
checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral); auto checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral);
checkBoxLoadGdbDumpers->setText(GdbOptionsPage::tr("Load system GDB pretty printers")); checkBoxLoadGdbDumpers->setText(GdbOptionsPage::tr("Load system GDB pretty printers"));
checkBoxLoadGdbDumpers->setToolTip(GdbOptionsPage::tr( checkBoxLoadGdbDumpers->setToolTip(GdbOptionsPage::tr(
"Uses the default GDB pretty printers installed in your " "Uses the default GDB pretty printers installed in your "
"system or linked to the libraries your application uses.")); "system or linked to the libraries your application uses."));
checkBoxIntelFlavor = new QCheckBox(groupBoxGeneral); auto checkBoxIntelFlavor = new QCheckBox(groupBoxGeneral);
checkBoxIntelFlavor->setText(GdbOptionsPage::tr("Use Intel style disassembly")); checkBoxIntelFlavor->setText(GdbOptionsPage::tr("Use Intel style disassembly"));
checkBoxIntelFlavor->setToolTip(GdbOptionsPage::tr( checkBoxIntelFlavor->setToolTip(GdbOptionsPage::tr(
"<html><head/><body>GDB shows by default AT&&T style disassembly." "<html><head/><body>GDB shows by default AT&&T style disassembly."
"</body></html>")); "</body></html>"));
checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral); auto checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral);
checkBoxIdentifyDebugInfoPackages->setText(GdbOptionsPage::tr("Create tasks from missing packages")); checkBoxIdentifyDebugInfoPackages->setText(GdbOptionsPage::tr("Create tasks from missing packages"));
checkBoxIdentifyDebugInfoPackages->setToolTip(GdbOptionsPage::tr( checkBoxIdentifyDebugInfoPackages->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>Attempts to identify missing debug info packages " "<html><head/><body><p>Attempts to identify missing debug info packages "
@@ -185,7 +161,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"<p>To execute arbitrary Python scripts, " "<p>To execute arbitrary Python scripts, "
"use <i>python execfile('/path/to/script.py')</i>.</p>"); "use <i>python execfile('/path/to/script.py')</i>.</p>");
groupBoxStartupCommands = new QGroupBox(this); auto groupBoxStartupCommands = new QGroupBox(this);
groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands")); groupBoxStartupCommands->setTitle(GdbOptionsPage::tr("Additional Startup Commands"));
groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr( groupBoxStartupCommands->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>GDB commands entered here will be executed after " "<html><head/><body><p>GDB commands entered here will be executed after "
@@ -193,11 +169,11 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"attached, and before the debugging helpers are initialized.</p>%1" "attached, and before the debugging helpers are initialized.</p>%1"
"</body></html>").arg(howToUsePython)); "</body></html>").arg(howToUsePython));
textEditStartupCommands = new QTextEdit(groupBoxStartupCommands); auto textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
textEditStartupCommands->setAcceptRichText(false); textEditStartupCommands->setAcceptRichText(false);
textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip()); textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip());
groupBoxPostAttachCommands = new QGroupBox(this); auto groupBoxPostAttachCommands = new QGroupBox(this);
groupBoxPostAttachCommands->setTitle(GdbOptionsPage::tr("Additional Attach Commands")); groupBoxPostAttachCommands->setTitle(GdbOptionsPage::tr("Additional Attach Commands"));
groupBoxPostAttachCommands->setToolTip(GdbOptionsPage::tr( groupBoxPostAttachCommands->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>GDB commands entered here will be executed after " "<html><head/><body><p>GDB commands entered here will be executed after "
@@ -206,11 +182,11 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"such as \"monitor reset\" or \"load\"." "such as \"monitor reset\" or \"load\"."
"</body></html>")); "</body></html>"));
textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands); auto textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
textEditPostAttachCommands->setAcceptRichText(false); textEditPostAttachCommands->setAcceptRichText(false);
textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip()); textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());
groupBoxCustomDumperCommands = new QGroupBox(this); auto groupBoxCustomDumperCommands = new QGroupBox(this);
groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization")); groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization"));
groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr( groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr(
"<html><head/><body><p>GDB commands entered here will be executed after " "<html><head/><body><p>GDB commands entered here will be executed after "
@@ -218,14 +194,18 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
"You can load additional debugging helpers or modify existing ones here.</p>" "You can load additional debugging helpers or modify existing ones here.</p>"
"%1</body></html>").arg(howToUsePython)); "%1</body></html>").arg(howToUsePython));
textEditCustomDumperCommands = new QTextEdit(groupBoxCustomDumperCommands); auto textEditCustomDumperCommands = new QTextEdit(groupBoxCustomDumperCommands);
textEditCustomDumperCommands->setAcceptRichText(false); textEditCustomDumperCommands->setAcceptRichText(false);
textEditCustomDumperCommands->setToolTip(groupBoxCustomDumperCommands->toolTip()); textEditCustomDumperCommands->setToolTip(groupBoxCustomDumperCommands->toolTip());
extraDumperFile = new QLineEdit(groupBoxCustomDumperCommands); auto groupBoxExtraDumperFile = new QGroupBox(this);
extraDumperFile->setToolTip(GdbOptionsPage::tr( groupBoxExtraDumperFile->setTitle(GdbOptionsPage::tr("Extra Debugging Helpers"));
groupBoxExtraDumperFile->setToolTip(GdbOptionsPage::tr(
"Path to a Python file containing additional data dumpers.")); "Path to a Python file containing additional data dumpers."));
auto pathChooserExtraDumperFile = new Utils::PathChooser(groupBoxExtraDumperFile);
pathChooserExtraDumperFile->setExpectedKind(Utils::PathChooser::File);
/* /*
groupBoxPluginDebugging = new QGroupBox(q); groupBoxPluginDebugging = new QGroupBox(q);
groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr( groupBoxPluginDebugging->setTitle(GdbOptionsPage::tr(
@@ -255,9 +235,9 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
VariableChooser::addVariableSupport(textEditCustomDumperCommands); VariableChooser::addVariableSupport(textEditCustomDumperCommands);
VariableChooser::addVariableSupport(textEditPostAttachCommands); VariableChooser::addVariableSupport(textEditPostAttachCommands);
VariableChooser::addVariableSupport(textEditStartupCommands); VariableChooser::addVariableSupport(textEditStartupCommands);
VariableChooser::addVariableSupport(extraDumperFile); VariableChooser::addVariableSupport(pathChooserExtraDumperFile->lineEdit());
QFormLayout *formLayout = new QFormLayout(groupBoxGeneral); auto formLayout = new QFormLayout(groupBoxGeneral);
formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout); formLayout->addRow(labelGdbWatchdogTimeout, spinBoxGdbWatchdogTimeout);
formLayout->addRow(checkBoxSkipKnownFrames); formLayout->addRow(checkBoxSkipKnownFrames);
formLayout->addRow(checkBoxUseMessageBoxForSignals); formLayout->addRow(checkBoxUseMessageBoxForSignals);
@@ -268,38 +248,29 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
formLayout->addRow(checkBoxIntelFlavor); formLayout->addRow(checkBoxIntelFlavor);
formLayout->addRow(checkBoxIdentifyDebugInfoPackages); formLayout->addRow(checkBoxIdentifyDebugInfoPackages);
QGridLayout *startLayout = new QGridLayout(groupBoxStartupCommands); auto startLayout = new QGridLayout(groupBoxStartupCommands);
startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1); startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);
QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands); auto postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1); postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);
QFormLayout *customDumperLayout = new QFormLayout(groupBoxCustomDumperCommands); auto customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands);
customDumperLayout->addRow(GdbOptionsPage::tr("Additional file:"), extraDumperFile); customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1);
customDumperLayout->addRow(textEditCustomDumperCommands);
//QHBoxLayout *horizontalLayout = new QHBoxLayout(); auto extraDumperLayout = new QGridLayout(groupBoxExtraDumperFile);
//horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum)); extraDumperLayout->addWidget(pathChooserExtraDumperFile, 0, 0, 1, 1);
//horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
//horizontalLayout->addWidget(lineEditSelectedPluginBreakpointsPattern);
QGridLayout *gridLayout = new QGridLayout(this); auto gridLayout = new QGridLayout(this);
gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1); gridLayout->addWidget(groupBoxGeneral, 0, 0, 5, 1);
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1); gridLayout->addWidget(groupBoxExtraDumperFile, 5, 0, 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(groupBoxStartupCommands, 0, 1, 2, 1);
//gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1); gridLayout->addWidget(groupBoxPostAttachCommands, 2, 1, 2, 1);
//gridLayout->addWidget(radioButtonSelectedPluginBreakpoints, 1, 0, 1, 1); gridLayout->addWidget(groupBoxCustomDumperCommands, 4, 1, 2, 1);
//gridLayout->addLayout(horizontalLayout, 2, 0, 1, 1);
//gridLayout->addWidget(radioButtonNoPluginBreakpoints, 3, 0, 1, 1);
//gridLayout->addWidget(groupBoxPluginDebugging, 1, 0, 1, 2);
DebuggerCore *dc = debuggerCore(); DebuggerCore *dc = debuggerCore();
group.insert(dc->action(GdbStartupCommands), textEditStartupCommands); group.insert(dc->action(GdbStartupCommands), textEditStartupCommands);
group.insert(dc->action(ExtraDumperFile), extraDumperFile); group.insert(dc->action(ExtraDumperFile), pathChooserExtraDumperFile);
group.insert(dc->action(ExtraDumperCommands), textEditCustomDumperCommands); group.insert(dc->action(ExtraDumperCommands), textEditCustomDumperCommands);
group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands); group.insert(dc->action(GdbPostAttachCommands), textEditPostAttachCommands);
group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit); group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);

View File

@@ -821,35 +821,23 @@ static QHash<QString, WatchData> m_toolTipCache;
void LldbEngine::showToolTip() void LldbEngine::showToolTip()
{ {
if (m_toolTipContext.isNull()) if (m_toolTipContext.expression.isEmpty())
return; return;
const QString expression = m_toolTipContext->expression; //const QString expression = m_toolTipContext->expression;
if (DebuggerToolTipManager::debug()) // qDebug() << "LldbEngine::showToolTip " << expression << m_toolTipContext->iname << (*m_toolTipContext);
qDebug() << "LldbEngine::showToolTip " << expression << m_toolTipContext->iname << (*m_toolTipContext);
if (m_toolTipContext->iname.startsWith("tooltip") DebuggerToolTipManager::showToolTip(m_toolTipContext, this);
&& (!debuggerCore()->boolSetting(UseToolTipsInMainEditor)
|| !watchHandler()->isValidToolTip(m_toolTipContext->iname))) {
watchHandler()->removeData(m_toolTipContext->iname);
return;
}
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
tw->setContext(*m_toolTipContext);
tw->acquireEngine(this);
DebuggerToolTipManager::showToolTip(m_toolTipContext->mousePosition, tw);
// Prevent tooltip from re-occurring (classic GDB, QTCREATORBUG-4711). // Prevent tooltip from re-occurring (classic GDB, QTCREATORBUG-4711).
m_toolTipContext.reset(); m_toolTipContext.expression.clear();
} }
void LldbEngine::resetLocation() void LldbEngine::resetLocation()
{ {
m_toolTipContext.reset(); m_toolTipContext.expression.clear();
DebuggerEngine::resetLocation(); DebuggerEngine::resetLocation();
} }
bool LldbEngine::setToolTipExpression(const QPoint &mousePos, bool LldbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &context)
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &contextIn)
{ {
if (state() != InferiorStopOk || !isCppEditor(editor)) { if (state() != InferiorStopOk || !isCppEditor(editor)) {
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED " //qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED "
@@ -857,46 +845,12 @@ bool LldbEngine::setToolTipExpression(const QPoint &mousePos,
return false; return false;
} }
DebuggerToolTipContext context = contextIn; m_toolTipContext = context;
int line, column;
QString exp = fixCppExpression(cppExpressionAt(editor, context.position, &line, &column, &context.function));
if (exp.isEmpty())
return false;
// Prefer a filter on an existing local variable if it can be found.
QByteArray iname;
if (const WatchData *localVariable = watchHandler()->findCppLocalVariable(exp)) {
exp = QLatin1String(localVariable->exp);
iname = localVariable->iname;
} else {
iname = tooltipIName(exp);
}
if (DebuggerToolTipManager::debug())
qDebug() << "GdbEngine::setToolTipExpression1 " << exp << iname << context;
// Same expression: Display synchronously.
if (!m_toolTipContext.isNull() && m_toolTipContext->expression == exp) {
showToolTip();
return true;
}
m_toolTipContext.reset(new DebuggerToolTipContext(context));
m_toolTipContext->mousePosition = mousePos;
m_toolTipContext->expression = exp;
m_toolTipContext->iname = iname;
// Local variable: Display synchronously.
if (iname.startsWith("local")) {
showToolTip();
return true;
}
if (DebuggerToolTipManager::debug())
qDebug() << "GdbEngine::setToolTipExpression2 " << exp << (*m_toolTipContext);
UpdateParameters params; UpdateParameters params;
params.tryPartial = true; params.tryPartial = true;
params.tooltipOnly = true; params.tooltipOnly = true;
params.varList = iname; params.varList = context.iname;
doUpdateLocals(params); doUpdateLocals(params);
return true; return true;
@@ -985,10 +939,9 @@ void LldbEngine::doUpdateLocals(UpdateParameters params)
// Re-create tooltip items that are not filters on existing local variables in // Re-create tooltip items that are not filters on existing local variables in
// the tooltip model. // the tooltip model.
DebuggerToolTipContexts toolTips = DebuggerToolTipContexts toolTips =
DebuggerToolTipManager::treeWidgetExpressions(frame.file, objectName(), frame.function); DebuggerToolTipManager::treeWidgetExpressions(this, frame.file, frame.function);
const QString currentExpression = const QString currentExpression = m_toolTipContext.expression;
m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression;
if (!currentExpression.isEmpty()) { if (!currentExpression.isEmpty()) {
int currentIndex = -1; int currentIndex = -1;
for (int i = 0; i < toolTips.size(); ++i) { for (int i = 0; i < toolTips.size(); ++i) {

View File

@@ -34,6 +34,7 @@
#include <debugger/disassembleragent.h> #include <debugger/disassembleragent.h>
#include <debugger/memoryagent.h> #include <debugger/memoryagent.h>
#include <debugger/watchhandler.h> #include <debugger/watchhandler.h>
#include <debugger/debuggertooltipmanager.h>
#include <utils/consoleprocess.h> #include <utils/consoleprocess.h>
@@ -107,8 +108,8 @@ private:
void abortDebugger(); void abortDebugger();
void resetLocation(); void resetLocation();
bool setToolTipExpression(const QPoint &mousePos, bool setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &); const DebuggerToolTipContext &);
void continueInferior(); void continueInferior();
void interruptInferior(); void interruptInferior();
@@ -217,7 +218,7 @@ private:
QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents; QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents;
QMap<QPointer<MemoryAgent>, int> m_memoryAgents; QMap<QPointer<MemoryAgent>, int> m_memoryAgents;
QHash<int, QPointer<QObject> > m_memoryAgentTokens; QHash<int, QPointer<QObject> > m_memoryAgentTokens;
QScopedPointer<DebuggerToolTipContext> m_toolTipContext; DebuggerToolTipContext m_toolTipContext;
void showToolTip(); void showToolTip();

View File

@@ -452,10 +452,9 @@ static WatchData m_toolTip;
static QPoint m_toolTipPos; static QPoint m_toolTipPos;
static QHash<QString, WatchData> m_toolTipCache; static QHash<QString, WatchData> m_toolTipCache;
bool PdbEngine::setToolTipExpression(const QPoint &mousePos, bool PdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx) const DebuggerToolTipContext &ctx)
{ {
Q_UNUSED(mousePos)
Q_UNUSED(editor) Q_UNUSED(editor)
if (state() != InferiorStopOk) { if (state() != InferiorStopOk) {

View File

@@ -75,8 +75,8 @@ private:
void shutdownInferior(); void shutdownInferior();
void shutdownEngine(); void shutdownEngine();
bool setToolTipExpression(const QPoint &mousePos, bool setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &); const DebuggerToolTipContext &);
void continueInferior(); void continueInferior();
void interruptInferior(); void interruptInferior();

View File

@@ -89,15 +89,14 @@ bool QmlCppEngine::canDisplayTooltip() const
return m_cppEngine->canDisplayTooltip() || m_qmlEngine->canDisplayTooltip(); return m_cppEngine->canDisplayTooltip() || m_qmlEngine->canDisplayTooltip();
} }
bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos, bool QmlCppEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
{ {
QTC_ASSERT(editor, return false); QTC_ASSERT(editor, return false);
bool success = false; bool success = false;
if (editor->document()->id() == CppEditor::Constants::CPPEDITOR_ID) if (editor->document()->id() == CppEditor::Constants::CPPEDITOR_ID)
success = m_cppEngine->setToolTipExpression(mousePos, editor, ctx); success = m_cppEngine->setToolTipExpression(editor, ctx);
else if (editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) else if (editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID)
success = m_qmlEngine->setToolTipExpression(mousePos, editor, ctx); success = m_qmlEngine->setToolTipExpression(editor, ctx);
return success; return success;
} }

View File

@@ -46,8 +46,8 @@ public:
~QmlCppEngine(); ~QmlCppEngine();
bool canDisplayTooltip() const; bool canDisplayTooltip() const;
bool setToolTipExpression(const QPoint &mousePos, bool setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor * editor, const DebuggerToolTipContext &); const DebuggerToolTipContext &);
void updateWatchData(const WatchData &data, void updateWatchData(const WatchData &data,
const WatchUpdateFlags &flags); const WatchUpdateFlags &flags);
void watchDataSelected(const QByteArray &iname); void watchDataSelected(const QByteArray &iname);

View File

@@ -983,12 +983,12 @@ void QmlEngine::requestModuleSymbols(const QString &moduleName)
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
bool QmlEngine::setToolTipExpression(const QPoint &mousePos, bool QmlEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx) const DebuggerToolTipContext &ctx)
{ {
// This is processed by QML inspector, which has dependencies to // This is processed by QML inspector, which has dependencies to
// the qml js editor. Makes life easier. // the qml js editor. Makes life easier.
emit tooltipRequested(mousePos, editor, ctx.position); emit tooltipRequested(ctx.mousePosition, editor, ctx.position);
return true; return true;
} }

View File

@@ -128,8 +128,8 @@ private:
void shutdownInferior(); void shutdownInferior();
void shutdownEngine(); void shutdownEngine();
bool setToolTipExpression(const QPoint &mousePos, bool setToolTipExpression(TextEditor::ITextEditor *editor,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &); const DebuggerToolTipContext &);
void continueInferior(); void continueInferior();
void interruptInferior(); void interruptInferior();

View File

@@ -500,7 +500,11 @@ WatchItem *WatchModel::findItem(const QByteArray &iname) const
void WatchModel::checkIndex(const QModelIndex &index) const void WatchModel::checkIndex(const QModelIndex &index) const
{ {
QTC_CHECK(index.isValid() ? index.model() == this : index.model() == 0); if (index.isValid()) {
QTC_CHECK(index.model() == this);
} else {
QTC_CHECK(index.model() == 0);
}
} }
WatchItem *WatchModel::createItem(const WatchData &data) WatchItem *WatchModel::createItem(const WatchData &data)

View File

@@ -958,7 +958,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
} else if (act == &actRemoveWatchExpression) { } else if (act == &actRemoveWatchExpression) {
handler->removeData(p.data(LocalsINameRole).toByteArray()); handler->removeData(p.data(LocalsINameRole).toByteArray());
} else if (act == &actCopy) { } else if (act == &actCopy) {
copyToClipboard(DebuggerToolTipWidget::treeModelClipboardContents(model())); copyToClipboard(DebuggerToolTipManager::treeModelClipboardContents(model()));
} else if (act == &actCopyValue) { } else if (act == &actCopyValue) {
copyToClipboard(mi1.data().toString()); copyToClipboard(mi1.data().toString());
} else if (act == &actShowInEditor) { } else if (act == &actShowInEditor) {
@@ -1025,31 +1025,31 @@ void WatchTreeView::handleItemIsExpanded(const QModelIndex &idx)
expand(idx); expand(idx);
} }
void WatchTreeView::resetHelper() void WatchTreeView::reexpand(QTreeView *view, const QModelIndex &idx)
{
QModelIndex idx = model()->index(m_type, 0);
resetHelper(idx);
expand(idx);
}
void WatchTreeView::resetHelper(const QModelIndex &idx)
{ {
if (idx.data(LocalsExpandedRole).toBool()) { if (idx.data(LocalsExpandedRole).toBool()) {
//qDebug() << "EXPANDING " << model()->data(idx, LocalsINameRole); //qDebug() << "EXPANDING " << view->model()->data(idx, LocalsINameRole);
if (!isExpanded(idx)) { if (!view->isExpanded(idx)) {
expand(idx); view->expand(idx);
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) { for (int i = 0, n = view->model()->rowCount(idx); i != n; ++i) {
QModelIndex idx1 = model()->index(i, 0, idx); QModelIndex idx1 = view->model()->index(i, 0, idx);
resetHelper(idx1); reexpand(view, idx1);
} }
} }
} else { } else {
//qDebug() << "COLLAPSING " << model()->data(idx, LocalsINameRole); //qDebug() << "COLLAPSING " << view->model()->data(idx, LocalsINameRole);
if (isExpanded(idx)) if (view->isExpanded(idx))
collapse(idx); view->collapse(idx);
} }
} }
void WatchTreeView::resetHelper()
{
QModelIndex idx = model()->index(m_type, 0);
reexpand(this, idx);
expand(idx);
}
void WatchTreeView::reset() void WatchTreeView::reset()
{ {
BaseTreeView::reset(); BaseTreeView::reset();

View File

@@ -56,6 +56,7 @@ public:
void reset(); void reset();
void fillFormatMenu(QMenu *, const QModelIndex &mi); void fillFormatMenu(QMenu *, const QModelIndex &mi);
static void reexpand(QTreeView *view, const QModelIndex &idx);
public slots: public slots:
void watchExpression(const QString &exp); void watchExpression(const QString &exp);
@@ -91,7 +92,6 @@ private:
void inputNewExpression(); void inputNewExpression();
void editItem(const QModelIndex &idx); void editItem(const QModelIndex &idx);
void resetHelper(const QModelIndex &idx);
void setModelData(int role, const QVariant &value = QVariant(), void setModelData(int role, const QVariant &value = QVariant(),
const QModelIndex &index = QModelIndex()); const QModelIndex &index = QModelIndex());

View File

@@ -240,13 +240,26 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
rows << RowData(TextLineData(QLatin1String("ABCD")), rows << RowData(TextLineData(QLatin1String("ABCD")),
TextLineData(TextLineData::Separator)); TextLineData(TextLineData::Separator));
rows << RowData(TextLineData(QLatin1String("EFGH"))); rows << RowData(TextLineData(QLatin1String("EFGH")));
rows << RowData(TextLineData(QLatin1String("")));
ChunkData chunk; ChunkData chunk;
chunk.rows = rows; chunk.rows = rows;
QString patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n" QString patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n"
"-ABCD\n" "-ABCD\n"
" EFGH\n"); " EFGH\n");
QTest::newRow("Simple") << chunk QTest::newRow("Simple not a last chunk") << chunk
<< fileName
<< fileName
<< false
<< patchText;
///////////
// chunk the same here
patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n"
"-ABCD\n"
" EFGH\n"
"\\ No newline at end of file\n");
QTest::newRow("Simple last chunk") << chunk
<< fileName << fileName
<< fileName << fileName
<< true << true
@@ -255,8 +268,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
/////////// ///////////
rows.clear(); rows.clear();
rows << RowData(TextLineData(QLatin1String("ABCD")), rows << RowData(TextLineData(QLatin1String("ABCD")));
TextLineData(QLatin1String("ABCD")));
rows << RowData(TextLineData(QLatin1String("")), rows << RowData(TextLineData(QLatin1String("")),
TextLineData(TextLineData::Separator)); TextLineData(TextLineData::Separator));
chunk.rows = rows; chunk.rows = rows;
@@ -265,7 +277,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
"+ABCD\n" "+ABCD\n"
"\\ No newline at end of file\n"); "\\ No newline at end of file\n");
QTest::newRow("Last newline removed") << chunk QTest::newRow("EOL in last line removed") << chunk
<< fileName << fileName
<< fileName << fileName
<< true << true
@@ -275,11 +287,10 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
// chunk the same here // chunk the same here
patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n" patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n"
"-ABCD\n" " ABCD\n"
"-\n" "-\n");
"+ABCD\n");
QTest::newRow("Not a last newline removed") << chunk QTest::newRow("Last empty line removed") << chunk
<< fileName << fileName
<< fileName << fileName
<< false << false
@@ -288,8 +299,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
/////////// ///////////
rows.clear(); rows.clear();
rows << RowData(TextLineData(QLatin1String("ABCD")), rows << RowData(TextLineData(QLatin1String("ABCD")));
TextLineData(QLatin1String("ABCD")));
rows << RowData(TextLineData(TextLineData::Separator), rows << RowData(TextLineData(TextLineData::Separator),
TextLineData(QLatin1String(""))); TextLineData(QLatin1String("")));
chunk.rows = rows; chunk.rows = rows;
@@ -298,7 +308,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
"\\ No newline at end of file\n" "\\ No newline at end of file\n"
"+ABCD\n"); "+ABCD\n");
QTest::newRow("Last newline added") << chunk QTest::newRow("EOL to last line added") << chunk
<< fileName << fileName
<< fileName << fileName
<< true << true
@@ -308,11 +318,26 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
// chunk the same here // chunk the same here
patchText = header + QLatin1String("@@ -1,1 +1,2 @@\n" patchText = header + QLatin1String("@@ -1,1 +1,2 @@\n"
"-ABCD\n" " ABCD\n"
"+ABCD\n"
"+\n"); "+\n");
QTest::newRow("Not a last newline added") << chunk QTest::newRow("Last empty line added") << chunk
<< fileName
<< fileName
<< false
<< patchText;
///////////
rows.clear();
rows << RowData(TextLineData(QLatin1String("ABCD")),
TextLineData(QLatin1String("EFGH")));
chunk.rows = rows;
patchText = header + QLatin1String("@@ -1,1 +1,1 @@\n"
"-ABCD\n"
"+EFGH\n");
QTest::newRow("Last line with a newline modified") << chunk
<< fileName << fileName
<< fileName << fileName
<< false << false
@@ -325,19 +350,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
TextLineData(QLatin1String("EFGH"))); TextLineData(QLatin1String("EFGH")));
rows << RowData(TextLineData(QLatin1String(""))); rows << RowData(TextLineData(QLatin1String("")));
chunk.rows = rows; chunk.rows = rows;
patchText = header + QLatin1String("@@ -1,1 +1,1 @@\n"
"-ABCD\n"
"+EFGH\n");
QTest::newRow("Last line with a newline modified") << chunk
<< fileName
<< fileName
<< true
<< patchText;
///////////
// chunk the same here
patchText = header + QLatin1String("@@ -1,2 +1,2 @@\n" patchText = header + QLatin1String("@@ -1,2 +1,2 @@\n"
"-ABCD\n" "-ABCD\n"
"+EFGH\n" "+EFGH\n"
@@ -424,7 +436,35 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
QString result = DiffUtils::makePatch(sourceChunk, leftFileName, rightFileName, lastChunk); QString result = DiffUtils::makePatch(sourceChunk, leftFileName, rightFileName, lastChunk);
QCOMPARE(patchText, result); QCOMPARE(result, patchText);
bool ok;
QList<FileData> resultList = DiffUtils::readPatch(result, false, &ok);
QVERIFY(ok);
QCOMPARE(resultList.count(), 1);
for (int i = 0; i < resultList.count(); i++) {
const FileData &resultFileData = resultList.at(i);
QCOMPARE(resultFileData.leftFileInfo.fileName, leftFileName);
QCOMPARE(resultFileData.rightFileInfo.fileName, rightFileName);
QCOMPARE(resultFileData.chunks.count(), 1);
for (int j = 0; j < resultFileData.chunks.count(); j++) {
const ChunkData &resultChunkData = resultFileData.chunks.at(j);
QCOMPARE(resultChunkData.leftStartingLineNumber, sourceChunk.leftStartingLineNumber);
QCOMPARE(resultChunkData.rightStartingLineNumber, sourceChunk.rightStartingLineNumber);
QCOMPARE(resultChunkData.contextChunk, sourceChunk.contextChunk);
QCOMPARE(resultChunkData.rows.count(), sourceChunk.rows.count());
for (int k = 0; k < sourceChunk.rows.count(); k++) {
const RowData &sourceRowData = sourceChunk.rows.at(k);
const RowData &resultRowData = resultChunkData.rows.at(k);
QCOMPARE(resultRowData.equal, sourceRowData.equal);
QCOMPARE(resultRowData.leftLine.text, sourceRowData.leftLine.text);
QCOMPARE(resultRowData.leftLine.textLineType, sourceRowData.leftLine.textLineType);
QCOMPARE(resultRowData.rightLine.text, sourceRowData.rightLine.text);
QCOMPARE(resultRowData.rightLine.textLineType, sourceRowData.rightLine.textLineType);
}
}
}
} }
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data() void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
@@ -614,11 +654,74 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
fileData8.rightFileInfo = DiffFileInfo(QLatin1String("file b.txt")); fileData8.rightFileInfo = DiffFileInfo(QLatin1String("file b.txt"));
fileData8.fileOperation = FileData::RenameFile; fileData8.fileOperation = FileData::RenameFile;
QList<FileData> fileDataList; QList<FileData> fileDataList1;
fileDataList << fileData1 << fileData2 << fileData3 << fileData4 << fileData5 << fileData6 << fileData7 << fileData8; fileDataList1 << fileData1 << fileData2 << fileData3 << fileData4 << fileData5 << fileData6 << fileData7 << fileData8;
QTest::newRow("Git patch") << patch QTest::newRow("Git patch") << patch
<< fileDataList; << fileDataList1;
//////////////
patch = QLatin1String("diff --git a/file foo.txt b/file foo.txt\n"
"index 1234567..9876543 100644\n"
"--- a/file foo.txt\n"
"+++ b/file foo.txt\n"
"@@ -50,4 +50,5 @@ void DiffEditor::ctor()\n"
" A\n"
" B\n"
" C\n"
"+\n");
fileData1.leftFileInfo = DiffFileInfo(QLatin1String("file foo.txt"), QLatin1String("1234567"));
fileData1.rightFileInfo = DiffFileInfo(QLatin1String("file foo.txt"), QLatin1String("9876543"));
fileData1.fileOperation = FileData::ChangeFile;
chunkData1.leftStartingLineNumber = 49;
chunkData1.rightStartingLineNumber = 49;
rows1.clear();
rows1.append(RowData(TextLineData(QLatin1String("A"))));
rows1.append(RowData(TextLineData(QLatin1String("B"))));
rows1.append(RowData(TextLineData(QLatin1String("C"))));
rows1.append(RowData(TextLineData(TextLineData::Separator),
TextLineData(QLatin1String(""))));
chunkData1.rows = rows1;
fileData1.chunks.clear();
fileData1.chunks.append(chunkData1);
QList<FileData> fileDataList2;
fileDataList2 << fileData1;
QTest::newRow("Added line") << patch
<< fileDataList2;
//////////////
patch = QLatin1String("diff --git a/file foo.txt b/file foo.txt\n"
"index 1234567..9876543 100644\n"
"--- a/file foo.txt\n"
"+++ b/file foo.txt\n"
"@@ -1,1 +1,1 @@\n"
"-ABCD\n"
"\\ No newline at end of file\n"
"+ABCD\n");
fileData1.leftFileInfo = DiffFileInfo(QLatin1String("file foo.txt"), QLatin1String("1234567"));
fileData1.rightFileInfo = DiffFileInfo(QLatin1String("file foo.txt"), QLatin1String("9876543"));
fileData1.fileOperation = FileData::ChangeFile;
chunkData1.leftStartingLineNumber = 0;
chunkData1.rightStartingLineNumber = 0;
rows1.clear();
rows1.append(RowData(TextLineData(QLatin1String("ABCD"))));
rows1.append(RowData(TextLineData(TextLineData::Separator),
TextLineData(QLatin1String(""))));
chunkData1.rows = rows1;
fileData1.chunks.clear();
fileData1.chunks.append(chunkData1);
QList<FileData> fileDataList3;
fileDataList3 << fileData1;
QTest::newRow("Last newline added to a line without newline") << patch
<< fileDataList3;
} }
void DiffEditor::Internal::DiffEditorPlugin::testReadPatch() void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()

View File

@@ -131,15 +131,23 @@ ChunkData DiffUtils::calculateOriginalData(const QList<Diff> &leftDiffList,
: Diff(Diff::Equal); : Diff(Diff::Equal);
if (leftDiff.command == Diff::Delete) { if (leftDiff.command == Diff::Delete) {
if (j == rightDiffList.count() && lastLineEqual && leftDiff.text.startsWith(QLatin1Char('\n')))
equalLines.insert(leftLineNumber, rightLineNumber);
// process delete // process delete
handleDifference(leftDiff.text, &leftLines, &leftLineNumber); handleDifference(leftDiff.text, &leftLines, &leftLineNumber);
lastLineEqual = lastLinesEqual(leftLines, rightLines); lastLineEqual = lastLinesEqual(leftLines, rightLines);
if (j == rightDiffList.count())
lastLineEqual = false;
i++; i++;
} }
if (rightDiff.command == Diff::Insert) { if (rightDiff.command == Diff::Insert) {
if (i == leftDiffList.count() && lastLineEqual && rightDiff.text.startsWith(QLatin1Char('\n')))
equalLines.insert(leftLineNumber, rightLineNumber);
// process insert // process insert
handleDifference(rightDiff.text, &rightLines, &rightLineNumber); handleDifference(rightDiff.text, &rightLines, &rightLineNumber);
lastLineEqual = lastLinesEqual(leftLines, rightLines); lastLineEqual = lastLinesEqual(leftLines, rightLines);
if (i == leftDiffList.count())
lastLineEqual = false;
j++; j++;
} }
if (leftDiff.command == Diff::Equal && rightDiff.command == Diff::Equal) { if (leftDiff.command == Diff::Equal && rightDiff.command == Diff::Equal) {
@@ -262,6 +270,7 @@ FileData DiffUtils::calculateContextData(const ChunkData &originalData,
FileData fileData; FileData fileData;
fileData.contextChunksIncluded = true; fileData.contextChunksIncluded = true;
fileData.lastChunkAtTheEndOfFile = true;
QMap<int, bool> hiddenRows; QMap<int, bool> hiddenRows;
int i = 0; int i = 0;
@@ -353,13 +362,24 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
int rightLineCount = 0; int rightLineCount = 0;
QList<TextLineData> leftBuffer, rightBuffer; QList<TextLineData> leftBuffer, rightBuffer;
int lastEqualRow = -1;
if (lastChunk) {
for (int i = chunkData.rows.count(); i > 0; i--) {
if (chunkData.rows.at(i - 1).equal) {
if (i != chunkData.rows.count())
lastEqualRow = i - 1;
break;
}
}
}
for (int i = 0; i <= chunkData.rows.count(); i++) { for (int i = 0; i <= chunkData.rows.count(); i++) {
const RowData &rowData = i < chunkData.rows.count() const RowData &rowData = i < chunkData.rows.count()
? chunkData.rows.at(i) ? chunkData.rows.at(i)
: RowData(TextLineData(TextLineData::Separator)); // dummy, : RowData(TextLineData(TextLineData::Separator)); // dummy,
// ensure we process buffers to the end. // ensure we process buffers to the end.
// rowData will be equal // rowData will be equal
if (rowData.equal) { if (rowData.equal && i != lastEqualRow) {
if (leftBuffer.count()) { if (leftBuffer.count()) {
for (int j = 0; j < leftBuffer.count(); j++) { for (int j = 0; j < leftBuffer.count(); j++) {
const QString line = makePatchLine(QLatin1Char('-'), const QString line = makePatchLine(QLatin1Char('-'),
@@ -554,11 +574,15 @@ static QList<RowData> readLines(const QString &patch,
} }
} }
if (i < lines.count() if (i < lines.count() // we broke before
// or we have noNewLine in some equal line and in either delete or insert line
|| (noNewLineInEqual >= 0 && (noNewLineInDelete >= 0 || noNewLineInInsert >= 0)) || (noNewLineInEqual >= 0 && (noNewLineInDelete >= 0 || noNewLineInInsert >= 0))
// or we have noNewLine in not the last equal line
|| (noNewLineInEqual >= 0 && noNewLineInEqual != lastEqual) || (noNewLineInEqual >= 0 && noNewLineInEqual != lastEqual)
|| (noNewLineInDelete >= 0 && noNewLineInDelete != lastDelete) // or we have noNewLine in not the last delete line or there is a equal line after the noNewLine for delete
|| (noNewLineInInsert >= 0 && noNewLineInInsert != lastInsert)) { || (noNewLineInDelete >= 0 && (noNewLineInDelete != lastDelete || lastEqual > lastDelete))
// or we have noNewLine in not the last insert line or there is a equal line after the noNewLine for insert
|| (noNewLineInInsert >= 0 && (noNewLineInInsert != lastInsert || lastEqual > lastInsert))) {
if (ok) if (ok)
*ok = false; *ok = false;
return QList<RowData>(); return QList<RowData>();
@@ -577,7 +601,11 @@ static QList<RowData> readLines(const QString &patch,
removeNewLineFromLastDelete = true; removeNewLineFromLastDelete = true;
if (noNewLineInInsert >= 0) if (noNewLineInInsert >= 0)
removeNewLineFromLastInsert = true; removeNewLineFromLastInsert = true;
} else if (lastEqual > lastDelete && lastEqual > lastInsert) { } else {
if (noNewLineInEqual >= 0) {
removeNewLineFromLastEqual = true;
} else if (lastChunk) {
if (lastEqual > lastDelete && lastEqual > lastInsert) {
removeNewLineFromLastEqual = true; removeNewLineFromLastEqual = true;
} else if (lastDelete > lastEqual && lastDelete > lastInsert) { } else if (lastDelete > lastEqual && lastDelete > lastInsert) {
if (lastInsert > lastEqual) { if (lastInsert > lastEqual) {
@@ -585,6 +613,7 @@ static QList<RowData> readLines(const QString &patch,
removeNewLineFromLastInsert = true; removeNewLineFromLastInsert = true;
} else if (lastEqual > lastInsert) { } else if (lastEqual > lastInsert) {
removeNewLineFromLastEqual = true; removeNewLineFromLastEqual = true;
removeNewLineFromLastDelete = true;
prependNewLineAfterLastEqual = true; prependNewLineAfterLastEqual = true;
} }
} else if (lastInsert > lastEqual && lastInsert > lastDelete) { } else if (lastInsert > lastEqual && lastInsert > lastDelete) {
@@ -593,9 +622,13 @@ static QList<RowData> readLines(const QString &patch,
removeNewLineFromLastInsert = true; removeNewLineFromLastInsert = true;
} else if (lastEqual > lastDelete) { } else if (lastEqual > lastDelete) {
removeNewLineFromLastEqual = true; removeNewLineFromLastEqual = true;
removeNewLineFromLastInsert = true;
prependNewLineAfterLastEqual = true; prependNewLineAfterLastEqual = true;
} }
} }
}
}
if (removeNewLineFromLastEqual) { if (removeNewLineFromLastEqual) {
Diff &diff = diffList[lastEqual]; Diff &diff = diffList[lastEqual];

View File

@@ -478,13 +478,24 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
(*selections)[*blockNumber].append(DiffSelection(&m_chunkLineFormat)); (*selections)[*blockNumber].append(DiffSelection(&m_chunkLineFormat));
int lastEqualRow = -1;
if (lastChunk) {
for (int i = chunkData.rows.count(); i > 0; i--) {
if (chunkData.rows.at(i - 1).equal) {
if (i != chunkData.rows.count())
lastEqualRow = i - 1;
break;
}
}
}
for (int i = 0; i <= chunkData.rows.count(); i++) { for (int i = 0; i <= chunkData.rows.count(); i++) {
const RowData &rowData = i < chunkData.rows.count() const RowData &rowData = i < chunkData.rows.count()
? chunkData.rows.at(i) ? chunkData.rows.at(i)
: RowData(TextLineData(TextLineData::Separator)); // dummy, : RowData(TextLineData(TextLineData::Separator)); // dummy,
// ensure we process buffers to the end. // ensure we process buffers to the end.
// rowData will be equal // rowData will be equal
if (rowData.equal) { if (rowData.equal && i != lastEqualRow) {
if (leftBuffer.count()) { if (leftBuffer.count()) {
for (int j = 0; j < leftBuffer.count(); j++) { for (int j = 0; j < leftBuffer.count(); j++) {
const TextLineData &lineData = leftBuffer.at(j); const TextLineData &lineData = leftBuffer.at(j);

View File

@@ -555,6 +555,7 @@ HelpViewer *HelpPlugin::externalHelpViewer()
if (!m_externalWindowState.isNull()) if (!m_externalWindowState.isNull())
m_externalWindow->setGeometry(m_externalWindowState); m_externalWindow->setGeometry(m_externalWindowState);
m_externalWindow->show(); m_externalWindow->show();
m_externalWindow->setFocus();
return m_externalWindow->currentViewer(); return m_externalWindow->currentViewer();
} }

View File

@@ -1,7 +1,7 @@
<plugin name=\"Ios\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\"> <plugin name=\"Ios\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
<vendor>Digia Plc</vendor> <vendor>Digia Plc</vendor>
<copyright>(C) 2014 Digia Plc</copyright> <copyright>(C) 2014 Digia Plc</copyright>
<platform>Mac OS.*</platform> <platform>OS X.*</platform>
<license> <license>
Commercial Usage Commercial Usage

View File

@@ -243,24 +243,25 @@ void QbsBuildStep::buildingDone(bool success)
item.codeLocation().fileName(), item.codeLocation().line()); item.codeLocation().fileName(), item.codeLocation().line());
QbsProject *pro = static_cast<QbsProject *>(project()); QbsProject *pro = static_cast<QbsProject *>(project());
connect(pro, SIGNAL(projectParsingDone(bool)), this, SLOT(reparsingDone()));
// Building can uncover additional target artifacts. // Building can uncover additional target artifacts.
// Wait for reparsing to finish, since before that our run configurations may not be valid. pro->updateAfterBuild();
// The reparsing, if it is necessary, has to be done before finished() is emitted, as
// otherwise a potential additional build step could conflict with the parsing step.
if (pro->parsingScheduled()) {
connect(pro, SIGNAL(projectParsingDone(bool)), this, SLOT(reparsingDone()));
pro->parseCurrentBuildConfiguration(true); pro->parseCurrentBuildConfiguration(true);
} else {
finish();
}
} }
void QbsBuildStep::reparsingDone() void QbsBuildStep::reparsingDone()
{ {
disconnect(static_cast<QbsProject *>(project()), SIGNAL(projectParsingDone(bool)), disconnect(static_cast<QbsProject *>(project()), SIGNAL(projectParsingDone(bool)),
this, SLOT(reparsingDone())); this, SLOT(reparsingDone()));
QTC_ASSERT(m_fi, return); finish();
m_fi->reportResult(m_lastWasSuccess);
m_fi = 0; // do not delete, it is not ours
m_job->deleteLater();
m_job = 0;
emit finished();
} }
void QbsBuildStep::handleTaskStarted(const QString &desciption, int max) void QbsBuildStep::handleTaskStarted(const QString &desciption, int max)
@@ -374,6 +375,17 @@ void QbsBuildStep::setMaxJobs(int jobcount)
emit qbsBuildOptionsChanged(); emit qbsBuildOptionsChanged();
} }
void QbsBuildStep::finish()
{
QTC_ASSERT(m_fi, return);
m_fi->reportResult(m_lastWasSuccess);
m_fi = 0; // do not delete, it is not ours
m_job->deleteLater();
m_job = 0;
emit finished();
}
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// QbsBuildStepConfigWidget: // QbsBuildStepConfigWidget:
// -------------------------------------------------------------------- // --------------------------------------------------------------------

View File

@@ -98,6 +98,8 @@ private:
void setCheckTimestamps(bool ts); void setCheckTimestamps(bool ts);
void setMaxJobs(int jobcount); void setMaxJobs(int jobcount);
void finish();
QVariantMap m_qbsConfiguration; QVariantMap m_qbsConfiguration;
qbs::BuildOptions m_qbsBuildOptions; qbs::BuildOptions m_qbsBuildOptions;

View File

@@ -35,14 +35,13 @@
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/messagemanager.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <qbs.h>
#include <QDir> #include <QDir>
#include <QStyle> #include <QStyle>
@@ -125,6 +124,7 @@ static bool addQbsFiles(QbsBaseProjectNode *node, const QStringList &filePaths,
foreach (const QString &path, filePaths) { foreach (const QString &path, filePaths) {
qbs::ErrorInfo err = prj.addFiles(productData, groupData, QStringList() << path); qbs::ErrorInfo err = prj.addFiles(productData, groupData, QStringList() << path);
if (err.hasError()) { if (err.hasError()) {
Core::MessageManager::write(err.toString());
*notAdded += path; *notAdded += path;
} else { } else {
allPaths += path; allPaths += path;
@@ -144,6 +144,7 @@ static bool removeQbsFiles(QbsBaseProjectNode *node, const QStringList &filePath
foreach (const QString &path, filePaths) { foreach (const QString &path, filePaths) {
qbs::ErrorInfo err = prj.removeFiles(productData, groupData, QStringList() << path); qbs::ErrorInfo err = prj.removeFiles(productData, groupData, QStringList() << path);
if (err.hasError()) { if (err.hasError()) {
Core::MessageManager::write(err.toString());
*notRemoved += path; *notRemoved += path;
} else { } else {
allPaths.removeOne(path); allPaths.removeOne(path);
@@ -743,16 +744,8 @@ QbsGroupNode *QbsProductNode::findGroupNode(const QString &name)
// QbsProjectNode: // QbsProjectNode:
// -------------------------------------------------------------------- // --------------------------------------------------------------------
QbsProjectNode::QbsProjectNode(QbsProject *project) :
QbsBaseProjectNode(project->projectFilePath().toString()),
m_project(project)
{
ctor();
}
QbsProjectNode::QbsProjectNode(const QString &path) : QbsProjectNode::QbsProjectNode(const QString &path) :
QbsBaseProjectNode(path), QbsBaseProjectNode(path)
m_project(0)
{ {
ctor(); ctor();
} }
@@ -768,19 +761,6 @@ bool QbsProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdde
return prd ? prd->addFiles(filePaths, notAdded) : false; return prd ? prd->addFiles(filePaths, notAdded) : false;
} }
void QbsProjectNode::setProject(const qbs::Project &prj)
{
m_qbsProject = prj;
}
void QbsProjectNode::update()
{
if (m_qbsProject.isValid())
update(m_qbsProject.projectData());
else
update(qbs::ProjectData());
}
void QbsProjectNode::update(const qbs::ProjectData &prjData) void QbsProjectNode::update(const qbs::ProjectData &prjData)
{ {
QList<ProjectExplorer::ProjectNode *> toAdd; QList<ProjectExplorer::ProjectNode *> toAdd;
@@ -811,7 +791,7 @@ void QbsProjectNode::update(const qbs::ProjectData &prjData)
if (!prjData.name().isEmpty()) if (!prjData.name().isEmpty())
setDisplayName(prjData.name()); setDisplayName(prjData.name());
else else
setDisplayName(m_project->displayName()); setDisplayName(project()->displayName());
removeProjectNodes(toRemove); removeProjectNodes(toRemove);
addProjectNodes(toAdd); addProjectNodes(toAdd);
@@ -819,25 +799,17 @@ void QbsProjectNode::update(const qbs::ProjectData &prjData)
QbsProject *QbsProjectNode::project() const QbsProject *QbsProjectNode::project() const
{ {
if (!m_project && projectNode()) return static_cast<QbsProjectNode *>(parentFolderNode())->project();
return static_cast<QbsProjectNode *>(projectNode())->project();
return m_project;
} }
const qbs::Project QbsProjectNode::qbsProject() const const qbs::Project QbsProjectNode::qbsProject() const
{ {
QbsProjectNode *parent = qobject_cast<QbsProjectNode *>(projectNode()); return project()->qbsProject();
if (!m_qbsProject.isValid() && parent != this)
return parent->qbsProject();
return m_qbsProject;
} }
const qbs::ProjectData QbsProjectNode::qbsProjectData() const const qbs::ProjectData QbsProjectNode::qbsProjectData() const
{ {
if (m_qbsProject.isValid()) return project()->qbsProjectData();
return m_qbsProject.projectData();
else
return qbs::ProjectData();
} }
bool QbsProjectNode::showInSimpleTree() const bool QbsProjectNode::showInSimpleTree() const
@@ -875,5 +847,17 @@ QbsProjectNode *QbsProjectNode::findProjectNode(const QString &name)
return 0; return 0;
} }
QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) :
QbsProjectNode(project->projectFilePath().toString()),
m_project(project)
{
}
void QbsRootProjectNode::update()
{
update(m_project->qbsProjectData());
}
} // namespace Internal } // namespace Internal
} // namespace QbsProjectManager } // namespace QbsProjectManager

View File

@@ -36,8 +36,6 @@
#include <QIcon> #include <QIcon>
namespace qbs { class Project; }
namespace QbsProjectManager { namespace QbsProjectManager {
namespace Internal { namespace Internal {
@@ -165,34 +163,46 @@ class QbsProjectNode : public QbsBaseProjectNode
Q_OBJECT Q_OBJECT
public: public:
explicit QbsProjectNode(QbsProject *project);
explicit QbsProjectNode(const QString &path); explicit QbsProjectNode(const QString &path);
~QbsProjectNode(); ~QbsProjectNode();
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0); bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
void setProject(const qbs::Project &prj); // This does *not* update the node tree! virtual QbsProject *project() const;
void update();
QbsProject *project() const;
const qbs::Project qbsProject() const; const qbs::Project qbsProject() const;
const qbs::ProjectData qbsProjectData() const; const qbs::ProjectData qbsProjectData() const;
bool showInSimpleTree() const; bool showInSimpleTree() const;
protected:
void update(const qbs::ProjectData &prjData);
private: private:
void ctor(); void ctor();
void update(const qbs::ProjectData &prjData);
QbsProductNode *findProductNode(const QString &name); QbsProductNode *findProductNode(const QString &name);
QbsProjectNode *findProjectNode(const QString &name); QbsProjectNode *findProjectNode(const QString &name);
QbsProject *m_project;
qbs::Project m_qbsProject;
static QIcon m_projectIcon; static QIcon m_projectIcon;
}; };
class QbsRootProjectNode : public QbsProjectNode
{
Q_OBJECT
public:
explicit QbsRootProjectNode(QbsProject *project);
using QbsProjectNode::update;
void update();
QbsProject *project() const { return m_project; }
private:
QbsProject * const m_project;
};
} // namespace Internal } // namespace Internal
} // namespace QbsProjectManager } // namespace QbsProjectManager

View File

@@ -101,6 +101,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
m_qbsProjectParser(0), m_qbsProjectParser(0),
m_qbsUpdateFutureInterface(0), m_qbsUpdateFutureInterface(0),
m_forceParsing(false), m_forceParsing(false),
m_parsingScheduled(false),
m_currentBc(0) m_currentBc(0)
{ {
m_parsingDelay.setInterval(1000); // delay parsing by 1s. m_parsingDelay.setInterval(1000); // delay parsing by 1s.
@@ -120,7 +121,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
updateDocuments(QSet<QString>() << fileName); updateDocuments(QSet<QString>() << fileName);
// NOTE: QbsProjectNode does not use this as a parent! // NOTE: QbsProjectNode does not use this as a parent!
m_rootProjectNode = new QbsProjectNode(this); // needs documents to be initialized! m_rootProjectNode = new QbsRootProjectNode(this); // needs documents to be initialized!
} }
QbsProject::~QbsProject() QbsProject::~QbsProject()
@@ -255,16 +256,14 @@ Utils::FileName QbsProject::defaultBuildDirectory(const QString &projectFilePath
qbs::Project QbsProject::qbsProject() const qbs::Project QbsProject::qbsProject() const
{ {
if (!m_rootProjectNode) return m_qbsProject;
return qbs::Project();
return m_rootProjectNode->qbsProject();
} }
const qbs::ProjectData QbsProject::qbsProjectData() const const qbs::ProjectData QbsProject::qbsProjectData() const
{ {
if (!m_rootProjectNode) if (m_qbsProject.isValid())
return m_qbsProject.projectData();
return qbs::ProjectData(); return qbs::ProjectData();
return m_rootProjectNode->qbsProjectData();
} }
bool QbsProject::needsSpecialDeployment() const bool QbsProject::needsSpecialDeployment() const
@@ -276,12 +275,14 @@ void QbsProject::handleQbsParsingDone(bool success)
{ {
QTC_ASSERT(m_qbsProjectParser, return); QTC_ASSERT(m_qbsProjectParser, return);
qbs::Project project;
if (success)
project = m_qbsProjectParser->qbsProject();
generateErrors(m_qbsProjectParser->error()); generateErrors(m_qbsProjectParser->error());
if (success) {
m_qbsProject = m_qbsProjectParser->qbsProject();
QTC_CHECK(m_qbsProject.isValid());
readQbsData();
}
m_qbsProjectParser->deleteLater(); m_qbsProjectParser->deleteLater();
m_qbsProjectParser = 0; m_qbsProjectParser = 0;
@@ -291,11 +292,6 @@ void QbsProject::handleQbsParsingDone(bool success)
m_qbsUpdateFutureInterface = 0; m_qbsUpdateFutureInterface = 0;
} }
if (project.isValid())
m_rootProjectNode->setProject(project);
readQbsData();
emit projectParsingDone(success); emit projectParsingDone(success);
} }
@@ -363,17 +359,14 @@ void QbsProject::readQbsData()
qbs::ProjectData data = m_rootProjectNode->qbsProjectData(); qbs::ProjectData data = m_rootProjectNode->qbsProjectData();
updateCppCodeModel(data); updateCppCodeModel(data);
updateQmlJsCodeModel(data); updateQmlJsCodeModel(data);
updateApplicationTargets(data); updateBuildTargetData();
updateDeploymentInfo(project);
foreach (Target *t, targets())
t->updateDefaultRunConfigurations();
emit fileListChanged(); emit fileListChanged();
} }
void QbsProject::parseCurrentBuildConfiguration(bool force) void QbsProject::parseCurrentBuildConfiguration(bool force)
{ {
m_parsingScheduled = false;
if (!m_forceParsing) if (!m_forceParsing)
m_forceParsing = force; m_forceParsing = force;
@@ -385,6 +378,11 @@ void QbsProject::parseCurrentBuildConfiguration(bool force)
parse(bc->qbsConfiguration(), bc->environment(), bc->buildDirectory().toString()); parse(bc->qbsConfiguration(), bc->environment(), bc->buildDirectory().toString());
} }
void QbsProject::updateAfterBuild()
{
updateBuildTargetData();
}
void QbsProject::registerQbsProjectParser(QbsProjectParser *p) void QbsProject::registerQbsProjectParser(QbsProjectParser *p)
{ {
m_parsingDelay.stop(); m_parsingDelay.stop();
@@ -652,5 +650,13 @@ void QbsProject::updateDeploymentInfo(const qbs::Project &project)
activeTarget()->setDeploymentData(deploymentData); activeTarget()->setDeploymentData(deploymentData);
} }
void QbsProject::updateBuildTargetData()
{
updateApplicationTargets(m_qbsProject.projectData());
updateDeploymentInfo(m_qbsProject);
foreach (Target *t, targets())
t->updateDefaultRunConfigurations();
}
} // namespace Internal } // namespace Internal
} // namespace QbsProjectManager } // namespace QbsProjectManager

View File

@@ -38,6 +38,8 @@
#include <utils/environment.h> #include <utils/environment.h>
#include <qbs.h>
#include <QFuture> #include <QFuture>
#include <QTimer> #include <QTimer>
#include <QVariantMap> #include <QVariantMap>
@@ -62,6 +64,7 @@ namespace QbsProjectManager {
namespace Internal { namespace Internal {
class QbsProjectNode; class QbsProjectNode;
class QbsRootProjectNode;
class QbsProjectParser; class QbsProjectParser;
class QbsBuildConfiguration; class QbsBuildConfiguration;
@@ -91,6 +94,9 @@ public:
bool isParsing() const; bool isParsing() const;
bool hasParseResult() const; bool hasParseResult() const;
void parseCurrentBuildConfiguration(bool force); void parseCurrentBuildConfiguration(bool force);
void scheduleParsing() { m_parsingScheduled = true; }
bool parsingScheduled() const { return m_parsingScheduled; }
void updateAfterBuild();
void registerQbsProjectParser(QbsProjectParser *p); void registerQbsProjectParser(QbsProjectParser *p);
@@ -133,17 +139,20 @@ private:
void updateQmlJsCodeModel(const qbs::ProjectData &prj); void updateQmlJsCodeModel(const qbs::ProjectData &prj);
void updateApplicationTargets(const qbs::ProjectData &projectData); void updateApplicationTargets(const qbs::ProjectData &projectData);
void updateDeploymentInfo(const qbs::Project &project); void updateDeploymentInfo(const qbs::Project &project);
void updateBuildTargetData();
QbsManager *const m_manager; QbsManager *const m_manager;
const QString m_projectName; const QString m_projectName;
const QString m_fileName; const QString m_fileName;
qbs::Project m_qbsProject;
QSet<Core::IDocument *> m_qbsDocuments; QSet<Core::IDocument *> m_qbsDocuments;
QbsProjectNode *m_rootProjectNode; QbsRootProjectNode *m_rootProjectNode;
QbsProjectParser *m_qbsProjectParser; QbsProjectParser *m_qbsProjectParser;
QFutureInterface<bool> *m_qbsUpdateFutureInterface; QFutureInterface<bool> *m_qbsUpdateFutureInterface;
bool m_forceParsing; bool m_forceParsing;
bool m_parsingScheduled;
QFuture<void> m_codeModelFuture; QFuture<void> m_codeModelFuture;

View File

@@ -514,13 +514,14 @@ void QbsProjectManagerPlugin::reparseCurrentProject()
void QbsProjectManagerPlugin::reparseProject(QbsProject *project) void QbsProjectManagerPlugin::reparseProject(QbsProject *project)
{ {
if (!project || BuildManager::isBuilding(project)) { if (!project)
return;
// Qbs does update the build graph during the build. So we cannot // Qbs does update the build graph during the build. So we cannot
// start to parse while a build is running or we will lose information. // start to parse while a build is running or we will lose information.
// Just return since the qbsbuildstep will trigger a reparse after the build. if (BuildManager::isBuilding(project))
return; project->scheduleParsing();
} else
project->parseCurrentBuildConfiguration(true); project->parseCurrentBuildConfiguration(true);
} }

View File

@@ -15,4 +15,19 @@
<comment>Qt Project feature file</comment> <comment>Qt Project feature file</comment>
<glob pattern="*.prf"/> <glob pattern="*.prf"/>
</mime-type> </mime-type>
<mime-type type="application/vnd.qt.qmakeproconfigurationfile">
<sub-class-of type="text/plain"/>
<comment>Qt Project configuration file</comment>
<glob pattern=".qmake.conf"/>
</mime-type>
<mime-type type="application/vnd.qt.qmakeprocachefile">
<sub-class-of type="text/plain"/>
<comment>Qt Project cache file</comment>
<glob pattern=".qmake.cache"/>
</mime-type>
<mime-type type="application/vnd.qt.qmakeprostashfile">
<sub-class-of type="text/plain"/>
<comment>Qt Project stash file</comment>
<glob pattern=".qmake.stash"/>
</mime-type>
</mime-info> </mime-info>

View File

@@ -51,6 +51,9 @@ ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager) :
addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE); addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROCONFIGURATIONFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROCACHEFILE_MIMETYPE);
addMimeType(QmakeProjectManager::Constants::PROSTASHFILE_MIMETYPE);
new TextEditor::TextEditorActionHandler(this, Constants::C_PROFILEEDITOR, new TextEditor::TextEditorActionHandler(this, Constants::C_PROFILEEDITOR,
TextEditor::TextEditorActionHandler::UnCommentSelection TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::JumpToFileUnderCursor); | TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);

View File

@@ -38,7 +38,6 @@ QtcPlugin {
"profilehighlighter.cpp", "profilehighlighter.h", "profilehighlighter.cpp", "profilehighlighter.h",
"profilehoverhandler.cpp", "profilehoverhandler.h", "profilehoverhandler.cpp", "profilehoverhandler.h",
"qmakebuildinfo.h", "qmakebuildinfo.h",
"qmakeparser.cpp", "qmakeparser.h",
"qmakekitconfigwidget.cpp", "qmakekitconfigwidget.h", "qmakekitconfigwidget.cpp", "qmakekitconfigwidget.h",
"qmakekitinformation.cpp", "qmakekitinformation.h", "qmakekitinformation.cpp", "qmakekitinformation.h",
"qmakeparser.cpp", "qmakeparser.h", "qmakeparser.cpp", "qmakeparser.h",

View File

@@ -48,6 +48,9 @@ const char PROFILE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors"
const char PROFILE_MIMETYPE[] = "application/vnd.qt.qmakeprofile"; const char PROFILE_MIMETYPE[] = "application/vnd.qt.qmakeprofile";
const char PROINCLUDEFILE_MIMETYPE [] = "application/vnd.qt.qmakeproincludefile"; const char PROINCLUDEFILE_MIMETYPE [] = "application/vnd.qt.qmakeproincludefile";
const char PROFEATUREFILE_MIMETYPE [] = "application/vnd.qt.qmakeprofeaturefile"; const char PROFEATUREFILE_MIMETYPE [] = "application/vnd.qt.qmakeprofeaturefile";
const char PROCONFIGURATIONFILE_MIMETYPE [] = "application/vnd.qt.qmakeproconfigurationfile";
const char PROCACHEFILE_MIMETYPE [] = "application/vnd.qt.qmakeprocachefile";
const char PROSTASHFILE_MIMETYPE [] = "application/vnd.qt.qmakeprostashfile";
// Actions // Actions
const char RUNQMAKE[] = "Qt4Builder.RunQMake"; const char RUNQMAKE[] = "Qt4Builder.RunQMake";

View File

@@ -223,9 +223,6 @@ void ItemLibraryModel::updateVisibility()
foreach (ItemLibrarySection *itemLibrarySection, m_sections) { foreach (ItemLibrarySection *itemLibrarySection, m_sections) {
QString sectionSearchText = m_searchText; QString sectionSearchText = m_searchText;
if (itemLibrarySection->sectionName().toLower().contains(m_searchText))
sectionSearchText.clear();
bool sectionChanged = false; bool sectionChanged = false;
bool sectionVisibility = itemLibrarySection->updateSectionVisibility(sectionSearchText, bool sectionVisibility = itemLibrarySection->updateSectionVisibility(sectionSearchText,
&sectionChanged); &sectionChanged);

View File

@@ -58,7 +58,11 @@ class TreeViewStyle : public QProxyStyle
public: public:
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
{ {
static QRect mouseOverStateSavedFrameRectangle;
if (element == QStyle::PE_PanelItemViewRow) { if (element == QStyle::PE_PanelItemViewRow) {
if (option->state & QStyle::State_MouseOver)
mouseOverStateSavedFrameRectangle = option->rect;
if (option->state & QStyle::State_Selected) { if (option->state & QStyle::State_Selected) {
NavigatorTreeView::drawSelectionBackground(painter, *option); NavigatorTreeView::drawSelectionBackground(painter, *option);
} else { } else {
@@ -71,22 +75,26 @@ public:
// painter->restore(); // painter->restore();
} }
} else if (element == PE_IndicatorItemViewItemDrop) { } else if (element == PE_IndicatorItemViewItemDrop) {
// between elements and on elements we have a width
if (option->rect.width() > 0) {
m_currentTextColor = option->palette.text().color();
QRect frameRectangle = adjustedRectangleToWidgetWidth(option->rect, widget);
painter->save(); painter->save();
QRect rect = option->rect;
rect.setLeft(0);
rect.setWidth(widget->rect().width());
QColor highlight = option->palette.text().color();
highlight.setAlphaF(0.7);
painter->setPen(QPen(highlight.lighter(), 1));
if (option->rect.height() == 0) { if (option->rect.height() == 0) {
if (option->rect.top()>0) bool isNotRootItem = option->rect.top() > 10 && mouseOverStateSavedFrameRectangle.top() > 10;
painter->drawLine(rect.topLeft(), rect.topRight()); if (isNotRootItem) {
drawIndicatorLine(frameRectangle.topLeft(), frameRectangle.topRight(), painter);
// there is only a line in the styleoption object at this moment
// so we need to use the last saved rect from the mouse over state
frameRectangle = adjustedRectangleToWidgetWidth(mouseOverStateSavedFrameRectangle, widget);
drawBackgroundFrame(frameRectangle, painter);
}
} else { } else {
highlight.setAlphaF(0.2); drawHighlightFrame(frameRectangle, painter);
painter->setBrush(highlight);
painter->drawRect(rect.adjusted(0, 0, -1, -1));
} }
painter->restore(); painter->restore();
}
} else if (element == PE_FrameFocusRect) { } else if (element == PE_FrameFocusRect) {
// don't draw // don't draw
} else { } else {
@@ -100,6 +108,56 @@ public:
else else
return QProxyStyle::styleHint(hint, option, widget, returnData); return QProxyStyle::styleHint(hint, option, widget, returnData);
} }
private: // functions
QColor highlightBrushColor() const
{
QColor highlightBrushColor = m_currentTextColor;
highlightBrushColor.setAlphaF(0.7);
return highlightBrushColor;
}
QColor highlightLineColor() const
{
return highlightBrushColor().lighter();
}
QColor backgroundBrushColor() const
{
QColor backgroundBrushColor = highlightBrushColor();
backgroundBrushColor.setAlphaF(0.2);
return backgroundBrushColor;
}
QColor backgroundLineColor() const
{
return backgroundBrushColor().lighter();
}
void drawHighlightFrame(const QRect &frameRectangle, QPainter *painter) const
{
painter->setPen(QPen(highlightLineColor(), 2));
painter->setBrush(highlightBrushColor());
painter->drawRect(frameRectangle);
}
void drawBackgroundFrame(const QRect &frameRectangle, QPainter *painter) const
{
painter->setPen(QPen(backgroundLineColor(), 2));
painter->setBrush(backgroundBrushColor());
painter->drawRect(frameRectangle);
}
void drawIndicatorLine(const QPoint &leftPoint, const QPoint &rightPoint, QPainter *painter) const
{
painter->setPen(QPen(highlightLineColor(), 3));
painter->drawLine(leftPoint, rightPoint);
}
QRect adjustedRectangleToWidgetWidth(const QRect &originalRectangle, const QWidget *widget) const
{
QRect adjustesRectangle = originalRectangle;
adjustesRectangle.setLeft(0);
adjustesRectangle.setWidth(widget->rect().width());
return adjustesRectangle.adjusted(0, 0, -1, -1);
}
private: // variables
mutable QColor m_currentTextColor;
}; };
} }

View File

@@ -52,9 +52,6 @@ public:
virtual int indentDepth() const; virtual int indentDepth() const;
virtual bool renameId(const QString &oldId, const QString &newId); virtual bool renameId(const QString &oldId, const QString &newId);
virtual QmlJS::Snapshot getSnapshot() const;
virtual QStringList importPaths() const;
}; };
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -58,7 +58,6 @@ public:
virtual void deactivateChangeSignals(); virtual void deactivateChangeSignals();
virtual void reactivateChangeSignals(); virtual void reactivateChangeSignals();
virtual QmlJS::Snapshot getSnapshot() const;
virtual QStringList importPaths() const; virtual QStringList importPaths() const;
virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; } virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; }

View File

@@ -101,6 +101,7 @@ public:
void setUsedImports(const QList<Import> &usedImports); void setUsedImports(const QList<Import> &usedImports);
bool hasImport(const Import &import, bool ignoreAlias = true, bool allowHigherVersion = false); bool hasImport(const Import &import, bool ignoreAlias = true, bool allowHigherVersion = false);
QString pathForImport(const Import &import); QString pathForImport(const Import &import);
QStringList importPaths() const;
RewriterView *rewriterView() const; RewriterView *rewriterView() const;
void setRewriterView(RewriterView *rewriterView); void setRewriterView(RewriterView *rewriterView);

View File

@@ -78,6 +78,7 @@ public:
QPixmap blurredRenderPixmap() const; QPixmap blurredRenderPixmap() const;
QVariant property(const PropertyName &name) const; QVariant property(const PropertyName &name) const;
bool hasProperty(const PropertyName &name) const;
bool hasBindingForProperty(const PropertyName &name) const; bool hasBindingForProperty(const PropertyName &name) const;
QPair<PropertyName, qint32> anchor(const PropertyName &name) const; QPair<PropertyName, qint32> anchor(const PropertyName &name) const;
bool hasAnchor(const PropertyName &name) const; bool hasAnchor(const PropertyName &name) const;

View File

@@ -73,8 +73,7 @@ public:
virtual void deactivateChangeSignals(); virtual void deactivateChangeSignals();
virtual void reactivateChangeSignals(); virtual void reactivateChangeSignals();
virtual QmlJS::Snapshot getSnapshot() const = 0; virtual QStringList importPaths() const;
virtual QStringList importPaths() const = 0;
virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; } virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; }
@@ -108,10 +107,6 @@ public:
virtual int indentDepth() const virtual int indentDepth() const
{ return 0; } { return 0; }
virtual QmlJS::Snapshot getSnapshot() const;
virtual QStringList importPaths() const;
}; };
} }

View File

@@ -73,6 +73,7 @@ public:
NodeProperty nodeProperty(const PropertyName &name) const; NodeProperty nodeProperty(const PropertyName &name) const;
NodeListProperty nodeListProperty(const PropertyName &name) const; NodeListProperty nodeListProperty(const PropertyName &name) const;
bool instanceHasValue(const PropertyName &name) const;
QVariant instanceValue(const PropertyName &name) const; QVariant instanceValue(const PropertyName &name) const;
TypeName instanceType(const PropertyName &name) const; TypeName instanceType(const PropertyName &name) const;

View File

@@ -69,6 +69,7 @@ private: // functions
void unregisterQmlFile(const QFileInfo &fileInfo, const QString &qualifier); void unregisterQmlFile(const QFileInfo &fileInfo, const QString &qualifier);
void registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier, bool addToLibrary); void registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier, bool addToLibrary);
Model *model() const; Model *model() const;
QStringList importPaths() const;
private: // variables private: // variables
QFileSystemWatcher m_watcher; QFileSystemWatcher m_watcher;

View File

@@ -83,7 +83,7 @@ public:
virtual void deactivateChangeSignals() = 0; virtual void deactivateChangeSignals() = 0;
virtual void reactivateChangeSignals() = 0; virtual void reactivateChangeSignals() = 0;
virtual QmlJS::Snapshot getSnapshot() const = 0; static QmlJS::Snapshot qmljsSnapshot();
virtual QStringList importPaths() const = 0; virtual QStringList importPaths() const = 0;
virtual bool renameId(const QString &oldId, const QString &newId) = 0; virtual bool renameId(const QString &oldId, const QString &newId) = 0;

View File

@@ -315,6 +315,14 @@ QVariant NodeInstance::property(const PropertyName &name) const
return QVariant(); return QVariant();
} }
bool NodeInstance::hasProperty(const PropertyName &name) const
{
if (isValid())
return d->propertyValues.contains(name);
return false;
}
bool NodeInstance::hasBindingForProperty(const PropertyName &name) const bool NodeInstance::hasBindingForProperty(const PropertyName &name) const
{ {
if (isValid()) if (isValid())

View File

@@ -100,8 +100,8 @@ static bool hasQtQuick1(NodeInstanceView *nodeInstanceView)
static void showCannotConnectToPuppetWarningAndSwitchToEditMode() static void showCannotConnectToPuppetWarningAndSwitchToEditMode()
{ {
QmlDesignerWarning::show(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to Qml Emulation Layer (Qml Puppet)"), QmlDesignerWarning::show(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to QML Emulation Layer (QML Puppet)"),
QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the emulation layer process is maybe hanging. " QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) process is maybe hanging. "
"Switching to an other kit maybe helps.")); "Switching to an other kit maybe helps."));
QmlDesignerPlugin::instance()->switchToTextModeDeferred(); QmlDesignerPlugin::instance()->switchToTextModeDeferred();
@@ -200,8 +200,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
} }
} else { } else {
QmlDesignerWarning::show(tr("Cannot Start QML Puppet Executable"), QmlDesignerWarning::show(tr("Cannot Start QML Emulation Layer (QML Puppet)"),
tr("The executable of the QML Puppet process cannot be started or is hanging.")); tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or is hanging."));
QmlDesignerPlugin::instance()->switchToTextModeDeferred(); QmlDesignerPlugin::instance()->switchToTextModeDeferred();
} }
@@ -384,8 +384,8 @@ void NodeInstanceServerProxy::processFinished(int exitCode, QProcess::ExitStatus
if (m_captureFileForTest.isOpen()) { if (m_captureFileForTest.isOpen()) {
m_captureFileForTest.close(); m_captureFileForTest.close();
m_captureFileForTest.remove(); m_captureFileForTest.remove();
QMessageBox::warning(Core::ICore::dialogParent(), tr("QML Puppet Crashed"), QMessageBox::warning(Core::ICore::dialogParent(), tr("QML Emulation Layer (QML Puppet) Crashed"),
tr("You are recording a puppet stream and the puppet crashed. " tr("You are recording a puppet stream and the emulations layer crashed. "
"It is recommended to reopen the Qt Quick Designer and start again.")); "It is recommended to reopen the Qt Quick Designer and start again."));
} }

View File

@@ -184,16 +184,16 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
} }
if (!buildSucceeded) if (!buildSucceeded)
QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Emulation layer building was unsuccessful"), QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "QML Emulation Layer (QML Puppet) Building was Unsuccessful"),
QCoreApplication::translate("PuppetCreator", QCoreApplication::translate("PuppetCreator",
"The emulation layer (Qml Puppet) cannot be built. " "The QML emulation layer (QML Puppet) cannot be built. "
"The fallback emulation layer, which does not support all features, will be used." "The fallback emulation layer, which does not support all features, will be used."
)); ));
} }
} else { } else {
QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Qt Version is not supported"), QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Qt Version is not supported"),
QCoreApplication::translate("PuppetCreator", QCoreApplication::translate("PuppetCreator",
"The emulation layer (Qml Puppet) cannot be built because the Qt version is too old " "The QML emulation layer (QML Puppet) cannot be built because the Qt version is too old "
"or it cannot run natively on your computer. " "or it cannot run natively on your computer. "
"The fallback emulation layer, which does not support all features, will be used." "The fallback emulation layer, which does not support all features, will be used."
)); ));
@@ -206,7 +206,7 @@ static void warnAboutInvalidKit()
{ {
QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Kit is invalid"), QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Kit is invalid"),
QCoreApplication::translate("PuppetCreator", QCoreApplication::translate("PuppetCreator",
"The emulation layer (Qml Puppet) cannot be built because the kit is not configured correctly. " "The QML emulation layer (QML Puppet) cannot be built because the kit is not configured correctly. "
"For example the compiler can be misconfigured. " "For example the compiler can be misconfigured. "
"Fix the kit configuration and restart Qt Creator. " "Fix the kit configuration and restart Qt Creator. "
"Otherwise, the fallback emulation layer, which does not support all features, will be used." "Otherwise, the fallback emulation layer, which does not support all features, will be used."

View File

@@ -959,7 +959,7 @@ QString NodeMetaInfoPrivate::importDirectoryPath() const
return importInfo.path(); return importInfo.path();
} else if (importInfo.type() == ImportType::Library) { } else if (importInfo.type() == ImportType::Library) {
if (modelManager) { if (modelManager) {
foreach (const QString &importPath, modelManager->importPaths()) { foreach (const QString &importPath, model()->importPaths()) {
const QString targetPath = QDir(importPath).filePath(importInfo.path()); const QString targetPath = QDir(importPath).filePath(importInfo.path());
if (QDir(targetPath).exists()) if (QDir(targetPath).exists())
return targetPath; return targetPath;

View File

@@ -61,20 +61,6 @@ static bool operator<(const QFileInfo &file1, const QFileInfo &file2)
QT_END_NAMESPACE QT_END_NAMESPACE
static inline QStringList importPaths() {
QStringList paths;
// env import paths
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
if (!envImportPath.isEmpty()) {
paths = QString::fromUtf8(envImportPath)
.split(Utils::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts);
}
paths.append(QmlJS::ModelManagerInterface::instance()->importPaths());
return paths;
}
static inline bool checkIfDerivedFromItem(const QString &fileName) static inline bool checkIfDerivedFromItem(const QString &fileName)
{ {
@@ -413,6 +399,14 @@ Model *SubComponentManager::model() const
return m_model.data(); return m_model.data();
} }
QStringList SubComponentManager::importPaths() const
{
if (model())
return model()->importPaths();
return QStringList();
}
/*! /*!
\class SubComponentManager \class SubComponentManager

Some files were not shown because too many files have changed in this diff Show More