Merge remote-tracking branch 'origin/4.2'

Change-Id: I3a54f679238e6eb4f053608286fc39eae3041561
This commit is contained in:
Eike Ziller
2016-10-17 16:22:04 +02:00
157 changed files with 4676 additions and 5430 deletions

View File

@@ -28,8 +28,7 @@
namespace ClangBackEnd {
LinePrefixer::LinePrefixer(const QByteArray &prefix)
: m_prefix(prefix),
m_previousIsEndingWithNewLine(true)
: m_prefix(prefix)
{}
void LinePrefixer::setPrefix(const QByteArray &prefix)

View File

@@ -43,7 +43,7 @@ public:
private:
QByteArray m_prefix;
bool m_previousIsEndingWithNewLine;
bool m_previousIsEndingWithNewLine = true;
};
} // namespace ClangBackEnd

View File

@@ -101,25 +101,22 @@ static inline std::string fixInnerType(const std::string &type,
// Return size from an STL vector (last/first iterators).
static inline int msvcStdVectorSize(const SymbolGroupValue &v)
{
// MSVC2012 has 2 base classes, MSVC2010 1, MSVC2008 none
if (const SymbolGroupValue myFirstPtrV = SymbolGroupValue::findMember(v, "_Myfirst")) {
if (const SymbolGroupValue myLastPtrV = myFirstPtrV.parent()["_Mylast"]) {
const ULONG64 firstPtr = myFirstPtrV.pointerValue();
const ULONG64 lastPtr = myLastPtrV.pointerValue();
if (!firstPtr || lastPtr < firstPtr)
return -1;
if (lastPtr == firstPtr)
return 0;
// Subtract the pointers: We need to do the pointer arithmetics ourselves
// as we get char *pointers.
const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(myFirstPtrV.type()), v);
const size_t size = SymbolGroupValue::sizeOf(innerType.c_str());
if (size == 0)
return -1;
return static_cast<int>((lastPtr - firstPtr) / size);
}
}
return -1;
const ULONG64 firstPtr = v.readPointerValueFromAncestor("_Myfirst");
const ULONG64 lastPtr = v.readPointerValueFromAncestor("_Mylast");
if (!firstPtr || lastPtr < firstPtr)
return -1;
const std::vector<std::string> innerTypes = v.innerTypes();
if (innerTypes.empty())
return -1;
const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(innerTypes[0]), v);
const size_t size = SymbolGroupValue::sizeOf(innerType.c_str());
if (size == 0)
return -1;
if (lastPtr == firstPtr)
return 0;
// Subtract the pointers: We need to do the pointer arithmetics ourselves
// as we get char *pointers.
return static_cast<int>((lastPtr - firstPtr) / size);
}
// Return size of container or -1
@@ -193,10 +190,12 @@ int containerSize(KnownType kt, const SymbolGroupValue &v)
case KT_StdMap:
case KT_StdMultiMap:
case KT_StdValArray:
case KT_StdList:
if (const SymbolGroupValue size = SymbolGroupValue::findMember(v, "_Mysize"))
return size.intValue();
case KT_StdList: {
const int size = v.readIntegerFromAncestor("_Mysize");
if (size >= 0)
return size;
break;
}
case KT_StdStack:
if (const SymbolGroupValue deque = v[unsigned(0)])
return containerSize(KT_StdDeque, deque);

View File

@@ -53,11 +53,30 @@ PyObject *lookupType(const std::string &typeNameIn)
{
std::string typeName = typeNameIn;
CIDebugSymbols *symbols = ExtensionCommandContext::instance()->symbols();
std::string fullTypeName = typeName;
// GetSymbolTypeId doesn't support pointer types so we need to strip off the '*' first
while (endsWith(typeName, '*'))
typeName.pop_back();
ULONG64 module;
ULONG typeId;
if (FAILED(symbols->GetSymbolTypeId(typeName.c_str(), &typeId, &module)))
Py_RETURN_NONE;
return createType(module, typeId);
if (typeName != fullTypeName) {
if (module == 0) { // found some builtin type like char so we take the first module available to look up the pointer type
ULONG loaded, unloaded;
if (FAILED(symbols->GetNumberModules(&loaded, &unloaded)))
Py_RETURN_NONE;
if ((loaded + unloaded == 0) || FAILED(symbols->GetModuleByIndex(0, &module)))
Py_RETURN_NONE;
}
if (FAILED(symbols->GetTypeId(module, fullTypeName.c_str(), &typeId)))
Py_RETURN_NONE;
}
size_t typeNameLength = fullTypeName.length();
char *cTypeName = new char[typeNameLength + 1];
fullTypeName.copy(cTypeName, fullTypeName.length());
cTypeName[typeNameLength] = 0;
return createType(module, typeId, cTypeName);
}
char *getTypeName(ULONG64 module, ULONG typeId)
@@ -93,7 +112,9 @@ PyObject *type_bitSize(Type *self)
{
ULONG size;
auto extcmd = ExtensionCommandContext::instance();
if (FAILED(extcmd->symbols()->GetTypeSize(self->m_module, self->m_typeId, &size)))
if (endsWith(getTypeName(self), '*'))
size = SUCCEEDED(ExtensionCommandContext::instance()->control()->IsPointer64Bit()) ? 8 : 4;
else if (FAILED(extcmd->symbols()->GetTypeSize(self->m_module, self->m_typeId, &size)))
return NULL;
return Py_BuildValue("k", size * 8);
}
@@ -143,13 +164,8 @@ PyObject *type_Target(Type *self)
Py_XINCREF(self);
return (PyObject *)self;
}
typeName = typeName.substr(0, typeName.length() - 1);
CIDebugSymbols *symbols = ExtensionCommandContext::instance()->symbols();
ULONG typeId;
if (FAILED(symbols->GetTypeId(self->m_module, typeName.c_str(), &typeId)))
return NULL;
return createType(self->m_module, typeId);
typeName.pop_back();
return lookupType(typeName);
}
PyObject *type_StripTypedef(Type *self)
@@ -241,7 +257,7 @@ PyObject *type_TemplateArgument(Type *self, PyObject *args)
if (innerTypes.size() <= index)
Py_RETURN_NONE;
const std::string &innerType = innerTypes.at(index);
const std::string &innerType = SymbolGroupValue::stripConst(innerTypes.at(index));
if (numeric) {
try {
return Py_BuildValue("i", std::stoi(innerType));
@@ -270,12 +286,12 @@ void type_Dealloc(Type *self)
delete[] self->m_name;
}
PyObject *createType(ULONG64 module, ULONG typeId)
PyObject *createType(ULONG64 module, ULONG typeId, char* name)
{
Type *type = PyObject_New(Type, type_pytype());
type->m_module = module;
type->m_typeId = typeId;
type->m_name = nullptr;
type->m_name = name;
return reinterpret_cast<PyObject *>(type);
}

View File

@@ -44,4 +44,4 @@ PyTypeObject *type_pytype();
char *getTypeName(ULONG64 module, ULONG typeId);
PyObject *lookupType(const std::string &typeName);
PyObject *createType(ULONG64 module, ULONG typeId);
PyObject *createType(ULONG64 module, ULONG typeId, char *name = nullptr);

View File

@@ -154,6 +154,15 @@ int SymbolGroupValue::readIntegerFromAncestor(const std::string &name, int defau
return readPODFromAncestor<int>(name, defaultValue);
}
ULONG64 SymbolGroupValue::offsetOfChild(const SymbolGroupValue &child) const
{
const ULONG64 base = isPointerType(type()) ? pointerValue() : address();
const ULONG64 childAddress = child.address();
if (base == 0 || childAddress == 0)
return 0;
return childAddress - base;
}
LONG64 SymbolGroupValue::offsetOfAncestor(const std::string &name) const
{
return infoOfAncestor(name).offset;
@@ -204,7 +213,7 @@ SymbolAncestorInfo SymbolGroupValue::infoOfAncestor(const std::string &name) con
continue;
info = child.infoOfAncestor(name);
if (info.isValid()) {
info.offset += offsetOfAncestor(child.name());
info.offset += offsetOfChild(child);
break;
}
}

View File

@@ -71,6 +71,7 @@ public:
SymbolGroupValue operator[](const char *name) const;
SymbolGroupValue operator[](unsigned) const;
unsigned childCount() const;
ULONG64 offsetOfChild(const SymbolGroupValue &child) const;
SymbolGroupValue parent() const;
// take address and cast to desired (pointer) type
SymbolGroupValue typeCast(const char *type) const;

View File

@@ -269,7 +269,8 @@ QStringList Environment::appendExeExtensions(const QString &executable) const
}
FileName Environment::searchInPath(const QString &executable,
const QStringList &additionalDirs) const
const QStringList &additionalDirs,
bool (*func)(const QString &name)) const
{
if (executable.isEmpty())
return FileName();
@@ -292,7 +293,7 @@ FileName Environment::searchInPath(const QString &executable,
continue;
alreadyChecked.insert(dir);
FileName tmp = searchInDirectory(execs, dir);
if (!tmp.isEmpty())
if (!tmp.isEmpty() && (!func || func(tmp.toString())))
return tmp;
}
@@ -304,7 +305,7 @@ FileName Environment::searchInPath(const QString &executable,
continue;
alreadyChecked.insert(p);
FileName tmp = searchInDirectory(execs, QDir::fromNativeSeparators(p));
if (!tmp.isEmpty())
if (!tmp.isEmpty() && (!func || func(tmp.toString())))
return tmp;
}
return FileName();

View File

@@ -100,7 +100,9 @@ public:
Environment::const_iterator constFind(const QString &name) const;
FileName searchInPath(const QString &executable,
const QStringList &additionalDirs = QStringList()) const;
const QStringList &additionalDirs = QStringList(),
bool (*func)(const QString &name) = nullptr) const;
QStringList path() const;
QStringList appendExeExtensions(const QString &executable) const;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 977 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 211 B

View File

@@ -38,11 +38,16 @@
<file>images/compile_error_taskbar@2x.png</file>
<file>images/dir.png</file>
<file>images/editcopy.png</file>
<file>images/editcopy@2x.png</file>
<file>images/editcut.png</file>
<file>images/editcut@2x.png</file>
<file>images/editpaste.png</file>
<file>images/editpaste@2x.png</file>
<file>images/empty14.png</file>
<file>images/filenew.png</file>
<file>images/filenew@2x.png</file>
<file>images/fileopen.png</file>
<file>images/fileopen@2x.png</file>
<file>images/filesave.png</file>
<file>images/filesave@2x.png</file>
<file>images/inputfield.png</file>

View File

