forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.2'
Change-Id: Ifa095e8503bc9bf47389d34251301cae67a944f8
This commit is contained in:
3
README
3
README
@@ -20,9 +20,10 @@ Prerequisites:
|
||||
* Qt 5.3.1 or later (with restrictions also Qt 4.8.x)
|
||||
* On Windows:
|
||||
- ActiveState Active Perl
|
||||
- MinGW or Visual Studio 2010 or later
|
||||
- MinGW with g++ 4.5 or Visual Studio 2010 or later
|
||||
- jom
|
||||
* 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.
|
||||
|
||||
|
||||
17
dist/changes-3.2.0
vendored
17
dist/changes-3.2.0
vendored
@@ -80,6 +80,7 @@ Qbs Projects
|
||||
Generic Projects
|
||||
|
||||
Debugging
|
||||
* Fixed tooltip expansion behavior (QTCREATORBUG-11404)
|
||||
* Changed default of "Load system GDB pretty printer" option back to "off"
|
||||
* Added option to disable automatic centering on currently debugged
|
||||
line in editor
|
||||
@@ -135,13 +136,27 @@ C++ Support
|
||||
* Fixed indentation of concatenated strings
|
||||
* Fixed pointer typedef resolving (QTCREATORBUG-10021)
|
||||
* Fixed scroll wheel behavior in editor's symbols dropdown
|
||||
* Fixed encoding issues (QTCREATORBUG-7356)
|
||||
* Fixed that some wizards were ignoring configured file extensions
|
||||
(QTCREATORBUG-12309)
|
||||
* Fixed parsing of trailing type-specifier
|
||||
* Fixed parsing of expressions like vector<int>{1}
|
||||
* Fixed generating getters and setters for variables with
|
||||
'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
|
||||
* Fixed handling of properties that start with underscore (QTCREATORBUG-12214)
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
\image qtcreator-togglebookmark.png
|
||||
|
||||
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.
|
||||
|
||||
To go to previous bookmark in the current session, press \key{Ctrl+,}.
|
||||
|
||||
@@ -28,44 +28,47 @@ OTHER_FILES += dist/copyright_template.txt \
|
||||
$$files(scripts/*.sh) \
|
||||
$$files(scripts/*.pl)
|
||||
|
||||
qmake_cache = $$targetPath($$IDE_BUILD_TREE/.qmake.cache)
|
||||
!equals(QMAKE_HOST.os, Windows) {
|
||||
maybe_quote = "\""
|
||||
maybe_backslash = "\\"
|
||||
}
|
||||
system("echo $${maybe_quote}$${LITERAL_HASH} config for qmake$${maybe_quote} > $$qmake_cache")
|
||||
# Make sure the qbs dll ends up alongside the Creator executable.
|
||||
exists(src/shared/qbs/qbs.pro) {
|
||||
system("echo QBS_DLLDESTDIR = $${IDE_BUILD_TREE}/bin >> $$qmake_cache")
|
||||
system("echo QBS_DESTDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache")
|
||||
system("echo QBSLIBDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache")
|
||||
system("echo QBS_INSTALL_PREFIX = $${QTC_PREFIX} >> $$qmake_cache")
|
||||
system("echo QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache")
|
||||
minQtVersion(5, 0, 0):exists(src/shared/qbs/qbs.pro) {
|
||||
# Make sure the qbs dll ends up alongside the Creator executable.
|
||||
QBS_DLLDESTDIR = $${IDE_BUILD_TREE}/bin
|
||||
cache(QBS_DLLDESTDIR)
|
||||
QBS_DESTDIR = $${IDE_LIBRARY_PATH}
|
||||
cache(QBS_DESTDIR)
|
||||
QBSLIBDIR = $${IDE_LIBRARY_PATH}
|
||||
cache(QBSLIBDIR)
|
||||
QBS_INSTALL_PREFIX = $${QTC_PREFIX}
|
||||
cache(QBS_INSTALL_PREFIX)
|
||||
QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator
|
||||
cache(QBS_LIB_INSTALL_DIR)
|
||||
QBS_RESOURCES_BUILD_DIR = $${IDE_DATA_PATH}/qbs
|
||||
system("echo QBS_RESOURCES_BUILD_DIR = $${maybe_backslash}\"$${QBS_RESOURCES_BUILD_DIR}$${maybe_backslash}\" >> $$qmake_cache")
|
||||
system("echo QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs >> $$qmake_cache")
|
||||
cache(QBS_RESOURCES_BUILD_DIR)
|
||||
QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs
|
||||
cache(QBS_RESOURCES_INSTALL_DIR)
|
||||
macx {
|
||||
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 {
|
||||
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")
|
||||
system("echo QBS_PLUGINS_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache")
|
||||
system("echo QBS_LIBRARY_DIRNAME = $${IDE_LIBRARY_BASENAME} >> $$qmake_cache")
|
||||
cache(QBS_PLUGINS_BUILD_DIR)
|
||||
cache(QBS_APPS_RPATH_DIR)
|
||||
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}
|
||||
system("echo QBS_APPS_DESTDIR = $${maybe_backslash}\"$${QBS_APPS_DESTDIR}$${maybe_backslash}\">> $$qmake_cache")
|
||||
system("echo QBS_APPS_INSTALL_DIR = $${QTC_PREFIX}/bin >> $$qmake_cache")
|
||||
cache(QBS_APPS_DESTDIR)
|
||||
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$$)
|
||||
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)
|
||||
system("echo QBS_RELATIVE_SEARCH_PATH = $${QBS_RELATIVE_SEARCH_PATH}" >> $$qmake_cache)
|
||||
system("echo CONFIG += qbs_no_dev_install >> $$qmake_cache")
|
||||
cache(QBS_RELATIVE_SEARCH_PATH)
|
||||
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
|
||||
else: ARCHITECTURE = $$QT_ARCH
|
||||
|
||||
|
||||
@@ -2218,6 +2218,26 @@ def qdump__QXmlAttributes(d, value):
|
||||
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
|
||||
|
||||
@@ -94,6 +94,8 @@ static bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName)
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
|
||||
QHash<EnumerationName, int> ObjectNodeInstance::m_enumationValueHash;
|
||||
|
||||
ObjectNodeInstance::ObjectNodeInstance(QObject *object)
|
||||
: m_object(object),
|
||||
m_metaObject(0),
|
||||
@@ -477,7 +479,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
|
||||
QVariant fixedValue = fixResourcePaths(value);
|
||||
|
||||
if (value.canConvert<Enumeration>())
|
||||
fixedValue = QVariant::fromValue(value.value<Enumeration>().nameToString());
|
||||
fixedValue = enumationValue(value.value<Enumeration>());
|
||||
|
||||
QVariant oldValue = property.read();
|
||||
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
|
||||
{
|
||||
QObject *parentHolder = parent();
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include "enumeration.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsItem;
|
||||
class QQmlContext;
|
||||
@@ -200,6 +202,7 @@ protected:
|
||||
QVariant convertSpecialCharacter(const QVariant& value) const;
|
||||
static QObject *parentObject(QObject *object);
|
||||
static void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
|
||||
static QVariant enumationValue(const Enumeration &enumeration);
|
||||
|
||||
private:
|
||||
QHash<PropertyName, QVariant> m_resetValueHash;
|
||||
@@ -217,6 +220,7 @@ private:
|
||||
qint32 m_instanceId;
|
||||
bool m_deleteHeldInstance;
|
||||
bool m_isInLayoutable;
|
||||
static QHash<EnumerationName, int> m_enumationValueHash;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -76,7 +76,7 @@ QString Enumeration::toString() const
|
||||
return QString::fromUtf8(m_enumerationName);
|
||||
}
|
||||
|
||||
QString Enumeration::nameToString()
|
||||
QString Enumeration::nameToString() const
|
||||
{
|
||||
return QString::fromUtf8(name());
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
EnumerationName name() const;
|
||||
EnumerationName toEnumerationName() const;
|
||||
QString toString() const;
|
||||
QString nameToString();
|
||||
QString nameToString() const;
|
||||
|
||||
private:
|
||||
EnumerationName m_enumerationName;
|
||||
|
||||
12
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
12
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -1095,20 +1095,24 @@ Function *Bind::lambdaDeclarator(LambdaDeclaratorAST *ast)
|
||||
Function *fun = control()->newFunction(0, 0);
|
||||
fun->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin());
|
||||
fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd());
|
||||
|
||||
FullySpecifiedType type;
|
||||
if (ast->trailing_return_type)
|
||||
_type = this->trailingReturnType(ast->trailing_return_type, _type);
|
||||
fun->setReturnType(_type);
|
||||
type = this->trailingReturnType(ast->trailing_return_type, type);
|
||||
ast->symbol = fun;
|
||||
|
||||
// unsigned lparen_token = ast->lparen_token;
|
||||
FullySpecifiedType type;
|
||||
this->parameterDeclarationClause(ast->parameter_declaration_clause, ast->lparen_token, fun);
|
||||
// unsigned rparen_token = ast->rparen_token;
|
||||
for (SpecifierListAST *it = ast->attributes; it; it = it->next) {
|
||||
type = this->specifier(it->value, type);
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "plugindetailsview.h"
|
||||
#include "ui_plugindetailsview.h"
|
||||
|
||||
#include "pluginmanager.h"
|
||||
#include "pluginspec.h"
|
||||
|
||||
#include <QDir>
|
||||
@@ -86,7 +88,10 @@ void PluginDetailsView::update(PluginSpec *spec)
|
||||
m_ui->copyright->setText(spec->copyright());
|
||||
m_ui->license->setText(spec->license());
|
||||
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;
|
||||
foreach (const PluginDependency &dep, spec->dependencies()) {
|
||||
QString depString = dep.name;
|
||||
|
||||
@@ -1377,11 +1377,20 @@ void PluginManagerPrivate::profilingSummary() const
|
||||
static inline QString getPlatformName()
|
||||
{
|
||||
#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);
|
||||
return result;
|
||||
} else {
|
||||
return QLatin1String("Mac OS");
|
||||
}
|
||||
#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
|
||||
if (osReleaseFile.open(QIODevice::ReadOnly)) {
|
||||
QString name;
|
||||
@@ -1398,22 +1407,10 @@ static inline QString getPlatformName()
|
||||
if (!name.isEmpty()) {
|
||||
if (!version.isEmpty())
|
||||
name += QLatin1Char(' ') + version;
|
||||
return name;
|
||||
return base + QLatin1String(" (") + name + QLatin1Char(')');
|
||||
}
|
||||
}
|
||||
QFile issueFile(QLatin1String("/etc/issue")); // Older Linuxes
|
||||
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
|
||||
return base;
|
||||
#elif defined(Q_OS_WIN)
|
||||
QString result = QLatin1String("Windows");
|
||||
switch (QSysInfo::WindowsVersion) {
|
||||
|
||||
@@ -25,23 +25,6 @@ for(l, SUBDIRS) {
|
||||
SUBDIRS += \
|
||||
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
|
||||
|
||||
# Windows: Compile Qt Creator CDB extension if Debugging tools can be detected.
|
||||
|
||||
@@ -36,7 +36,12 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDropEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QMimeData>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
@@ -679,6 +684,72 @@ FileName &FileName::appendString(QChar str)
|
||||
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
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QXmlStreamWriter> // Mac.
|
||||
#include <QMetaType>
|
||||
#include <QStringList>
|
||||
|
||||
namespace Utils {class FileName; }
|
||||
|
||||
@@ -192,6 +193,26 @@ private:
|
||||
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
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
81
src/libs/utils/proxycredentialsdialog.cpp
Normal file
81
src/libs/utils/proxycredentialsdialog.cpp
Normal 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);
|
||||
}
|
||||
|
||||
@@ -27,22 +27,37 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MACFULLSCREEN_H
|
||||
#define MACFULLSCREEN_H
|
||||
#ifndef PROXYCREDENTIALSDIALOG_H
|
||||
#define PROXYCREDENTIALSDIALOG_H
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "utils_global.h"
|
||||
#include <QDialog>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
namespace MacFullScreen {
|
||||
QT_FORWARD_DECLARE_CLASS(QNetworkProxy)
|
||||
|
||||
bool supportsFullScreen();
|
||||
// adds fullscreen button to window for lion
|
||||
void addFullScreen(Core::Internal::MainWindow *window);
|
||||
void toggleFullScreen(Core::Internal::MainWindow *window);
|
||||
namespace Utils {
|
||||
|
||||
} // MacFullScreen
|
||||
} // Internal
|
||||
} // Core
|
||||
namespace Ui {
|
||||
class ProxyCredentialsDialog;
|
||||
}
|
||||
|
||||
#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
|
||||
106
src/libs/utils/proxycredentialsdialog.ui
Normal file
106
src/libs/utils/proxycredentialsdialog.ui
Normal 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>
|
||||
@@ -89,7 +89,8 @@ SOURCES += $$PWD/environment.cpp \
|
||||
$$PWD/completinglineedit.cpp \
|
||||
$$PWD/winutils.cpp \
|
||||
$$PWD/itemviews.cpp \
|
||||
$$PWD/treeviewcombobox.cpp
|
||||
$$PWD/treeviewcombobox.cpp \
|
||||
$$PWD/proxycredentialsdialog.cpp
|
||||
|
||||
win32:SOURCES += $$PWD/consoleprocess_win.cpp
|
||||
else:SOURCES += $$PWD/consoleprocess_unix.cpp
|
||||
@@ -185,10 +186,12 @@ HEADERS += \
|
||||
$$PWD/treeviewcombobox.h \
|
||||
$$PWD/scopedswap.h \
|
||||
$$PWD/algorithm.h \
|
||||
$$PWD/QtConcurrentTools
|
||||
$$PWD/QtConcurrentTools \
|
||||
$$PWD/proxycredentialsdialog.h
|
||||
|
||||
FORMS += $$PWD/filewizardpage.ui \
|
||||
$$PWD/projectintropage.ui \
|
||||
$$PWD/newclasswidget.ui
|
||||
$$PWD/newclasswidget.ui \
|
||||
$$PWD/proxycredentialsdialog.ui
|
||||
|
||||
RESOURCES += $$PWD/utils.qrc
|
||||
|
||||
@@ -136,6 +136,9 @@ QtcLibrary {
|
||||
"projectnamevalidatinglineedit.h",
|
||||
"proxyaction.cpp",
|
||||
"proxyaction.h",
|
||||
"proxycredentialsdialog.cpp",
|
||||
"proxycredentialsdialog.h",
|
||||
"proxycredentialsdialog.ui",
|
||||
"qtcassert.cpp",
|
||||
"qtcassert.h",
|
||||
"qtcolorbutton.cpp",
|
||||
|
||||
@@ -52,8 +52,7 @@ public:
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
||||
QString displayNameForId(Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent,
|
||||
const Core::Id id) const;
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
||||
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
|
||||
|
||||
@@ -44,8 +44,7 @@ public:
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
||||
QString displayNameForId(Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent,
|
||||
const Core::Id id) const;
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
||||
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
|
||||
|
||||
@@ -44,8 +44,7 @@ public:
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
||||
QString displayNameForId(Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent,
|
||||
const Core::Id id) const;
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
||||
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent,
|
||||
|
||||
@@ -44,8 +44,7 @@ public:
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
||||
QString displayNameForId(Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent,
|
||||
const Core::Id id) const;
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
|
||||
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent,
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
@@ -148,6 +149,7 @@ void ArtisticStyle::formatFile()
|
||||
if (m_settings->version() > ArtisticStyleSettings::Version_2_03) {
|
||||
command.setProcessing(Command::PipeProcessing);
|
||||
command.setPipeAddsNewline(true);
|
||||
command.setReturnsCRLF(Utils::HostOsInfo::isWindowsHost());
|
||||
} else {
|
||||
command.addOption(QLatin1String("%file"));
|
||||
}
|
||||
|
||||
@@ -198,9 +198,14 @@ QString BeautifierPlugin::format(const QString &text, const Command &command,
|
||||
return QString();
|
||||
}
|
||||
|
||||
if (command.pipeAddsNewline()) {
|
||||
const bool addsNewline = command.pipeAddsNewline();
|
||||
const bool returnsCRLF = command.returnsCRLF();
|
||||
if (addsNewline || returnsCRLF) {
|
||||
QString formatted = QString::fromUtf8(process.readAllStandardOutput());
|
||||
if (addsNewline)
|
||||
formatted.remove(QRegExp(QLatin1String("(\\r\\n|\\n)$")));
|
||||
if (returnsCRLF)
|
||||
formatted.replace(QLatin1String("\r\n"), QLatin1String("\n"));
|
||||
return formatted;
|
||||
}
|
||||
return QString::fromUtf8(process.readAllStandardOutput());
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <QFutureInterface>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPointer>
|
||||
#include <QSignalMapper>
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Internal {
|
||||
Command::Command()
|
||||
: m_processing(FileProcessing)
|
||||
, m_pipeAddsNewline(false)
|
||||
, m_returnsCRLF(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,5 +79,16 @@ void Command::setPipeAddsNewline(bool pipeAddsNewline)
|
||||
m_pipeAddsNewline = pipeAddsNewline;
|
||||
}
|
||||
|
||||
bool Command::returnsCRLF() const
|
||||
{
|
||||
return m_returnsCRLF;
|
||||
}
|
||||
|
||||
void Command::setReturnsCRLF(bool returnsCRLF)
|
||||
{
|
||||
m_returnsCRLF = returnsCRLF;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Beautifier
|
||||
|
||||
@@ -58,11 +58,15 @@ public:
|
||||
bool pipeAddsNewline() const;
|
||||
void setPipeAddsNewline(bool pipeAddsNewline);
|
||||
|
||||
bool returnsCRLF() const;
|
||||
void setReturnsCRLF(bool returnsCRLF);
|
||||
|
||||
private:
|
||||
QString m_executable;
|
||||
QStringList m_options;
|
||||
Processing m_processing;
|
||||
bool m_pipeAddsNewline;
|
||||
bool m_returnsCRLF;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
if (m_lineText != block.text()) {
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
Bookmark(const QString &fileName, int lineNumber, BookmarkManager *manager);
|
||||
|
||||
void updateLineNumber(int lineNumber);
|
||||
void move(int line);
|
||||
void updateBlock(const QTextBlock &block);
|
||||
void updateFileName(const QString &fileName);
|
||||
void setNote(const QString ¬e);
|
||||
|
||||
@@ -45,15 +45,18 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QAction>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QDebug>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QInputDialog>
|
||||
#include <QSpinBox>
|
||||
|
||||
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
|
||||
|
||||
@@ -243,7 +246,7 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
|
||||
QMenu menu;
|
||||
QAction *moveUp = menu.addAction(tr("Move Up"));
|
||||
QAction *moveDown = menu.addAction(tr("Move Down"));
|
||||
QAction *editNote = menu.addAction(tr("Edit Note"));
|
||||
QAction *edit = menu.addAction(tr("&Edit"));
|
||||
menu.addSeparator();
|
||||
QAction *remove = menu.addAction(tr("&Remove"));
|
||||
menu.addSeparator();
|
||||
@@ -254,7 +257,7 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
|
||||
moveUp->setEnabled(false);
|
||||
moveDown->setEnabled(false);
|
||||
remove->setEnabled(false);
|
||||
editNote->setEnabled(false);
|
||||
edit->setEnabled(false);
|
||||
}
|
||||
|
||||
if (model()->rowCount() == 0)
|
||||
@@ -268,8 +271,8 @@ void BookmarkView::contextMenuEvent(QContextMenuEvent *event)
|
||||
this, SLOT(removeFromContextMenu()));
|
||||
connect(removeAll, SIGNAL(triggered()),
|
||||
this, SLOT(removeAll()));
|
||||
connect(editNote, SIGNAL(triggered()),
|
||||
m_manager, SLOT(editNote()));
|
||||
connect(edit, SIGNAL(triggered()),
|
||||
m_manager, SLOT(edit()));
|
||||
|
||||
menu.exec(mapToGlobal(event->pos()));
|
||||
}
|
||||
@@ -673,27 +676,39 @@ void BookmarkManager::moveDown()
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
void BookmarkManager::editNote(const QString &fileName, int lineNumber)
|
||||
void BookmarkManager::edit(const QString &fileName, int lineNumber)
|
||||
{
|
||||
Bookmark *b = findBookmark(fileName, lineNumber);
|
||||
QModelIndex current = selectionModel()->currentIndex();
|
||||
selectionModel()->setCurrentIndex(current.sibling(m_bookmarksList.indexOf(b), 0),
|
||||
QItemSelectionModel::Select | QItemSelectionModel::Clear);
|
||||
|
||||
editNote();
|
||||
edit();
|
||||
}
|
||||
|
||||
void BookmarkManager::editNote()
|
||||
void BookmarkManager::edit()
|
||||
{
|
||||
QModelIndex current = selectionModel()->currentIndex();
|
||||
Bookmark *b = m_bookmarksList.at(current.row());
|
||||
|
||||
bool inputOk = false;
|
||||
QString noteText = QInputDialog::getText(0, tr("Edit Note"),
|
||||
tr("Note text:"), QLineEdit::Normal,
|
||||
b->note(), &inputOk);
|
||||
if (inputOk) {
|
||||
b->updateNote(noteText.replace(QLatin1Char('\t'), QLatin1Char(' ')));
|
||||
QDialog dlg;
|
||||
dlg.setWindowTitle(tr("Edit Bookmark"));
|
||||
auto layout = new QFormLayout(&dlg);
|
||||
auto noteEdit = new QLineEdit(b->note());
|
||||
noteEdit->setMinimumWidth(300);
|
||||
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);
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
@@ -97,8 +97,8 @@ public slots:
|
||||
void prev();
|
||||
void moveUp();
|
||||
void moveDown();
|
||||
void editNote();
|
||||
void editNote(const QString &fileName, int lineNumber);
|
||||
void edit();
|
||||
void edit(const QString &fileName, int lineNumber);
|
||||
bool gotoBookmark(Bookmark *bookmark);
|
||||
|
||||
signals:
|
||||
|
||||
@@ -105,7 +105,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
cmd = Core::ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext);
|
||||
mbm->addAction(cmd);
|
||||
|
||||
m_editNoteAction = new QAction(tr("Edit Bookmark Note"), this);
|
||||
m_editBookmarkAction = new QAction(tr("Edit Bookmark"), this);
|
||||
|
||||
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_docPrevAction, SIGNAL(triggered()), m_bookmarkManager, SLOT(prevInDocument()));
|
||||
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)));
|
||||
updateActions(m_bookmarkManager->state());
|
||||
addAutoReleasedObject(new BookmarkViewFactory(m_bookmarkManager));
|
||||
@@ -189,7 +189,7 @@ void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
|
||||
|
||||
menu->addAction(m_bookmarkMarginAction);
|
||||
if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber))
|
||||
menu->addAction(m_editNoteAction);
|
||||
menu->addAction(m_editBookmarkAction);
|
||||
}
|
||||
|
||||
void BookmarksPlugin::bookmarkMarginActionTriggered()
|
||||
@@ -198,9 +198,9 @@ void BookmarksPlugin::bookmarkMarginActionTriggered()
|
||||
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)
|
||||
|
||||
@@ -70,7 +70,7 @@ private slots:
|
||||
void requestContextMenu(TextEditor::ITextEditor *editor,
|
||||
int lineNumber, QMenu *menu);
|
||||
void bookmarkMarginActionTriggered();
|
||||
void bookmarkEditNoteActionTriggered();
|
||||
void editBookmarkActionTriggered();
|
||||
|
||||
private:
|
||||
static BookmarksPlugin *m_instance;
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
QAction *m_nextAction;
|
||||
QAction *m_docPrevAction;
|
||||
QAction *m_docNextAction;
|
||||
QAction *m_editNoteAction;
|
||||
QAction *m_editBookmarkAction;
|
||||
|
||||
QAction *m_bookmarkMarginAction;
|
||||
int m_bookmarkMarginActionLineNumber;
|
||||
|
||||
@@ -20,7 +20,6 @@ QtcPlugin {
|
||||
]
|
||||
|
||||
files: [
|
||||
"CMakeProjectManager.mimetypes.xml",
|
||||
"cmakebuildconfiguration.cpp",
|
||||
"cmakebuildconfiguration.h",
|
||||
"cmakebuildinfo.h",
|
||||
|
||||
@@ -224,10 +224,8 @@ win32 {
|
||||
LIBS += -lole32 -luser32
|
||||
}
|
||||
else:macx {
|
||||
HEADERS += macfullscreen.h
|
||||
OBJECTIVE_SOURCES += \
|
||||
progressmanager/progressmanager_mac.mm \
|
||||
macfullscreen.mm
|
||||
progressmanager/progressmanager_mac.mm
|
||||
LIBS += -framework AppKit
|
||||
}
|
||||
else:unix {
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -118,6 +118,10 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
|
||||
m_container->addWidget(empty);
|
||||
m_widgetEditorMap.insert(empty, 0);
|
||||
|
||||
auto dropSupport = new Utils::FileDropSupport(this);
|
||||
connect(dropSupport, SIGNAL(filesDropped(QStringList)),
|
||||
this, SLOT(openDroppedFiles(QStringList)));
|
||||
|
||||
updateNavigatorActions();
|
||||
}
|
||||
|
||||
@@ -330,6 +334,17 @@ void EditorView::closeSplit()
|
||||
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)
|
||||
{
|
||||
m_parentSplitterOrView = splitterOrView;
|
||||
|
||||
@@ -115,6 +115,7 @@ private slots:
|
||||
void splitVertically();
|
||||
void splitNewWindow();
|
||||
void closeSplit();
|
||||
void openDroppedFiles(const QStringList &files);
|
||||
|
||||
private:
|
||||
friend class SplitterOrView; // for setParentSplitterOrView
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
@@ -55,10 +55,6 @@
|
||||
#include "externaltoolmanager.h"
|
||||
#include "editormanager/systemeditor.h"
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include "macfullscreen.h"
|
||||
#endif
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -74,6 +70,7 @@
|
||||
#include <coreplugin/progressmanager/progressmanager_p.h>
|
||||
#include <coreplugin/progressmanager/progressview.h>
|
||||
#include <coreplugin/settingsdatabase.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/historycompleter.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -87,7 +84,6 @@
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
#include <QMimeData>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
@@ -211,11 +207,10 @@ MainWindow::MainWindow() :
|
||||
//signal(SIGINT, handleSigInt);
|
||||
|
||||
statusBar()->setProperty("p_styled", true);
|
||||
setAcceptDrops(true);
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
MacFullScreen::addFullScreen(this);
|
||||
#endif
|
||||
auto dropSupport = new Utils::FileDropSupport(this);
|
||||
connect(dropSupport, SIGNAL(filesDropped(QStringList)),
|
||||
this, SLOT(openDroppedFiles(QStringList)));
|
||||
}
|
||||
|
||||
void MainWindow::setSidebarVisible(bool visible)
|
||||
@@ -241,12 +236,19 @@ void MainWindow::setOverrideColor(const QColor &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"));
|
||||
else
|
||||
m_toggleFullScreenAction->setChecked(true);
|
||||
} else {
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
|
||||
else
|
||||
m_toggleFullScreenAction->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::isNewItemDialogRunning() const
|
||||
@@ -386,61 +388,10 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
event->accept();
|
||||
}
|
||||
|
||||
// Check for desktop file manager file drop events
|
||||
|
||||
static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0)
|
||||
void MainWindow::openDroppedFiles(const QStringList &files)
|
||||
{
|
||||
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();
|
||||
openFiles(m_filesToOpenDelayed, ICore::SwitchMode);
|
||||
m_filesToOpenDelayed.clear();
|
||||
openFiles(files, ICore::SwitchMode);
|
||||
}
|
||||
|
||||
IContext *MainWindow::currentContextObject() const
|
||||
@@ -700,11 +651,23 @@ void MainWindow::registerDefaultActions()
|
||||
cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext);
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
||||
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
|
||||
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
|
||||
tr("Show Sidebar"), this);
|
||||
@@ -724,25 +687,6 @@ void MainWindow::registerDefaultActions()
|
||||
connect(m_toggleModeSelectorAction, SIGNAL(triggered(bool)), ModeManager::instance(), SLOT(setModeSelectorVisible(bool)));
|
||||
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
|
||||
ActionContainer *mviews = ActionManager::createMenu(Constants::M_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;
|
||||
m_minimizeAction->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;
|
||||
}
|
||||
|
||||
void MainWindow::setFullScreen(bool on)
|
||||
void MainWindow::toggleFullScreen()
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
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 {
|
||||
if (isFullScreen()) {
|
||||
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
||||
//menuBar()->show();
|
||||
//statusBar()->show();
|
||||
} else {
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display a warning with an additional button to open
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
void setOverrideColor(const QColor &color);
|
||||
|
||||
void setIsFullScreen(bool fullScreen);
|
||||
void updateFullScreenAction();
|
||||
|
||||
bool isNewItemDialogRunning() const;
|
||||
|
||||
@@ -119,7 +119,7 @@ public slots:
|
||||
void newFile();
|
||||
void openFileWith();
|
||||
void exit();
|
||||
void setFullScreen(bool on);
|
||||
void toggleFullScreen();
|
||||
|
||||
void showNewItemDialog(const QString &title,
|
||||
const QList<IWizardFactory *> &factories,
|
||||
@@ -137,8 +137,6 @@ public slots:
|
||||
protected:
|
||||
virtual void changeEvent(QEvent *e);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private slots:
|
||||
void openFile();
|
||||
@@ -151,7 +149,7 @@ private slots:
|
||||
void updateFocusWidget(QWidget *old, QWidget *now);
|
||||
void setSidebarVisible(bool visible);
|
||||
void destroyVersionDialog();
|
||||
void openDelayedFiles();
|
||||
void openDroppedFiles(const QStringList &files);
|
||||
void restoreWindowState();
|
||||
void newItemDialogFinished();
|
||||
|
||||
@@ -213,8 +211,6 @@ private:
|
||||
|
||||
QToolButton *m_toggleSideBarButton;
|
||||
QColor m_overrideColor;
|
||||
|
||||
QStringList m_filesToOpenDelayed;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -1194,6 +1194,39 @@ void CppEditorPlugin::test_quickfix_data()
|
||||
<< CppQuickFixFactoryPtr(new OptimizeForLoop)
|
||||
<< _("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()
|
||||
|
||||
@@ -3953,8 +3953,8 @@ public:
|
||||
if (m_signalName.isEmpty()) {
|
||||
setter << m_storageName << " = arg;\n}\n";
|
||||
} else {
|
||||
setter << "if (" << m_storageName << " != arg) {\n" << m_storageName
|
||||
<< " = arg;\nemit " << m_signalName << "(arg);\n}\n}\n";
|
||||
setter << "if (" << m_storageName << " == arg)\nreturn;\n\n"
|
||||
<< m_storageName << " = arg;\nemit " << m_signalName << "(arg);\n}\n";
|
||||
}
|
||||
InsertionLocation setterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::PublicSlot);
|
||||
QTC_ASSERT(setterLoc.isValid(), return);
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cplusplus/TranslationUnit.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QTextDocument>
|
||||
#include <QtTest>
|
||||
@@ -54,6 +55,7 @@
|
||||
#if QT_VERSION >= 0x050000
|
||||
#define MSKIP_SINGLE(x) QSKIP(x)
|
||||
#else
|
||||
#include <QtTest/qtestkeyboard.h>
|
||||
#define MSKIP_SINGLE(x) QSKIP(x, SkipSingle)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -447,8 +447,7 @@ void CdbEngine::syncVerboseLog(bool verboseLog)
|
||||
postCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet"), 0);
|
||||
}
|
||||
|
||||
bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor,
|
||||
bool CdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &contextIn)
|
||||
{
|
||||
if (debug)
|
||||
@@ -469,10 +468,7 @@ bool CdbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
if (!localVariable)
|
||||
return false;
|
||||
context.iname = localVariable->iname;
|
||||
DebuggerToolTipWidget *tw = new DebuggerToolTipWidget;
|
||||
tw->setContext(context);
|
||||
tw->acquireEngine(this);
|
||||
DebuggerToolTipManager::showToolTip(mousePos, tw);
|
||||
DebuggerToolTipManager::showToolTip(context, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1972,8 +1968,10 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
|
||||
foreach (const WatchData &wd, watchData)
|
||||
nsp << wd.toString() <<'\n';
|
||||
}
|
||||
if (flags & LocalsUpdateForNewFrame)
|
||||
if (flags & LocalsUpdateForNewFrame) {
|
||||
emit stackFrameCompleted();
|
||||
DebuggerToolTipManager::updateEngine(this);
|
||||
}
|
||||
} else {
|
||||
showMessage(QString::fromLatin1(reply->errorMessage), LogWarning);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
// 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);
|
||||
virtual void setupEngine();
|
||||
virtual void setupInferior();
|
||||
|
||||
@@ -76,8 +76,6 @@ private:
|
||||
QCheckBox *checkBoxKeepEditorStationaryWhileStepping;
|
||||
QLabel *labelMaximalStackDepth;
|
||||
QSpinBox *spinBoxMaximalStackDepth;
|
||||
QSpinBox *spinBoxMaximalStringLength;
|
||||
QSpinBox *spinBoxDisplayStringLimit;
|
||||
|
||||
DebuggerSourcePathMappingWidget *sourcesMappingWidget;
|
||||
const QSharedPointer<Utils::SavedActionSet> m_group;
|
||||
|
||||
@@ -60,7 +60,6 @@ class BreakHandler;
|
||||
class SnapshotHandler;
|
||||
class Symbol;
|
||||
class Section;
|
||||
class DebuggerToolTipManager;
|
||||
class GlobalDebuggerOptions;
|
||||
|
||||
enum TestCases
|
||||
@@ -120,7 +119,6 @@ public:
|
||||
virtual QStringList stringListSetting(int code) const = 0;
|
||||
virtual void setThreads(const QStringList &list, int index) = 0;
|
||||
|
||||
virtual DebuggerToolTipManager *toolTipManager() const = 0;
|
||||
virtual QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const = 0;
|
||||
|
||||
static QTreeView *inspectorView();
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "debuggerrunner.h"
|
||||
#include "debuggerstringutils.h"
|
||||
#include "debuggerstartparameters.h"
|
||||
#include "debuggertooltipmanager.h"
|
||||
|
||||
#include "breakhandler.h"
|
||||
#include "disassembleragent.h"
|
||||
@@ -1176,11 +1177,16 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
|
||||
if (!forced && !isAllowedTransition(oldState, state))
|
||||
qDebug() << "*** UNEXPECTED STATE TRANSITION: " << this << msg;
|
||||
|
||||
if (state == EngineRunRequested) {
|
||||
DebuggerToolTipManager::registerEngine(this);
|
||||
}
|
||||
|
||||
if (state == DebuggerFinished) {
|
||||
// Give up ownership on claimed breakpoints.
|
||||
BreakHandler *handler = breakHandler();
|
||||
foreach (BreakpointModelId id, handler->engineBreakpointIds(this))
|
||||
handler->notifyBreakpointReleased(id);
|
||||
DebuggerToolTipManager::deregisterEngine(this);
|
||||
}
|
||||
|
||||
showMessage(msg, LogDebug);
|
||||
@@ -1355,8 +1361,8 @@ DebuggerRunControl *DebuggerEngine::runControl() const
|
||||
return d->runControl();
|
||||
}
|
||||
|
||||
bool DebuggerEngine::setToolTipExpression
|
||||
(const QPoint &, TextEditor::ITextEditor *, const DebuggerToolTipContext &)
|
||||
bool DebuggerEngine::setToolTipExpression(TextEditor::ITextEditor *,
|
||||
const DebuggerToolTipContext &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -143,8 +143,8 @@ public:
|
||||
const DebuggerStartParameters &startParameters() const;
|
||||
DebuggerStartParameters &startParameters();
|
||||
|
||||
virtual bool setToolTipExpression(const QPoint & mousePos,
|
||||
TextEditor::ITextEditor *editor, const Internal::DebuggerToolTipContext &);
|
||||
virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const Internal::DebuggerToolTipContext &);
|
||||
|
||||
virtual void updateWatchData(const Internal::WatchData &data,
|
||||
const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
|
||||
|
||||
@@ -1202,7 +1202,6 @@ public slots:
|
||||
bool parseArguments(const QStringList &args, QString *errorMessage);
|
||||
void parseCommandLineArguments();
|
||||
|
||||
DebuggerToolTipManager *toolTipManager() const { return m_toolTipManager; }
|
||||
QSharedPointer<GlobalDebuggerOptions> globalDebuggerOptions() const { return m_globalDebuggerOptions; }
|
||||
|
||||
void updateQmlActions() {
|
||||
@@ -2526,7 +2525,7 @@ void DebuggerPluginPrivate::sessionLoaded()
|
||||
{
|
||||
m_breakHandler->loadSessionData();
|
||||
dummyEngine()->watchHandler()->loadSessionData();
|
||||
m_toolTipManager->loadSessionData();
|
||||
DebuggerToolTipManager::loadSessionData();
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::aboutToUnloadSession()
|
||||
@@ -2537,8 +2536,8 @@ void DebuggerPluginPrivate::aboutToUnloadSession()
|
||||
void DebuggerPluginPrivate::aboutToSaveSession()
|
||||
{
|
||||
dummyEngine()->watchHandler()->saveSessionData();
|
||||
m_toolTipManager->saveSessionData();
|
||||
m_breakHandler->saveSessionData();
|
||||
DebuggerToolTipManager::saveSessionData();
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "debuggerrunconfigurationaspect.h"
|
||||
#include "debuggerstartparameters.h"
|
||||
#include "debuggerstringutils.h"
|
||||
#include "debuggertooltipmanager.h"
|
||||
#include "breakhandler.h"
|
||||
#include "shared/peutils.h"
|
||||
|
||||
@@ -136,9 +135,7 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
|
||||
QString errorMessage;
|
||||
d->m_engine = DebuggerRunControlFactory::createEngine(sp.masterEngineType, sp, &errorMessage);
|
||||
|
||||
if (d->m_engine) {
|
||||
DebuggerToolTipManager::registerEngine(d->m_engine);
|
||||
} else {
|
||||
if (!d->m_engine) {
|
||||
debuggingFinished();
|
||||
Core::ICore::showWarningWithOptions(DebuggerRunControl::tr("Debugger"), errorMessage);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,47 +32,37 @@
|
||||
|
||||
#include "debuggerconstants.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QPointer>
|
||||
#include <QTreeView>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QDate>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QVBoxLayout;
|
||||
class QToolButton;
|
||||
class QStandardItemModel;
|
||||
class QToolBar;
|
||||
class QDebug;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IMode;
|
||||
}
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
namespace TextEditor { class ITextEditor; }
|
||||
|
||||
namespace Debugger {
|
||||
class DebuggerEngine;
|
||||
|
||||
namespace Internal {
|
||||
class DraggableLabel;
|
||||
class DebuggerToolTipEditor;
|
||||
|
||||
class DebuggerToolTipContext
|
||||
{
|
||||
public:
|
||||
DebuggerToolTipContext();
|
||||
static DebuggerToolTipContext fromEditor(Core::IEditor *ed, int pos);
|
||||
bool isValid() const { return !fileName.isEmpty(); }
|
||||
bool isValid() const { return !expression.isEmpty(); }
|
||||
bool matchesFrame(const QString &frameFile, const QString &frameFunction) const;
|
||||
bool isSame(const DebuggerToolTipContext &other) const;
|
||||
|
||||
QString fileName;
|
||||
int position;
|
||||
int line;
|
||||
int column;
|
||||
QString function; //!< Optional function. This must be set by the engine as it is language-specific.
|
||||
QString engineType;
|
||||
QDate creationDate;
|
||||
|
||||
QPoint mousePosition;
|
||||
QString expression;
|
||||
@@ -84,81 +74,6 @@ typedef QList<DebuggerToolTipContext> DebuggerToolTipContexts;
|
||||
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -168,16 +83,14 @@ public:
|
||||
|
||||
QAbstractItemModel *swapModel(QAbstractItemModel *model);
|
||||
QSize sizeHint() const { return m_size; }
|
||||
int computeHeight(const QModelIndex &index) const;
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
void computeSize();
|
||||
void expandNode(const QModelIndex &idx);
|
||||
void collapseNode(const QModelIndex &idx);
|
||||
void handleItemIsExpanded(const QModelIndex &sourceIdx);
|
||||
|
||||
private:
|
||||
void init(QAbstractItemModel *model);
|
||||
int computeHeight(const QModelIndex &index) const;
|
||||
|
||||
QSize m_size;
|
||||
};
|
||||
@@ -191,35 +104,40 @@ public:
|
||||
~DebuggerToolTipManager();
|
||||
|
||||
static void registerEngine(DebuggerEngine *engine);
|
||||
static void deregisterEngine(DebuggerEngine *engine);
|
||||
static void updateEngine(DebuggerEngine *engine);
|
||||
static bool hasToolTips();
|
||||
|
||||
// Collect all expressions of DebuggerTreeViewToolTipWidget
|
||||
static DebuggerToolTipContexts treeWidgetExpressions(const QString &fileName,
|
||||
const QString &engineType = QString(),
|
||||
const QString &function= QString());
|
||||
static DebuggerToolTipContexts treeWidgetExpressions(DebuggerEngine *engine,
|
||||
const QString &fileName, const QString &function = QString());
|
||||
|
||||
static void showToolTip(const QPoint &p, DebuggerToolTipWidget *);
|
||||
static void showToolTip(const DebuggerToolTipContext &context,
|
||||
DebuggerEngine *engine);
|
||||
|
||||
virtual bool eventFilter(QObject *, QEvent *);
|
||||
|
||||
static bool debug();
|
||||
static QString treeModelClipboardContents(const QAbstractItemModel *model);
|
||||
|
||||
public slots:
|
||||
void debugModeEntered();
|
||||
void leavingDebugMode();
|
||||
void sessionAboutToChange();
|
||||
void loadSessionData();
|
||||
void saveSessionData();
|
||||
static void loadSessionData();
|
||||
static void saveSessionData();
|
||||
static void closeAllToolTips();
|
||||
void hide();
|
||||
static void hide();
|
||||
|
||||
private slots:
|
||||
void slotUpdateVisibleToolTips();
|
||||
static void slotUpdateVisibleToolTips();
|
||||
void slotDebuggerStateChanged(Debugger::DebuggerState);
|
||||
void slotStackFrameCompleted();
|
||||
void slotEditorOpened(Core::IEditor *);
|
||||
void slotTooltipOverrideRequested(TextEditor::ITextEditor *editor,
|
||||
const QPoint &point, int pos, bool *handled);
|
||||
|
||||
private:
|
||||
bool tryHandleToolTipOverride(TextEditor::ITextEditor *editor,
|
||||
const QPoint &point, int pos);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -3629,42 +3629,30 @@ void GdbEngine::handleRegisterListValues(const GdbResponse &response)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
void GdbEngine::showToolTip()
|
||||
{
|
||||
if (m_toolTipContext.isNull())
|
||||
return;
|
||||
const QString expression = m_toolTipContext->expression;
|
||||
if (DebuggerToolTipManager::debug())
|
||||
qDebug() << "GdbEngine::showToolTip " << expression << m_toolTipContext->iname << (*m_toolTipContext);
|
||||
//void GdbEngine::showToolTip()
|
||||
//{
|
||||
// const QString expression = m_toolTipContext.expression;
|
||||
// if (DebuggerToolTipManager::debug())
|
||||
// qDebug() << "GdbEngine::showToolTip " << expression << m_toolTipContext.iname << m_toolTipContext;
|
||||
|
||||
if (m_toolTipContext->iname.startsWith("tooltip")
|
||||
&& (!debuggerCore()->boolSetting(UseToolTipsInMainEditor)
|
||||
|| !watchHandler()->isValidToolTip(m_toolTipContext->iname))) {
|
||||
watchHandler()->removeData(m_toolTipContext->iname);
|
||||
return;
|
||||
}
|
||||
// if (m_toolTipContext.iname.startsWith("tooltip")
|
||||
// && (!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).
|
||||
m_toolTipContext.reset();
|
||||
}
|
||||
|
||||
QString GdbEngine::tooltipExpression() const
|
||||
{
|
||||
return m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression;
|
||||
}
|
||||
// DebuggerToolTipManager::showToolTip(m_toolTipContext, this);
|
||||
//}
|
||||
|
||||
void GdbEngine::resetLocation()
|
||||
{
|
||||
m_toolTipContext.reset();
|
||||
m_toolTipContext.expression.clear();
|
||||
DebuggerEngine::resetLocation();
|
||||
}
|
||||
|
||||
bool GdbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &contextIn)
|
||||
bool GdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &context)
|
||||
{
|
||||
if (state() != InferiorStopOk || !isCppEditor(editor)) {
|
||||
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED "
|
||||
@@ -3672,46 +3660,13 @@ bool GdbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
return false;
|
||||
}
|
||||
|
||||
DebuggerToolTipContext context = contextIn;
|
||||
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);
|
||||
m_toolTipContext = context;
|
||||
// qDebug() << "GdbEngine::setToolTipExpression2 " << exp << m_toolTipContext;
|
||||
|
||||
UpdateParameters params;
|
||||
params.tryPartial = true;
|
||||
params.tooltipOnly = true;
|
||||
params.varList = iname;
|
||||
params.varList = context.iname;
|
||||
updateLocalsPython(params);
|
||||
return true;
|
||||
}
|
||||
@@ -3777,7 +3732,12 @@ void GdbEngine::rebuildWatchModel()
|
||||
showMessage(LogWindow::logTimeStamp(), LogMiscInput);
|
||||
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
|
||||
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 &)
|
||||
@@ -4879,9 +4839,9 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms)
|
||||
// Re-create tooltip items that are not filters on existing local variables in
|
||||
// the tooltip model.
|
||||
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()) {
|
||||
int currentIndex = -1;
|
||||
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");
|
||||
rebuildWatchModel();
|
||||
//}
|
||||
if (!partial)
|
||||
if (!partial) {
|
||||
emit stackFrameCompleted();
|
||||
DebuggerToolTipManager::updateEngine(this);
|
||||
}
|
||||
} else {
|
||||
showMessage(_("DUMPER FAILED: " + response.toString()));
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <debugger/watchhandler.h>
|
||||
#include <debugger/watchutils.h>
|
||||
#include <debugger/debuggertooltipmanager.h>
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
@@ -406,8 +407,8 @@ protected:
|
||||
//
|
||||
// Watch specific stuff
|
||||
//
|
||||
virtual bool setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
|
||||
virtual bool setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &);
|
||||
virtual void assignValueInDebugger(const WatchData *data,
|
||||
const QString &expr, const QVariant &value);
|
||||
|
||||
@@ -467,8 +468,7 @@ protected:
|
||||
void showExecutionError(const QString &message);
|
||||
|
||||
static QByteArray tooltipIName(const QString &exp);
|
||||
QString tooltipExpression() const;
|
||||
QScopedPointer<DebuggerToolTipContext> m_toolTipContext;
|
||||
DebuggerToolTipContext m_toolTipContext;
|
||||
|
||||
// For short-circuiting stack and thread list evaluation.
|
||||
bool m_stackNeeded;
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/variablechooser.h>
|
||||
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
@@ -62,33 +65,6 @@ class GdbOptionsPageWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -97,10 +73,10 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
||||
{
|
||||
(void) new VariableChooser(this);
|
||||
|
||||
groupBoxGeneral = new QGroupBox(this);
|
||||
auto groupBoxGeneral = new QGroupBox(this);
|
||||
groupBoxGeneral->setTitle(GdbOptionsPage::tr("General"));
|
||||
|
||||
QLabel *labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral);
|
||||
auto labelGdbWatchdogTimeout = new QLabel(groupBoxGeneral);
|
||||
labelGdbWatchdogTimeout->setText(GdbOptionsPage::tr("GDB timeout:"));
|
||||
labelGdbWatchdogTimeout->setToolTip(GdbOptionsPage::tr(
|
||||
"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"
|
||||
"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->setSuffix(GdbOptionsPage::tr("sec"));
|
||||
spinBoxGdbWatchdogTimeout->setLayoutDirection(Qt::LeftToRight);
|
||||
@@ -118,7 +94,7 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
||||
spinBoxGdbWatchdogTimeout->setSingleStep(20);
|
||||
spinBoxGdbWatchdogTimeout->setValue(20);
|
||||
|
||||
checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral);
|
||||
auto checkBoxSkipKnownFrames = new QCheckBox(groupBoxGeneral);
|
||||
checkBoxSkipKnownFrames->setText(GdbOptionsPage::tr("Skip known frames when stepping"));
|
||||
checkBoxSkipKnownFrames->setToolTip(GdbOptionsPage::tr(
|
||||
"<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"
|
||||
"emission ends up directly in the slot connected to it."));
|
||||
|
||||
checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
|
||||
auto checkBoxUseMessageBoxForSignals = new QCheckBox(groupBoxGeneral);
|
||||
checkBoxUseMessageBoxForSignals->setText(GdbOptionsPage::tr(
|
||||
"Show a message box when receiving a signal"));
|
||||
checkBoxUseMessageBoxForSignals->setToolTip(GdbOptionsPage::tr(
|
||||
"Displays a message box as soon as your application\n"
|
||||
"receives a signal like SIGSEGV during debugging."));
|
||||
|
||||
checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
|
||||
auto checkBoxAdjustBreakpointLocations = new QCheckBox(groupBoxGeneral);
|
||||
checkBoxAdjustBreakpointLocations->setText(GdbOptionsPage::tr(
|
||||
"Adjust breakpoint locations"));
|
||||
checkBoxAdjustBreakpointLocations->setToolTip(GdbOptionsPage::tr(
|
||||
@@ -144,32 +120,32 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
||||
"This option reflects such temporary change by moving the breakpoint\n"
|
||||
"markers in the source code editor."));
|
||||
|
||||
checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
|
||||
auto checkBoxUseDynamicType = new QCheckBox(groupBoxGeneral);
|
||||
checkBoxUseDynamicType->setText(GdbOptionsPage::tr(
|
||||
"Use dynamic object type for display"));
|
||||
checkBoxUseDynamicType->setToolTip(GdbOptionsPage::tr(
|
||||
"Specifies whether the dynamic or the static type of objects will be "
|
||||
"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->setToolTip(GdbOptionsPage::tr(
|
||||
"Allows or inhibits reading the user's default\n"
|
||||
".gdbinit file on debugger startup."));
|
||||
|
||||
checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral);
|
||||
auto checkBoxLoadGdbDumpers = new QCheckBox(groupBoxGeneral);
|
||||
checkBoxLoadGdbDumpers->setText(GdbOptionsPage::tr("Load system GDB pretty printers"));
|
||||
checkBoxLoadGdbDumpers->setToolTip(GdbOptionsPage::tr(
|
||||
"Uses the default GDB pretty printers installed in your "
|
||||
"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->setToolTip(GdbOptionsPage::tr(
|
||||
"<html><head/><body>GDB shows by default AT&&T style disassembly."
|
||||
"</body></html>"));
|
||||
|
||||
checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral);
|
||||
auto checkBoxIdentifyDebugInfoPackages = new QCheckBox(groupBoxGeneral);
|
||||
checkBoxIdentifyDebugInfoPackages->setText(GdbOptionsPage::tr("Create tasks from missing packages"));
|
||||
checkBoxIdentifyDebugInfoPackages->setToolTip(GdbOptionsPage::tr(
|
||||
"<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, "
|
||||
"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->setToolTip(GdbOptionsPage::tr(
|
||||
"<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"
|
||||
"</body></html>").arg(howToUsePython));
|
||||
|
||||
textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
|
||||
auto textEditStartupCommands = new QTextEdit(groupBoxStartupCommands);
|
||||
textEditStartupCommands->setAcceptRichText(false);
|
||||
textEditStartupCommands->setToolTip(groupBoxStartupCommands->toolTip());
|
||||
|
||||
groupBoxPostAttachCommands = new QGroupBox(this);
|
||||
auto groupBoxPostAttachCommands = new QGroupBox(this);
|
||||
groupBoxPostAttachCommands->setTitle(GdbOptionsPage::tr("Additional Attach Commands"));
|
||||
groupBoxPostAttachCommands->setToolTip(GdbOptionsPage::tr(
|
||||
"<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\"."
|
||||
"</body></html>"));
|
||||
|
||||
textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
|
||||
auto textEditPostAttachCommands = new QTextEdit(groupBoxPostAttachCommands);
|
||||
textEditPostAttachCommands->setAcceptRichText(false);
|
||||
textEditPostAttachCommands->setToolTip(groupBoxPostAttachCommands->toolTip());
|
||||
|
||||
groupBoxCustomDumperCommands = new QGroupBox(this);
|
||||
auto groupBoxCustomDumperCommands = new QGroupBox(this);
|
||||
groupBoxCustomDumperCommands->setTitle(GdbOptionsPage::tr("Debugging Helper Customization"));
|
||||
groupBoxCustomDumperCommands->setToolTip(GdbOptionsPage::tr(
|
||||
"<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>"
|
||||
"%1</body></html>").arg(howToUsePython));
|
||||
|
||||
textEditCustomDumperCommands = new QTextEdit(groupBoxCustomDumperCommands);
|
||||
auto textEditCustomDumperCommands = new QTextEdit(groupBoxCustomDumperCommands);
|
||||
textEditCustomDumperCommands->setAcceptRichText(false);
|
||||
textEditCustomDumperCommands->setToolTip(groupBoxCustomDumperCommands->toolTip());
|
||||
|
||||
extraDumperFile = new QLineEdit(groupBoxCustomDumperCommands);
|
||||
extraDumperFile->setToolTip(GdbOptionsPage::tr(
|
||||
auto groupBoxExtraDumperFile = new QGroupBox(this);
|
||||
groupBoxExtraDumperFile->setTitle(GdbOptionsPage::tr("Extra Debugging Helpers"));
|
||||
groupBoxExtraDumperFile->setToolTip(GdbOptionsPage::tr(
|
||||
"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->setTitle(GdbOptionsPage::tr(
|
||||
@@ -255,9 +235,9 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
||||
VariableChooser::addVariableSupport(textEditCustomDumperCommands);
|
||||
VariableChooser::addVariableSupport(textEditPostAttachCommands);
|
||||
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(checkBoxSkipKnownFrames);
|
||||
formLayout->addRow(checkBoxUseMessageBoxForSignals);
|
||||
@@ -268,38 +248,29 @@ GdbOptionsPageWidget::GdbOptionsPageWidget(QWidget *parent)
|
||||
formLayout->addRow(checkBoxIntelFlavor);
|
||||
formLayout->addRow(checkBoxIdentifyDebugInfoPackages);
|
||||
|
||||
QGridLayout *startLayout = new QGridLayout(groupBoxStartupCommands);
|
||||
auto startLayout = new QGridLayout(groupBoxStartupCommands);
|
||||
startLayout->addWidget(textEditStartupCommands, 0, 0, 1, 1);
|
||||
|
||||
QGridLayout *postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
|
||||
auto postAttachLayout = new QGridLayout(groupBoxPostAttachCommands);
|
||||
postAttachLayout->addWidget(textEditPostAttachCommands, 0, 0, 1, 1);
|
||||
|
||||
QFormLayout *customDumperLayout = new QFormLayout(groupBoxCustomDumperCommands);
|
||||
customDumperLayout->addRow(GdbOptionsPage::tr("Additional file:"), extraDumperFile);
|
||||
customDumperLayout->addRow(textEditCustomDumperCommands);
|
||||
auto customDumperLayout = new QGridLayout(groupBoxCustomDumperCommands);
|
||||
customDumperLayout->addWidget(textEditCustomDumperCommands, 0, 0, 1, 1);
|
||||
|
||||
//QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
||||
//horizontalLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Preferred, QSizePolicy::Minimum));
|
||||
//horizontalLayout->addWidget(labelSelectedPluginBreakpoints);
|
||||
//horizontalLayout->addWidget(lineEditSelectedPluginBreakpointsPattern);
|
||||
auto extraDumperLayout = new QGridLayout(groupBoxExtraDumperFile);
|
||||
extraDumperLayout->addWidget(pathChooserExtraDumperFile, 0, 0, 1, 1);
|
||||
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
gridLayout->addWidget(groupBoxGeneral, 0, 0, 2, 1);
|
||||
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
|
||||
gridLayout->addWidget(groupBoxPostAttachCommands, 1, 1, 1, 1);
|
||||
gridLayout->addWidget(groupBoxCustomDumperCommands, 2, 1, 1, 1);
|
||||
auto gridLayout = new QGridLayout(this);
|
||||
gridLayout->addWidget(groupBoxGeneral, 0, 0, 5, 1);
|
||||
gridLayout->addWidget(groupBoxExtraDumperFile, 5, 0, 1, 1);
|
||||
|
||||
//gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 1, 1);
|
||||
//gridLayout->addWidget(radioButtonAllPluginBreakpoints, 0, 0, 1, 1);
|
||||
//gridLayout->addWidget(radioButtonSelectedPluginBreakpoints, 1, 0, 1, 1);
|
||||
|
||||
//gridLayout->addLayout(horizontalLayout, 2, 0, 1, 1);
|
||||
//gridLayout->addWidget(radioButtonNoPluginBreakpoints, 3, 0, 1, 1);
|
||||
//gridLayout->addWidget(groupBoxPluginDebugging, 1, 0, 1, 2);
|
||||
gridLayout->addWidget(groupBoxStartupCommands, 0, 1, 2, 1);
|
||||
gridLayout->addWidget(groupBoxPostAttachCommands, 2, 1, 2, 1);
|
||||
gridLayout->addWidget(groupBoxCustomDumperCommands, 4, 1, 2, 1);
|
||||
|
||||
DebuggerCore *dc = debuggerCore();
|
||||
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(GdbPostAttachCommands), textEditPostAttachCommands);
|
||||
group.insert(dc->action(LoadGdbInit), checkBoxLoadGdbInit);
|
||||
|
||||
@@ -821,35 +821,23 @@ static QHash<QString, WatchData> m_toolTipCache;
|
||||
|
||||
void LldbEngine::showToolTip()
|
||||
{
|
||||
if (m_toolTipContext.isNull())
|
||||
if (m_toolTipContext.expression.isEmpty())
|
||||
return;
|
||||
const QString expression = m_toolTipContext->expression;
|
||||
if (DebuggerToolTipManager::debug())
|
||||
qDebug() << "LldbEngine::showToolTip " << expression << m_toolTipContext->iname << (*m_toolTipContext);
|
||||
//const QString expression = m_toolTipContext->expression;
|
||||
// qDebug() << "LldbEngine::showToolTip " << expression << m_toolTipContext->iname << (*m_toolTipContext);
|
||||
|
||||
if (m_toolTipContext->iname.startsWith("tooltip")
|
||||
&& (!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);
|
||||
DebuggerToolTipManager::showToolTip(m_toolTipContext, this);
|
||||
// Prevent tooltip from re-occurring (classic GDB, QTCREATORBUG-4711).
|
||||
m_toolTipContext.reset();
|
||||
m_toolTipContext.expression.clear();
|
||||
}
|
||||
|
||||
void LldbEngine::resetLocation()
|
||||
{
|
||||
m_toolTipContext.reset();
|
||||
m_toolTipContext.expression.clear();
|
||||
DebuggerEngine::resetLocation();
|
||||
}
|
||||
|
||||
bool LldbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &contextIn)
|
||||
bool LldbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &context)
|
||||
{
|
||||
if (state() != InferiorStopOk || !isCppEditor(editor)) {
|
||||
//qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED "
|
||||
@@ -857,46 +845,12 @@ bool LldbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
return false;
|
||||
}
|
||||
|
||||
DebuggerToolTipContext context = contextIn;
|
||||
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);
|
||||
m_toolTipContext = context;
|
||||
|
||||
UpdateParameters params;
|
||||
params.tryPartial = true;
|
||||
params.tooltipOnly = true;
|
||||
params.varList = iname;
|
||||
params.varList = context.iname;
|
||||
doUpdateLocals(params);
|
||||
|
||||
return true;
|
||||
@@ -985,10 +939,9 @@ void LldbEngine::doUpdateLocals(UpdateParameters params)
|
||||
// Re-create tooltip items that are not filters on existing local variables in
|
||||
// the tooltip model.
|
||||
DebuggerToolTipContexts toolTips =
|
||||
DebuggerToolTipManager::treeWidgetExpressions(frame.file, objectName(), frame.function);
|
||||
DebuggerToolTipManager::treeWidgetExpressions(this, frame.file, frame.function);
|
||||
|
||||
const QString currentExpression =
|
||||
m_toolTipContext.isNull() ? QString() : m_toolTipContext->expression;
|
||||
const QString currentExpression = m_toolTipContext.expression;
|
||||
if (!currentExpression.isEmpty()) {
|
||||
int currentIndex = -1;
|
||||
for (int i = 0; i < toolTips.size(); ++i) {
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <debugger/disassembleragent.h>
|
||||
#include <debugger/memoryagent.h>
|
||||
#include <debugger/watchhandler.h>
|
||||
#include <debugger/debuggertooltipmanager.h>
|
||||
|
||||
#include <utils/consoleprocess.h>
|
||||
|
||||
@@ -107,8 +108,8 @@ private:
|
||||
void abortDebugger();
|
||||
void resetLocation();
|
||||
|
||||
bool setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
|
||||
bool setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &);
|
||||
|
||||
void continueInferior();
|
||||
void interruptInferior();
|
||||
@@ -217,7 +218,7 @@ private:
|
||||
QMap<QPointer<DisassemblerAgent>, int> m_disassemblerAgents;
|
||||
QMap<QPointer<MemoryAgent>, int> m_memoryAgents;
|
||||
QHash<int, QPointer<QObject> > m_memoryAgentTokens;
|
||||
QScopedPointer<DebuggerToolTipContext> m_toolTipContext;
|
||||
DebuggerToolTipContext m_toolTipContext;
|
||||
|
||||
void showToolTip();
|
||||
|
||||
|
||||
@@ -452,10 +452,9 @@ static WatchData m_toolTip;
|
||||
static QPoint m_toolTipPos;
|
||||
static QHash<QString, WatchData> m_toolTipCache;
|
||||
|
||||
bool PdbEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
|
||||
bool PdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &ctx)
|
||||
{
|
||||
Q_UNUSED(mousePos)
|
||||
Q_UNUSED(editor)
|
||||
|
||||
if (state() != InferiorStopOk) {
|
||||
|
||||
@@ -75,8 +75,8 @@ private:
|
||||
void shutdownInferior();
|
||||
void shutdownEngine();
|
||||
|
||||
bool setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
|
||||
bool setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &);
|
||||
|
||||
void continueInferior();
|
||||
void interruptInferior();
|
||||
|
||||
@@ -89,15 +89,14 @@ bool QmlCppEngine::canDisplayTooltip() const
|
||||
return m_cppEngine->canDisplayTooltip() || m_qmlEngine->canDisplayTooltip();
|
||||
}
|
||||
|
||||
bool QmlCppEngine::setToolTipExpression(const QPoint & mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
|
||||
bool QmlCppEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
|
||||
{
|
||||
QTC_ASSERT(editor, return false);
|
||||
bool success = false;
|
||||
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)
|
||||
success = m_qmlEngine->setToolTipExpression(mousePos, editor, ctx);
|
||||
success = m_qmlEngine->setToolTipExpression(editor, ctx);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
~QmlCppEngine();
|
||||
|
||||
bool canDisplayTooltip() const;
|
||||
bool setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor * editor, const DebuggerToolTipContext &);
|
||||
bool setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &);
|
||||
void updateWatchData(const WatchData &data,
|
||||
const WatchUpdateFlags &flags);
|
||||
void watchDataSelected(const QByteArray &iname);
|
||||
|
||||
@@ -983,12 +983,12 @@ void QmlEngine::requestModuleSymbols(const QString &moduleName)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool QmlEngine::setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx)
|
||||
bool QmlEngine::setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &ctx)
|
||||
{
|
||||
// This is processed by QML inspector, which has dependencies to
|
||||
// the qml js editor. Makes life easier.
|
||||
emit tooltipRequested(mousePos, editor, ctx.position);
|
||||
emit tooltipRequested(ctx.mousePosition, editor, ctx.position);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ private:
|
||||
void shutdownInferior();
|
||||
void shutdownEngine();
|
||||
|
||||
bool setToolTipExpression(const QPoint &mousePos,
|
||||
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
|
||||
bool setToolTipExpression(TextEditor::ITextEditor *editor,
|
||||
const DebuggerToolTipContext &);
|
||||
|
||||
void continueInferior();
|
||||
void interruptInferior();
|
||||
|
||||
@@ -500,7 +500,11 @@ WatchItem *WatchModel::findItem(const QByteArray &iname) 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)
|
||||
|
||||
@@ -958,7 +958,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
|
||||
} else if (act == &actRemoveWatchExpression) {
|
||||
handler->removeData(p.data(LocalsINameRole).toByteArray());
|
||||
} else if (act == &actCopy) {
|
||||
copyToClipboard(DebuggerToolTipWidget::treeModelClipboardContents(model()));
|
||||
copyToClipboard(DebuggerToolTipManager::treeModelClipboardContents(model()));
|
||||
} else if (act == &actCopyValue) {
|
||||
copyToClipboard(mi1.data().toString());
|
||||
} else if (act == &actShowInEditor) {
|
||||
@@ -1025,31 +1025,31 @@ void WatchTreeView::handleItemIsExpanded(const QModelIndex &idx)
|
||||
expand(idx);
|
||||
}
|
||||
|
||||
void WatchTreeView::resetHelper()
|
||||
{
|
||||
QModelIndex idx = model()->index(m_type, 0);
|
||||
resetHelper(idx);
|
||||
expand(idx);
|
||||
}
|
||||
|
||||
void WatchTreeView::resetHelper(const QModelIndex &idx)
|
||||
void WatchTreeView::reexpand(QTreeView *view, const QModelIndex &idx)
|
||||
{
|
||||
if (idx.data(LocalsExpandedRole).toBool()) {
|
||||
//qDebug() << "EXPANDING " << model()->data(idx, LocalsINameRole);
|
||||
if (!isExpanded(idx)) {
|
||||
expand(idx);
|
||||
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
||||
QModelIndex idx1 = model()->index(i, 0, idx);
|
||||
resetHelper(idx1);
|
||||
//qDebug() << "EXPANDING " << view->model()->data(idx, LocalsINameRole);
|
||||
if (!view->isExpanded(idx)) {
|
||||
view->expand(idx);
|
||||
for (int i = 0, n = view->model()->rowCount(idx); i != n; ++i) {
|
||||
QModelIndex idx1 = view->model()->index(i, 0, idx);
|
||||
reexpand(view, idx1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//qDebug() << "COLLAPSING " << model()->data(idx, LocalsINameRole);
|
||||
if (isExpanded(idx))
|
||||
collapse(idx);
|
||||
//qDebug() << "COLLAPSING " << view->model()->data(idx, LocalsINameRole);
|
||||
if (view->isExpanded(idx))
|
||||
view->collapse(idx);
|
||||
}
|
||||
}
|
||||
|
||||
void WatchTreeView::resetHelper()
|
||||
{
|
||||
QModelIndex idx = model()->index(m_type, 0);
|
||||
reexpand(this, idx);
|
||||
expand(idx);
|
||||
}
|
||||
|
||||
void WatchTreeView::reset()
|
||||
{
|
||||
BaseTreeView::reset();
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
void reset();
|
||||
|
||||
void fillFormatMenu(QMenu *, const QModelIndex &mi);
|
||||
static void reexpand(QTreeView *view, const QModelIndex &idx);
|
||||
|
||||
public slots:
|
||||
void watchExpression(const QString &exp);
|
||||
@@ -91,7 +92,6 @@ private:
|
||||
|
||||
void inputNewExpression();
|
||||
void editItem(const QModelIndex &idx);
|
||||
void resetHelper(const QModelIndex &idx);
|
||||
|
||||
void setModelData(int role, const QVariant &value = QVariant(),
|
||||
const QModelIndex &index = QModelIndex());
|
||||
|
||||
@@ -240,13 +240,26 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
rows << RowData(TextLineData(QLatin1String("ABCD")),
|
||||
TextLineData(TextLineData::Separator));
|
||||
rows << RowData(TextLineData(QLatin1String("EFGH")));
|
||||
rows << RowData(TextLineData(QLatin1String("")));
|
||||
ChunkData chunk;
|
||||
chunk.rows = rows;
|
||||
QString patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n"
|
||||
"-ABCD\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
|
||||
<< true
|
||||
@@ -255,8 +268,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
///////////
|
||||
|
||||
rows.clear();
|
||||
rows << RowData(TextLineData(QLatin1String("ABCD")),
|
||||
TextLineData(QLatin1String("ABCD")));
|
||||
rows << RowData(TextLineData(QLatin1String("ABCD")));
|
||||
rows << RowData(TextLineData(QLatin1String("")),
|
||||
TextLineData(TextLineData::Separator));
|
||||
chunk.rows = rows;
|
||||
@@ -265,7 +277,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
"+ABCD\n"
|
||||
"\\ No newline at end of file\n");
|
||||
|
||||
QTest::newRow("Last newline removed") << chunk
|
||||
QTest::newRow("EOL in last line removed") << chunk
|
||||
<< fileName
|
||||
<< fileName
|
||||
<< true
|
||||
@@ -275,11 +287,10 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
|
||||
// chunk the same here
|
||||
patchText = header + QLatin1String("@@ -1,2 +1,1 @@\n"
|
||||
"-ABCD\n"
|
||||
"-\n"
|
||||
"+ABCD\n");
|
||||
" ABCD\n"
|
||||
"-\n");
|
||||
|
||||
QTest::newRow("Not a last newline removed") << chunk
|
||||
QTest::newRow("Last empty line removed") << chunk
|
||||
<< fileName
|
||||
<< fileName
|
||||
<< false
|
||||
@@ -288,8 +299,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
///////////
|
||||
|
||||
rows.clear();
|
||||
rows << RowData(TextLineData(QLatin1String("ABCD")),
|
||||
TextLineData(QLatin1String("ABCD")));
|
||||
rows << RowData(TextLineData(QLatin1String("ABCD")));
|
||||
rows << RowData(TextLineData(TextLineData::Separator),
|
||||
TextLineData(QLatin1String("")));
|
||||
chunk.rows = rows;
|
||||
@@ -298,7 +308,7 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
"\\ No newline at end of file\n"
|
||||
"+ABCD\n");
|
||||
|
||||
QTest::newRow("Last newline added") << chunk
|
||||
QTest::newRow("EOL to last line added") << chunk
|
||||
<< fileName
|
||||
<< fileName
|
||||
<< true
|
||||
@@ -308,11 +318,26 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
|
||||
// chunk the same here
|
||||
patchText = header + QLatin1String("@@ -1,1 +1,2 @@\n"
|
||||
"-ABCD\n"
|
||||
"+ABCD\n"
|
||||
" ABCD\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
|
||||
<< false
|
||||
@@ -325,19 +350,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data()
|
||||
TextLineData(QLatin1String("EFGH")));
|
||||
rows << RowData(TextLineData(QLatin1String("")));
|
||||
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"
|
||||
"-ABCD\n"
|
||||
"+EFGH\n"
|
||||
@@ -424,7 +436,35 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch()
|
||||
|
||||
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()
|
||||
@@ -614,11 +654,74 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch_data()
|
||||
fileData8.rightFileInfo = DiffFileInfo(QLatin1String("file b.txt"));
|
||||
fileData8.fileOperation = FileData::RenameFile;
|
||||
|
||||
QList<FileData> fileDataList;
|
||||
fileDataList << fileData1 << fileData2 << fileData3 << fileData4 << fileData5 << fileData6 << fileData7 << fileData8;
|
||||
QList<FileData> fileDataList1;
|
||||
fileDataList1 << fileData1 << fileData2 << fileData3 << fileData4 << fileData5 << fileData6 << fileData7 << fileData8;
|
||||
|
||||
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()
|
||||
|
||||
@@ -131,15 +131,23 @@ ChunkData DiffUtils::calculateOriginalData(const QList<Diff> &leftDiffList,
|
||||
: Diff(Diff::Equal);
|
||||
|
||||
if (leftDiff.command == Diff::Delete) {
|
||||
if (j == rightDiffList.count() && lastLineEqual && leftDiff.text.startsWith(QLatin1Char('\n')))
|
||||
equalLines.insert(leftLineNumber, rightLineNumber);
|
||||
// process delete
|
||||
handleDifference(leftDiff.text, &leftLines, &leftLineNumber);
|
||||
lastLineEqual = lastLinesEqual(leftLines, rightLines);
|
||||
if (j == rightDiffList.count())
|
||||
lastLineEqual = false;
|
||||
i++;
|
||||
}
|
||||
if (rightDiff.command == Diff::Insert) {
|
||||
if (i == leftDiffList.count() && lastLineEqual && rightDiff.text.startsWith(QLatin1Char('\n')))
|
||||
equalLines.insert(leftLineNumber, rightLineNumber);
|
||||
// process insert
|
||||
handleDifference(rightDiff.text, &rightLines, &rightLineNumber);
|
||||
lastLineEqual = lastLinesEqual(leftLines, rightLines);
|
||||
if (i == leftDiffList.count())
|
||||
lastLineEqual = false;
|
||||
j++;
|
||||
}
|
||||
if (leftDiff.command == Diff::Equal && rightDiff.command == Diff::Equal) {
|
||||
@@ -262,6 +270,7 @@ FileData DiffUtils::calculateContextData(const ChunkData &originalData,
|
||||
|
||||
FileData fileData;
|
||||
fileData.contextChunksIncluded = true;
|
||||
fileData.lastChunkAtTheEndOfFile = true;
|
||||
|
||||
QMap<int, bool> hiddenRows;
|
||||
int i = 0;
|
||||
@@ -353,13 +362,24 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
|
||||
int rightLineCount = 0;
|
||||
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++) {
|
||||
const RowData &rowData = i < chunkData.rows.count()
|
||||
? chunkData.rows.at(i)
|
||||
: RowData(TextLineData(TextLineData::Separator)); // dummy,
|
||||
// ensure we process buffers to the end.
|
||||
// rowData will be equal
|
||||
if (rowData.equal) {
|
||||
if (rowData.equal && i != lastEqualRow) {
|
||||
if (leftBuffer.count()) {
|
||||
for (int j = 0; j < leftBuffer.count(); j++) {
|
||||
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))
|
||||
// or we have noNewLine in not the last equal line
|
||||
|| (noNewLineInEqual >= 0 && noNewLineInEqual != lastEqual)
|
||||
|| (noNewLineInDelete >= 0 && noNewLineInDelete != lastDelete)
|
||||
|| (noNewLineInInsert >= 0 && noNewLineInInsert != lastInsert)) {
|
||||
// or we have noNewLine in not the last delete line or there is a equal line after the noNewLine for delete
|
||||
|| (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)
|
||||
*ok = false;
|
||||
return QList<RowData>();
|
||||
@@ -577,7 +601,11 @@ static QList<RowData> readLines(const QString &patch,
|
||||
removeNewLineFromLastDelete = true;
|
||||
if (noNewLineInInsert >= 0)
|
||||
removeNewLineFromLastInsert = true;
|
||||
} else if (lastEqual > lastDelete && lastEqual > lastInsert) {
|
||||
} else {
|
||||
if (noNewLineInEqual >= 0) {
|
||||
removeNewLineFromLastEqual = true;
|
||||
} else if (lastChunk) {
|
||||
if (lastEqual > lastDelete && lastEqual > lastInsert) {
|
||||
removeNewLineFromLastEqual = true;
|
||||
} else if (lastDelete > lastEqual && lastDelete > lastInsert) {
|
||||
if (lastInsert > lastEqual) {
|
||||
@@ -585,6 +613,7 @@ static QList<RowData> readLines(const QString &patch,
|
||||
removeNewLineFromLastInsert = true;
|
||||
} else if (lastEqual > lastInsert) {
|
||||
removeNewLineFromLastEqual = true;
|
||||
removeNewLineFromLastDelete = true;
|
||||
prependNewLineAfterLastEqual = true;
|
||||
}
|
||||
} else if (lastInsert > lastEqual && lastInsert > lastDelete) {
|
||||
@@ -593,9 +622,13 @@ static QList<RowData> readLines(const QString &patch,
|
||||
removeNewLineFromLastInsert = true;
|
||||
} else if (lastEqual > lastDelete) {
|
||||
removeNewLineFromLastEqual = true;
|
||||
removeNewLineFromLastInsert = true;
|
||||
prependNewLineAfterLastEqual = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (removeNewLineFromLastEqual) {
|
||||
Diff &diff = diffList[lastEqual];
|
||||
|
||||
@@ -478,13 +478,24 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
|
||||
|
||||
(*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++) {
|
||||
const RowData &rowData = i < chunkData.rows.count()
|
||||
? chunkData.rows.at(i)
|
||||
: RowData(TextLineData(TextLineData::Separator)); // dummy,
|
||||
// ensure we process buffers to the end.
|
||||
// rowData will be equal
|
||||
if (rowData.equal) {
|
||||
if (rowData.equal && i != lastEqualRow) {
|
||||
if (leftBuffer.count()) {
|
||||
for (int j = 0; j < leftBuffer.count(); j++) {
|
||||
const TextLineData &lineData = leftBuffer.at(j);
|
||||
|
||||
@@ -555,6 +555,7 @@ HelpViewer *HelpPlugin::externalHelpViewer()
|
||||
if (!m_externalWindowState.isNull())
|
||||
m_externalWindow->setGeometry(m_externalWindowState);
|
||||
m_externalWindow->show();
|
||||
m_externalWindow->setFocus();
|
||||
return m_externalWindow->currentViewer();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<plugin name=\"Ios\" version=\"$$QTCREATOR_VERSION\" compatVersion=\"$$QTCREATOR_VERSION\">
|
||||
<vendor>Digia Plc</vendor>
|
||||
<copyright>(C) 2014 Digia Plc</copyright>
|
||||
<platform>Mac OS.*</platform>
|
||||
<platform>OS X.*</platform>
|
||||
<license>
|
||||
Commercial Usage
|
||||
|
||||
|
||||
@@ -243,24 +243,25 @@ void QbsBuildStep::buildingDone(bool success)
|
||||
item.codeLocation().fileName(), item.codeLocation().line());
|
||||
|
||||
QbsProject *pro = static_cast<QbsProject *>(project());
|
||||
connect(pro, SIGNAL(projectParsingDone(bool)), this, SLOT(reparsingDone()));
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
void QbsBuildStep::reparsingDone()
|
||||
{
|
||||
disconnect(static_cast<QbsProject *>(project()), SIGNAL(projectParsingDone(bool)),
|
||||
this, SLOT(reparsingDone()));
|
||||
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();
|
||||
finish();
|
||||
}
|
||||
|
||||
void QbsBuildStep::handleTaskStarted(const QString &desciption, int max)
|
||||
@@ -374,6 +375,17 @@ void QbsBuildStep::setMaxJobs(int jobcount)
|
||||
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:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -98,6 +98,8 @@ private:
|
||||
void setCheckTimestamps(bool ts);
|
||||
void setMaxJobs(int jobcount);
|
||||
|
||||
void finish();
|
||||
|
||||
QVariantMap m_qbsConfiguration;
|
||||
qbs::BuildOptions m_qbsBuildOptions;
|
||||
|
||||
|
||||
@@ -35,14 +35,13 @@
|
||||
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <qbs.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QStyle>
|
||||
|
||||
@@ -125,6 +124,7 @@ static bool addQbsFiles(QbsBaseProjectNode *node, const QStringList &filePaths,
|
||||
foreach (const QString &path, filePaths) {
|
||||
qbs::ErrorInfo err = prj.addFiles(productData, groupData, QStringList() << path);
|
||||
if (err.hasError()) {
|
||||
Core::MessageManager::write(err.toString());
|
||||
*notAdded += path;
|
||||
} else {
|
||||
allPaths += path;
|
||||
@@ -144,6 +144,7 @@ static bool removeQbsFiles(QbsBaseProjectNode *node, const QStringList &filePath
|
||||
foreach (const QString &path, filePaths) {
|
||||
qbs::ErrorInfo err = prj.removeFiles(productData, groupData, QStringList() << path);
|
||||
if (err.hasError()) {
|
||||
Core::MessageManager::write(err.toString());
|
||||
*notRemoved += path;
|
||||
} else {
|
||||
allPaths.removeOne(path);
|
||||
@@ -743,16 +744,8 @@ QbsGroupNode *QbsProductNode::findGroupNode(const QString &name)
|
||||
// QbsProjectNode:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsProjectNode::QbsProjectNode(QbsProject *project) :
|
||||
QbsBaseProjectNode(project->projectFilePath().toString()),
|
||||
m_project(project)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
|
||||
QbsProjectNode::QbsProjectNode(const QString &path) :
|
||||
QbsBaseProjectNode(path),
|
||||
m_project(0)
|
||||
QbsBaseProjectNode(path)
|
||||
{
|
||||
ctor();
|
||||
}
|
||||
@@ -768,19 +761,6 @@ bool QbsProjectNode::addFiles(const QStringList &filePaths, QStringList *notAdde
|
||||
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)
|
||||
{
|
||||
QList<ProjectExplorer::ProjectNode *> toAdd;
|
||||
@@ -811,7 +791,7 @@ void QbsProjectNode::update(const qbs::ProjectData &prjData)
|
||||
if (!prjData.name().isEmpty())
|
||||
setDisplayName(prjData.name());
|
||||
else
|
||||
setDisplayName(m_project->displayName());
|
||||
setDisplayName(project()->displayName());
|
||||
|
||||
removeProjectNodes(toRemove);
|
||||
addProjectNodes(toAdd);
|
||||
@@ -819,25 +799,17 @@ void QbsProjectNode::update(const qbs::ProjectData &prjData)
|
||||
|
||||
QbsProject *QbsProjectNode::project() const
|
||||
{
|
||||
if (!m_project && projectNode())
|
||||
return static_cast<QbsProjectNode *>(projectNode())->project();
|
||||
return m_project;
|
||||
return static_cast<QbsProjectNode *>(parentFolderNode())->project();
|
||||
}
|
||||
|
||||
const qbs::Project QbsProjectNode::qbsProject() const
|
||||
{
|
||||
QbsProjectNode *parent = qobject_cast<QbsProjectNode *>(projectNode());
|
||||
if (!m_qbsProject.isValid() && parent != this)
|
||||
return parent->qbsProject();
|
||||
return m_qbsProject;
|
||||
return project()->qbsProject();
|
||||
}
|
||||
|
||||
const qbs::ProjectData QbsProjectNode::qbsProjectData() const
|
||||
{
|
||||
if (m_qbsProject.isValid())
|
||||
return m_qbsProject.projectData();
|
||||
else
|
||||
return qbs::ProjectData();
|
||||
return project()->qbsProjectData();
|
||||
}
|
||||
|
||||
bool QbsProjectNode::showInSimpleTree() const
|
||||
@@ -875,5 +847,17 @@ QbsProjectNode *QbsProjectNode::findProjectNode(const QString &name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
QbsRootProjectNode::QbsRootProjectNode(QbsProject *project) :
|
||||
QbsProjectNode(project->projectFilePath().toString()),
|
||||
m_project(project)
|
||||
{
|
||||
}
|
||||
|
||||
void QbsRootProjectNode::update()
|
||||
{
|
||||
update(m_project->qbsProjectData());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace qbs { class Project; }
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -165,34 +163,46 @@ class QbsProjectNode : public QbsBaseProjectNode
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QbsProjectNode(QbsProject *project);
|
||||
explicit QbsProjectNode(const QString &path);
|
||||
~QbsProjectNode();
|
||||
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||
|
||||
void setProject(const qbs::Project &prj); // This does *not* update the node tree!
|
||||
|
||||
void update();
|
||||
|
||||
QbsProject *project() const;
|
||||
virtual QbsProject *project() const;
|
||||
const qbs::Project qbsProject() const;
|
||||
const qbs::ProjectData qbsProjectData() const;
|
||||
|
||||
bool showInSimpleTree() const;
|
||||
|
||||
protected:
|
||||
void update(const qbs::ProjectData &prjData);
|
||||
|
||||
private:
|
||||
void ctor();
|
||||
|
||||
void update(const qbs::ProjectData &prjData);
|
||||
|
||||
QbsProductNode *findProductNode(const QString &name);
|
||||
QbsProjectNode *findProjectNode(const QString &name);
|
||||
|
||||
QbsProject *m_project;
|
||||
|
||||
qbs::Project m_qbsProject;
|
||||
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 QbsProjectManager
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
|
||||
m_qbsProjectParser(0),
|
||||
m_qbsUpdateFutureInterface(0),
|
||||
m_forceParsing(false),
|
||||
m_parsingScheduled(false),
|
||||
m_currentBc(0)
|
||||
{
|
||||
m_parsingDelay.setInterval(1000); // delay parsing by 1s.
|
||||
@@ -120,7 +121,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
|
||||
updateDocuments(QSet<QString>() << fileName);
|
||||
|
||||
// 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()
|
||||
@@ -255,16 +256,14 @@ Utils::FileName QbsProject::defaultBuildDirectory(const QString &projectFilePath
|
||||
|
||||
qbs::Project QbsProject::qbsProject() const
|
||||
{
|
||||
if (!m_rootProjectNode)
|
||||
return qbs::Project();
|
||||
return m_rootProjectNode->qbsProject();
|
||||
return m_qbsProject;
|
||||
}
|
||||
|
||||
const qbs::ProjectData QbsProject::qbsProjectData() const
|
||||
{
|
||||
if (!m_rootProjectNode)
|
||||
if (m_qbsProject.isValid())
|
||||
return m_qbsProject.projectData();
|
||||
return qbs::ProjectData();
|
||||
return m_rootProjectNode->qbsProjectData();
|
||||
}
|
||||
|
||||
bool QbsProject::needsSpecialDeployment() const
|
||||
@@ -276,12 +275,14 @@ void QbsProject::handleQbsParsingDone(bool success)
|
||||
{
|
||||
QTC_ASSERT(m_qbsProjectParser, return);
|
||||
|
||||
qbs::Project project;
|
||||
if (success)
|
||||
project = m_qbsProjectParser->qbsProject();
|
||||
|
||||
generateErrors(m_qbsProjectParser->error());
|
||||
|
||||
if (success) {
|
||||
m_qbsProject = m_qbsProjectParser->qbsProject();
|
||||
QTC_CHECK(m_qbsProject.isValid());
|
||||
readQbsData();
|
||||
}
|
||||
|
||||
m_qbsProjectParser->deleteLater();
|
||||
m_qbsProjectParser = 0;
|
||||
|
||||
@@ -291,11 +292,6 @@ void QbsProject::handleQbsParsingDone(bool success)
|
||||
m_qbsUpdateFutureInterface = 0;
|
||||
}
|
||||
|
||||
if (project.isValid())
|
||||
m_rootProjectNode->setProject(project);
|
||||
|
||||
readQbsData();
|
||||
|
||||
emit projectParsingDone(success);
|
||||
}
|
||||
|
||||
@@ -363,17 +359,14 @@ void QbsProject::readQbsData()
|
||||
qbs::ProjectData data = m_rootProjectNode->qbsProjectData();
|
||||
updateCppCodeModel(data);
|
||||
updateQmlJsCodeModel(data);
|
||||
updateApplicationTargets(data);
|
||||
updateDeploymentInfo(project);
|
||||
|
||||
foreach (Target *t, targets())
|
||||
t->updateDefaultRunConfigurations();
|
||||
updateBuildTargetData();
|
||||
|
||||
emit fileListChanged();
|
||||
}
|
||||
|
||||
void QbsProject::parseCurrentBuildConfiguration(bool force)
|
||||
{
|
||||
m_parsingScheduled = false;
|
||||
if (!m_forceParsing)
|
||||
m_forceParsing = force;
|
||||
|
||||
@@ -385,6 +378,11 @@ void QbsProject::parseCurrentBuildConfiguration(bool force)
|
||||
parse(bc->qbsConfiguration(), bc->environment(), bc->buildDirectory().toString());
|
||||
}
|
||||
|
||||
void QbsProject::updateAfterBuild()
|
||||
{
|
||||
updateBuildTargetData();
|
||||
}
|
||||
|
||||
void QbsProject::registerQbsProjectParser(QbsProjectParser *p)
|
||||
{
|
||||
m_parsingDelay.stop();
|
||||
@@ -652,5 +650,13 @@ void QbsProject::updateDeploymentInfo(const qbs::Project &project)
|
||||
activeTarget()->setDeploymentData(deploymentData);
|
||||
}
|
||||
|
||||
void QbsProject::updateBuildTargetData()
|
||||
{
|
||||
updateApplicationTargets(m_qbsProject.projectData());
|
||||
updateDeploymentInfo(m_qbsProject);
|
||||
foreach (Target *t, targets())
|
||||
t->updateDefaultRunConfigurations();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <qbs.h>
|
||||
|
||||
#include <QFuture>
|
||||
#include <QTimer>
|
||||
#include <QVariantMap>
|
||||
@@ -62,6 +64,7 @@ namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QbsProjectNode;
|
||||
class QbsRootProjectNode;
|
||||
class QbsProjectParser;
|
||||
class QbsBuildConfiguration;
|
||||
|
||||
@@ -91,6 +94,9 @@ public:
|
||||
bool isParsing() const;
|
||||
bool hasParseResult() const;
|
||||
void parseCurrentBuildConfiguration(bool force);
|
||||
void scheduleParsing() { m_parsingScheduled = true; }
|
||||
bool parsingScheduled() const { return m_parsingScheduled; }
|
||||
void updateAfterBuild();
|
||||
|
||||
void registerQbsProjectParser(QbsProjectParser *p);
|
||||
|
||||
@@ -133,17 +139,20 @@ private:
|
||||
void updateQmlJsCodeModel(const qbs::ProjectData &prj);
|
||||
void updateApplicationTargets(const qbs::ProjectData &projectData);
|
||||
void updateDeploymentInfo(const qbs::Project &project);
|
||||
void updateBuildTargetData();
|
||||
|
||||
QbsManager *const m_manager;
|
||||
const QString m_projectName;
|
||||
const QString m_fileName;
|
||||
qbs::Project m_qbsProject;
|
||||
QSet<Core::IDocument *> m_qbsDocuments;
|
||||
QbsProjectNode *m_rootProjectNode;
|
||||
QbsRootProjectNode *m_rootProjectNode;
|
||||
|
||||
QbsProjectParser *m_qbsProjectParser;
|
||||
|
||||
QFutureInterface<bool> *m_qbsUpdateFutureInterface;
|
||||
bool m_forceParsing;
|
||||
bool m_parsingScheduled;
|
||||
|
||||
QFuture<void> m_codeModelFuture;
|
||||
|
||||
|
||||
@@ -514,13 +514,14 @@ void QbsProjectManagerPlugin::reparseCurrentProject()
|
||||
|
||||
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
|
||||
// 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.
|
||||
return;
|
||||
}
|
||||
|
||||
if (BuildManager::isBuilding(project))
|
||||
project->scheduleParsing();
|
||||
else
|
||||
project->parseCurrentBuildConfiguration(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,4 +15,19 @@
|
||||
<comment>Qt Project feature file</comment>
|
||||
<glob pattern="*.prf"/>
|
||||
</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>
|
||||
|
||||
@@ -51,6 +51,9 @@ ProFileEditorFactory::ProFileEditorFactory(QmakeManager *manager) :
|
||||
addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE);
|
||||
addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_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,
|
||||
TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::JumpToFileUnderCursor);
|
||||
|
||||
@@ -38,7 +38,6 @@ QtcPlugin {
|
||||
"profilehighlighter.cpp", "profilehighlighter.h",
|
||||
"profilehoverhandler.cpp", "profilehoverhandler.h",
|
||||
"qmakebuildinfo.h",
|
||||
"qmakeparser.cpp", "qmakeparser.h",
|
||||
"qmakekitconfigwidget.cpp", "qmakekitconfigwidget.h",
|
||||
"qmakekitinformation.cpp", "qmakekitinformation.h",
|
||||
"qmakeparser.cpp", "qmakeparser.h",
|
||||
|
||||
@@ -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 PROINCLUDEFILE_MIMETYPE [] = "application/vnd.qt.qmakeproincludefile";
|
||||
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
|
||||
const char RUNQMAKE[] = "Qt4Builder.RunQMake";
|
||||
|
||||
@@ -223,9 +223,6 @@ void ItemLibraryModel::updateVisibility()
|
||||
foreach (ItemLibrarySection *itemLibrarySection, m_sections) {
|
||||
QString sectionSearchText = m_searchText;
|
||||
|
||||
if (itemLibrarySection->sectionName().toLower().contains(m_searchText))
|
||||
sectionSearchText.clear();
|
||||
|
||||
bool sectionChanged = false;
|
||||
bool sectionVisibility = itemLibrarySection->updateSectionVisibility(sectionSearchText,
|
||||
§ionChanged);
|
||||
|
||||
@@ -58,7 +58,11 @@ class TreeViewStyle : public QProxyStyle
|
||||
public:
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const
|
||||
{
|
||||
static QRect mouseOverStateSavedFrameRectangle;
|
||||
if (element == QStyle::PE_PanelItemViewRow) {
|
||||
if (option->state & QStyle::State_MouseOver)
|
||||
mouseOverStateSavedFrameRectangle = option->rect;
|
||||
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
NavigatorTreeView::drawSelectionBackground(painter, *option);
|
||||
} else {
|
||||
@@ -71,22 +75,26 @@ public:
|
||||
// painter->restore();
|
||||
}
|
||||
} 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();
|
||||
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.top()>0)
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
bool isNotRootItem = option->rect.top() > 10 && mouseOverStateSavedFrameRectangle.top() > 10;
|
||||
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 {
|
||||
highlight.setAlphaF(0.2);
|
||||
painter->setBrush(highlight);
|
||||
painter->drawRect(rect.adjusted(0, 0, -1, -1));
|
||||
drawHighlightFrame(frameRectangle, painter);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
} else if (element == PE_FrameFocusRect) {
|
||||
// don't draw
|
||||
} else {
|
||||
@@ -100,6 +108,56 @@ public:
|
||||
else
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -52,9 +52,6 @@ public:
|
||||
virtual int indentDepth() const;
|
||||
|
||||
virtual bool renameId(const QString &oldId, const QString &newId);
|
||||
|
||||
virtual QmlJS::Snapshot getSnapshot() const;
|
||||
virtual QStringList importPaths() const;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -58,7 +58,6 @@ public:
|
||||
virtual void deactivateChangeSignals();
|
||||
virtual void reactivateChangeSignals();
|
||||
|
||||
virtual QmlJS::Snapshot getSnapshot() const;
|
||||
virtual QStringList importPaths() const;
|
||||
|
||||
virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; }
|
||||
|
||||
@@ -101,6 +101,7 @@ public:
|
||||
void setUsedImports(const QList<Import> &usedImports);
|
||||
bool hasImport(const Import &import, bool ignoreAlias = true, bool allowHigherVersion = false);
|
||||
QString pathForImport(const Import &import);
|
||||
QStringList importPaths() const;
|
||||
|
||||
RewriterView *rewriterView() const;
|
||||
void setRewriterView(RewriterView *rewriterView);
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
QPixmap blurredRenderPixmap() const;
|
||||
|
||||
QVariant property(const PropertyName &name) const;
|
||||
bool hasProperty(const PropertyName &name) const;
|
||||
bool hasBindingForProperty(const PropertyName &name) const;
|
||||
QPair<PropertyName, qint32> anchor(const PropertyName &name) const;
|
||||
bool hasAnchor(const PropertyName &name) const;
|
||||
|
||||
@@ -73,8 +73,7 @@ public:
|
||||
virtual void deactivateChangeSignals();
|
||||
virtual void reactivateChangeSignals();
|
||||
|
||||
virtual QmlJS::Snapshot getSnapshot() const = 0;
|
||||
virtual QStringList importPaths() const = 0;
|
||||
virtual QStringList importPaths() const;
|
||||
|
||||
virtual bool renameId(const QString & /* oldId */, const QString & /* newId */) { return false; }
|
||||
|
||||
@@ -108,10 +107,6 @@ public:
|
||||
|
||||
virtual int indentDepth() const
|
||||
{ return 0; }
|
||||
|
||||
virtual QmlJS::Snapshot getSnapshot() const;
|
||||
|
||||
virtual QStringList importPaths() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
NodeProperty nodeProperty(const PropertyName &name) const;
|
||||
NodeListProperty nodeListProperty(const PropertyName &name) const;
|
||||
|
||||
bool instanceHasValue(const PropertyName &name) const;
|
||||
QVariant instanceValue(const PropertyName &name) const;
|
||||
TypeName instanceType(const PropertyName &name) const;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ private: // functions
|
||||
void unregisterQmlFile(const QFileInfo &fileInfo, const QString &qualifier);
|
||||
void registerQmlFile(const QFileInfo &fileInfo, const QString &qualifier, bool addToLibrary);
|
||||
Model *model() const;
|
||||
QStringList importPaths() const;
|
||||
|
||||
private: // variables
|
||||
QFileSystemWatcher m_watcher;
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
virtual void deactivateChangeSignals() = 0;
|
||||
virtual void reactivateChangeSignals() = 0;
|
||||
|
||||
virtual QmlJS::Snapshot getSnapshot() const = 0;
|
||||
static QmlJS::Snapshot qmljsSnapshot();
|
||||
virtual QStringList importPaths() const = 0;
|
||||
|
||||
virtual bool renameId(const QString &oldId, const QString &newId) = 0;
|
||||
|
||||
@@ -315,6 +315,14 @@ QVariant NodeInstance::property(const PropertyName &name) const
|
||||
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
|
||||
{
|
||||
if (isValid())
|
||||
|
||||
@@ -100,8 +100,8 @@ static bool hasQtQuick1(NodeInstanceView *nodeInstanceView)
|
||||
|
||||
static void showCannotConnectToPuppetWarningAndSwitchToEditMode()
|
||||
{
|
||||
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. "
|
||||
QmlDesignerWarning::show(QCoreApplication::translate("NodeInstanceServerProxy", "Cannot Connect to QML Emulation Layer (QML Puppet)"),
|
||||
QCoreApplication::translate("NodeInstanceServerProxy", "The executable of the QML emulation layer (QML Puppet) process is maybe hanging. "
|
||||
"Switching to an other kit maybe helps."));
|
||||
|
||||
QmlDesignerPlugin::instance()->switchToTextModeDeferred();
|
||||
@@ -200,8 +200,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
|
||||
}
|
||||
|
||||
} else {
|
||||
QmlDesignerWarning::show(tr("Cannot Start QML Puppet Executable"),
|
||||
tr("The executable of the QML Puppet process cannot be started or is hanging."));
|
||||
QmlDesignerWarning::show(tr("Cannot Start QML Emulation Layer (QML Puppet)"),
|
||||
tr("The executable of the QML emulation layer (QML Puppet) process cannot be started or is hanging."));
|
||||
|
||||
QmlDesignerPlugin::instance()->switchToTextModeDeferred();
|
||||
}
|
||||
@@ -384,8 +384,8 @@ void NodeInstanceServerProxy::processFinished(int exitCode, QProcess::ExitStatus
|
||||
if (m_captureFileForTest.isOpen()) {
|
||||
m_captureFileForTest.close();
|
||||
m_captureFileForTest.remove();
|
||||
QMessageBox::warning(Core::ICore::dialogParent(), tr("QML Puppet Crashed"),
|
||||
tr("You are recording a puppet stream and the puppet crashed. "
|
||||
QMessageBox::warning(Core::ICore::dialogParent(), tr("QML Emulation Layer (QML 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."));
|
||||
}
|
||||
|
||||
|
||||
@@ -184,16 +184,16 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
|
||||
}
|
||||
|
||||
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",
|
||||
"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."
|
||||
));
|
||||
}
|
||||
} else {
|
||||
QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Qt Version is not supported"),
|
||||
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. "
|
||||
"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"),
|
||||
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. "
|
||||
"Fix the kit configuration and restart Qt Creator. "
|
||||
"Otherwise, the fallback emulation layer, which does not support all features, will be used."
|
||||
|
||||
@@ -959,7 +959,7 @@ QString NodeMetaInfoPrivate::importDirectoryPath() const
|
||||
return importInfo.path();
|
||||
} else if (importInfo.type() == ImportType::Library) {
|
||||
if (modelManager) {
|
||||
foreach (const QString &importPath, modelManager->importPaths()) {
|
||||
foreach (const QString &importPath, model()->importPaths()) {
|
||||
const QString targetPath = QDir(importPath).filePath(importInfo.path());
|
||||
if (QDir(targetPath).exists())
|
||||
return targetPath;
|
||||
|
||||
@@ -61,20 +61,6 @@ static bool operator<(const QFileInfo &file1, const QFileInfo &file2)
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -413,6 +399,14 @@ Model *SubComponentManager::model() const
|
||||
return m_model.data();
|
||||
}
|
||||
|
||||
QStringList SubComponentManager::importPaths() const
|
||||
{
|
||||
if (model())
|
||||
return model()->importPaths();
|
||||
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class SubComponentManager
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user