@@ -64,10 +64,10 @@ const Icon BOOKMARK_TOOLBAR({
const Icon BOOKMARK_TEXTEDITOR({
{QLatin1String(":/utils/images/bookmark.png"), Theme::Bookmarks_TextMarkColor}}, Icon::Tint);
const Icon NEWFILE(
QLatin1String(":/utils/images/filenew.png"));
const Icon OPENFILE(
QLatin1String(":/utils/images/fileopen.png"));
const Icon NEWFILE({
{QLatin1String(":/utils/images/filenew.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon OPENFILE({
{QLatin1String(":/utils/images/fileopen.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon SAVEFILE({
{QLatin1String(":/utils/images/filesave.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon SAVEFILE_TOOLBAR({
@@ -76,12 +76,12 @@ const Icon UNDO({
{QLatin1String(":/utils/images/undo.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon REDO({
{QLatin1String(":/utils/images/redo.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon COPY(
QLatin1String(":/utils/images/editcopy.png"));
const Icon PASTE(
QLatin1String(":/utils/images/editpaste.png"));
const Icon CUT(
QLatin1String(":/utils/images/editcut.png"));
const Icon COPY({
{QLatin1String(":/utils/images/editcopy.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon PASTE({
{QLatin1String(":/utils/images/editpaste.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon CUT({
{QLatin1String(":/utils/images/editcut.png"), Theme::PanelTextColorMid}}, Icon::Tint);
const Icon DIR(
QLatin1String(":/utils/images/dir.png"));
const Icon RESET({

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>205</height>
<width>449</width>
<height>210</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,57 +17,44 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="runDisabledGTestsCB">
<property name="toolTip">
<string>Executes disabled tests when performing a test run.</string>
</property>
<property name="text">
<string>Run disabled tests</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="breakOnFailureCB">
<property name="toolTip">
<string>Turn failures into debugger breakpoints.</string>
</property>
<property name="text">
<string>Break on failure while debugging</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="repeatGTestsCB">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QCheckBox" name="breakOnFailureCB">
<property name="toolTip">
<string>Repeats a test run (you might be required to increase the timeout to avoid canceling the tests).</string>
<string>Turn failures into debugger breakpoints.</string>
</property>
<property name="text">
<string>Repeat tests</string>
<string>Break on failure while debugging</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="0">
<widget class="QCheckBox" name="runDisabledGTestsCB">
<property name="toolTip">
<string>Executes disabled tests when performing a test run.</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>Run disabled tests</string>
</property>
</spacer>
</widget>
</item>
<item>
<item row="4" column="0">
<widget class="QCheckBox" name="throwOnFailureCB">
<property name="toolTip">
<string>Turn assertion failures into C++ exceptions.</string>
</property>
<property name="text">
<string>Throw on failure</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -77,7 +64,27 @@
</property>
</widget>
</item>
<item>
<item row="3" column="0">
<widget class="QCheckBox" name="shuffleGTestsCB">
<property name="toolTip">
<string>Shuffle tests automatically on every iteration by the given seed.</string>
</property>
<property name="text">
<string>Shuffle tests</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="repeatGTestsCB">
<property name="toolTip">
<string>Repeats a test run (you might be required to increase the timeout to avoid canceling the tests).</string>
</property>
<property name="text">
<string>Repeat tests</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="repetitionSpin">
<property name="enabled">
<bool>false</bool>
@@ -90,50 +97,10 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="shuffleGTestsCB">
<property name="toolTip">
<string>Shuffle tests automatically on every iteration by the given seed.</string>
</property>
<property name="text">
<string>Shuffle tests</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<item row="3" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -143,7 +110,7 @@
</property>
</widget>
</item>
<item>
<item row="3" column="2">
<widget class="QSpinBox" name="seedSpin">
<property name="enabled">
<bool>false</bool>
@@ -159,31 +126,8 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="throwOnFailureCB">
<property name="toolTip">
<string>Turn assertion failures into C++ exceptions.</string>
</property>
<property name="text">
<string>Throw on failure</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@@ -36,9 +36,6 @@
<property name="title">
<string>Benchmark Metrics</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="walltimeRB">

View File

@@ -237,7 +237,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
int grandChildCount = child->childCount();
for (int grandChildRow = 0; grandChildRow < grandChildCount; ++grandChildRow) {
const TestTreeItem *grandChild = child->childItem(grandChildRow);
if (grandChild->type() != TestFunctionOrSet)
if (grandChild->checked() != Qt::Checked || grandChild->type() != TestFunctionOrSet)
continue;
testFunctions << child->name() + "::" + grandChild->name();
}

View File

@@ -15,7 +15,6 @@ QtcPlugin {
"bookmark.h",
"bookmarkmanager.cpp",
"bookmarkmanager.h",
"bookmarks.qrc",
"bookmarks_global.h",
"bookmarksplugin.cpp",
"bookmarksplugin.h",

View File

@@ -38,7 +38,6 @@
#include <QDir>
#include <QFile>
#include <QRegularExpression>
#include <QStringList>
using namespace ClangCodeModel;
@@ -100,7 +99,7 @@ public:
optionsBuilder.addPredefinedMacrosAndHeaderPathsOptions();
optionsBuilder.addWrappedQtHeadersIncludePath();
optionsBuilder.addHeaderPathOptions(/*addAsNativePath*/ true);
optionsBuilder.addHeaderPathOptions();
optionsBuilder.addProjectConfigFileInclude();
optionsBuilder.addMsvcCompatibilityVersion();
@@ -118,18 +117,12 @@ private:
bool excludeHeaderPath(const QString &path) const override
{
if (path.contains(QLatin1String("lib/gcc/i686-apple-darwin")))
return true;
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
if (path.contains(QLatin1String("lib/gcc/i686-apple-darwin")))
return true;
}
// We already provide a custom clang include path matching the used libclang version,
// so better ignore the clang include paths from the system as this might lead to an
// unfavorable order with regard to include_next.
static QRegularExpression clangIncludeDir(
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
if (clangIncludeDir.match(path).hasMatch())
return true;
return false;
return CompilerOptionsBuilder::excludeHeaderPath(path);
}
void addPredefinedMacrosAndHeaderPathsOptions()

View File

@@ -56,18 +56,12 @@ RefactoringCompilerOptionsBuilder::RefactoringCompilerOptionsBuilder(CppTools::P
bool RefactoringCompilerOptionsBuilder::excludeHeaderPath(const QString &path) const
{
if (path.contains(QLatin1String("lib/gcc/i686-apple-darwin")))
return true;
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
if (path.contains(QLatin1String("lib/gcc/i686-apple-darwin")))
return true;
}
// We already provide a custom clang include path matching the used libclang version,
// so better ignore the clang include paths from the system as this might lead to an
// unfavorable order with regard to include_next.
static QRegularExpression clangIncludeDir(
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
if (clangIncludeDir.match(path).hasMatch())
return true;
return false;
return CompilerOptionsBuilder::excludeHeaderPath(path);
}
void RefactoringCompilerOptionsBuilder::addPredefinedMacrosAndHeaderPathsOptions()

View File

@@ -34,7 +34,6 @@
#include <coreplugin/icore.h>
#include <QDir>
#include <QRegularExpression>
namespace ClangRefactoring {

View File

@@ -107,7 +107,8 @@ void ClangStaticAnalyzerPreconfiguredSessionTests::testPreconfiguredSession()
QSignalSpy waitUntilAnalyzerFinished(&m_analyzerTool, SIGNAL(finished(bool)));
QVERIFY(waitUntilAnalyzerFinished.wait(30000));
const QList<QVariant> arguments = waitUntilAnalyzerFinished.takeFirst();
QVERIFY(arguments.first().toBool());
const bool analyzerFinishedSuccessfully = arguments.first().toBool();
QVERIFY(analyzerFinishedSuccessfully);
QCOMPARE(m_analyzerTool.diagnostics().count(), 0);
}

View File

@@ -182,7 +182,7 @@ public:
const Core::Id type = projectPart.toolchainType;
if (type == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID
|| type == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID)
optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n");
optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED");
if (type != ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
optionsBuilder.addDefines(projectPart.toolchainDefines);

View File

@@ -63,7 +63,7 @@ static QStringList constructCommandLineArguments(const QString &filePath,
arguments
<< QLatin1String("--analyze")
<< QLatin1String("-o")
<< logFile
<< QDir::toNativeSeparators(logFile)
;
arguments += options;
arguments << QDir::toNativeSeparators(filePath);
@@ -80,7 +80,7 @@ ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecuta
const Utils::Environment &environment,
QObject *parent)
: QObject(parent)
, m_clangExecutable(clangExecutable)
, m_clangExecutable(QDir::toNativeSeparators(clangExecutable))
, m_clangLogFileDir(clangLogFileDir)
{
QTC_CHECK(!m_clangExecutable.isEmpty());

View File

@@ -1970,6 +1970,7 @@ void EditorManagerPrivate::autoSave()
if (!errors.isEmpty())
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
errors.join(QLatin1Char('\n')));
emit m_instance->autoSaved();
}
void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)

View File

@@ -185,6 +185,7 @@ signals:
void editorsClosed(QList<Core::IEditor *> editors);
void findOnFileSystemRequest(const QString &path);
void aboutToSave(IDocument *document);
void autoSaved();
public slots:
static void saveDocument();

View File

@@ -68,11 +68,6 @@ void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBac
m_cancelButtonCallBack = callBack;
}
void InfoBarEntry::setSuppressionButtonInfo(InfoBarEntry::CallBack callback)
{
m_suppressionButtonCallBack = callback;
}
void InfoBarEntry::setShowDefaultCancelButton(bool yesno)
{
m_showDefaultCancelButton = yesno;
@@ -282,9 +277,7 @@ void InfoBarDisplay::update()
if (info.globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) {
infoWidgetSuppressButton = new QToolButton;
infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, info, id] {
if (info.m_suppressionButtonCallBack)
info.m_suppressionButtonCallBack();
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] {
m_infoBar->removeInfo(id);
InfoBar::globallySuppressInfo(id);
});

View File

@@ -58,7 +58,6 @@ public:
void setCustomButtonInfo(const QString &_buttonText, CallBack callBack);
void setCancelButtonInfo(CallBack callBack);
void setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack);
void setSuppressionButtonInfo(CallBack callback);
void setShowDefaultCancelButton(bool yesno);
using DetailsWidgetCreator = std::function<QWidget*()>;
@@ -71,7 +70,6 @@ private:
CallBack m_buttonCallBack;
QString cancelButtonText;
CallBack m_cancelButtonCallBack;
CallBack m_suppressionButtonCallBack;
GlobalSuppressionMode globalSuppression;
DetailsWidgetCreator m_detailsWidgetCreator;
bool m_showDefaultCancelButton = true;

View File

@@ -56,6 +56,7 @@
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cpptoolsplugin.h>
#include <cpptools/cpptoolsreuse.h>
#include <cpptools/cpptoolssettings.h>
#include <cpptools/cppworkingcopy.h>
#include <cpptools/symbolfinder.h>
#include <cpptools/refactoringengineinterface.h>
@@ -130,7 +131,7 @@ public:
QScopedPointer<FollowSymbolUnderCursor> m_followSymbolUnderCursor;
QToolButton *m_preprocessorButton = nullptr;
QToolButton *m_headerErrorsIndicatorButton = nullptr;
QAction *m_headerErrorsIndicatorAction = nullptr;
CppSelectionChanger m_cppSelectionChanger;
@@ -229,15 +230,20 @@ void CppEditorWidget::finalizeInitialization()
connect(cmd, &Command::keySequenceChanged, this, &CppEditorWidget::updatePreprocessorButtonTooltip);
updatePreprocessorButtonTooltip();
connect(d->m_preprocessorButton, &QAbstractButton::clicked, this, &CppEditorWidget::showPreProcessorWidget);
d->m_headerErrorsIndicatorButton = new QToolButton(this);
d->m_headerErrorsIndicatorButton->setIcon(Utils::Icons::WARNING_TOOLBAR.pixmap());
connect(d->m_headerErrorsIndicatorButton, &QAbstractButton::clicked,
this, &CppEditorWidget::showHeaderErrorInfoBar);
d->m_headerErrorsIndicatorButton->setEnabled(false);
insertExtraToolBarWidget(TextEditorWidget::Left, d->m_preprocessorButton);
insertExtraToolBarWidget(TextEditorWidget::Left, d->m_headerErrorsIndicatorButton);
auto *headerErrorsIndicatorButton = new QToolButton(this);
headerErrorsIndicatorButton->setToolTip(tr("Show First Error in Included Files"));
headerErrorsIndicatorButton->setIcon(Utils::Icons::WARNING_TOOLBAR.pixmap());
connect(headerErrorsIndicatorButton, &QAbstractButton::clicked, []() {
CppToolsSettings::instance()->setShowHeaderErrorInfoBar(true);
});
d->m_headerErrorsIndicatorAction = insertExtraToolBarWidget(TextEditorWidget::Left,
headerErrorsIndicatorButton);
d->m_headerErrorsIndicatorAction->setVisible(false);
connect(CppToolsSettings::instance(), &CppToolsSettings::showHeaderErrorInfoBarChanged,
this, &CppEditorWidget::updateHeaderErrorWidgets);
insertExtraToolBarWidget(TextEditorWidget::Left, d->m_cppEditorOutline->widget());
}
@@ -252,6 +258,10 @@ void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *o
d->m_cppEditorOutline->update();
const Id selectionKind = CodeWarningsSelection;
setExtraSelections(selectionKind, cppEditorWidget->extraSelections(selectionKind));
d->m_headerErrorDiagnosticWidgetCreator
= cppEditorWidget->d->m_headerErrorDiagnosticWidgetCreator;
updateHeaderErrorWidgets();
}
CppEditorWidget::~CppEditorWidget()
@@ -329,13 +339,14 @@ void CppEditorWidget::updateHeaderErrorWidgets()
infoBar->removeInfo(id);
if (d->m_headerErrorDiagnosticWidgetCreator) {
if (infoBar->canInfoBeAdded(id)) {
addHeaderErrorInfoBarEntryAndHideIndicator();
if (CppToolsSettings::instance()->showHeaderErrorInfoBar()) {
addHeaderErrorInfoBarEntry();
d->m_headerErrorsIndicatorAction->setVisible(false);
} else {
d->m_headerErrorsIndicatorButton->setEnabled(true);
d->m_headerErrorsIndicatorAction->setVisible(true);
}
} else {
d->m_headerErrorsIndicatorButton->setEnabled(false);
d->m_headerErrorsIndicatorAction->setVisible(false);
}
}
@@ -434,23 +445,20 @@ void CppEditorWidget::renameSymbolUnderCursorBuiltin()
renameUsages(); // Rename non-local symbol or macro
}
void CppEditorWidget::addHeaderErrorInfoBarEntryAndHideIndicator() const
void CppEditorWidget::addHeaderErrorInfoBarEntry() const
{
InfoBarEntry info(Constants::ERRORS_IN_HEADER_FILES,
tr("<b>Warning</b>: The code model could not parse an included file, "
"which might lead to slow or incorrect code completion and "
"highlighting, for example."),
InfoBarEntry::GlobalSuppressionEnabled);
"highlighting, for example."));
info.setDetailsWidgetCreator(d->m_headerErrorDiagnosticWidgetCreator);
info.setShowDefaultCancelButton(false);
info.setSuppressionButtonInfo([this](){
d->m_headerErrorsIndicatorButton->setEnabled(true);
info.setCustomButtonInfo("Minimize", [](){
CppToolsSettings::instance()->setShowHeaderErrorInfoBar(false);
});
InfoBar *infoBar = textDocument()->infoBar();
infoBar->addInfo(info);
d->m_headerErrorsIndicatorButton->setEnabled(false);
}
namespace {
@@ -1024,14 +1032,5 @@ void CppEditorWidget::showPreProcessorWidget()
}
}
void CppEditorWidget::showHeaderErrorInfoBar()
{
const Id id(Constants::ERRORS_IN_HEADER_FILES);
QTC_CHECK(!textDocument()->infoBar()->canInfoBeAdded(id));
InfoBar::globallyUnsuppressInfo(id);
addHeaderErrorInfoBarEntryAndHideIndicator();
}
} // namespace Internal
} // namespace CppEditor

View File

@@ -31,10 +31,6 @@
#include <QScopedPointer>
namespace Core {
class InfoBarEntry;
}
namespace CppTools {
class CppEditorOutline;
class RefactoringEngineInterface;
@@ -91,7 +87,6 @@ public:
void switchDeclarationDefinition(bool inNextSplit);
void showPreProcessorWidget();
void showHeaderErrorInfoBar();
void findUsages();
void renameSymbolUnderCursor();
@@ -150,7 +145,7 @@ private:
void renameSymbolUnderCursorClang();
void renameSymbolUnderCursorBuiltin();
void addHeaderErrorInfoBarEntryAndHideIndicator() const;
void addHeaderErrorInfoBarEntry() const;
CppTools::ProjectPart *projectPart() const;

View File

@@ -28,6 +28,7 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <QDir>
#include <QRegularExpression>
namespace CppTools {
@@ -100,7 +101,7 @@ void CompilerOptionsBuilder::enableExceptions()
add(QLatin1String("-fexceptions"));
}
void CompilerOptionsBuilder::addHeaderPathOptions(bool addAsNativePath)
void CompilerOptionsBuilder::addHeaderPathOptions()
{
typedef ProjectPartHeaderPath HeaderPath;
const QString defaultPrefix = includeOption();
@@ -126,10 +127,7 @@ void CompilerOptionsBuilder::addHeaderPathOptions(bool addAsNativePath)
break;
}
QString path = prefix + headerPath.path;
path = addAsNativePath ? QDir::toNativeSeparators(path) : path;
result.append(path);
result.append(prefix + QDir::toNativeSeparators(headerPath.path));
}
m_options.append(result);
@@ -393,7 +391,15 @@ bool CompilerOptionsBuilder::excludeDefineLine(const QByteArray &defineLine) con
bool CompilerOptionsBuilder::excludeHeaderPath(const QString &headerPath) const
{
Q_UNUSED(headerPath);
// A clang tool chain might have another version and passing in the
// intrinsics path from that version will lead to errors (unknown
// intrinsics, unfavorable order with regard to include_next).
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
static QRegularExpression clangIncludeDir(
QLatin1String("\\A.*/lib/clang/\\d+\\.\\d+(\\.\\d+)?/include\\z"));
return clangIncludeDir.match(headerPath).hasMatch();
}
return false;
}

View File

@@ -46,7 +46,7 @@ public:
// Add options based on project part
virtual void addTargetTriple();
virtual void enableExceptions();
void addHeaderPathOptions(bool addAsNativePath = false);
void addHeaderPathOptions();
void addToolchainAndProjectDefines();
void addDefines(const QByteArray &defineDirectives);
virtual void addLanguageOption(ProjectFile::Kind fileKind);

View File

@@ -49,6 +49,7 @@ const char CPPTOOLS_SETTINGSGROUP[] = "CppTools";
const char LOWERCASE_CPPFILES_KEY[] = "LowerCaseFiles";
enum { lowerCaseFilesDefault = 1 };
const char CPPTOOLS_SORT_EDITOR_DOCUMENT_OUTLINE[] = "SortedMethodOverview";
const char CPPTOOLS_SHOW_INFO_BAR_FOR_HEADER_ERRORS[] = "ShowInfoBarForHeaderErrors";
const char CPPTOOLS_MODEL_MANAGER_PCH_USAGE[] = "PCHUsage";
const char CPPTOOLS_SKIP_INDEXING_BIG_FILES[] = "SkipIndexingBigFiles";
const char CPPTOOLS_INDEXER_FILE_SIZE_LIMIT[] = "IndexerFileSizeLimit";

View File

@@ -267,3 +267,21 @@ void CppToolsSettings::setSortedEditorDocumentOutline(bool sorted)
ICore::settings()->setValue(sortEditorDocumentOutlineKey(), sorted);
emit editorDocumentOutlineSortingChanged(sorted);
}
static QString showHeaderErrorInfoBarKey()
{
return QLatin1String(CppTools::Constants::CPPTOOLS_SETTINGSGROUP)
+ QLatin1Char('/')
+ QLatin1String(CppTools::Constants::CPPTOOLS_SHOW_INFO_BAR_FOR_HEADER_ERRORS);
}
bool CppToolsSettings::showHeaderErrorInfoBar() const
{
return ICore::settings()->value(showHeaderErrorInfoBarKey(), true).toBool();
}
void CppToolsSettings::setShowHeaderErrorInfoBar(bool show)
{
ICore::settings()->setValue(showHeaderErrorInfoBarKey(), show);
emit showHeaderErrorInfoBarChanged(show);
}

View File

@@ -63,8 +63,12 @@ public:
bool sortedEditorDocumentOutline() const;
void setSortedEditorDocumentOutline(bool sorted);
bool showHeaderErrorInfoBar() const;
void setShowHeaderErrorInfoBar(bool show);
signals:
void editorDocumentOutlineSortingChanged(bool isSorted);
void showHeaderErrorInfoBarChanged(bool isShown);
private:
Internal::CppToolsSettingsPrivate *d;

View File

@@ -2374,6 +2374,7 @@ void QmlEnginePrivate::insertSubItems(WatchItem *parent, const QVariantList &pro
QTC_ASSERT(parent, return);
LookupItems itemsToLookup;
const QSet<QString> expandedINames = engine->watchHandler()->expandedINames();
foreach (const QVariant &property, properties) {
QmlV8ObjectData propertyData = extractData(property);
auto item = new WatchItem;
@@ -2395,7 +2396,7 @@ void QmlEnginePrivate::insertSubItems(WatchItem *parent, const QVariantList &pro
item->id = propertyData.handle;
item->type = propertyData.type;
item->value = propertyData.value.toString();
if (item->type.isEmpty())
if (item->type.isEmpty() || expandedINames.contains(item->iname))
itemsToLookup.insert(propertyData.handle, {item->iname, item->name, item->exp});
item->setHasChildren(propertyData.properties.count() > 0);
parent->appendChild(item);

View File

@@ -33,7 +33,8 @@ HEADERS += \
iosdeploystep.h \
iosdeploystepfactory.h \
iosdeploystepwidget.h \
iosanalyzesupport.h
iosanalyzesupport.h \
simulatorcontrol.h
SOURCES += \
@@ -61,7 +62,8 @@ SOURCES += \
iosdeploystep.cpp \
iosdeploystepfactory.cpp \
iosdeploystepwidget.cpp \
iosanalyzesupport.cpp
iosanalyzesupport.cpp \
simulatorcontrol.cpp
FORMS += \
iossettingswidget.ui \

View File

@@ -69,6 +69,8 @@ QtcPlugin {
"iossimulatorfactory.cpp",
"iossimulatorfactory.h",
"iostoolhandler.cpp",
"iostoolhandler.h"
"iostoolhandler.h",
"simulatorcontrol.cpp",
"simulatorcontrol.h"
]
}

View File

@@ -27,6 +27,7 @@
#include "iosconstants.h"
#include "iosdevice.h"
#include "iossimulator.h"
#include "simulatorcontrol.h"
#include "iosprobe.h"
#include <coreplugin/icore.h>
@@ -332,7 +333,7 @@ void IosConfigurations::updateSimulators()
dev = IDevice::ConstPtr(new IosSimulator(devId));
devManager->addDevice(dev);
}
IosSimulator::updateAvailableDevices();
SimulatorControl::updateAvailableSimulators();
}
void IosConfigurations::setDeveloperPath(const FileName &devPath)

View File

@@ -169,6 +169,8 @@ IosDebugSupport::IosDebugSupport(IosRunConfiguration *runConfig,
m_runner, &IosRunner::start);
connect(m_runControl, &RunControl::finished,
m_runner, &IosRunner::stop);
connect(m_runControl, &DebuggerRunControl::stateChanged,
m_runner, &IosRunner::debuggerStateChanged);
connect(m_runner, &IosRunner::gotServerPorts,
this, &IosDebugSupport::handleServerPorts);

View File

@@ -101,7 +101,12 @@ bool IosDeployStep::init(QList<const BuildStep *> &earlierSteps)
this->target()->activeRunConfiguration());
QTC_ASSERT(runConfig, return false);
m_bundlePath = runConfig->bundleDirectory().toString();
if (m_device.isNull()) {
if (iosdevice()) {
m_deviceType = IosDeviceType(IosDeviceType::IosDevice, deviceId());
} else if (iossimulator()) {
m_deviceType = runConfig->deviceType();
} else {
emit addOutput(tr("Error: no device available, deploy failed."),
BuildStep::ErrorMessageOutput);
return false;
@@ -113,17 +118,15 @@ void IosDeployStep::run(QFutureInterface<bool> &fi)
{
m_futureInterface = fi;
QTC_CHECK(m_transferStatus == NoTransfer);
if (iosdevice().isNull()) {
if (iossimulator().isNull())
TaskHub::addTask(Task::Error, tr("Deployment failed. No iOS device found."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
if (device().isNull()) {
TaskHub::addTask(Task::Error, tr("Deployment failed. No iOS device found."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
reportRunResult(m_futureInterface, !iossimulator().isNull());
cleanup();
return;
}
m_toolHandler = new IosToolHandler(m_deviceType, this);
m_transferStatus = TransferInProgress;
QTC_CHECK(m_toolHandler == 0);
m_toolHandler = new IosToolHandler(IosDeviceType(IosDeviceType::IosDevice), this);
m_futureInterface.setProgressRange(0, 200);
m_futureInterface.setProgressValueAndText(0, QLatin1String("Transferring application"));
m_futureInterface.reportStarted();
@@ -136,7 +139,7 @@ void IosDeployStep::run(QFutureInterface<bool> &fi)
connect(m_toolHandler, &IosToolHandler::errorMsg,
this, &IosDeployStep::handleErrorMsg);
checkProvisioningProfile();
m_toolHandler->requestTransferApp(appBundle(), deviceId());
m_toolHandler->requestTransferApp(appBundle(), m_deviceType.identifier);
}
void IosDeployStep::cancel()
@@ -150,7 +153,7 @@ void IosDeployStep::cleanup()
QTC_CHECK(m_transferStatus != TransferInProgress);
m_transferStatus = NoTransfer;
m_device.clear();
m_toolHandler = 0;
m_toolHandler = nullptr;
m_expectFail = false;
}

View File

@@ -101,6 +101,7 @@ private:
QFutureInterface<bool> m_futureInterface;
ProjectExplorer::IDevice::ConstPtr m_device;
QString m_bundlePath;
IosDeviceType m_deviceType;
static const Core::Id Id;
bool m_expectFail;
};

View File

@@ -27,6 +27,7 @@
#include "iosconstants.h"
#include "iosmanager.h"
#include "iosdeploystep.h"
#include "simulatorcontrol.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
@@ -346,7 +347,7 @@ IosDeviceType IosRunConfiguration::deviceType() const
{
QList<IosDeviceType> availableSimulators;
if (m_deviceType.type == IosDeviceType::SimulatedDevice)
availableSimulators = IosSimulator::availableDevices();
availableSimulators = SimulatorControl::availableSimulators();
if (!availableSimulators.isEmpty()) {
QList<IosDeviceType> elegibleDevices;
QString devname = m_deviceType.identifier.split(QLatin1Char(',')).value(0);
@@ -417,7 +418,7 @@ void IosRunConfigurationWidget::updateValues()
m_deviceTypeLabel->setVisible(showDeviceSelector);
m_deviceTypeComboBox->setVisible(showDeviceSelector);
if (showDeviceSelector && m_deviceTypeModel.rowCount() == 0) {
foreach (const IosDeviceType &dType, IosSimulator::availableDevices()) {
foreach (const IosDeviceType &dType, SimulatorControl::availableSimulators()) {
QStandardItem *item = new QStandardItem(dType.displayName);
QVariant v;
v.setValue(dType);

View File

@@ -168,6 +168,12 @@ void IosRunner::stop()
}
}
void IosRunner::debuggerStateChanged(Debugger::DebuggerState state)
{
if (m_toolHandler)
m_toolHandler->debuggerStateChanged(state);
}
void IosRunner::handleDidStartApp(IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, IosToolHandler::OpStatus status)
{

View File

@@ -29,6 +29,7 @@
#include "iostoolhandler.h"
#include "iossimulator.h"
#include <debugger/debuggerconstants.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
@@ -64,6 +65,9 @@ public:
void start();
void stop();
public slots:
void debuggerStateChanged(Debugger::DebuggerState state);
signals:
void didStartApp(Ios::IosToolHandler::OpStatus status);
void gotServerPorts(Utils::Port gdbPort, Utils::Port qmlPort);

View File

@@ -45,9 +45,6 @@ static const QLatin1String iosDeviceTypeDisplayNameKey = QLatin1String("displayN
static const QLatin1String iosDeviceTypeTypeKey = QLatin1String("type");
static const QLatin1String iosDeviceTypeIdentifierKey = QLatin1String("identifier");
QMutex IosSimulator::_mutex;
QList<IosDeviceType> IosSimulator::_availableDevices;
IosSimulator::IosSimulator(Core::Id id)
: IDevice(Core::Id(Constants::IOS_SIMULATOR_TYPE),
IDevice::AutoDetected,
@@ -124,48 +121,6 @@ IDevice::Ptr IosSimulator::clone() const
return IDevice::Ptr(new IosSimulator(*this));
}
QList<IosDeviceType> IosSimulator::availableDevices()
{
QMutexLocker l(&_mutex);
return _availableDevices;
}
void IosSimulator::setAvailableDevices(QList<IosDeviceType> value)
{
QMutexLocker l(&_mutex);
_availableDevices = value;
}
namespace {
void handleDeviceInfo(Ios::IosToolHandler *handler, const QString &deviceId,
const Ios::IosToolHandler::Dict &info)
{
Q_UNUSED(deviceId);
QList<IosDeviceType> res;
QMapIterator<QString, QString> i(info);
while (i.hasNext()) {
i.next();
IosDeviceType simulatorType(IosDeviceType::SimulatedDevice);
simulatorType.displayName = i.value();
simulatorType.identifier = i.key();
QStringList ids = i.key().split(QLatin1Char(','));
if (ids.length() > 1)
simulatorType.displayName += QLatin1String(", iOS ") + ids.last().trimmed();
res.append(simulatorType);
}
handler->deleteLater();
std::stable_sort(res.begin(), res.end());
IosSimulator::setAvailableDevices(res);
}
}
void IosSimulator::updateAvailableDevices()
{
IosToolHandler *toolHandler = new IosToolHandler(IosDeviceType(IosDeviceType::SimulatedDevice));
QObject::connect(toolHandler, &IosToolHandler::deviceInfo, &handleDeviceInfo);
toolHandler->requestDeviceInfo(QString());
}
void IosSimulator::fromMap(const QVariantMap &map)
{
IDevice::fromMap(map);

View File

@@ -67,10 +67,6 @@ public:
typedef QSharedPointer<IosSimulator> Ptr;
ProjectExplorer::IDevice::DeviceInfo deviceInformation() const override;
static QList<IosDeviceType> availableDevices();
static void setAvailableDevices(QList<IosDeviceType> value);
static void updateAvailableDevices();
QString displayType() const override;
ProjectExplorer::IDeviceWidget *createWidget() override;
QList<Core::Id> actionIds() const override;
@@ -91,8 +87,6 @@ protected:
IosSimulator(const IosSimulator &other);
private:
mutable quint16 m_lastPort;
static QMutex _mutex;
static QList<IosDeviceType> _availableDevices;
};
namespace IosKitInformation {

View File

@@ -27,13 +27,18 @@
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iossimulator.h"
#include "simulatorcontrol.h"
#include "debugger/debuggerconstants.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
#include <QCoreApplication>
#include <QFileInfo>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QList>
#include <QLoggingCategory>
#include <QProcess>
@@ -52,6 +57,8 @@ namespace Ios {
namespace Internal {
using namespace std::placeholders;
struct ParserState {
enum Kind {
Msg,
@@ -132,7 +139,8 @@ public:
virtual void requestDeviceInfo(const QString &deviceId, int timeout = 1000) = 0;
bool isRunning();
void start(const QString &exe, const QStringList &args);
void stop(int errorCode);
virtual void stop(int errorCode) = 0;
virtual void debuggerStateChanged(Debugger::DebuggerState state) { Q_UNUSED(state); }
// signals
void isTransferringApp(const QString &bundlePath, const QString &deviceId, int progress,
@@ -148,15 +156,12 @@ public:
void appOutput(const QString &output);
void errorMsg(const QString &msg);
void toolExited(int code);
// slots
void subprocessError(QProcess::ProcessError error);
void subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void subprocessHasData();
void killProcess();
virtual bool expectsFileDescriptor() = 0;
protected:
void processXml();
protected:
void killProcess();
protected:
IosToolHandler *q;
QProcess *process;
QTimer killTimer;
@@ -176,34 +181,56 @@ class IosDeviceToolHandlerPrivate : public IosToolHandlerPrivate
{
public:
explicit IosDeviceToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q);
virtual void requestTransferApp(const QString &bundlePath, const QString &deviceId,
int timeout = 1000);
virtual void requestRunApp(const QString &bundlePath, const QStringList &extraArgs,
IosToolHandler::RunKind runKind,
const QString &deviceId, int timeout = 1000);
virtual void requestDeviceInfo(const QString &deviceId, int timeout = 1000);
virtual bool expectsFileDescriptor();
// IosToolHandlerPrivate overrides
public:
void requestTransferApp(const QString &bundlePath, const QString &deviceId,
int timeout = 1000) override;
void requestRunApp(const QString &bundlePath, const QStringList &extraArgs,
IosToolHandler::RunKind runKind,
const QString &deviceId, int timeout = 1000) override;
void requestDeviceInfo(const QString &deviceId, int timeout = 1000) override;
void stop(int errorCode) override;
private:
void subprocessError(QProcess::ProcessError error);
void subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void subprocessHasData();
void processXml();
};
class IosSimulatorToolHandlerPrivate : public IosToolHandlerPrivate
{
public:
explicit IosSimulatorToolHandlerPrivate(const IosDeviceType &devType, IosToolHandler *q);
virtual void requestTransferApp(const QString &bundlePath, const QString &deviceId,
int timeout = 1000);
virtual void requestRunApp(const QString &bundlePath, const QStringList &extraArgs,
IosToolHandler::RunKind runKind,
const QString &deviceId, int timeout = 1000);
virtual void requestDeviceInfo(const QString &deviceId, int timeout = 1000);
virtual bool expectsFileDescriptor();
// IosToolHandlerPrivate overrides
public:
void requestTransferApp(const QString &bundlePath, const QString &deviceIdentifier,
int timeout = 1000) override;
void requestRunApp(const QString &bundlePath, const QStringList &extraArgs,
IosToolHandler::RunKind runKind,
const QString &deviceIdentifier, int timeout = 1000) override;
void requestDeviceInfo(const QString &deviceId, int timeout = 1000) override;
void stop(int errorCode) override;
void debuggerStateChanged(Debugger::DebuggerState state) override;
private:
void addDeviceArguments(QStringList &args) const;
void simAppProcessError(QProcess::ProcessError error);
void simAppProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void simAppProcessHasData();
void simAppProcessHasErrorOutput();
void launchAppOnSimulator();
private:
qint64 appPId = -1;
bool appLaunched = false;
};
IosToolHandlerPrivate::IosToolHandlerPrivate(const IosDeviceType &devType,
Ios::IosToolHandler *q) :
q(q),
process(new QProcess),
process(nullptr),
state(NonStarted),
devType(devType),
iBegin(0),
@@ -211,34 +238,6 @@ IosToolHandlerPrivate::IosToolHandlerPrivate(const IosDeviceType &devType,
gdbSocket(-1)
{
killTimer.setSingleShot(true);
QProcessEnvironment env(QProcessEnvironment::systemEnvironment());
foreach (const QString &k, env.keys())
if (k.startsWith(QLatin1String("DYLD_")))
env.remove(k);
QStringList frameworkPaths;
Utils::FileName xcPath = IosConfigurations::developerPath();
QString privateFPath = xcPath.appendPath(QLatin1String("Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks")).toFileInfo().canonicalFilePath();
if (!privateFPath.isEmpty())
frameworkPaths << privateFPath;
QString otherFPath = xcPath.appendPath(QLatin1String("../OtherFrameworks")).toFileInfo().canonicalFilePath();
if (!otherFPath.isEmpty())
frameworkPaths << otherFPath;
QString sharedFPath = xcPath.appendPath(QLatin1String("../SharedFrameworks")).toFileInfo().canonicalFilePath();
if (!sharedFPath.isEmpty())
frameworkPaths << sharedFPath;
frameworkPaths << QLatin1String("/System/Library/Frameworks")
<< QLatin1String("/System/Library/PrivateFrameworks");
env.insert(QLatin1String("DYLD_FALLBACK_FRAMEWORK_PATH"), frameworkPaths.join(QLatin1Char(':')));
qCDebug(toolHandlerLog) << "IosToolHandler runEnv:" << env.toStringList();
process->setProcessEnvironment(env);
QObject::connect(process, &QProcess::readyReadStandardOutput,
q, &IosToolHandler::subprocessHasData);
QObject::connect(process,
static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
q, &IosToolHandler::subprocessFinished);
QObject::connect(process, &QProcess::errorOccurred, q, &IosToolHandler::subprocessError);
QObject::connect(&killTimer, &QTimer::timeout,
q, &IosToolHandler::killProcess);
}
IosToolHandlerPrivate::~IosToolHandlerPrivate()
@@ -258,6 +257,7 @@ bool IosToolHandlerPrivate::isRunning()
void IosToolHandlerPrivate::start(const QString &exe, const QStringList &args)
{
Q_ASSERT(process);
QTC_CHECK(state == NonStarted);
state = Starting;
qCDebug(toolHandlerLog) << "running " << exe << args;
@@ -265,44 +265,6 @@ void IosToolHandlerPrivate::start(const QString &exe, const QStringList &args)
state = StartedInferior;
}
void IosToolHandlerPrivate::stop(int errorCode)
{
qCDebug(toolHandlerLog) << "IosToolHandlerPrivate::stop";
State oldState = state;
state = Stopped;
switch (oldState) {
case NonStarted:
qCWarning(toolHandlerLog) << "IosToolHandler::stop() when state was NonStarted";
// pass
case Starting:
switch (op){
case OpNone:
qCWarning(toolHandlerLog) << "IosToolHandler::stop() when op was OpNone";
break;
case OpAppTransfer:
didTransferApp(bundlePath, deviceId, IosToolHandler::Failure);
break;
case OpAppRun:
didStartApp(bundlePath, deviceId, IosToolHandler::Failure);
break;
case OpDeviceInfo:
break;
}
// pass
case StartedInferior:
case XmlEndProcessed:
toolExited(errorCode);
break;
case Stopped:
return;
}
if (isRunning()) {
process->write("k\n\r");
process->closeWriteChannel();
killTimer.start(1500);
}
}
// signals
void IosToolHandlerPrivate::isTransferringApp(const QString &bundlePath, const QString &deviceId,
int progress, int maxProgress, const QString &info)
@@ -355,7 +317,7 @@ void IosToolHandlerPrivate::toolExited(int code)
emit q->toolExited(q, code);
}
void IosToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
void IosDeviceToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
{
if (state != Stopped)
errorMsg(IosToolHandler::tr("iOS tool Error %1").arg(error));
@@ -366,7 +328,7 @@ void IosToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
}
}
void IosToolHandlerPrivate::subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus)
void IosDeviceToolHandlerPrivate::subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
stop((exitStatus == QProcess::NormalExit) ? exitCode : -1 );
qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
@@ -374,7 +336,7 @@ void IosToolHandlerPrivate::subprocessFinished(int exitCode, QProcess::ExitStatu
emit q->finished(q);
}
void IosToolHandlerPrivate::processXml()
void IosDeviceToolHandlerPrivate::processXml()
{
while (!outputParser.atEnd()) {
QXmlStreamReader::TokenType tt = outputParser.readNext();
@@ -556,7 +518,7 @@ void IosToolHandlerPrivate::processXml()
}
}
void IosToolHandlerPrivate::subprocessHasData()
void IosDeviceToolHandlerPrivate::subprocessHasData()
{
qCDebug(toolHandlerLog) << "subprocessHasData, state:" << state;
while (true) {
@@ -596,7 +558,42 @@ void IosToolHandlerPrivate::subprocessHasData()
IosDeviceToolHandlerPrivate::IosDeviceToolHandlerPrivate(const IosDeviceType &devType,
IosToolHandler *q)
: IosToolHandlerPrivate(devType, q)
{ }
{
process = new QProcess;
// Prepare & set process Environment.
QProcessEnvironment env(QProcessEnvironment::systemEnvironment());
foreach (const QString &k, env.keys())
if (k.startsWith(QLatin1String("DYLD_")))
env.remove(k);
QStringList frameworkPaths;
Utils::FileName xcPath = IosConfigurations::developerPath();
QString privateFPath = xcPath.appendPath(QLatin1String("Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks")).toFileInfo().canonicalFilePath();
if (!privateFPath.isEmpty())
frameworkPaths << privateFPath;
QString otherFPath = xcPath.appendPath(QLatin1String("../OtherFrameworks")).toFileInfo().canonicalFilePath();
if (!otherFPath.isEmpty())
frameworkPaths << otherFPath;
QString sharedFPath = xcPath.appendPath(QLatin1String("../SharedFrameworks")).toFileInfo().canonicalFilePath();
if (!sharedFPath.isEmpty())
frameworkPaths << sharedFPath;
frameworkPaths << QLatin1String("/System/Library/Frameworks")
<< QLatin1String("/System/Library/PrivateFrameworks");
env.insert(QLatin1String("DYLD_FALLBACK_FRAMEWORK_PATH"), frameworkPaths.join(QLatin1Char(':')));
qCDebug(toolHandlerLog) << "IosToolHandler runEnv:" << env.toStringList();
process->setProcessEnvironment(env);
QObject::connect(process, &QProcess::readyReadStandardOutput,
std::bind(&IosDeviceToolHandlerPrivate::subprocessHasData,this));
QObject::connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
std::bind(&IosDeviceToolHandlerPrivate::subprocessFinished,this, _1,_2));
QObject::connect(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
std::bind(&IosDeviceToolHandlerPrivate::subprocessError, this, _1));
QObject::connect(&killTimer, &QTimer::timeout, std::bind(&IosDeviceToolHandlerPrivate::killProcess, this));
}
void IosDeviceToolHandlerPrivate::requestTransferApp(const QString &bundlePath,
const QString &deviceId, int timeout)
@@ -644,11 +641,46 @@ void IosDeviceToolHandlerPrivate::requestDeviceInfo(const QString &deviceId, int
start(IosToolHandler::iosDeviceToolPath(), args);
}
bool IosDeviceToolHandlerPrivate::expectsFileDescriptor()
void IosDeviceToolHandlerPrivate::stop(int errorCode)
{
return op == OpAppRun && runKind == IosToolHandler::DebugRun;
qCDebug(toolHandlerLog) << "IosToolHandlerPrivate::stop";
State oldState = state;
state = Stopped;
switch (oldState) {
case NonStarted:
qCWarning(toolHandlerLog) << "IosToolHandler::stop() when state was NonStarted";
// pass
case Starting:
switch (op){
case OpNone:
qCWarning(toolHandlerLog) << "IosToolHandler::stop() when op was OpNone";
break;
case OpAppTransfer:
didTransferApp(bundlePath, deviceId, IosToolHandler::Failure);
break;
case OpAppRun:
didStartApp(bundlePath, deviceId, IosToolHandler::Failure);
break;
case OpDeviceInfo:
break;
}
// pass
case StartedInferior:
case XmlEndProcessed:
toolExited(errorCode);
break;
case Stopped:
return;
}
if (isRunning()) {
process->write("k\n\r");
process->closeWriteChannel();
killTimer.start(1500);
}
}
// IosSimulatorToolHandlerPrivate
IosSimulatorToolHandlerPrivate::IosSimulatorToolHandlerPrivate(const IosDeviceType &devType,
@@ -657,64 +689,159 @@ IosSimulatorToolHandlerPrivate::IosSimulatorToolHandlerPrivate(const IosDeviceTy
{ }
void IosSimulatorToolHandlerPrivate::requestTransferApp(const QString &bundlePath,
const QString &deviceId, int timeout)
const QString &deviceIdentifier, int timeout)
{
Q_UNUSED(timeout);
this->bundlePath = bundlePath;
this->deviceId = deviceId;
emit didTransferApp(bundlePath, deviceId, IosToolHandler::Success);
this->deviceId = deviceIdentifier;
isTransferringApp(bundlePath, deviceId, 0, 100, "");
if (SimulatorControl::startSimulator(deviceId)) {
isTransferringApp(bundlePath, deviceId, 20, 100, "");
QByteArray cmdOutput;
if (SimulatorControl::installApp(deviceId, Utils::FileName::fromString(bundlePath), cmdOutput)) {
isTransferringApp(bundlePath, deviceId, 100, 100, "");
didTransferApp(bundlePath, deviceId, IosToolHandler::Success);
} else {
errorMsg(IosToolHandler::tr("Application install on Simulator failed. %1").arg(QString::fromLocal8Bit(cmdOutput)));
didTransferApp(bundlePath, deviceId, IosToolHandler::Failure);
}
} else {
errorMsg(IosToolHandler::tr("Application install on Simulator failed. Simulator not running."));
didTransferApp(bundlePath, deviceId, IosToolHandler::Failure);
}
emit q->finished(q);
}
void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &bundlePath,
const QStringList &extraArgs,
IosToolHandler::RunKind runType,
const QString &deviceId, int timeout)
const QString &deviceIdentifier, int timeout)
{
Q_UNUSED(timeout);
Q_UNUSED(deviceIdentifier);
this->bundlePath = bundlePath;
this->deviceId = deviceId;
this->deviceId = devType.identifier;
this->runKind = runType;
QStringList args;
args << QLatin1String("launch") << bundlePath;
Utils::FileName devPath = IosConfigurations::developerPath();
if (!devPath.isEmpty())
args << QLatin1String("--developer-path") << devPath.toString();
addDeviceArguments(args);
switch (runType) {
case IosToolHandler::NormalRun:
break;
case IosToolHandler::DebugRun:
args << QLatin1String("--wait-for-debugger");
break;
}
args << QLatin1String("--args") << extraArgs;
op = OpAppRun;
start(IosToolHandler::iosSimulatorToolPath(), args);
Utils::FileName appBundle = Utils::FileName::fromString(bundlePath);
if (!appBundle.exists()) {
errorMsg(IosToolHandler::tr("Application launch on Simulator failed. Invalid Bundle path %1")
.arg(bundlePath));
didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Failure);
return;
}
if (SimulatorControl::startSimulator(deviceId)) {
qint64 pId = -1;
bool debugRun = runType == IosToolHandler::DebugRun;
QProcess* controlProcess = SimulatorControl::spawnAppProcess(deviceId, appBundle, pId, debugRun, extraArgs);
if (controlProcess) {
Q_ASSERT(!process || !isRunning());
if (process) {
delete process;
process = nullptr;
}
process = controlProcess;
QObject::connect(process, &QProcess::readyReadStandardOutput,
std::bind(&IosSimulatorToolHandlerPrivate::simAppProcessHasData,this));
QObject::connect(process, &QProcess::readyReadStandardError,
std::bind(&IosSimulatorToolHandlerPrivate::simAppProcessHasErrorOutput,this));
QObject::connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
std::bind(&IosSimulatorToolHandlerPrivate::simAppProcessFinished,this, _1,_2));
QObject::connect(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
std::bind(&IosSimulatorToolHandlerPrivate::simAppProcessError, this, _1));
appPId = pId;
gotInferiorPid(bundlePath,deviceId,pId);
// For debug run, wait for the debugger to attach and then launch the app.
if (!debugRun) {
launchAppOnSimulator();
}
} else {
errorMsg(IosToolHandler::tr("Spawning the Application process on Simulator failed."));
didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Failure);
}
} else {
errorMsg(IosToolHandler::tr("Application launch on Simulator failed. Simulator not running.")
.arg(bundlePath));
didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Failure);
}
}
void IosSimulatorToolHandlerPrivate::launchAppOnSimulator()
{
// Wait for the app to reach a state when we can launch it on the simulator.
if (appPId != -1 && SimulatorControl::waitForProcessSpawn(appPId)) {
QByteArray commandOutput;
Utils::FileName appBundle = Utils::FileName::fromString(bundlePath);
if (SimulatorControl::launchApp(deviceId, SimulatorControl::bundleIdentifier(appBundle), &commandOutput) != -1) {
appLaunched = true;
didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Success);
} else {
errorMsg(IosToolHandler::tr("Application launch on Simulator failed. %1")
.arg(QString::fromLocal8Bit(commandOutput)));
didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Failure);
}
} else {
errorMsg(IosToolHandler::tr("Spawning the Application process on Simulator failed. Spawning timed out."));
didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Failure);
}
}
void IosSimulatorToolHandlerPrivate::requestDeviceInfo(const QString &deviceId, int timeout)
{
Q_UNUSED(timeout);
this->deviceId = deviceId;
QStringList args;
args << QLatin1String("showdevicetypes");
op = OpDeviceInfo;
start(IosToolHandler::iosSimulatorToolPath(), args);
Q_UNUSED(deviceId);
}
bool IosSimulatorToolHandlerPrivate::expectsFileDescriptor()
void IosSimulatorToolHandlerPrivate::stop(int errorCode)
{
return false;
}
void IosSimulatorToolHandlerPrivate::addDeviceArguments(QStringList &args) const
{
if (devType.type != IosDeviceType::SimulatedDevice) {
qCWarning(toolHandlerLog) << "IosSimulatorToolHandlerPrivate device type is not SimulatedDevice";
return;
if (process) {
if (isRunning()) {
process->terminate();
if (!process->waitForFinished(1000))
process->kill();
}
process->deleteLater();
process = nullptr;
appPId = -1;
appLaunched = false;
}
args << QLatin1String("--devicetypeid") << devType.identifier;
toolExited(errorCode);
}
void IosSimulatorToolHandlerPrivate::debuggerStateChanged(Debugger::DebuggerState state)
{
if (!appLaunched && state == Debugger::DebuggerState::InferiorRunOk) {
// Debugger attached. Launch it on the simulator.
launchAppOnSimulator();
}
}
void IosSimulatorToolHandlerPrivate::simAppProcessError(QProcess::ProcessError error)
{
errorMsg(IosToolHandler::tr("Simulator application process error %1").arg(error));
}
void IosSimulatorToolHandlerPrivate::simAppProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
stop((exitStatus == QProcess::NormalExit) ? exitCode : -1 );
qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
q->finished(q);
}
void IosSimulatorToolHandlerPrivate::simAppProcessHasData()
{
appOutput(QString::fromLocal8Bit(process->readAllStandardOutput()));
}
void IosSimulatorToolHandlerPrivate::simAppProcessHasErrorOutput()
{
errorMsg(QString::fromLocal8Bit(process->readAllStandardError()));
}
void IosToolHandlerPrivate::killProcess()
@@ -731,18 +858,6 @@ QString IosToolHandler::iosDeviceToolPath()
return res;
}
QString IosToolHandler::iosSimulatorToolPath()
{
Utils::FileName devPath = Internal::IosConfigurations::developerPath();
bool version182 = devPath.appendPath(QLatin1String(
"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework"))
.exists();
QString res = Core::ICore::libexecPath() + QLatin1String("/ios/iossim");
if (version182)
res = res.append(QLatin1String("_1_8_2"));
return res;
}
IosToolHandler::IosToolHandler(const Internal::IosDeviceType &devType, QObject *parent) :
QObject(parent)
{
@@ -762,6 +877,11 @@ void IosToolHandler::stop()
d->stop(-1);
}
void IosToolHandler::debuggerStateChanged(int state)
{
d->debuggerStateChanged((Debugger::DebuggerState)state);
}
void IosToolHandler::requestTransferApp(const QString &bundlePath, const QString &deviceId,
int timeout)
{
@@ -784,24 +904,4 @@ bool IosToolHandler::isRunning()
return d->isRunning();
}
void IosToolHandler::subprocessError(QProcess::ProcessError error)
{
d->subprocessError(error);
}
void IosToolHandler::subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
d->subprocessFinished(exitCode, exitStatus);
}
void IosToolHandler::subprocessHasData()
{
d->subprocessHasData();
}
void IosToolHandler::killProcess()
{
d->killProcess();
}
} // namespace Ios

View File

@@ -33,7 +33,6 @@
#include <QStringList>
#include <QProcess>
namespace Ios {
namespace Internal {
class IosToolHandlerPrivate;
@@ -56,7 +55,6 @@ public:
};
static QString iosDeviceToolPath();
static QString iosSimulatorToolPath();
explicit IosToolHandler(const Internal::IosDeviceType &type, QObject *parent = 0);
~IosToolHandler();
@@ -66,6 +64,7 @@ public:
void requestDeviceInfo(const QString &deviceId, int timeout = 1000);
bool isRunning();
void stop();
void debuggerStateChanged(int state);
signals:
void isTransferringApp(Ios::IosToolHandler *handler, const QString &bundlePath,
@@ -85,11 +84,10 @@ signals:
void errorMsg(Ios::IosToolHandler *handler, const QString &msg);
void toolExited(Ios::IosToolHandler *handler, int code);
void finished(Ios::IosToolHandler *handler);
private:
void subprocessError(QProcess::ProcessError error);
void subprocessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void subprocessHasData();
protected:
void killProcess();
private:
friend class Ios::Internal::IosToolHandlerPrivate;
Ios::Internal::IosToolHandlerPrivate *d;

View File

@@ -0,0 +1,422 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "simulatorcontrol.h"
#include "iossimulator.h"
#include "iosconfigurations.h"
#ifdef Q_OS_MAC
#include <CoreFoundation/CoreFoundation.h>
#endif
#include <chrono>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QLoggingCategory>
#include <QMap>
#include <QProcess>
#include <QReadLocker>
#include <QReadWriteLock>
#include <QTime>
#include <QUrl>
#include <QWriteLocker>
namespace {
Q_LOGGING_CATEGORY(simulatorLog, "qtc.ios.simulator")
}
namespace Ios {
namespace Internal {
static int COMMAND_TIMEOUT = 10000;
static int SIMULATOR_TIMEOUT = 60000;
static bool checkForTimeout(const std::chrono::time_point< std::chrono::high_resolution_clock, std::chrono::nanoseconds> &start, int msecs = COMMAND_TIMEOUT)
{
bool timedOut = false;
auto end = std::chrono::high_resolution_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count() > msecs)
timedOut = true;
return timedOut;
}
class SimulatorControlPrivate :QObject {
Q_OBJECT
private:
struct SimDeviceInfo {
bool isBooted() const { return state.compare(QStringLiteral("Booted")) == 0; }
bool isAvailable() const { return !availability.contains(QStringLiteral("unavailable")); }
QString name;
QString udid;
QString availability;
QString state;
QString sdk;
};
SimulatorControlPrivate(QObject *parent = nullptr);
~SimulatorControlPrivate();
QByteArray runSimCtlCommand(QStringList args) const;
SimDeviceInfo deviceInfo(const QString &simUdid) const;
bool runCommand(QString command, const QStringList &args, QByteArray *output = nullptr);
QHash<QString, QProcess*> simulatorProcesses;
QReadWriteLock processDataLock;
QList<IosDeviceType> availableDevices;
QReadWriteLock deviceDataLock;
friend class SimulatorControl;
};
SimulatorControlPrivate *SimulatorControl::d = new SimulatorControlPrivate;
SimulatorControl::SimulatorControl()
{
}
QList<Ios::Internal::IosDeviceType> SimulatorControl::availableSimulators()
{
QReadLocker locer(&d->deviceDataLock);
return d->availableDevices;
}
void SimulatorControl::updateAvailableSimulators()
{
const QByteArray output = d->runSimCtlCommand({QLatin1String("list"), QLatin1String("-j"), QLatin1String("devices")});
QJsonDocument doc = QJsonDocument::fromJson(output);
if (!doc.isNull()) {
QList<IosDeviceType> availableDevices;
const QJsonObject buildInfo = doc.object().value("devices").toObject();
foreach (const QString &buildVersion, buildInfo.keys()) {
QJsonArray devices = buildInfo.value(buildVersion).toArray();
foreach (const QJsonValue device, devices) {
QJsonObject deviceInfo = device.toObject();
QString deviceName = QString("%1, %2")
.arg(deviceInfo.value("name").toString("Unknown"))
.arg(buildVersion);
QString deviceUdid = deviceInfo.value("udid").toString("Unknown");
if (!deviceInfo.value("availability").toString().contains("unavailable")) {
IosDeviceType iOSDevice(IosDeviceType::SimulatedDevice, deviceUdid, deviceName);
availableDevices.append(iOSDevice);
}
}
}
std::stable_sort(availableDevices.begin(), availableDevices.end());
{
QWriteLocker locker(&d->deviceDataLock);
d->availableDevices = availableDevices;
}
} else {
qCDebug(simulatorLog) << "Error parsing json output from simctl. Output:" << output;
}
}
// Blocks until simulators reaches "Booted" state.
bool SimulatorControl::startSimulator(const QString &simUdid)
{
QWriteLocker locker(&d->processDataLock);
bool simulatorRunning = isSimulatorRunning(simUdid);
if (!simulatorRunning && d->deviceInfo(simUdid).isAvailable()) {
// Simulator is not running but it's available. Start the simulator.
QProcess *p = new QProcess;
QObject::connect(p, static_cast<void(QProcess::*)(int)>(&QProcess::finished), [simUdid]() {
QWriteLocker locker(&d->processDataLock);
d->simulatorProcesses[simUdid]->deleteLater();
d->simulatorProcesses.remove(simUdid);
});
const QString cmd = IosConfigurations::developerPath().appendPath(QStringLiteral("/Applications/Simulator.app")).toString();
const QStringList args({QStringLiteral("--args"), QStringLiteral("-CurrentDeviceUDID"), simUdid});
p->start(cmd, args);
if (p->waitForStarted()) {
d->simulatorProcesses[simUdid] = p;
// At this point the sim device exists, available and was not running.
// So the simulator is started and we'll wait for it to reach to a state
// where we can interact with it.
auto start = std::chrono::high_resolution_clock::now();
SimulatorControlPrivate::SimDeviceInfo info;
do {
info = d->deviceInfo(simUdid);
} while (!info.isBooted()
&& p->state() == QProcess::Running
&& !checkForTimeout(start, SIMULATOR_TIMEOUT));
simulatorRunning = info.isBooted();
} else {
qCDebug(simulatorLog) << "Error starting simulator." << p->errorString();
delete p;
}
}
return simulatorRunning;
}
bool SimulatorControl::isSimulatorRunning(const QString &simUdid)
{
if (simUdid.isEmpty())
return false;
return d->deviceInfo(simUdid).isBooted();
}
bool SimulatorControl::installApp(const QString &simUdid, const Utils::FileName &bundlePath, QByteArray &commandOutput)
{
bool installed = false;
if (isSimulatorRunning(simUdid)) {
commandOutput = d->runSimCtlCommand(QStringList() << QStringLiteral("install") << simUdid << bundlePath.toString());
installed = commandOutput.isEmpty();
} else {
commandOutput = "Simulator device not running.";
}
return installed;
}
qint64 SimulatorControl::launchApp(const QString &simUdid, const QString &bundleIdentifier, QByteArray* commandOutput)
{
qint64 pId = -1;
pId = -1;
if (!bundleIdentifier.isEmpty() && isSimulatorRunning(simUdid)) {
const QStringList args({QStringLiteral("launch"), simUdid , bundleIdentifier});
const QByteArray output = d->runSimCtlCommand(args);
const QByteArray pIdStr = output.trimmed().split(' ').last().trimmed();
bool validInt = false;
pId = pIdStr.toLongLong(&validInt);
if (!validInt) {
// Launch Failed.
qCDebug(simulatorLog) << "Launch app failed. Process id returned is not valid. PID =" << pIdStr;
pId = -1;
if (commandOutput)
*commandOutput = output;
}
}
return pId;
}
QString SimulatorControl::bundleIdentifier(const Utils::FileName &bundlePath)
{
QString bundleID;
#ifdef Q_OS_MAC
if (bundlePath.exists()) {
CFStringRef cFBundlePath = bundlePath.toString().toCFString();
CFURLRef bundle_url = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, cFBundlePath, kCFURLPOSIXPathStyle, true);
CFRelease(cFBundlePath);
CFBundleRef bundle = CFBundleCreate (kCFAllocatorDefault, bundle_url);
CFRelease(bundle_url);
CFStringRef cFBundleID = CFBundleGetIdentifier(bundle);
bundleID = QString::fromCFString(cFBundleID).trimmed();
CFRelease(bundle);
}
#else
Q_UNUSED(bundlePath)
#endif
return bundleID;
}
QString SimulatorControl::bundleExecutable(const Utils::FileName &bundlePath)
{
QString executable;
#ifdef Q_OS_MAC
if (bundlePath.exists()) {
CFStringRef cFBundlePath = bundlePath.toString().toCFString();
CFURLRef bundle_url = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, cFBundlePath, kCFURLPOSIXPathStyle, true);
CFRelease(cFBundlePath);
CFBundleRef bundle = CFBundleCreate (kCFAllocatorDefault, bundle_url);
CFStringRef cFStrExecutableName = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleExecutableKey);
executable = QString::fromCFString(cFStrExecutableName).trimmed();
CFRelease(bundle);
}
#else
Q_UNUSED(bundlePath)
#endif
return executable;
}
SimulatorControlPrivate::SimulatorControlPrivate(QObject *parent):
QObject(parent),
processDataLock(QReadWriteLock::Recursive)
{
}
SimulatorControlPrivate::~SimulatorControlPrivate()
{
}
QByteArray SimulatorControlPrivate::runSimCtlCommand(QStringList args) const
{
QProcess simCtlProcess;
args.prepend(QStringLiteral("simctl"));
simCtlProcess.start(QStringLiteral("xcrun"), args, QProcess::ReadOnly);
if (!simCtlProcess.waitForFinished())
qCDebug(simulatorLog) << "simctl command failed." << simCtlProcess.errorString();
return simCtlProcess.readAll();
}
// The simctl spawns the process and returns the pId but the application process might not have started, at least in a state where you can interrupt it.
// Use SimulatorControl::waitForProcessSpawn to be sure.
QProcess *SimulatorControl::spawnAppProcess(const QString &simUdid, const Utils::FileName &bundlePath, qint64 &pId, bool waitForDebugger, const QStringList &extraArgs)
{
QProcess *simCtlProcess = nullptr;
if (isSimulatorRunning(simUdid)) {
QString bundleId = bundleIdentifier(bundlePath);
QString executableName = bundleExecutable(bundlePath);
QByteArray appPath = d->runSimCtlCommand(QStringList() << QStringLiteral("get_app_container") << simUdid << bundleId).trimmed();
if (!appPath.isEmpty() && !executableName.isEmpty()) {
// Spawn the app. The spawned app is started in suspended mode.
appPath.append('/' + executableName.toLocal8Bit());
simCtlProcess = new QProcess;
QStringList args;
args << QStringLiteral("simctl");
args << QStringLiteral("spawn");
if (waitForDebugger)
args << QStringLiteral("-w");
args << simUdid;
args << QString::fromLocal8Bit(appPath);
args << extraArgs;
simCtlProcess->start(QStringLiteral("xcrun"), args);
if (!simCtlProcess->waitForStarted()){
// Spawn command failed.
qCDebug(simulatorLog) << "Spawning the app failed." << simCtlProcess->errorString();
delete simCtlProcess;
simCtlProcess = nullptr;
}
// Find the process id of the the app process.
if (simCtlProcess) {
qint64 simctlPId = simCtlProcess->processId();
pId = -1;
QByteArray commandOutput;
QStringList pGrepArgs;
pGrepArgs << QStringLiteral("-f") << QString::fromLocal8Bit(appPath);
auto begin = std::chrono::high_resolution_clock::now();
// Find the pid of the spawned app.
while (pId == -1 && d->runCommand(QStringLiteral("pgrep"), pGrepArgs, &commandOutput)) {
foreach (auto pidStr, commandOutput.trimmed().split('\n')) {
qint64 parsedPId = pidStr.toLongLong();
if (parsedPId != simctlPId)
pId = parsedPId;
}
if (checkForTimeout(begin)) {
qCDebug(simulatorLog) << "Spawning the app failed. Process timed out";
break;
}
}
}
if (pId == -1) {
// App process id can't be found.
qCDebug(simulatorLog) << "Spawning the app failed. PID not found.";
delete simCtlProcess;
simCtlProcess = nullptr;
}
} else {
qCDebug(simulatorLog) << "Spawning the app failed. Check installed app." << appPath;
}
} else {
qCDebug(simulatorLog) << "Spawning the app failed. Simulator not running." << simUdid;
}
return simCtlProcess;
}
bool SimulatorControl::waitForProcessSpawn(qint64 processPId)
{
bool success = true;
if (processPId != -1) {
// Wait for app to reach intruptible sleep state.
QByteArray wqStr;
QStringList args;
int wqCount = -1;
args << QStringLiteral("-p") << QString::number(processPId) << QStringLiteral("-o") << QStringLiteral("wq=");
auto begin = std::chrono::high_resolution_clock::now();
do {
if (!d->runCommand(QStringLiteral("ps"), args, &wqStr)) {
success = false;
break;
}
bool validInt = false;
wqCount = wqStr.toInt(&validInt);
if (!validInt) {
wqCount = -1;
}
} while (wqCount < 0 && !checkForTimeout(begin));
success = wqCount >= 0;
} else {
qCDebug(simulatorLog) << "Wait for spawned failed. Invalid Process ID." << processPId;
}
return success;
}
SimulatorControlPrivate::SimDeviceInfo SimulatorControlPrivate::deviceInfo(const QString &simUdid) const
{
SimDeviceInfo info;
bool found = false;
if (!simUdid.isEmpty()) {
// It might happend that the simulator is not started by SimControl.
// Check of intances started externally.
const QByteArray output = runSimCtlCommand({QLatin1String("list"), QLatin1String("-j"), QLatin1String("devices")});
QJsonDocument doc = QJsonDocument::fromJson(output);
if (!doc.isNull()) {
const QJsonObject buildInfo = doc.object().value(QStringLiteral("devices")).toObject();
foreach (const QString &buildVersion, buildInfo.keys()) {
QJsonArray devices = buildInfo.value(buildVersion).toArray();
foreach (const QJsonValue device, devices) {
QJsonObject deviceInfo = device.toObject();
QString deviceUdid = deviceInfo.value(QStringLiteral("udid")).toString();
if (deviceUdid.compare(simUdid) == 0) {
found = true;
info.name = deviceInfo.value(QStringLiteral("name")).toString();
info.udid = deviceUdid;
info.state = deviceInfo.value(QStringLiteral("state")).toString();
info.sdk = buildVersion;
info.availability = deviceInfo.value(QStringLiteral("availability")).toString();
break;
}
}
if (found)
break;
}
} else {
qCDebug(simulatorLog) << "Cannot find device info. Error parsing json output from simctl. Output:" << output;
}
} else {
qCDebug(simulatorLog) << "Cannot find device info. Invalid UDID.";
}
return info;
}
bool SimulatorControlPrivate::runCommand(QString command, const QStringList &args, QByteArray *output)
{
bool success = false;
QProcess process;
process.start(command, args);
success = process.waitForFinished();
if (output)
*output = process.readAll().trimmed();
return success;
}
} // namespace Internal
} // namespace Ios
#include "simulatorcontrol.moc"

View File

@@ -0,0 +1,64 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef SIMULATORCONTROL_H
#define SIMULATORCONTROL_H
#include <QHash>
#include "utils/fileutils.h"
class QProcess;
namespace Ios {
namespace Internal {
class IosDeviceType;
class SimulatorControlPrivate;
class SimulatorControl
{
explicit SimulatorControl();
public:
static QList<IosDeviceType> availableSimulators();
static void updateAvailableSimulators();
static bool startSimulator(const QString &simUdid);
static bool isSimulatorRunning(const QString &simUdid);
static bool installApp(const QString &simUdid, const Utils::FileName &bundlePath, QByteArray &commandOutput);
static QProcess* spawnAppProcess(const QString &simUdid, const Utils::FileName &bundlePath, qint64 &pId,
bool waitForDebugger, const QStringList &extraArgs);
static qint64 launchApp(const QString &simUdid, const QString &bundleIdentifier, QByteArray *commandOutput = nullptr);
static QString bundleIdentifier(const Utils::FileName &bundlePath);
static QString bundleExecutable(const Utils::FileName &bundlePath);
static bool waitForProcessSpawn(qint64 processPId);
private:
static SimulatorControlPrivate *d;
};
} // namespace Internal
} // namespace Ios
#endif // SIMULATORCONTROL_H

View File

@@ -77,7 +77,7 @@ exists(../shared/qbs/qbs.pro)|!isEmpty(QBS_INSTALL_DIR): \
isEmpty(LLVM_INSTALL_DIR):LLVM_INSTALL_DIR=$$(LLVM_INSTALL_DIR)
exists($$LLVM_INSTALL_DIR) {
SUBDIRS += clangcodemodel
SUBDIRS += clangrefactoring
# SUBDIRS += clangrefactoring
} else {
warning("Set LLVM_INSTALL_DIR to build the Clang Code Model. " \
"For details, see doc/src/editors/creator-clang-codemodel.qdoc.")

View File

@@ -208,7 +208,16 @@ Utils::FileName AbstractMsvcToolChain::compilerCommand() const
{
Utils::Environment env = Utils::Environment::systemEnvironment();
addToEnvironment(env);
return env.searchInPath(QLatin1String("cl.exe"));
Utils::FileName clexe = env.searchInPath(QLatin1String("cl.exe"), QStringList(), [](const QString &name) {
QDir dir(QDir::cleanPath(QFileInfo(name).absolutePath() + QStringLiteral("/..")));
do {
if (QFile::exists(dir.absoluteFilePath(QStringLiteral("vcvarsall.bat"))))
return true;
} while (dir.cdUp() && !dir.isRoot());
return false;
});
return clexe;
}
IOutputParser *AbstractMsvcToolChain::outputParser() const

View File

@@ -1061,6 +1061,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(ICore::instance(), &ICore::saveSettingsRequested,
dd, &ProjectExplorerPluginPrivate::savePersistentSettings);
connect(EditorManager::instance(), &EditorManager::autoSaved, this, [this] {
if (!dd->m_shuttingDown && !SessionManager::loadingSession())
SessionManager::save();
});
addAutoReleasedObject(new ProjectTreeWidgetFactory);
addAutoReleasedObject(new FolderNavigationWidgetFactory);
@@ -1518,11 +1522,7 @@ void ProjectExplorerPlugin::openNewProjectDialog()
void ProjectExplorerPluginPrivate::showSessionManager()
{
if (SessionManager::isDefaultVirgin()) {
// do not save new virgin default sessions
} else {
SessionManager::save();
}
SessionManager::save();
SessionDialog sessionDialog(ICore::mainWindow());
sessionDialog.setAutoLoadSession(dd->m_projectExplorerSettings.autorestoreLastSession);
sessionDialog.exec();
@@ -1551,11 +1551,7 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
foreach (Project *pro, SessionManager::projects())
pro->saveSettings();
if (SessionManager::isDefaultVirgin()) {
// do not save new virgin default sessions
} else {
SessionManager::save();
}
SessionManager::save();
}
QSettings *s = ICore::settings();

View File

@@ -50,6 +50,7 @@
#include <QComboBox>
#include <QDockWidget>
#include <QHeaderView>
#include <QLabel>
#include <QMenu>
#include <QStyledItemDelegate>
#include <QTimer>
@@ -234,6 +235,11 @@ public:
{
Q_UNUSED(column)
if (role == ItemUpdatedFromBelowRole) {
announceChange();
return true;
}
if (role == ItemDeactivatedFromBelowRole) {
announceChange();
return true;
@@ -375,16 +381,13 @@ public:
this, &SelectorModel::openContextMenu);
}
void announceChange()
{
m_changeListener(m_projectsModel.rootItem()->childAt(0)->data(0, PanelWidgetRole).value<QWidget *>());
}
void updatePanel()
{
announceChange();
ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0);
m_changeListener(projectItem->data(0, PanelWidgetRole).value<QWidget *>());
QModelIndex activeIndex = m_projectsModel.rootItem()->childAt(0)->activeIndex();
QModelIndex activeIndex = projectItem->activeIndex();
m_selectorTree->expandAll();
m_selectorTree->selectionModel()->clear();
m_selectorTree->selectionModel()->select(activeIndex, QItemSelectionModel::Select);
}
@@ -481,9 +484,16 @@ ProjectWindow::ProjectWindow()
selectorView->setWindowTitle(tr("Project Selector"));
selectorView->setAutoFillBackground(true);
auto activeLabel = new QLabel(tr("Active Project"));
QFont font = activeLabel->font();
font.setBold(true);
font.setPointSizeF(font.pointSizeF() * 1.2);
activeLabel->setFont(font);
auto innerLayout = new QVBoxLayout;
innerLayout->setSpacing(10);
innerLayout->setContentsMargins(14, innerLayout->spacing(), 14, 0);
innerLayout->addWidget(activeLabel);
innerLayout->addWidget(selectorModel->m_projectSelection);
innerLayout->addWidget(selectorModel->m_selectorTree);

View File

@@ -42,6 +42,7 @@ enum {
ItemActivatedFromBelowRole, // A subitem gots activated and gives us the opportunity to adjust
ItemActivatedFromAboveRole, // A parent item gots activated and makes us its active child.
ItemDeactivatedFromBelowRole, // A subitem got deactivated and gives us the opportunity to adjust
ItemUpdatedFromBelowRole, // A subitem got updated, re-expansion is necessary.
ActiveItemRole, // The index of the currently selected item in the tree view
PanelWidgetRole // This item's widget to be shown as central widget.
};

View File

@@ -408,6 +408,10 @@ bool SessionManager::loadingSession()
bool SessionManager::save()
{
// do not save new virgin default sessions
if (isDefaultVirgin())
return true;
emit m_instance->aboutToSaveSession();
if (!d->m_writer || d->m_writer->fileName() != sessionNameToFileName(d->m_sessionName)) {
@@ -961,11 +965,9 @@ bool SessionManager::loadSession(const QString &session)
// Allow everyone to set something in the session and before saving
emit m_instance->aboutToUnloadSession(d->m_sessionName);
if (!isDefaultVirgin()) {
if (!save()) {
d->m_loadingSession = false;
return false;
}
if (!save()) {
d->m_loadingSession = false;
return false;
}
// Clean up

View File

@@ -212,6 +212,7 @@ public:
void handleRemovedKit(Kit *kit);
void handleAddedKit(Kit *kit);
void handleUpdatedKit(Kit *kit);
void handleTargetAdded(Target *target);
void handleTargetRemoved(Target *target);
@@ -755,6 +756,8 @@ TargetGroupItemPrivate::TargetGroupItemPrivate(TargetGroupItem *q, Project *proj
this, &TargetGroupItemPrivate::handleAddedKit);
connect(KitManager::instance(), &KitManager::kitRemoved,
this, &TargetGroupItemPrivate::handleRemovedKit);
connect(KitManager::instance(), &KitManager::kitUpdated,
this, &TargetGroupItemPrivate::handleUpdatedKit);
rebuildContents();
}
@@ -789,7 +792,7 @@ QVariant TargetGroupItem::data(int column, int role) const
bool TargetGroupItem::setData(int column, const QVariant &data, int role)
{
Q_UNUSED(data)
if (role == ItemActivatedFromBelowRole) {
if (role == ItemActivatedFromBelowRole || role == ItemUpdatedFromBelowRole) {
// Bubble up to trigger setting the active project.
parent()->setData(column, QVariant::fromValue(static_cast<TreeItem *>(this)), role);
return true;
@@ -823,9 +826,16 @@ void TargetGroupItemPrivate::handleRemovedKit(Kit *kit)
rebuildContents();
}
void TargetGroupItemPrivate::handleUpdatedKit(Kit *kit)
{
Q_UNUSED(kit);
rebuildContents();
}
void TargetGroupItemPrivate::handleAddedKit(Kit *kit)
{
q->appendChild(new TargetItem(m_project, kit->id()));
if (m_project->supportsKit(kit))
q->appendChild(new TargetItem(m_project, kit->id()));
}
void TargetItem::updateSubItems()
@@ -843,8 +853,14 @@ void TargetGroupItemPrivate::rebuildContents()
{
q->removeChildren();
foreach (Kit *kit, KitManager::sortKits(KitManager::kits()))
KitMatcher matcher([this](const Kit *kit) { return m_project->supportsKit(const_cast<Kit *>(kit)); });
const QList<Kit *> kits = KitManager::sortKits(KitManager::matchingKits(matcher));
for (Kit *kit : kits)
q->appendChild(new TargetItem(m_project, kit->id()));
if (q->parent())
q->parent()->setData(0, QVariant::fromValue(static_cast<TreeItem *>(q)),
ItemUpdatedFromBelowRole);
}
void TargetGroupItemPrivate::handleTargetAdded(Target *target)

View File

@@ -1477,7 +1477,9 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
destDir.append(QLatin1Char('/')).append(ti.target)
.append(QLatin1String(".framework"));
} else {
targetFileName.prepend(QLatin1String("lib"));
if (!(isPlugin && config.contains(QLatin1String("no_plugin_name_prefix"))))
targetFileName.prepend(QLatin1String("lib"));
if (!isPlugin) {
targetFileName += QLatin1Char('.');
const QString version = node->singleVariableValue(VersionVar);
@@ -1496,7 +1498,9 @@ void QmakeProject::collectLibraryData(const QmakeProFileNode *node, DeploymentDa
case Abi::LinuxOS:
case Abi::BsdOS:
case Abi::UnixOS:
targetFileName.prepend(QLatin1String("lib"));
if (!(isPlugin && config.contains(QLatin1String("no_plugin_name_prefix"))))
targetFileName.prepend(QLatin1String("lib"));
targetFileName += QLatin1Char('.');
if (isStatic) {
targetFileName += QLatin1Char('a');

View File

@@ -63,7 +63,7 @@ static CrumbleBarInfo createCrumbleBarInfoFromModelNode(const ModelNode &modelNo
{
CrumbleBarInfo crumbleBarInfo;
crumbleBarInfo.displayName = componentIdForModelNode(modelNode);
crumbleBarInfo.fileName = currentDesignDocument()->textEditor()->document()->filePath().toString();
crumbleBarInfo.fileName = currentDesignDocument()->textEditor()->document()->filePath();
crumbleBarInfo.modelNode = modelNode;
return crumbleBarInfo;
@@ -87,7 +87,7 @@ CrumbleBar::~CrumbleBar()
delete m_crumblePath;
}
void CrumbleBar::pushFile(const QString &fileName)
void CrumbleBar::pushFile(const Utils::FileName &fileName)
{
if (m_isInternalCalled == false) {
crumblePath()->clear();
@@ -102,7 +102,7 @@ void CrumbleBar::pushFile(const QString &fileName)
CrumbleBarInfo crumbleBarInfo;
crumbleBarInfo.fileName = fileName;
crumblePath()->pushElement(fileName.split(QLatin1String("/")).last(), QVariant::fromValue(crumbleBarInfo));
crumblePath()->pushElement(fileName.fileName(), QVariant::fromValue(crumbleBarInfo));
m_isInternalCalled = false;
@@ -171,7 +171,7 @@ void CrumbleBar::onCrumblePathElementClicked(const QVariant &data)
m_isInternalCalled = true;
if (!clickedCrumbleBarInfo.modelNode.isValid()
&& Utils::FileName::fromString(clickedCrumbleBarInfo.fileName) == currentDesignDocument()->fileName()) {
&& clickedCrumbleBarInfo.fileName == currentDesignDocument()->fileName()) {
nextFileIsCalledInternally();
currentDesignDocument()->changeToDocumentModel();
QmlDesignerPlugin::instance()->viewManager().setComponentViewToMaster();
@@ -179,8 +179,8 @@ void CrumbleBar::onCrumblePathElementClicked(const QVariant &data)
showSaveDialog();
crumblePath()->popElement();
nextFileIsCalledInternally();
Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName, Core::Id(),
Core::EditorManager::DoNotMakeVisible);
Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName.toString(),
Core::Id(), Core::EditorManager::DoNotMakeVisible);
if (clickedCrumbleBarInfo.modelNode.isValid()) {
currentDesignDocument()->changeToSubComponent(clickedCrumbleBarInfo.modelNode);
QmlDesignerPlugin::instance()->viewManager().setComponentNode(clickedCrumbleBarInfo.modelNode);

View File

@@ -27,6 +27,7 @@
#include <QObject>
#include <utils/crumblepath.h>
#include <utils/fileutils.h>
#include <modelnode.h>
namespace QmlDesigner {
@@ -38,7 +39,7 @@ public:
explicit CrumbleBar(QObject *parent = 0);
~CrumbleBar();
void pushFile(const QString &fileName);
void pushFile(const Utils::FileName &fileName);
void pushInFileComponent(const ModelNode &modelNode);
void nextFileIsCalledInternally();
@@ -59,7 +60,7 @@ private:
class CrumbleBarInfo {
public:
QString fileName;
Utils::FileName fileName;
QString displayName;
ModelNode modelNode;
};

View File

@@ -71,10 +71,10 @@ static bool importLess(const Import &firstImport, const Import &secondImport)
return false;
if (firstImport.isLibraryImport() && secondImport.isFileImport())
return true;
return false;
if (firstImport.isFileImport() && secondImport.isLibraryImport())
return false;
return true;
if (firstImport.isFileImport() && secondImport.isFileImport())
return QString::localeAwareCompare(firstImport.file(), secondImport.file()) < 0;

View File

@@ -191,7 +191,9 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
bool masterNotAdded = true;
foreach (const ModelNode &node, node.allSubModelNodesAndThisNode()) {
if (node.nodeSourceType() == ModelNode::NodeWithComponentSource) {
if (node.nodeSourceType() == ModelNode::NodeWithComponentSource
|| (node.hasParentProperty()
&& !node.parentProperty().isDefaultProperty())) {
if (masterNotAdded) {
masterNotAdded = true;
addMasterDocument();
@@ -200,9 +202,6 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
if (!hasEntryForNode(node)) {
QString description = descriptionForNode(node);
QStandardItem *item = new QStandardItem(description);
item->setData(QVariant::fromValue(node.internalId()), ModelNodeRole);
item->setEditable(false);

View File

@@ -321,7 +321,7 @@ void DesignDocument::changeToMaster()
if (m_inFileComponentModel)
changeToDocumentModel();
QmlDesignerPlugin::instance()->viewManager().pushFileOnCrumbleBar(fileName().toString());
QmlDesignerPlugin::instance()->viewManager().pushFileOnCrumbleBar(fileName());
QmlDesignerPlugin::instance()->viewManager().setComponentNode(rootModelNode());
}

View File

@@ -80,9 +80,6 @@ PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) :
m_isBaseState(false),
m_selectionChanged(false),
m_backendValues(0),
m_majorVersion(-1),
m_minorVersion(-1),
m_majorQtQuickVersion(-1),
m_qmlComponent(0),
m_qmlContext(0)
{
@@ -167,7 +164,12 @@ int PropertyEditorContextObject::majorVersion() const
int PropertyEditorContextObject::majorQtQuickVersion() const
{
return m_majorQtQuickVersion;
return m_majorQtQuickVersion;
}
int PropertyEditorContextObject::minorQtQuickVersion() const
{
return m_minorQtQuickVersion;
}
void PropertyEditorContextObject::setMajorVersion(int majorVersion)
@@ -191,6 +193,16 @@ void PropertyEditorContextObject::setMajorQtQuickVersion(int majorVersion)
}
void PropertyEditorContextObject::setMinorQtQuickVersion(int minorVersion)
{
if (m_minorQtQuickVersion == minorVersion)
return;
m_minorQtQuickVersion = minorVersion;
emit minorQtQuickVersionChanged();
}
int PropertyEditorContextObject::minorVersion() const
{
return m_minorVersion;

View File

@@ -51,6 +51,7 @@ class PropertyEditorContextObject : public QObject
Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged)
Q_PROPERTY(int minorVersion READ minorVersion WRITE setMinorVersion NOTIFY minorVersionChanged)
Q_PROPERTY(int majorQtQuickVersion READ majorQtQuickVersion WRITE setMajorQtQuickVersion NOTIFY majorQtQuickVersionChanged)
Q_PROPERTY(int minorQtQuickVersion READ minorQtQuickVersion WRITE setMinorQtQuickVersion NOTIFY minorQtQuickVersionChanged)
Q_PROPERTY(bool hasAliasExport READ hasAliasExport NOTIFY hasAliasExportChanged)
@@ -81,8 +82,10 @@ public:
int majorVersion() const;
int majorQtQuickVersion() const;
int minorQtQuickVersion() const;
void setMajorVersion(int majorVersion);
void setMajorQtQuickVersion(int majorVersion);
void setMinorQtQuickVersion(int minorVersion);
int minorVersion() const;
void setMinorVersion(int minorVersion);
@@ -102,6 +105,7 @@ signals:
void majorVersionChanged();
void minorVersionChanged();
void majorQtQuickVersionChanged();
void minorQtQuickVersionChanged();
void specificQmlComponentChanged();
void hasAliasExportChanged();
@@ -137,9 +141,10 @@ private:
QQmlPropertyMap* m_backendValues;
int m_majorVersion;
int m_minorVersion;
int m_majorQtQuickVersion;
int m_majorVersion = 1;
int m_minorVersion = 1;
int m_majorQtQuickVersion = 1;
int m_minorQtQuickVersion = -1;
QQmlComponent *m_qmlComponent;
QQmlContext *m_qmlContext;

View File

@@ -328,10 +328,12 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
} else {
contextObject()->setMajorVersion(-1);
contextObject()->setMinorVersion(-1);
contextObject()->setMajorQtQuickVersion(-1);
contextObject()->setMajorQtQuickVersion(-1);
contextObject()->setMinorQtQuickVersion(-1);
}
contextObject()->setMajorQtQuickVersion(qmlObjectNode.view()->majorQtQuickVersion());
contextObject()->setMinorQtQuickVersion(qmlObjectNode.view()->minorQtQuickVersion());
} else {
qWarning() << "PropertyEditor: invalid node for setup";
}

View File

@@ -236,6 +236,7 @@ public:
QmlModelState currentState() const;
int majorQtQuickVersion() const;
int minorQtQuickVersion() const;
void resetView();

View File

@@ -29,6 +29,8 @@
#include <QWidgetAction>
#include <utils/fileutils.h>
namespace ProjectExplorer {
class Kit;
class Project;
@@ -76,7 +78,7 @@ public:
void disableWidgets();
void enableWidgets();
void pushFileOnCrumbleBar(const QString &fileName);
void pushFileOnCrumbleBar(const Utils::FileName &fileName);
void pushInFileComponentOnCrumbleBar(const ModelNode &modelNode);
void nextFileIsCalledInternally();

View File

@@ -477,9 +477,9 @@ QString AbstractView::generateNewId(const QString &prefixName) const
QString newId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName));
newId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]")));
while (hasId(newId) || rootModelNode().hasProperty(newId.toUtf8()) || newId == "item") {
while (!ModelNode::isValidId(newId) || hasId(newId) || rootModelNode().hasProperty(newId.toUtf8()) || newId == "item") {
counter += 1;
newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter);
newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter - 1);
newId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]")));
}
@@ -672,6 +672,21 @@ QmlModelState AbstractView::currentState() const
return QmlModelState(currentStateNode());
}
static int getMinorVersionFromImport(const Model *model)
{
foreach (const Import &import, model->imports()) {
if (import.isLibraryImport() && import.url() == "QtQuick") {
const QString versionString = import.version();
if (versionString.contains(".")) {
const QString minorVersionString = versionString.split(".").last();
return minorVersionString.toInt();
}
}
}
return -1;
}
static int getMajorVersionFromImport(const Model *model)
{
foreach (const Import &import, model->imports()) {
@@ -702,6 +717,21 @@ static int getMajorVersionFromNode(const ModelNode &modelNode)
return 1; //default
}
static int getMinorVersionFromNode(const ModelNode &modelNode)
{
if (modelNode.metaInfo().isValid()) {
if (modelNode.type() == "QtQuick.QtObject" || modelNode.type() == "QtQuick.Item")
return modelNode.minorVersion();
foreach (const NodeMetaInfo &superClass, modelNode.metaInfo().superClasses()) {
if (modelNode.type() == "QtQuick.QtObject" || modelNode.type() == "QtQuick.Item")
return superClass.minorVersion();
}
}
return 1; //default
}
int AbstractView::majorQtQuickVersion() const
{
int majorVersionFromImport = getMajorVersionFromImport(model());
@@ -711,4 +741,14 @@ int AbstractView::majorQtQuickVersion() const
return getMajorVersionFromNode(rootModelNode());
}
int AbstractView::minorQtQuickVersion() const
{
int minorVersionFromImport = getMinorVersionFromImport(model());
if (minorVersionFromImport >= 0)
return minorVersionFromImport;
return getMinorVersionFromNode(rootModelNode());
}
} // namespace QmlDesigner

View File

@@ -29,8 +29,6 @@
#include <model.h>
#include <nodemetainfo.h>
#include "internalnode_p.h"
#include <QHash>
#include <QTextStream>
#include "invalidargumentexception.h"
#include "invalididexception.h"
#include "invalidmodelnodeexception.h"
@@ -44,6 +42,10 @@
#include "nodeproperty.h"
#include <rewriterview.h>
#include <QHash>
#include <QSet>
#include <QTextStream>
namespace QmlDesigner {
using namespace QmlDesigner::Internal;
@@ -143,8 +145,36 @@ QString ModelNode::validId()
static bool idIsQmlKeyWord(const QString& id)
{
QStringList keywords;
keywords << QLatin1String("import") << QLatin1String("as");
static const QSet<QString> keywords = {
"as",
"break",
"case",
"catch",
"continue",
"debugger",
"default",
"delete",
"do",
"else",
"finally",
"for",
"function",
"if",
"import",
"in",
"instanceof",
"new",
"return",
"switch",
"this",
"throw",
"try",
"typeof",
"var",
"void",
"while",
"with"
};
return keywords.contains(id);
}

View File

@@ -61,6 +61,23 @@ inline static QString doubleToString(double d)
return string;
}
static QString unicodeEscape(const QString &stringValue)
{
if (stringValue.count() == 1) {
ushort code = stringValue.at(0).unicode();
bool isUnicode = code <= 127;
if (isUnicode) {
return stringValue;
} else {
QString escaped;
escaped += "\\u";
escaped += QString::number(code, 16).rightJustified(4, '0');
return escaped;
}
}
return stringValue;
}
QmlTextGenerator::QmlTextGenerator(const PropertyNameList &propertyOrder, int indentDepth):
m_propertyOrder(propertyOrder),
m_indentDepth(indentDepth)
@@ -131,7 +148,9 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept
case QMetaType::UInt:
case QMetaType::ULongLong:
return stringValue;
case QMetaType::QString:
case QMetaType::QChar:
return QStringLiteral("\"%1\"").arg(escape(unicodeEscape(stringValue)));
default:
return QStringLiteral("\"%1\"").arg(escape(stringValue));
}

View File

@@ -90,7 +90,7 @@ static inline QStringList globalQtEnums()
static inline QStringList knownEnumScopes()
{
static const QStringList list = {
"TextInput", "TextEdit", "Material", "Universal"
"TextInput", "TextEdit", "Material", "Universal", "Font"
};
return list;
}
@@ -819,7 +819,23 @@ static void removeUsedImports(QHash<QString, ImportKey> &filteredPossibleImportK
filteredPossibleImportKeys.remove(import.info.path());
}
static QList<QmlDesigner::Import> generatePossibleImports(const QHash<QString, ImportKey> &filteredPossibleImportKeys)
static QList<QmlDesigner::Import> generatePossibleFileImports(const QString &path)
{
QList<QmlDesigner::Import> possibleImports;
foreach (const QString &subDir, QDir(path).entryList(QDir::Dirs | QDir::NoDot | QDir::NoDotDot)) {
QDir dir(path + "/" + subDir);
if (!dir.entryInfoList(QStringList("*.qml"), QDir::Files).isEmpty()
&& dir.entryInfoList(QStringList("qmldir"), QDir::Files).isEmpty()) {
QmlDesigner::Import import = QmlDesigner::Import::createFileImport(subDir);
possibleImports.append(import);
}
}
return possibleImports;
}
static QList<QmlDesigner::Import> generatePossibleLibraryImports(const QHash<QString, ImportKey> &filteredPossibleImportKeys)
{
QList<QmlDesigner::Import> possibleImports;
@@ -842,9 +858,11 @@ void TextToModelMerger::setupPossibleImports(const QmlJS::Snapshot &snapshot, co
removeUsedImports(filteredPossibleImportKeys, m_scopeChain->context()->imports(m_document.data())->all());
QList<QmlDesigner::Import> possibleImports = generatePossibleImports(filteredPossibleImportKeys);
QList<QmlDesigner::Import> possibleImports = generatePossibleLibraryImports(filteredPossibleImportKeys);
if ( m_rewriterView->isAttached())
possibleImports.append(generatePossibleFileImports(document()->path()));
if (m_rewriterView->isAttached())
m_rewriterView->model()->setPossibleImports(possibleImports);
}

View File

@@ -267,7 +267,7 @@ void ViewManager::enableWidgets()
widgetInfo.widget->setEnabled(true);
}
void ViewManager::pushFileOnCrumbleBar(const QString &fileName)
void ViewManager::pushFileOnCrumbleBar(const Utils::FileName &fileName)
{
crumbleBar()->pushFile(fileName);
}

View File

@@ -452,7 +452,7 @@ ViewManager &DesignModeWidget::viewManager()
void DesignModeWidget::setupNavigatorHistory(Core::IEditor *editor)
{
if (!m_keepNavigatorHistory)
addNavigatorHistoryEntry(editor->document()->filePath().toString());
addNavigatorHistoryEntry(editor->document()->filePath());
const bool canGoBack = m_navigatorHistoryCounter > 0;
const bool canGoForward = m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1);
@@ -461,12 +461,12 @@ void DesignModeWidget::setupNavigatorHistory(Core::IEditor *editor)
m_toolBar->setCurrentEditor(editor);
}
void DesignModeWidget::addNavigatorHistoryEntry(const QString &fileName)
void DesignModeWidget::addNavigatorHistoryEntry(const Utils::FileName &fileName)
{
if (m_navigatorHistoryCounter > 0)
m_navigatorHistory.insert(m_navigatorHistoryCounter + 1, fileName);
m_navigatorHistory.insert(m_navigatorHistoryCounter + 1, fileName.toString());
else
m_navigatorHistory.append(fileName);
m_navigatorHistory.append(fileName.toString());
++m_navigatorHistoryCounter;
}

View File

@@ -101,7 +101,7 @@ private: // functions
void setup();
bool isInNodeDefinition(int nodeOffset, int nodeLength, int cursorPos) const;
QmlDesigner::ModelNode nodeForPosition(int cursorPos) const;
void addNavigatorHistoryEntry(const QString &fileName);
void addNavigatorHistoryEntry(const Utils::FileName &fileName);
QWidget *createCenterWidget();
QWidget *createCrumbleBarFrame();

View File

@@ -270,8 +270,7 @@ DocumentManager::DocumentManager()
DocumentManager::~DocumentManager()
{
foreach (const QPointer<DesignDocument> &designDocument, m_designDocumentHash)
delete designDocument.data();
qDeleteAll(m_designDocumentHash);
}
void DocumentManager::setCurrentDesignDocument(Core::IEditor *editor)
@@ -299,7 +298,7 @@ bool DocumentManager::hasCurrentDesignDocument() const
return m_currentDesignDocument.data();
}
void DocumentManager::removeEditors(QList<Core::IEditor *> editors)
void DocumentManager::removeEditors(const QList<Core::IEditor *> &editors)
{
foreach (Core::IEditor *editor, editors)
delete m_designDocumentHash.take(editor).data();

View File

@@ -49,7 +49,7 @@ public:
DesignDocument *currentDesignDocument() const;
bool hasCurrentDesignDocument() const;
void removeEditors(QList<Core::IEditor*> editors);
void removeEditors(const QList<Core::IEditor *> &editors);
static void goIntoComponent(const ModelNode &modelNode);

View File

@@ -274,7 +274,7 @@ void QmlDesignerPlugin::createDesignModeWidget()
connect(Core::EditorManager::instance(), &Core::EditorManager::editorsClosed, [=] (QList<Core::IEditor*> editors) {
if (d) {
if (d->documentManager.hasCurrentDesignDocument()
&& editors.contains(d->documentManager.currentDesignDocument()->textEditor()))
&& editors.contains(currentDesignDocument()->textEditor()))
hideDesigner();
d->documentManager.removeEditors(editors);
@@ -336,7 +336,7 @@ void QmlDesignerPlugin::showDesigner()
if (d->documentManager.hasCurrentDesignDocument()) {
activateAutoSynchronization();
d->shortCutManager.updateActions(currentDesignDocument()->textEditor());
d->viewManager.pushFileOnCrumbleBar(d->documentManager.currentDesignDocument()->fileName().toString());
d->viewManager.pushFileOnCrumbleBar(currentDesignDocument()->fileName());
}
d->shortCutManager.updateUndoActions(currentDesignDocument());
@@ -374,7 +374,7 @@ void QmlDesignerPlugin::changeEditor()
if (d->documentManager.hasCurrentDesignDocument()) {
activateAutoSynchronization();
d->viewManager.pushFileOnCrumbleBar(d->documentManager.currentDesignDocument()->fileName().toString());
d->viewManager.pushFileOnCrumbleBar(currentDesignDocument()->fileName());
d->viewManager.setComponentViewToMaster();
}

View File

@@ -69,7 +69,8 @@ ShortCutManager::ShortCutManager()
m_restoreDefaultViewAction(tr("&Restore Default View"), 0),
m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar"), 0),
m_toggleRightSidebarAction(tr("Toggle &Right Sidebar"), 0),
m_goIntoComponentAction (tr("&Go into Component"), 0)
m_goIntoComponentAction(tr("&Go into Component"), 0),
m_escapeAction(this)
{
}
@@ -218,6 +219,11 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
command->setAttribute(Core::Command::CA_Hide);
viewsMenu->addAction(command);
/* Registering disabled action for Escape, because Qt Quick does not support shortcut overrides. */
command = Core::ActionManager::registerAction(&m_escapeAction, Core::Constants::S_RETURNTOEDITOR, qmlDesignerMainContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
m_escapeAction.setEnabled(false);
Core::ActionManager::registerAction(&m_hideSidebarsAction, Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
}

View File

@@ -91,6 +91,7 @@ private:
QAction m_toggleLeftSidebarAction;
QAction m_toggleRightSidebarAction;
QAction m_goIntoComponentAction;
QAction m_escapeAction;
};
} // namespace QmlDesigner

View File

@@ -7035,8 +7035,8 @@ QWidget *BaseTextEditor::toolBar()
return editorWidget()->d->m_toolBar;
}
void TextEditorWidget::insertExtraToolBarWidget(TextEditorWidget::Side side,
QWidget *widget)
QAction * TextEditorWidget::insertExtraToolBarWidget(TextEditorWidget::Side side,
QWidget *widget)
{
if (widget->sizePolicy().horizontalPolicy() & QSizePolicy::ExpandFlag) {
if (d->m_stretchWidget)
@@ -7045,9 +7045,9 @@ void TextEditorWidget::insertExtraToolBarWidget(TextEditorWidget::Side side,
}
if (side == Right)
d->m_toolBar->insertWidget(d->m_cursorPositionLabelAction, widget);
return d->m_toolBar->insertWidget(d->m_cursorPositionLabelAction, widget);
else
d->m_toolBar->insertWidget(d->m_toolBar->actions().first(), widget);
return d->m_toolBar->insertWidget(d->m_toolBar->actions().first(), widget);
}
void TextEditorWidget::keepAutoCompletionHighlight(bool keepHighlight)

View File

@@ -322,7 +322,7 @@ public:
bool isMissingSyntaxDefinition() const;
enum Side { Left, Right };
void insertExtraToolBarWidget(Side side, QWidget *widget);
QAction *insertExtraToolBarWidget(Side side, QWidget *widget);
// keep the auto completion even if the focus is lost
void keepAutoCompletionHighlight(bool keepHighlight);

View File

@@ -1,10 +1,3 @@
TEMPLATE = subdirs
mac {
SUBDIRS += \
iossim \
iossim_1_8_2
}
isEmpty(BUILD_CPLUSPLUS_TOOLS):BUILD_CPLUSPLUS_TOOLS=$$(BUILD_CPLUSPLUS_TOOLS)
!isEmpty(BUILD_CPLUSPLUS_TOOLS): SUBDIRS += cplusplus-keywordgen

View File

@@ -1,31 +0,0 @@
Author: Landon Fuller <landonf@plausiblelabs.com>
Copyright (c) 2008-2011 Plausible Labs Cooperative, Inc.
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Modifications made by the following entities are licensed as above:
- Jeff Haynie, Appcelerator, Inc.
- https://github.com/hborders
- http://pivotallabs.com/users/scoward/blog
- Eloy Duran, Fingertips <eloy@fngtps.com>
- Fawzi Mohamed, digia <fawzi.mohamed@digia.com>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>iossim</string>
<key>CFBundleIdentifier</key>
<string>org.qt-project.qt-creator.iossim</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>

View File

@@ -1,450 +0,0 @@
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#pragma mark Function Pointers and Blocks
typedef void (*CDUnknownFunctionPointerType)(void); // return type and parameters are unknown
typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
#pragma mark Named Structures
/*struct CGSize {
double width;
double height;
};*/
#pragma mark -
//
// File: $(DEVELOPER_DIR)/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/CoreSimulator
// UUID: C7A40E7B-B10C-3CB4-85F5-42071E2E5C4C
//
// Arch: x86_64
// Current version: 84.0.0
// Compatibility version: 1.0.0
// Source version: 84.0.0.0.0
// Minimum Mac OS X version: 10.9.0
// SDK version: 10.9.0
//
// Objective-C Garbage Collection: Unsupported
//
@protocol OS_dispatch_queue;
@protocol OS_xpc_object;
@protocol SimBridge;
@class SimDevice;
@class SimDeviceSet;
@class SimDeviceType;
@class SimRuntime;
@class SimDeviceNotificationManager;
@class SimServiceConnectionManager;
@protocol SimDeviceNotifier
- (BOOL)unregisterNotificationHandler:(unsigned long long)arg1 error:(id *)arg2;
- (unsigned long long)registerNotificationHandlerOnQueue:(NSObject<OS_dispatch_queue> *)arg1 handler:(void (^)(NSDictionary *))arg2;
- (unsigned long long)registerNotificationHandler:(void (^)(NSDictionary *))arg1;
@end
@interface NSArray (argv)
- (void)freeArgv:(char **)arg1;
- (char **)argv;
@end
@interface NSDictionary (envp)
- (void)freeEnvp:(char **)arg1;
- (char **)envp;
@end
@interface NSError (SimError)
+ (id)errorFromXPCDict:(id)arg1;
+ (id)errorWithSimErrno:(int)arg1 localizedDescription:(id)arg2;
+ (id)errorWithSimErrno:(int)arg1 userInfo:(id)arg2;
+ (id)errorWithSimErrno:(int)arg1;
- (id)xpcDict;
@end
@interface NSString (cputype)
+ (id)stringForCPUType:(int)arg1;
- (int)cputype;
@end
@interface NSUserDefaults (SimDefaults)
+ (id)simulatorDefaults;
@end
@interface SimDevice : NSObject <SimDeviceNotifier>
{
unsigned long long _state;
NSString *_name;
NSDictionary *_uiWindowProperties;
SimDeviceType *_deviceType;
SimRuntime *_runtime;
NSUUID *_UDID;
SimDeviceSet *_deviceSet;
SimServiceConnectionManager *_connectionManager;
NSString *_setPath;
SimDeviceNotificationManager *_notificationManager;
NSObject<OS_dispatch_queue> *_bootstrapQueue;
NSMutableDictionary *_registeredServices;
NSObject<OS_dispatch_queue> *_stateVariableQueue;
NSMachPort *_deathTriggerPort;
NSMachPort *_hostSupportPort;
NSMachPort *_simBridgePort;
NSDistantObject<SimBridge> *_simBridgeDistantObject;
}
+ (id)simDevice:(id)arg1 UDID:(id)arg2 deviceType:(id)arg3 runtime:(id)arg4 state:(unsigned long long)arg5 connectionManager:(id)arg6 setPath:(id)arg7;
+ (id)simDeviceAtPath:(id)arg1;
+ (id)createDeviceWithName:(id)arg1 setPath:(id)arg2 deviceType:(id)arg3 runtime:(id)arg4;
+ (BOOL)isValidState:(unsigned long long)arg1;
@property(retain, nonatomic) NSDistantObject<SimBridge> *simBridgeDistantObject; // @synthesize simBridgeDistantObject=_simBridgeDistantObject;
@property(retain, nonatomic) NSMachPort *simBridgePort; // @synthesize simBridgePort=_simBridgePort;
@property(retain, nonatomic) NSMachPort *hostSupportPort; // @synthesize hostSupportPort=_hostSupportPort;
@property(retain) NSMachPort *deathTriggerPort; // @synthesize deathTriggerPort=_deathTriggerPort;
@property(retain) NSObject<OS_dispatch_queue> *stateVariableQueue; // @synthesize stateVariableQueue=_stateVariableQueue;
@property(retain) NSMutableDictionary *registeredServices; // @synthesize registeredServices=_registeredServices;
@property(retain) NSObject<OS_dispatch_queue> *bootstrapQueue; // @synthesize bootstrapQueue=_bootstrapQueue;
@property(retain) SimDeviceNotificationManager *notificationManager; // @synthesize notificationManager=_notificationManager;
@property(copy) NSString *setPath; // @synthesize setPath=_setPath;
@property(retain) SimServiceConnectionManager *connectionManager; // @synthesize connectionManager=_connectionManager;
@property(readonly) SimDeviceSet *deviceSet; // @synthesize deviceSet=_deviceSet;
@property(copy) NSUUID *UDID; // @synthesize UDID=_UDID;
@property(retain) SimRuntime *runtime; // @synthesize runtime=_runtime;
@property(retain) SimDeviceType *deviceType; // @synthesize deviceType=_deviceType;
//- (void).cxx_destruct;
- (BOOL)isAvailableWithError:(id *)arg1;
@property(readonly) BOOL available;
- (int)launchApplicationWithID:(id)arg1 options:(id)arg2 error:(id *)arg3;
- (void)launchApplicationAsyncWithID:(id)arg1 options:(id)arg2 completionHandler:(CDUnknownBlockType)arg3;
- (id)installedAppsWithError:(id *)arg1;
- (BOOL)applicationIsInstalled:(id)arg1 type:(id *)arg2 error:(id *)arg3;
- (BOOL)uninstallApplication:(id)arg1 withOptions:(id)arg2 error:(id *)arg3;
- (BOOL)installApplication:(id)arg1 withOptions:(id)arg2 error:(id *)arg3;
- (BOOL)setKeyboardLanguage:(id)arg1 error:(id *)arg2;
- (BOOL)addPhoto:(id)arg1 error:(id *)arg2;
- (BOOL)openURL:(id)arg1 error:(id *)arg2;
- (void)simBridgeSync:(CDUnknownBlockType)arg1;
- (void)simBridgeAsync:(CDUnknownBlockType)arg1;
- (void)simBridgeCommon:(CDUnknownBlockType)arg1;
- (long long)compare:(id)arg1;
- (id)newDeviceNotification;
- (id)createXPCNotification:(const char *)arg1;
- (id)createXPCRequest:(const char *)arg1;
- (void)handleXPCRequestSpawn:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestGetenv:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestLookup:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestRegister:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestRestore:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestUpdateUIWindow:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestErase:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestUpgrade:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestShutdown:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestBoot:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequestRename:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequest:(id)arg1 peer:(id)arg2;
- (void)handleXPCNotificationDeviceUIWindowPropertiesChanged:(id)arg1;
- (void)handleXPCNotificationDeviceRenamed:(id)arg1;
- (void)handleXPCNotificationDeviceStateChanged:(id)arg1;
- (void)handleXPCNotification:(id)arg1;
@property(copy) NSDictionary *uiWindowProperties;
@property(copy) NSString *name;
@property unsigned long long state;
- (id)stateString;
- (BOOL)unregisterNotificationHandler:(unsigned long long)arg1 error:(id *)arg2;
- (unsigned long long)registerNotificationHandlerOnQueue:(id)arg1 handler:(CDUnknownBlockType)arg2;
- (unsigned long long)registerNotificationHandler:(CDUnknownBlockType)arg1;
- (void)simulateMemoryWarning;
- (id)memoryWarningFilePath;
@property(readonly, copy) NSString *logPath;
- (id)dataPath;
- (id)devicePath;
- (id)environment;
- (int)_spawnFromSelfWithPath:(id)arg1 options:(id)arg2 terminationHandler:(CDUnknownBlockType)arg3 error:(id *)arg4;
- (int)_spawnFromLaunchdWithPath:(id)arg1 options:(id)arg2 terminationHandler:(CDUnknownBlockType)arg3 error:(id *)arg4;
- (int)spawnWithPath:(id)arg1 options:(id)arg2 terminationHandler:(CDUnknownBlockType)arg3 error:(id *)arg4;
- (void)spawnAsyncWithPath:(id)arg1 options:(id)arg2 terminationHandler:(CDUnknownBlockType)arg3 completionHandler:(CDUnknownBlockType)arg4;
- (BOOL)registerPort:(unsigned int)arg1 service:(id)arg2 error:(id *)arg3;
- (unsigned int)lookup:(id)arg1 error:(id *)arg2;
- (unsigned int)_lookup:(id)arg1 error:(id *)arg2;
- (id)getenv:(id)arg1 error:(id *)arg2;
- (BOOL)restoreContentsAndSettingsFromDevice:(id)arg1 error:(id *)arg2;
- (void)restoreContentsAndSettingsAsyncFromDevice:(id)arg1 completionHandler:(CDUnknownBlockType)arg2;
- (BOOL)updateUIWindowProperties:(id)arg1 error:(id *)arg2;
- (void)updateAsyncUIWindowProperties:(id)arg1 completionHandler:(CDUnknownBlockType)arg2;
- (void)_sendUIWindowPropertiesToDevice;
- (BOOL)eraseContentsAndSettingsWithError:(id *)arg1;
- (void)eraseContentsAndSettingsAsyncWithCompletionHandler:(CDUnknownBlockType)arg1;
- (BOOL)upgradeToRuntime:(id)arg1 error:(id *)arg2;
- (void)upgradeAsyncToRuntime:(id)arg1 completionHandler:(CDUnknownBlockType)arg2;
- (BOOL)rename:(id)arg1 error:(id *)arg2;
- (void)renameAsync:(id)arg1 completionHandler:(CDUnknownBlockType)arg2;
- (BOOL)shutdownWithError:(id *)arg1;
- (BOOL)_shutdownWithError:(id *)arg1;
- (void)shutdownAsyncWithCompletionHandler:(CDUnknownBlockType)arg1;
- (BOOL)bootWithOptions:(id)arg1 error:(id *)arg2;
- (void)bootAsyncWithOptions:(id)arg1 completionHandler:(CDUnknownBlockType)arg2;
- (void)launchdDeathHandlerWithDeathPort:(id)arg1;
- (BOOL)startLaunchdWithDeathPort:(id)arg1 deathHandler:(CDUnknownBlockType)arg2 error:(id *)arg3;
- (void)registerPortsWithLaunchd;
@property(readonly) NSArray *launchDaemonsPaths;
- (BOOL)removeLaunchdJobWithError:(id *)arg1;
- (BOOL)createLaunchdJobWithError:(id *)arg1 extraEnvironment:(id)arg2;
- (BOOL)clearTmpWithError:(id *)arg1;
- (BOOL)ensureLogPathsWithError:(id *)arg1;
- (BOOL)supportsFeature:(id)arg1;
@property(readonly, copy) NSString *launchdJobName;
- (void)saveToDisk;
- (id)saveStateDict;
- (void)validateAndFixState;
@property(readonly, copy) NSString *descriptiveName;
- (id)description;
- (void)dealloc;
- (id)initDevice:(id)arg1 UDID:(id)arg2 deviceType:(id)arg3 runtime:(id)arg4 state:(unsigned long long)arg5 connectionManager:(id)arg6 setPath:(id)arg7;
@end
@interface SimDeviceNotificationManager : NSObject <SimDeviceNotifier>
{
NSObject<OS_dispatch_queue> *_handlersQueue;
NSMutableDictionary *_handlers;
unsigned long long _next_regID;
NSObject<OS_dispatch_queue> *_sendQueue;
}
@property(retain) NSObject<OS_dispatch_queue> *sendQueue; // @synthesize sendQueue=_sendQueue;
@property unsigned long long next_regID; // @synthesize next_regID=_next_regID;
@property(retain) NSMutableDictionary *handlers; // @synthesize handlers=_handlers;
@property(retain) NSObject<OS_dispatch_queue> *handlersQueue; // @synthesize handlersQueue=_handlersQueue;
//- (void).cxx_destruct;
- (void)sendNotification:(id)arg1;
- (BOOL)unregisterNotificationHandler:(unsigned long long)arg1 error:(id *)arg2;
- (unsigned long long)registerNotificationHandlerOnQueue:(id)arg1 handler:(CDUnknownBlockType)arg2;
- (unsigned long long)registerNotificationHandler:(CDUnknownBlockType)arg1;
- (void)dealloc;
- (id)init;
@end
@interface SimDeviceSet : NSObject <SimDeviceNotifier>
{
NSString *_setPath;
NSObject<OS_dispatch_queue> *_devicesQueue;
NSMutableDictionary *__devicesByUDID;
NSMutableDictionary *_devicesNotificationRegIDs;
SimServiceConnectionManager *_connectionManager;
SimDeviceNotificationManager *_notificationManager;
}
+ (id)setForSetPath:(id)arg1;
+ (id)defaultSet;
+ (id)defaultSetPath;
@property(retain) SimDeviceNotificationManager *notificationManager; // @synthesize notificationManager=_notificationManager;
@property(retain) SimServiceConnectionManager *connectionManager; // @synthesize connectionManager=_connectionManager;
@property(retain) NSMutableDictionary *devicesNotificationRegIDs; // @synthesize devicesNotificationRegIDs=_devicesNotificationRegIDs;
@property(retain) NSMutableDictionary *_devicesByUDID; // @synthesize _devicesByUDID=__devicesByUDID;
@property(retain) NSObject<OS_dispatch_queue> *devicesQueue; // @synthesize devicesQueue=_devicesQueue;
@property(copy) NSString *setPath; // @synthesize setPath=_setPath;
//- (void).cxx_destruct;
- (void)handleXPCRequestDeleteDevice:(id)arg1 peer:(id)arg2 device:(id)arg3;
- (void)handleXPCRequestCreateDevice:(id)arg1 peer:(id)arg2;
- (void)handleXPCRequest:(id)arg1 peer:(id)arg2;
- (void)handleXPCNotificationDeviceRemoved:(id)arg1;
- (void)handleXPCNotificationDeviceAdded:(id)arg1;
- (void)handleXPCNotification:(id)arg1;
- (BOOL)deleteDevice:(id)arg1 error:(id *)arg2;
- (void)deleteDeviceAsync:(id)arg1 completionHandler:(CDUnknownBlockType)arg2;
- (id)createDeviceWithType:(id)arg1 runtime:(id)arg2 name:(id)arg3 error:(id *)arg4;
- (void)createDeviceAsyncWithType:(id)arg1 runtime:(id)arg2 name:(id)arg3 completionHandler:(CDUnknownBlockType)arg4;
- (BOOL)unregisterNotificationHandler:(unsigned long long)arg1 error:(id *)arg2;
- (unsigned long long)registerNotificationHandlerOnQueue:(id)arg1 handler:(CDUnknownBlockType)arg2;
- (unsigned long long)registerNotificationHandler:(CDUnknownBlockType)arg1;
- (void)removeDeviceAsync:(id)arg1;
- (void)addDevice:(id)arg1;
- (void)addDeviceAsync:(id)arg1;
- (void)updateDefaultDevices;
- (id)defaultCreatedPlistPath;
@property(readonly, copy) NSArray *availableDevices;
@property(readonly, copy) NSArray *devices;
@property(readonly, copy) NSDictionary *devicesByUDID;
- (id)description;
- (void)dealloc;
- (id)initWithSetPath:(id)arg1;
@end
@interface SimDeviceType : NSObject
{
float _mainScreenScale;
unsigned int _minRuntimeVersion;
unsigned int _maxRuntimeVersion;
NSString *_name;
NSString *_identifier;
NSString *_modelIdentifier;
NSBundle *_bundle;
NSArray *_supportedArchs;
NSArray *_supportedProductFamilyIDs;
NSDictionary *_capabilities;
NSString *_springBoardConfigName;
NSString *_productClass;
NSDictionary *_environment_extra;
NSDictionary *_aliases;
NSDictionary *_supportedFeatures;
NSDictionary *_supportedFeaturesConditionalOnRuntime;
struct CGSize _mainScreenSize;
struct CGSize _mainScreenDPI;
}
+ (id)supportedDeviceTypesByName;
+ (id)supportedDeviceTypesByAlias;
+ (id)supportedDeviceTypesByIdentifier;
+ (id)supportedDeviceTypes;
+ (id)supportedDevices;
@property(copy) NSDictionary *supportedFeaturesConditionalOnRuntime; // @synthesize supportedFeaturesConditionalOnRuntime=_supportedFeaturesConditionalOnRuntime;
@property(copy) NSDictionary *supportedFeatures; // @synthesize supportedFeatures=_supportedFeatures;
@property(copy) NSDictionary *aliases; // @synthesize aliases=_aliases;
@property(copy) NSDictionary *environment_extra; // @synthesize environment_extra=_environment_extra;
@property(copy) NSString *productClass; // @synthesize productClass=_productClass;
@property(copy) NSString *springBoardConfigName; // @synthesize springBoardConfigName=_springBoardConfigName;
@property unsigned int maxRuntimeVersion; // @synthesize maxRuntimeVersion=_maxRuntimeVersion;
@property unsigned int minRuntimeVersion; // @synthesize minRuntimeVersion=_minRuntimeVersion;
@property struct CGSize mainScreenDPI; // @synthesize mainScreenDPI=_mainScreenDPI;
@property struct CGSize mainScreenSize; // @synthesize mainScreenSize=_mainScreenSize;
@property(copy) NSDictionary *capabilities; // @synthesize capabilities=_capabilities;
@property float mainScreenScale; // @synthesize mainScreenScale=_mainScreenScale;
@property(copy) NSArray *supportedProductFamilyIDs; // @synthesize supportedProductFamilyIDs=_supportedProductFamilyIDs;
@property(copy) NSArray *supportedArchs; // @synthesize supportedArchs=_supportedArchs;
@property(retain) NSBundle *bundle; // @synthesize bundle=_bundle;
@property(copy) NSString *modelIdentifier; // @synthesize modelIdentifier=_modelIdentifier;
@property(copy) NSString *identifier; // @synthesize identifier=_identifier;
@property(copy) NSString *name; // @synthesize name=_name;
//- (void).cxx_destruct;
- (Class)deviceClass;
- (long long)compare:(id)arg1;
- (BOOL)supportsFeatureConditionally:(id)arg1;
- (BOOL)supportsFeature:(id)arg1;
- (id)environmentForRuntime:(id)arg1;
- (id)environment;
@property(readonly, copy) NSString *productFamily;
@property(readonly) int productFamilyID;
- (id)description;
- (void)dealloc;
- (id)initWithBundle:(id)arg1;
- (id)initWithPath:(id)arg1;
- (id)init;
@end
@interface SimRuntime : NSObject
{
unsigned int _version;
unsigned int _minHostVersion;
unsigned int _maxHostVersion;
NSString *_name;
NSString *_identifier;
NSBundle *_bundle;
NSString *_root;
NSString *_versionString;
NSString *_buildVersionString;
NSDictionary *_supportedFeatures;
NSDictionary *_supportedFeaturesConditionalOnDeviceType;
NSDictionary *_requiredHostServices;
NSString *_platformPath;
NSArray *_supportedProductFamilyIDs;
NSDictionary *_environment_extra;
void *_libLaunchHostHandle;
NSDictionary *_aliases;
}
+ (id)supportedRuntimesByAlias;
+ (id)supportedRuntimesByIdentifier;
+ (id)supportedRuntimes;
@property unsigned int maxHostVersion; // @synthesize maxHostVersion=_maxHostVersion;
@property unsigned int minHostVersion; // @synthesize minHostVersion=_minHostVersion;
@property(copy) NSDictionary *aliases; // @synthesize aliases=_aliases;
@property(nonatomic) void *libLaunchHostHandle; // @synthesize libLaunchHostHandle=_libLaunchHostHandle;
@property(copy) NSDictionary *environment_extra; // @synthesize environment_extra=_environment_extra;
@property(copy) NSArray *supportedProductFamilyIDs; // @synthesize supportedProductFamilyIDs=_supportedProductFamilyIDs;
@property(copy) NSString *platformPath; // @synthesize platformPath=_platformPath;
@property(copy) NSDictionary *requiredHostServices; // @synthesize requiredHostServices=_requiredHostServices;
@property(copy) NSDictionary *supportedFeaturesConditionalOnDeviceType; // @synthesize supportedFeaturesConditionalOnDeviceType=_supportedFeaturesConditionalOnDeviceType;
@property(copy) NSDictionary *supportedFeatures; // @synthesize supportedFeatures=_supportedFeatures;
@property unsigned int version; // @synthesize version=_version;
@property(copy) NSString *buildVersionString; // @synthesize buildVersionString=_buildVersionString;
@property(copy) NSString *versionString; // @synthesize versionString=_versionString;
@property(copy) NSString *root; // @synthesize root=_root;
@property(retain) NSBundle *bundle; // @synthesize bundle=_bundle;
@property(copy) NSString *identifier; // @synthesize identifier=_identifier;
@property(copy) NSString *name; // @synthesize name=_name;
//- (void).cxx_destruct;
- (id)platformRuntimeOverlay;
- (CDUnknownFunctionPointerType)launch_sim_set_death_handler;
- (CDUnknownFunctionPointerType)launch_sim_waitpid;
- (CDUnknownFunctionPointerType)launch_sim_spawn;
- (CDUnknownFunctionPointerType)launch_sim_getenv;
- (CDUnknownFunctionPointerType)launch_sim_bind_session_to_port;
- (CDUnknownFunctionPointerType)launch_sim_find_endpoint;
- (CDUnknownFunctionPointerType)launch_sim_register_endpoint;
- (BOOL)isAvailableWithError:(id *)arg1;
@property(readonly) BOOL available;
- (BOOL)verifyRuntime;
- (id)dyld_simPath;
- (BOOL)createInitialContentPath:(id)arg1 error:(id *)arg2;
- (void)createInitialContentPath:(id)arg1;
- (id)sampleContentPath;
- (long long)compare:(id)arg1;
- (BOOL)supportsFeatureConditionally:(id)arg1;
- (BOOL)supportsFeature:(id)arg1;
- (BOOL)supportsDeviceType:(id)arg1;
- (BOOL)supportsDevice:(id)arg1;
- (id)environment;
- (id)description;
- (void)dealloc;
- (id)initWithBundle:(id)arg1;
- (id)initWithPath:(id)arg1;
- (id)init;
@end
@interface SimServiceConnectionManager : NSObject
{
NSObject<OS_xpc_object> *_serviceConnection;
NSObject<OS_dispatch_queue> *_serviceConnectionQueue;
NSDate *_lastConnectionTime;
}
+ (void)useService:(BOOL)arg1;
+ (id)sharedConnectionManager;
@property(retain) NSDate *lastConnectionTime; // @synthesize lastConnectionTime=_lastConnectionTime;
@property(retain) NSObject<OS_dispatch_queue> *serviceConnectionQueue; // @synthesize serviceConnectionQueue=_serviceConnectionQueue;
@property(retain) NSObject<OS_xpc_object> *serviceConnection; // @synthesize serviceConnection=_serviceConnection;
//- (void).cxx_destruct;
- (void)handleXPCEvent:(id)arg1;
- (void)dealloc;
- (BOOL)connect;
- (id)init;
@end
@interface SimVerifier : NSObject
{
NSObject<OS_xpc_object> *_serviceConnection;
NSObject<OS_dispatch_queue> *_serviceConnectionQueue;
}
+ (id)verificationError:(int)arg1;
+ (id)connectionError;
+ (id)sharedVerifier;
@property(retain) NSObject<OS_dispatch_queue> *serviceConnectionQueue; // @synthesize serviceConnectionQueue=_serviceConnectionQueue;
@property(retain) NSObject<OS_xpc_object> *serviceConnection; // @synthesize serviceConnection=_serviceConnection;
//- (void).cxx_destruct;
- (id)verifyDyldSim:(id)arg1;
- (id)verifyAll;
- (BOOL)verifyAllWithError:(id *)arg1;
- (void)dealloc;
- (id)init;
@end

View File

@@ -1,295 +0,0 @@
#import "../coresimulator/coresimulator.h"
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#pragma mark Blocks
typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
#pragma mark -
//
// File: $(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/DVTiPhoneSimulatorRemoteClient.framework/Versions/A/DVTiPhoneSimulatorRemoteClient
//
// Arch: x86_64
// Current version: 12.0.0
// Compatibility version: 1.0.0
// Source version: 5037.3.0.0.0
// Minimum Mac OS X version: 10.8.0
// SDK version: 10.9.0
//
// Objective-C Garbage Collection: Unsupported
//
// Run path: @loader_path/../../../../PrivateFrameworks/
// = $(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks
//
@class DTiPhoneSimulatorApplicationSpecifier;
@class DTiPhoneSimulatorSession;
@class DTiPhoneSimulatorSessionConfig;
@class DTiPhoneSimulatorSystemRoot;
@class DVTiPhoneSimulatorMessenger;
@protocol DTiPhoneSimulatorSessionDelegate
- (void) session: (DTiPhoneSimulatorSession *) session didEndWithError: (NSError *) error;
- (void) session: (DTiPhoneSimulatorSession *) session didStart: (BOOL) started withError: (NSError *) error;
@end
@protocol OS_dispatch_source
@end
@protocol OS_dispatch_queue
@end
@class DVTDispatchLock;
@class DVTConfinementServiceConnection;
@class DVTTask;
@interface DVTiPhoneSimulatorMessenger : NSObject
{
DTiPhoneSimulatorSession *_session;
CDUnknownBlockType _readyMessageHandler;
CDUnknownBlockType _runningMessageHandler;
CDUnknownBlockType _appDidLaunchMessageHandler;
CDUnknownBlockType _appDidQuitMessageHandler;
CDUnknownBlockType _appPIDExitedMessageHandler;
CDUnknownBlockType _toolDidLaunchMessageHandler;
}
+ (id)messengerForSession:(id)arg1 withConnection:(id)arg2;
+ (id)messengerForSession:(id)arg1;
@property(copy, nonatomic) CDUnknownBlockType toolDidLaunchMessageHandler; // @synthesize toolDidLaunchMessageHandler=_toolDidLaunchMessageHandler;
@property(copy, nonatomic) CDUnknownBlockType appPIDExitedMessageHandler; // @synthesize appPIDExitedMessageHandler=_appPIDExitedMessageHandler;
@property(copy, nonatomic) CDUnknownBlockType appDidQuitMessageHandler; // @synthesize appDidQuitMessageHandler=_appDidQuitMessageHandler;
@property(copy, nonatomic) CDUnknownBlockType appDidLaunchMessageHandler; // @synthesize appDidLaunchMessageHandler=_appDidLaunchMessageHandler;
@property(copy, nonatomic) CDUnknownBlockType runningMessageHandler; // @synthesize runningMessageHandler=_runningMessageHandler;
@property(copy, nonatomic) CDUnknownBlockType readyMessageHandler; // @synthesize readyMessageHandler=_readyMessageHandler;
@property(readonly) DTiPhoneSimulatorSession *session; // @synthesize session=_session;
- (void)doUbiquityFetchEvent;
- (void)doFetchEventForPID:(int)arg1;
- (void)backgroundAllApps:(int)arg1;
- (void)startSimulatorToolSessionWithParameters:(id)arg1;
- (void)stopSimulatingLocation;
- (void)startSimulatingLocationWithLatitude:(id)arg1 longitute:(id)arg2;
- (void)endSimulatorSessionWithPID:(int)arg1;
- (void)startSimulatorSessionWithRequestInfo:(id)arg1;
- (void)clearAllMessageHandlers;
- (void)waitPID:(int)arg1 withAppPIDExitedMessagedHandler:(CDUnknownBlockType)arg2;
- (void)disconnectFromService;
- (BOOL)connectToServiceWithSessionOnLaunch:(BOOL)arg1 simulatorPID:(int *)arg2 error:(id *)arg3;
- (id)initWithSession:(id)arg1;
@end
@interface DVTiPhoneSimulatorLocalMessenger : DVTiPhoneSimulatorMessenger
{
BOOL _appTerminationMessageSent;
NSObject<OS_dispatch_source> *_pidDispatchSource;
DVTTask *_simTask;
}
- (void)doUbiquityFetchEvent;
- (void)doFetchEventForPID:(int)arg1;
- (void)backgroundAllApps:(int)arg1;
- (void)_handleSimulatorToolDidLaunchMessage:(id)arg1;
- (void)setToolDidLaunchMessageHandler:(CDUnknownBlockType)arg1;
- (void)waitPID:(int)arg1 withAppPIDExitedMessagedHandler:(CDUnknownBlockType)arg2;
- (void)_handleSimulatorAppDidQuitMessage:(id)arg1;
- (void)setAppDidQuitMessageHandler:(CDUnknownBlockType)arg1;
- (void)_handleSimulatorAppDidLaunchMessage:(id)arg1;
- (void)setAppDidLaunchMessageHandler:(CDUnknownBlockType)arg1;
- (void)_handleSimulatorRunningMessage:(id)arg1;
- (void)setRunningMessageHandler:(CDUnknownBlockType)arg1;
- (void)_handleSimulatorReadyMessage:(id)arg1;
- (void)setReadyMessageHandler:(CDUnknownBlockType)arg1;
- (void)startSimulatorToolSessionWithParameters:(id)arg1;
- (void)stopSimulatingLocation;
- (void)startSimulatingLocationWithLatitude:(id)arg1 longitute:(id)arg2;
- (void)endSimulatorSessionWithPID:(int)arg1;
- (void)startSimulatorSessionWithRequestInfo:(id)arg1;
- (void)clearAllMessageHandlers;
- (void)disconnectFromService;
- (BOOL)connectToServiceWithSessionOnLaunch:(BOOL)arg1 simulatorPID:(int *)arg2 error:(id *)arg3;
- (void)_enableObserver:(BOOL)arg1 forName:(id)arg2 selector:(SEL)arg3;
@end
@interface DVTiPhoneSimulatorRemoteMessenger : DVTiPhoneSimulatorMessenger
{
unsigned long long _commandTag;
NSObject<OS_dispatch_queue> *_responseQueue;
DVTDispatchLock *_awaitingLock;
NSMutableDictionary *_awaitingSemaphores;
NSMutableDictionary *_awaitingResponses;
NSMutableSet *_waitingAppPIDs;
DVTConfinementServiceConnection *_connection;
}
@property(readonly) DVTConfinementServiceConnection *connection; // @synthesize connection=_connection;
- (void)handleNotificationResponse:(id)arg1;
- (void)waitPID:(int)arg1 withAppPIDExitedMessagedHandler:(CDUnknownBlockType)arg2;
- (void)startSimulatorToolSessionWithParameters:(id)arg1;
- (void)stopSimulatingLocation;
- (void)startSimulatingLocationWithLatitude:(id)arg1 longitute:(id)arg2;
- (void)endSimulatorSessionWithPID:(int)arg1;
- (void)startSimulatorSessionWithRequestInfo:(id)arg1;
- (void)disconnectFromService;
- (BOOL)connectToServiceWithSessionOnLaunch:(BOOL)arg1 simulatorPID:(int *)arg2 error:(id *)arg3;
- (BOOL)sendTaggedRequest:(id)arg1 awaitingResponse:(id *)arg2 error:(id *)arg3;
- (id)nextCommandTag;
- (id)awaitResponseWithTag:(id)arg1 error:(id *)arg2;
- (void)enqueueResponse:(id)arg1 withTag:(id)arg2 error:(id)arg3;
- (BOOL)sendRequest:(id)arg1 withTag:(id)arg2 error:(id *)arg3;
- (id)initWithSession:(id)arg1 connection:(id)arg2;
@end
@interface DTiPhoneSimulatorSession : NSObject
{
int _simulatedApplicationPID;
int _simulatorPID;
NSString *_uuid;
id <DTiPhoneSimulatorSessionDelegate> _delegate;
NSString *_simulatedAppPath;
long long _sessionLifecycleProgress;
NSTimer *_timeoutTimer;
DTiPhoneSimulatorSessionConfig *_sessionConfig;
DVTiPhoneSimulatorMessenger *_messenger;
}
@property(retain) DVTiPhoneSimulatorMessenger *messenger; // @synthesize messenger=_messenger;
@property(copy, nonatomic) DTiPhoneSimulatorSessionConfig *sessionConfig; // @synthesize sessionConfig=_sessionConfig;
@property(retain, nonatomic) NSTimer *timeoutTimer; // @synthesize timeoutTimer=_timeoutTimer;
@property(nonatomic) long long sessionLifecycleProgress; // @synthesize sessionLifecycleProgress=_sessionLifecycleProgress;
@property int simulatorPID; // @synthesize simulatorPID=_simulatorPID;
@property(copy) NSString *simulatedAppPath; // @synthesize simulatedAppPath=_simulatedAppPath;
@property int simulatedApplicationPID; // @synthesize simulatedApplicationPID=_simulatedApplicationPID;
@property(retain, nonatomic) id <DTiPhoneSimulatorSessionDelegate> delegate; // @synthesize delegate=_delegate;
@property(copy, nonatomic) NSString *uuid; // @synthesize uuid=_uuid;
- (void)doUbiquityFetchEvent;
- (void)doFetchEventForPID:(int)arg1;
- (void)backgroundAllApps:(int)arg1;
- (id)_invalidConfigError;
- (void)_endSimulatorSession;
- (void)_callDelegateResponseFromSessionEndedInfo:(id)arg1;
- (void)_callDelegateResponseFromSessionStartedInfo:(id)arg1;
- (id)_sessionStartRequestInfoFromConfig:(id)arg1 withError:(id *)arg2;
- (BOOL)_startToolSessionInSimulatorWithError:(id *)arg1;
- (BOOL)_startApplicationSessionInSimulatorWithError:(id *)arg1;
- (BOOL)_startBasicSessionInSimulatorWithError:(id *)arg1;
- (BOOL)_startSessionInSimulatorWithError:(id *)arg1;
- (BOOL)_handleSessionEndedInSimulator:(id)arg1 notification:(id)arg2;
- (void)_handleSessionStartedWithSim:(id)arg1;
- (void)_handleSessionStartedInSimulator:(id)arg1;
- (void)_handleSimulatorReadyMessage:(id)arg1;
- (void)_timeoutElapsed:(id)arg1;
- (BOOL)attachedToTargetWithConfig:(id)arg1 error:(id *)arg2;
- (void)stopLocationSimulation;
- (void)simulateLocationWithLatitude:(id)arg1 longitude:(id)arg2;
- (void)requestEndWithTimeout:(double)arg1;
- (BOOL)requestStartWithConfig:(id)arg1 timeout:(double)arg2 error:(id *)arg3;
- (BOOL)_setUpSimulatorMessengerWithConfig:(id)arg1 error:(id *)arg2;
- (id)description;
- (void)dealloc;
- (id)init;
@end
@interface DTiPhoneSimulatorSessionConfig : NSObject <NSCopying>
{
BOOL _launchForBackgroundFetch;
BOOL _simulatedApplicationShouldWaitForDebugger;
NSString *_localizedClientName;
DTiPhoneSimulatorSystemRoot *_simulatedSystemRoot;
NSString *_simulatedDeviceInfoName;
NSNumber *_simulatedDeviceFamily;
NSString *_simulatedArchitecture;
NSNumber *_simulatedDisplayHeight;
NSNumber *_simulatedDisplayScale;
DTiPhoneSimulatorApplicationSpecifier *_applicationToSimulateOnStart;
NSNumber *_pid;
NSArray *_simulatedApplicationLaunchArgs;
NSDictionary *_simulatedApplicationLaunchEnvironment;
NSString *_simulatedApplicationStdOutPath;
NSString *_simulatedApplicationStdErrPath;
NSFileHandle *_stdinFileHandle;
NSFileHandle *_stdoutFileHandle;
NSFileHandle *_stderrFileHandle;
id _confinementService;
}
+ (id)displayNameForDeviceFamily:(id)arg1;
@property(retain) id confinementService; // @synthesize confinementService=_confinementService;
@property(retain) NSFileHandle *stderrFileHandle; // @synthesize stderrFileHandle=_stderrFileHandle;
@property(retain) NSFileHandle *stdoutFileHandle; // @synthesize stdoutFileHandle=_stdoutFileHandle;
@property(retain) NSFileHandle *stdinFileHandle; // @synthesize stdinFileHandle=_stdinFileHandle;
@property(copy) NSString *simulatedApplicationStdErrPath; // @synthesize simulatedApplicationStdErrPath=_simulatedApplicationStdErrPath;
@property(copy) NSString *simulatedApplicationStdOutPath; // @synthesize simulatedApplicationStdOutPath=_simulatedApplicationStdOutPath;
@property BOOL simulatedApplicationShouldWaitForDebugger; // @synthesize simulatedApplicationShouldWaitForDebugger=_simulatedApplicationShouldWaitForDebugger;
@property(copy) NSDictionary *simulatedApplicationLaunchEnvironment; // @synthesize simulatedApplicationLaunchEnvironment=_simulatedApplicationLaunchEnvironment;
@property(copy) NSArray *simulatedApplicationLaunchArgs; // @synthesize simulatedApplicationLaunchArgs=_simulatedApplicationLaunchArgs;
@property(copy) NSNumber *pid; // @synthesize pid=_pid;
@property(copy) DTiPhoneSimulatorApplicationSpecifier *applicationToSimulateOnStart; // @synthesize applicationToSimulateOnStart=_applicationToSimulateOnStart;
@property(copy) NSNumber *simulatedDisplayScale; // @synthesize simulatedDisplayScale=_simulatedDisplayScale;
@property(copy) NSNumber *simulatedDisplayHeight; // @synthesize simulatedDisplayHeight=_simulatedDisplayHeight;
@property(copy) NSString *simulatedArchitecture; // @synthesize simulatedArchitecture=_simulatedArchitecture;
@property(copy) NSNumber *simulatedDeviceFamily; // @synthesize simulatedDeviceFamily=_simulatedDeviceFamily;
@property(retain) NSString *simulatedDeviceInfoName; // @synthesize simulatedDeviceInfoName=_simulatedDeviceInfoName;
@property(copy) DTiPhoneSimulatorSystemRoot *simulatedSystemRoot; // @synthesize simulatedSystemRoot=_simulatedSystemRoot;
@property(copy) NSString *localizedClientName; // @synthesize localizedClientName=_localizedClientName;
@property BOOL launchForBackgroundFetch; // @synthesize launchForBackgroundFetch=_launchForBackgroundFetch;
@property(retain) SimDevice *device; // @synthesize device=_device;
@property(retain) SimRuntime *runtime; // @synthesize runtime=_runtime;
- (id)description;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (id)init;
@end
@interface DTiPhoneSimulatorSystemRoot : NSObject <NSCopying>
{
NSString *sdkRootPath;
NSString *sdkVersion;
NSString *sdkDisplayName;
}
+ (id)rootWithSDKVersion:(id)arg1;
+ (id)rootWithSDKPath:(id)arg1;
+ (id)defaultRoot;
+ (id)knownRoots;
+ (void)initialize;
@property(copy) NSString *sdkDisplayName; // @synthesize sdkDisplayName;
@property(copy) NSString *sdkVersion; // @synthesize sdkVersion;
@property(copy) NSString *sdkRootPath; // @synthesize sdkRootPath;
@property(readonly) SimRuntime *runtime; // @synthesize runtime=_runtime;
- (id)description;
- (long long)compare:(id)arg1;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (BOOL)isEqual:(id)arg1;
- (id)initWithSDKPath:(id)arg1;
@end
@interface DTiPhoneSimulatorApplicationSpecifier : NSObject <NSCopying>
{
NSString *appPath;
NSString *bundleID;
NSString *toolPath;
}
+ (id)specifierWithToolPath:(id)arg1;
+ (id)specifierWithApplicationBundleIdentifier:(id)arg1;
+ (id)specifierWithApplicationPath:(id)arg1;
@property(copy, nonatomic) NSString *toolPath; // @synthesize toolPath;
@property(copy, nonatomic) NSString *bundleID; // @synthesize bundleID;
@property(copy, nonatomic) NSString *appPath; // @synthesize appPath;
- (id)description;
- (id)copyWithZone:(struct _NSZone *)arg1;
@end

View File

@@ -1,60 +0,0 @@
CONFIG += console
QT -= core
QT -= gui
QT -= test
CONFIG -= app_bundle
include(../../../../qtcreator.pri)
# Prevent from popping up in the dock when launched.
# We embed the Info.plist file, so the application doesn't need to
# be a bundle.
QMAKE_LFLAGS += -Wl,-sectcreate,__TEXT,__info_plist,\"$$PWD/Info.plist\"
-fobjc-link-runtime
LIBS += \
-framework Foundation \
-framework CoreServices \
-framework ApplicationServices \
-framework CoreFoundation \
-F/System/Library/PrivateFrameworks \
-framework IOKit -framework AppKit
iPhoneSimulatorRemoteClientDirectLinking {
LIBS += \
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
-F/Applications/Xcode.app/Contents/OtherFrameworks
LIBS += \
-framework DTViPhoneSimulatorRemoteClient
QMAKE_RPATHDIR += /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
/Applications/Xcode.app/Contents/OtherFrameworks \
/System/Library/PrivateFrameworks
}
TEMPLATE = app
# put into a subdir, so we can deploy a separate qt.conf for it
DESTDIR = $$IDE_LIBEXEC_PATH/ios
include(../../../rpath.pri)
OBJECTIVE_SOURCES += \
main.mm \
nsprintf.mm \
nsstringexpandpath.mm \
iphonesimulator.mm
HEADERS += \
iphonesimulator.h \
nsprintf.h \
nsstringexpandpath.h \
version.h \
dvtiphonesimulatorremoteclient/dvtiphonesimulatorremoteclient.h \
coresimulator/coresimulator.h
DISTFILES = IOSSIM_LICENSE \
Info.plist
target.path = $$INSTALL_LIBEXEC_PATH/ios
INSTALLS += target

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