From 5b049394e1a37679faeb2e9e92414400f4b088be Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 8 Apr 2013 14:32:23 +0200 Subject: [PATCH 01/36] QmlDesigner: Fix resize controller assign operator Change-Id: Id9d00c0fa0c1f5d3780191dbe912c5c7c581e549 Reviewed-by: hjk Reviewed-by: Christian Stenger --- .../qmldesigner/components/formeditor/resizecontroller.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp index 36b526f8579..2a8e492140b 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp @@ -165,6 +165,8 @@ ResizeController::~ResizeController() ResizeController &ResizeController::operator =(const ResizeController &other) { m_data = other.m_data; + + return *this; } From 6a3a54ea9070d7f61867ebf7354677949c552553 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 8 Apr 2013 16:04:21 +0200 Subject: [PATCH 02/36] QmlDesigner: Optimize assign operator in resize controller Change-Id: I6b832cd436a70d4c6976fc192e0b2ad9a6964614 Reviewed-by: Friedemann Kleint --- .../qmldesigner/components/formeditor/resizecontroller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp index 2a8e492140b..f904421ae41 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp @@ -164,7 +164,8 @@ ResizeController::~ResizeController() ResizeController &ResizeController::operator =(const ResizeController &other) { - m_data = other.m_data; + if (m_data != other.m_data) + m_data = other.m_data; return *this; } From 0203f7499bab33c35cebdb5360f223087dc1eed1 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 8 Apr 2013 16:43:18 +0200 Subject: [PATCH 03/36] QmlDesigner: Introduce WeakResizeController WeakResizeController is a wrapper class for a weak pointer to the ResizeControllerData. Change-Id: I9052a26e6a5c29d2e794ceecc33075d3ae9970db Reviewed-by: Friedemann Kleint Reviewed-by: Thomas Hartmann --- .../formeditor/resizecontroller.cpp | 47 +++++++++++++++++-- .../components/formeditor/resizecontroller.h | 27 +++++++++-- .../formeditor/resizehandleitem.cpp | 9 ++-- .../components/formeditor/resizehandleitem.h | 4 +- 4 files changed, 74 insertions(+), 13 deletions(-) diff --git a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp index f904421ae41..ed2ce931eb4 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizecontroller.cpp @@ -158,6 +158,11 @@ ResizeController::ResizeController(const ResizeController &other) } +ResizeController::ResizeController(const WeakResizeController &resizeController) + : m_data(resizeController.m_data.toStrongRef()) +{ +} + ResizeController::~ResizeController() { } @@ -264,11 +269,6 @@ FormEditorItem* ResizeController::formEditorItem() const return m_data->formEditorItem.data(); } -QWeakPointer ResizeController::weakPointer() const -{ - return m_data; -} - bool ResizeController::isTopLeftHandle(const ResizeHandleItem *handle) const { return handle == m_data->topLeftItem; @@ -309,4 +309,41 @@ bool ResizeController::isBottomHandle(const ResizeHandleItem *handle) const return handle == m_data->bottomItem; } +WeakResizeController ResizeController::toWeakResizeController() const +{ + return WeakResizeController(*this); +} + +WeakResizeController::WeakResizeController() +{ + +} + +WeakResizeController::WeakResizeController(const WeakResizeController &resizeController) + : m_data(resizeController.m_data) +{ +} + +WeakResizeController::WeakResizeController(const ResizeController &resizeController) + : m_data(resizeController.m_data.toWeakRef()) +{ +} + +WeakResizeController::~WeakResizeController() +{ +} + +WeakResizeController &WeakResizeController::operator =(const WeakResizeController &other) +{ + if (m_data != other.m_data) + m_data = other.m_data; + + return *this; +} + +ResizeController WeakResizeController::toResizeController() const +{ + return ResizeController(*this); +} + } diff --git a/src/plugins/qmldesigner/components/formeditor/resizecontroller.h b/src/plugins/qmldesigner/components/formeditor/resizecontroller.h index d0d53bef5f3..e5f47379081 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizecontroller.h +++ b/src/plugins/qmldesigner/components/formeditor/resizecontroller.h @@ -41,15 +41,17 @@ class LayerItem; class ResizeHandleItem; class ResizeControllerData; +class WeakResizeController; + class ResizeController { + friend class WeakResizeController; public: - friend class ResizeHandleItem; - ResizeController(); ResizeController(LayerItem *layerItem, FormEditorItem *formEditorItem); ResizeController(const ResizeController &resizeController); + ResizeController(const WeakResizeController &resizeController); ~ResizeController(); ResizeController& operator=(const ResizeController &other); @@ -73,13 +75,32 @@ public: bool isRightHandle(const ResizeHandleItem *handle) const; bool isBottomHandle(const ResizeHandleItem *handle) const; + WeakResizeController toWeakResizeController() const; + + private: // functions ResizeController(const QSharedPointer &data); - QWeakPointer weakPointer() const; private: // variables QSharedPointer m_data; }; +class WeakResizeController +{ + friend class ResizeController; +public: + WeakResizeController(); + WeakResizeController(const WeakResizeController &resizeController); + WeakResizeController(const ResizeController &resizeController); + ~WeakResizeController(); + + WeakResizeController& operator=(const WeakResizeController &other); + + ResizeController toResizeController() const; + +private: // variables + QWeakPointer m_data; +}; + } #endif // RESIZECONTROLLER_H diff --git a/src/plugins/qmldesigner/components/formeditor/resizehandleitem.cpp b/src/plugins/qmldesigner/components/formeditor/resizehandleitem.cpp index 794812ed3b3..407a385cf21 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizehandleitem.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizehandleitem.cpp @@ -36,7 +36,7 @@ namespace QmlDesigner { ResizeHandleItem::ResizeHandleItem(QGraphicsItem *parent, const ResizeController &resizeController) : QGraphicsPixmapItem(QPixmap(":/icon/handle/resize_handle.png"), parent), - m_resizeControllerData(resizeController.weakPointer()) + m_weakResizeController(resizeController.toWeakResizeController()) { setShapeMode(QGraphicsPixmapItem::BoundingRectShape); setOffset(-pixmap().rect().center()); @@ -44,6 +44,10 @@ ResizeHandleItem::ResizeHandleItem(QGraphicsItem *parent, const ResizeController setFlag(QGraphicsItem::ItemIgnoresTransformations, true); } +ResizeHandleItem::~ResizeHandleItem() +{ +} + void ResizeHandleItem::setHandlePosition(const QPointF & globalPosition, const QPointF & itemSpacePosition) { m_itemSpacePosition = itemSpacePosition; @@ -62,8 +66,7 @@ QPainterPath ResizeHandleItem::shape() const ResizeController ResizeHandleItem::resizeController() const { - Q_ASSERT(!m_resizeControllerData.isNull()); - return ResizeController(m_resizeControllerData.toStrongRef()); + return ResizeController(m_weakResizeController.toResizeController()); } ResizeHandleItem* ResizeHandleItem::fromGraphicsItem(QGraphicsItem *item) diff --git a/src/plugins/qmldesigner/components/formeditor/resizehandleitem.h b/src/plugins/qmldesigner/components/formeditor/resizehandleitem.h index 1dc203347c1..35d68d5e8e3 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizehandleitem.h +++ b/src/plugins/qmldesigner/components/formeditor/resizehandleitem.h @@ -48,7 +48,7 @@ public: ResizeHandleItem(QGraphicsItem *parent, const ResizeController &resizeController); - + ~ResizeHandleItem(); void setHandlePosition(const QPointF & globalPosition, const QPointF & itemSpacePosition); int type() const; @@ -72,7 +72,7 @@ public: QPointF itemSpacePosition() const; private: - QWeakPointer m_resizeControllerData; + WeakResizeController m_weakResizeController; QPointF m_itemSpacePosition; }; From be085863fcc555ca9fb6a18d38f5c36a4b0ea690 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 9 Apr 2013 09:56:16 +0200 Subject: [PATCH 04/36] Doc: XML attributes of the fieldcontrol element Change-Id: I6ef3a730f659b7275d993d5d685d757b5adbcd93 Reviewed-by: Friedemann Kleint --- .../creator-projects-custom-wizards.qdoc | 148 ++++++++++++++++-- 1 file changed, 134 insertions(+), 14 deletions(-) diff --git a/doc/src/projects/creator-projects-custom-wizards.qdoc b/doc/src/projects/creator-projects-custom-wizards.qdoc index b3e27cc8d46..d48e3441d36 100644 --- a/doc/src/projects/creator-projects-custom-wizards.qdoc +++ b/doc/src/projects/creator-projects-custom-wizards.qdoc @@ -268,16 +268,23 @@ \li \c fieldpagetitle specifies the title of the page. - \li \c field specifies whether the field is mandatory (\c true or - \c false). You can use the value of the \c name field as a - variable in other files (for example, \c {%MESSAGE%}. + \li \c fields specifies the user interface objects on the page. - \li \c fieldcontrol specifies the field. \c class specifies the - field type. You can use interface objects from the QWidget class - to create fields. This example uses QLineEdit to create an input - field. + \li \c field specifies one object. You can use a set of interface objects + from QtWidgets classes, derived from QWidget, to create fields. This example + uses QLineEdit to create an input field. For more information about the objects + that you can add, see \l {Supported Widgets}. - \li \c validator specifies a regular expression to check the + \li \c mandatory specifies whether the field is mandatory (\c true or + \c false). For more information, see QWizardPage::registerField(). + + \li \c name specifies a name that you can use as a placeholder variable in the + template file (for example, \c {%MESSAGE%}). + + \li \c class specifies the type of the \c fieldcontrol. The XML attributes that you + can specify for the field depend on the field type. + + \li For a QLineEdit, \c validator specifies a regular expression to check the characters allowed in the field. \li \c defaulttext specifies text that appears in the field by @@ -360,9 +367,18 @@ Klassenname: - - - + + + + class QString + Klasse QString + + + Integer + Ganzzahlwert + + + Data type: Datentyp: @@ -371,11 +387,85 @@ \endcode In addition to QLineEdit, QComboBox is used in the class wizard to - create a field. \c combochoices specifies the options in the combobox - and \c defaultindex specifies that QString is the default value. + create a field. Specify the following XML attributes: + + \list + + \li \c defaultindex specifies which comboentry is displayed by default. In the above + example, "0" means that the first comboentry is the default value. + + \li \c comboentries specifies the options in the combobox. + + \li \c value specifies the type of each \c comboentry, QString or integer. + + \li \c comboentrytext specifies the text of the entry. + + \endlist \endlist + \section1 Supported Widgets + + You can use the following interface objects to create fields in the wizards: + + \list + + \li PathChooser utility to set paths + + \li Check boxes with text labels (QCheckBox) + + \li Combined button and popup lists (QComboBox) + + \li One-line text editors (QLineEdit) + + \li Multi-line rich text editors (QTextEdit) + + \endlist + + Using QLineEdit and QComboBox is described in the previous sections. + The following sections show examples of using the other classes and describe the XML + attributes that you can specify for the \c fieldcontrol element of a field in a particular + \c class. + + \section2 Path Choosers + + \code + + + Qt Creator sources: + + \endcode + + The \c defaulttext attribute specifies text that appears in the field by default. + + \section2 Check Boxes + + To make check boxes appear selected by default, set the \c fieldcontrol attribute + \c defaultvalue to \c true. Any other value or omitting the attribute makes the check box + appear not selected. + + For example: + + \code + + + Console application + + \endcode + + For more examples about using check boxes, see \l{Processing Template Files}. + + \section2 Text Editors + + \code + + + License: + + \endcode + + The \c defaulttext attribute specifies text that appears in the field by default. + \section1 Processing Template Files When processing a template source file, placeholders specifying the field @@ -396,9 +486,29 @@ \endlist + In the \c{helloworld} example, the placeholder \c %NETWORK% is used together with the + QCheckBox class. The following line is added to the project file: + + \code + %NETWORK%QT += network + \endcode + + And the following field is specified in the wizard.xml: + + \code + + + Include network module + Netzwerk-Modul verwenden + + \endcode + + If the checkbox is checked, the placeholder is replaced by \c truevalue. If it is not + checked, the placeholder is replaced by \c falsevalue. + You can use conditions to add sections of the file depending on field values. Use a syntax that is similar to C++ preprocessing, as demonstrated - in the profile of the \c{helloworld} example: + in the project file of the \c{helloworld} example: \code @@ -412,6 +522,16 @@ whether the script module is added. The expressions must expand to valid Javascript expressions after field replacement. + For example, the following field is specified in the wizard.xml: + + \code + + + Include script module + Script-Modul verwenden + + \endcode + \section1 Pre-defined Standard Variables In addition to the field values entered by the user, you can use From 7c74482ad361ee81f87c8ed039b789807934f0e7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Tue, 2 Apr 2013 23:04:12 +0200 Subject: [PATCH 05/36] C++: fixed operator* for nested class of enclosing template class Fixed: * highlighting * follow symbol * find usage Task-number: QTCREATORBUG-9006 Change-Id: I34a42f8665335857f41290217e7265e8a752455b Reviewed-by: Orgad Shaneh Reviewed-by: Sergey Shambir Reviewed-by: Erik Verbruggen --- src/libs/cplusplus/TypeOfExpression.h | 6 ++- src/plugins/cppeditor/cppeditor.cpp | 1 + .../checksymbols/tst_checksymbols.cpp | 47 +++++++++++++++++++ .../cplusplus/findusages/tst_findusages.cpp | 46 ++++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/src/libs/cplusplus/TypeOfExpression.h b/src/libs/cplusplus/TypeOfExpression.h index 848999f7d0f..adeb1d9644e 100644 --- a/src/libs/cplusplus/TypeOfExpression.h +++ b/src/libs/cplusplus/TypeOfExpression.h @@ -124,7 +124,11 @@ public: QByteArray preprocessedExpression(const QByteArray &utf8code) const; void setExpandTemplates(bool expandTemplates) - { m_expandTemplates = expandTemplates; } + { + if (m_bindings) + m_bindings->setExpandTemplates(expandTemplates); + m_expandTemplates = expandTemplates; + } private: diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 1924aa45774..a9f406480a3 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -321,6 +321,7 @@ struct CanonicalSymbol : editor(editor), info(info) { typeOfExpression.init(info.doc, info.snapshot); + typeOfExpression.setExpandTemplates(true); } const LookupContext &context() const diff --git a/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp b/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp index de6435677e9..432fd2dad42 100644 --- a/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp +++ b/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp @@ -179,6 +179,7 @@ private slots: void test_checksymbols_QTCREATORBUG8890_danglingPointer(); void test_checksymbols_QTCREATORBUG8974_danglingPointer(); + void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006(); }; void tst_CheckSymbols::test_checksymbols_TypeUse() @@ -1233,5 +1234,51 @@ void tst_CheckSymbols::test_checksymbols_QTCREATORBUG8974_danglingPointer() TestData::check(source, expectedUses); } +void tst_CheckSymbols::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006() +{ + const QByteArray source = + "struct Foo { int foo; };\n" + "\n" + "template\n" + "struct Outer\n" + "{\n" + " struct Nested\n" + " {\n" + " const T &operator*() { return t; }\n" + " T t;\n" + " };\n" + "};\n" + "\n" + "void bug()\n" + "{\n" + " Outer::Nested nested;\n" + " (*nested).foo;\n" + "}\n" + ; + + const QList expectedUses = QList() + << Use(1, 8, 3, SemanticInfo::TypeUse) + << Use(1, 18, 3, SemanticInfo::FieldUse) + << Use(3, 16, 1, SemanticInfo::TypeUse) + << Use(4, 8, 5, SemanticInfo::TypeUse) + << Use(6, 10, 6, SemanticInfo::TypeUse) + << Use(8, 11, 1, SemanticInfo::TypeUse) + << Use(8, 14, 8, SemanticInfo::FunctionUse) + << Use(8, 35, 1, SemanticInfo::FieldUse) + << Use(9, 5, 1, SemanticInfo::TypeUse) + << Use(9, 7, 1, SemanticInfo::FieldUse) + << Use(13, 6, 3, SemanticInfo::FunctionUse) + << Use(15, 3, 5, SemanticInfo::TypeUse) + << Use(15, 9, 3, SemanticInfo::TypeUse) + << Use(15, 15, 6, SemanticInfo::TypeUse) + << Use(15, 22, 6, SemanticInfo::LocalUse) + << Use(16, 5, 6, SemanticInfo::LocalUse) + << Use(16, 13, 3, SemanticInfo::FieldUse) + ; + + TestData::check(source, expectedUses); + +} + QTEST_APPLESS_MAIN(tst_CheckSymbols) #include "tst_checksymbols.moc" diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp index 339d852ca05..f2098ab8386 100644 --- a/tests/auto/cplusplus/findusages/tst_findusages.cpp +++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp @@ -94,6 +94,7 @@ private Q_SLOTS: // templates void instantiateTemplateWithNestedClass(); + void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006(); }; void tst_FindUsages::inlineMethod() @@ -444,5 +445,50 @@ void tst_FindUsages::instantiateTemplateWithNestedClass() QCOMPARE(findUsages.usages().size(), 2); } +void tst_FindUsages::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006() +{ + const QByteArray src = "\n" + "struct Foo { int foo; };\n" + "\n" + "template\n" + "struct Outer\n" + "{\n" + " struct Nested\n" + " {\n" + " const T &operator*() { return t; }\n" + " T t;\n" + " };\n" + "};\n" + "\n" + "void bug()\n" + "{\n" + " Outer::Nested nested;\n" + " (*nested).foo;\n" + "}\n" + ; + + Document::Ptr doc = Document::create("operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006"); + doc->setUtf8Source(src); + doc->parse(); + doc->check(); + + QVERIFY(doc->diagnosticMessages().isEmpty()); + QCOMPARE(doc->globalSymbolCount(), 3U); + + Snapshot snapshot; + snapshot.insert(doc); + + Class *classFoo = doc->globalSymbolAt(0)->asClass(); + QVERIFY(classFoo); + QCOMPARE(classFoo->memberCount(), 1U); + Declaration *fooDeclaration = classFoo->memberAt(0)->asDeclaration(); + QVERIFY(fooDeclaration); + QCOMPARE(fooDeclaration->name()->identifier()->chars(), "foo"); + + FindUsages findUsages(src, doc, snapshot); + findUsages(fooDeclaration); + QCOMPARE(findUsages.usages().size(), 2); +} + QTEST_APPLESS_MAIN(tst_FindUsages) #include "tst_findusages.moc" From d6c64717762fc781b1afab70929f7a255b3a7bc7 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Fri, 5 Apr 2013 09:46:05 -0300 Subject: [PATCH 06/36] Add SaveFile functionality to Utils::PathChooser Change-Id: I4e35c15a16eda924af217a668159cf2f65af0e94 Reviewed-by: Eike Ziller --- src/libs/utils/pathchooser.cpp | 21 +++++++++++++++++++++ src/libs/utils/pathchooser.h | 1 + 2 files changed, 22 insertions(+) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 256599e1644..961dc5e479f 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -231,6 +231,7 @@ QString PathChooserPrivate::expandedPath(const QString &input) const case PathChooser::Directory: case PathChooser::ExistingDirectory: case PathChooser::File: + case PathChooser::SaveFile: if (!m_baseDirectory.isEmpty() && QFileInfo(path).isRelative()) return QFileInfo(m_baseDirectory + QLatin1Char('/') + path).absoluteFilePath(); break; @@ -382,6 +383,11 @@ void PathChooser::slotBrowse() makeDialogTitle(tr("Choose File")), predefined, d->m_dialogFilter); break; + case PathChooser::SaveFile: + newPath = QFileDialog::getSaveFileName(this, + makeDialogTitle(tr("Choose File")), predefined, + d->m_dialogFilter); + break; case PathChooser::Any: { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::AnyFile); @@ -469,6 +475,13 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage) return false; } break; + case PathChooser::SaveFile: + if (!fi.absoluteDir().exists()) { + if (errorMessage) + *errorMessage = tr("The directory '%1' does not exist.").arg(QDir::toNativeSeparators(fi.absolutePath())); + return false; + } + break; case PathChooser::ExistingCommand: if (!fi.exists()) { if (errorMessage) @@ -518,6 +531,14 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage) } break; + case PathChooser::SaveFile: + if (fi.exists() && fi.isDir()) { + if (errorMessage) + *errorMessage = tr("The path %1 is not a file.").arg(QDir::toNativeSeparators(fi.absolutePath())); + return false; + } + break; + case PathChooser::ExistingCommand: if (!fi.isFile() || !fi.isExecutable()) { if (errorMessage) diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index dcb43ed8c1d..cf34dcd2cf5 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -72,6 +72,7 @@ public: ExistingDirectory, Directory, // A directory, doesn't need to exist File, + SaveFile, ExistingCommand, // A command that must exist at the time of selection Command, // A command that may or may not exist at the time of selection (e.g. result of a build) Any From e077b2338e046e92db86489c81372cfaafc91e48 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Fri, 5 Apr 2013 09:46:47 -0300 Subject: [PATCH 07/36] BlackBerry: set default path for debug token request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTCREATORBUG-9077 Change-Id: I5b969077a679cdc4da667fbbfcabd0bd6fa75fb9 Reviewed-by: Laszlo Papp Reviewed-by: Mehdi Fekari Reviewed-by: Nicolas Arnaud-Cormos Reviewed-by: Tobias Nätterlund --- .../qnx/blackberrydebugtokenrequestdialog.cpp | 37 ++++++++++++++++++- .../qnx/blackberrydebugtokenrequestdialog.h | 2 + 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp b/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp index 955ed226d43..22b60051b28 100644 --- a/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp +++ b/src/plugins/qnx/blackberrydebugtokenrequestdialog.cpp @@ -51,7 +51,7 @@ BlackBerryDebugTokenRequestDialog::BlackBerryDebugTokenRequestDialog( m_ui->setupUi(this); m_ui->progressBar->hide(); m_ui->status->clear(); - m_ui->debugTokenPath->setExpectedKind(Utils::PathChooser::Any); + m_ui->debugTokenPath->setExpectedKind(Utils::PathChooser::SaveFile); m_ui->debugTokenPath->setPromptDialogTitle(tr("Request Debug Token")); m_ui->debugTokenPath->setPromptDialogFilter(tr("BAR Files (*.bar)")); @@ -67,8 +67,12 @@ BlackBerryDebugTokenRequestDialog::BlackBerryDebugTokenRequestDialog( this, SLOT(requestDebugToken())); connect(m_ui->debugTokenPath, SIGNAL(changed(QString)), this, SLOT(validate())); + connect(m_ui->debugTokenPath, SIGNAL(beforeBrowsing()), + this, SLOT(setDefaultPath())); connect(m_ui->debugTokenPath, SIGNAL(editingFinished()), this, SLOT(appendExtension())); + connect(m_ui->debugTokenPath, SIGNAL(editingFinished()), + this, SLOT(expandPath())); connect(m_ui->keystorePassword, SIGNAL(textChanged(QString)), this, SLOT(validate())); connect(m_ui->cskPassword, SIGNAL(textChanged(QString)), @@ -133,16 +137,47 @@ void BlackBerryDebugTokenRequestDialog::requestDebugToken() m_ui->keystorePassword->text(), m_ui->devicePin->text()); } +void BlackBerryDebugTokenRequestDialog::setDefaultPath() +{ + const QString path = m_ui->debugTokenPath->path(); + const QString defaultFileName = QLatin1String("/debugToken.bar"); + + if (path.isEmpty()) { + m_ui->debugTokenPath->setPath(QDir::homePath() + defaultFileName); + return; + } + + const QFileInfo fileInfo(path); + + if (fileInfo.isDir()) + m_ui->debugTokenPath->setPath(path + defaultFileName); +} + void BlackBerryDebugTokenRequestDialog::appendExtension() { QString path = m_ui->debugTokenPath->path(); + if (path.isEmpty()) + return; + if (!path.endsWith(QLatin1String(".bar"))) { path += QLatin1String(".bar"); m_ui->debugTokenPath->setPath(path); } } +void BlackBerryDebugTokenRequestDialog::expandPath() +{ + const QString path = m_ui->debugTokenPath->path(); + + if (path.isEmpty() || path.startsWith(QLatin1String("/"))) + return; + + const QFileInfo fileInfo(path); + + m_ui->debugTokenPath->setPath(fileInfo.absoluteFilePath()); +} + void BlackBerryDebugTokenRequestDialog::checkBoxChanged(int state) { if (state == Qt::Checked) { diff --git a/src/plugins/qnx/blackberrydebugtokenrequestdialog.h b/src/plugins/qnx/blackberrydebugtokenrequestdialog.h index e31a1fd8885..e70f56d528b 100644 --- a/src/plugins/qnx/blackberrydebugtokenrequestdialog.h +++ b/src/plugins/qnx/blackberrydebugtokenrequestdialog.h @@ -57,7 +57,9 @@ public: private slots: void validate(); void requestDebugToken(); + void setDefaultPath(); void appendExtension(); + void expandPath(); void checkBoxChanged(int state); void debugTokenArrived(int status); From ac57bee146f2a43fc2ff1a30f3b7b51b5753f1dd Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 8 Apr 2013 13:39:04 +0200 Subject: [PATCH 08/36] Squish: Fix execution of tst_simple_debug Targets checked for debugging libraries now match the targets selected while creating the project. Change-Id: Ib5e73254b549a66850da64ffb955531aae6b3477 Reviewed-by: Robert Loehning --- tests/system/suite_debugger/tst_simple_debug/test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index b23f2e4a885..e6751b42dbe 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -16,7 +16,10 @@ def main(): return # using a temporary directory won't mess up a potentially existing workingDir = tempDir() - checkedTargets, projectName = createNewQtQuickApplication(workingDir) + targetsVal = 0 + for t in targets: + targetsVal |= t + checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targetsVal) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") if placeCursorToLine(editor, "MouseArea.*", True): type(editor, '') From b5b6c02957d964887cf0e0d0c0a9689df640fbff Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 8 Apr 2013 13:08:27 +0200 Subject: [PATCH 09/36] QmlDesigner.MetaInfo: Adding propertyIsPrivate() Change-Id: Ia78583b080ced996d98517ce5d3294d3040f8ceb Reviewed-by: Marco Bubke --- src/plugins/qmldesigner/designercore/include/nodemetainfo.h | 1 + .../qmldesigner/designercore/metainfo/nodemetainfo.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h index c2c4766bb0a..0ece87b058c 100644 --- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h +++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h @@ -79,6 +79,7 @@ public: bool propertyIsWritable(const PropertyName &propertyName) const; bool propertyIsListProperty(const PropertyName &propertyName) const; bool propertyIsEnumType(const PropertyName &propertyName) const; + bool propertyIsPrivate(const PropertyName &propertyName) const; QString propertyEnumScope(const PropertyName &propertyName) const; QStringList propertyKeysForEnum(const PropertyName &propertyName) const; QVariant propertyCastedValue(const PropertyName &propertyName, const QVariant &value) const; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 9a99ea08bdc..20e4562c5fe 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -1129,6 +1129,11 @@ bool NodeMetaInfo::propertyIsEnumType(const PropertyName &propertyName) const return m_privateData->isPropertyEnum(propertyName); } +bool NodeMetaInfo::propertyIsPrivate(const PropertyName &propertyName) const +{ + return propertyName.startsWith("__"); +} + QString NodeMetaInfo::propertyEnumScope(const PropertyName &propertyName) const { return m_privateData->propertyEnumScope(propertyName); From ff643ef5c6f52661907d92ff6d90e15988c8a72a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 8 Apr 2013 13:06:58 +0200 Subject: [PATCH 10/36] QmlDesigner.Navigator: Do not show private properties Change-Id: Iaa8588b000c8d936d98517ce5d3294d3040f8cbb Reviewed-by: Marco Bubke --- .../qmldesigner/components/navigator/navigatortreemodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 957b02a9e6f..9c36456e9d6 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -618,6 +618,7 @@ PropertyNameList NavigatorTreeModel::visibleProperties(const ModelNode &node) co if (!propertyName.contains('.') && //do not show any dot properties, since they are tricky and unlikely to make sense node.metaInfo().propertyIsWritable(propertyName) && !m_hiddenProperties.contains(propertyName) && !node.metaInfo().propertyIsEnumType(propertyName) && //Some enums have the same name as Qml types (e. g. Flow) + !node.metaInfo().propertyIsPrivate(propertyName) && //Do not show private properties propertyName != node.metaInfo().defaultPropertyName()) { // TODO: ask the node instances TypeName qmlType = qmlTypeInQtContainer(node.metaInfo().propertyTypeName(propertyName)); From 57ab0b8c65114bd91cbaaf6dce6c6be9c948adf4 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 8 Apr 2013 13:10:21 +0200 Subject: [PATCH 11/36] QmlDesigner: updating metainfo for Controls Change-Id: Ia79583e080ced936d98517ce553294d3040f8ceb Reviewed-by: Marco Bubke --- .../ButtonSpecifics.qml | 0 .../CheckBoxSpecifics.qml | 0 .../ComboBoxSpecifics.qml | 7 -- .../RadioButtonSpecifics.qml | 0 .../TextAreaSpecifics.qml | 0 .../TextFieldSpecifics.qml | 0 .../componentsplugin/components.metainfo | 111 ++++++++++-------- .../componentsplugin/componentsplugin.qrc | 14 +-- 8 files changed, 69 insertions(+), 63 deletions(-) rename src/plugins/qmldesigner/componentsplugin/{QtDesktop => Controls}/ButtonSpecifics.qml (100%) rename src/plugins/qmldesigner/componentsplugin/{QtDesktop => Controls}/CheckBoxSpecifics.qml (100%) rename src/plugins/qmldesigner/componentsplugin/{QtDesktop => Controls}/ComboBoxSpecifics.qml (92%) rename src/plugins/qmldesigner/componentsplugin/{QtDesktop => Controls}/RadioButtonSpecifics.qml (100%) rename src/plugins/qmldesigner/componentsplugin/{QtDesktop => Controls}/TextAreaSpecifics.qml (100%) rename src/plugins/qmldesigner/componentsplugin/{QtDesktop => Controls}/TextFieldSpecifics.qml (100%) diff --git a/src/plugins/qmldesigner/componentsplugin/QtDesktop/ButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml similarity index 100% rename from src/plugins/qmldesigner/componentsplugin/QtDesktop/ButtonSpecifics.qml rename to src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml diff --git a/src/plugins/qmldesigner/componentsplugin/QtDesktop/CheckBoxSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml similarity index 100% rename from src/plugins/qmldesigner/componentsplugin/QtDesktop/CheckBoxSpecifics.qml rename to src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml diff --git a/src/plugins/qmldesigner/componentsplugin/QtDesktop/ComboBoxSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml similarity index 92% rename from src/plugins/qmldesigner/componentsplugin/QtDesktop/ComboBoxSpecifics.qml rename to src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml index 677a3a0dc4e..151d47bd32b 100644 --- a/src/plugins/qmldesigner/componentsplugin/QtDesktop/ComboBoxSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/ComboBoxSpecifics.qml @@ -35,13 +35,6 @@ GroupBox { caption: "Combo Box" layout: VerticalLayout { - ColorGroupBox { - text: qsTr("Text") - toolTip: qsTr("The text shown on the combobox") - finished: finishedNotify - backendColor: backendValues.textColor - } - QWidget { layout: HorizontalLayout { Label { diff --git a/src/plugins/qmldesigner/componentsplugin/QtDesktop/RadioButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml similarity index 100% rename from src/plugins/qmldesigner/componentsplugin/QtDesktop/RadioButtonSpecifics.qml rename to src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml diff --git a/src/plugins/qmldesigner/componentsplugin/QtDesktop/TextAreaSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/TextAreaSpecifics.qml similarity index 100% rename from src/plugins/qmldesigner/componentsplugin/QtDesktop/TextAreaSpecifics.qml rename to src/plugins/qmldesigner/componentsplugin/Controls/TextAreaSpecifics.qml diff --git a/src/plugins/qmldesigner/componentsplugin/QtDesktop/TextFieldSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/TextFieldSpecifics.qml similarity index 100% rename from src/plugins/qmldesigner/componentsplugin/QtDesktop/TextFieldSpecifics.qml rename to src/plugins/qmldesigner/componentsplugin/Controls/TextFieldSpecifics.qml diff --git a/src/plugins/qmldesigner/componentsplugin/components.metainfo b/src/plugins/qmldesigner/componentsplugin/components.metainfo index 8dbc57b9b80..206d719a246 100644 --- a/src/plugins/qmldesigner/componentsplugin/components.metainfo +++ b/src/plugins/qmldesigner/componentsplugin/components.metainfo @@ -1,94 +1,107 @@ MetaInfo { Type { - name: "QtDesktop.Button" + name: "QtQuick.Controls.Button" icon: ":/componentsplugin/images/button16.png" ItemLibraryEntry { name: "Button" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/button.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "text"; type: "QString"; value: "Button"; } } } Type { - name: "QtDesktop.CheckBox" + name: "QtQuick.Controls.SpinBox" + icon: ":/componentsplugin/images/window16.png" + + ItemLibraryEntry { + name: "SpinBox" + category: "Qt Quick - Controls" + libraryIcon: ":/componentsplugin/images/window.png" + version: "1.0" + requiredImport: "QtQuick.Controls" + } + } + + Type { + name: "QtQuick.Controls.CheckBox" icon: ":/componentsplugin/images/checkbox16.png" ItemLibraryEntry { name: "Check Box" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/checkbox.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "text"; type: "QString"; value: "Check Box"; } } } Type { - name: "QtDesktop.RadioButton" + name: "QtQuick.Controls.RadioButton" icon: ":/componentsplugin/images/radiobutton16.png" ItemLibraryEntry { name: "Radio Button" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/radiobutton.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "text"; type: "QString"; value: "Radio Button"; } } } Type { - name: "QtDesktop.ComboBox" + name: "QtQuick.Controls.ComboBox" icon: ":/componentsplugin/images/combobox16.png" ItemLibraryEntry { name: "Combo Box" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/combobox.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" } } Type { - name: "QtDesktop.ButtonRow" + name: "QtQuick.Controls.ButtonRow" icon: ":/componentsplugin/images/buttonrow16.png" ItemLibraryEntry { name: "Button Row" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/buttonrow.png" version: "1.0" } } Type { - name: "QtDesktop.ButtonColumn" + name: "QtQuick.Controls.ButtonColumn" icon: ":/componentsplugin/images/buttoncolumn16.png" ItemLibraryEntry { name: "Button Column" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/buttoncolumn.png" version: "1.0" } } Type { - name: "QtDesktop.Label" + name: "QtQuick.Controls.Label" icon: ":/componentsplugin/images/label16.png" ItemLibraryEntry { name: "Label" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/label.png" version: "1.0" @@ -97,12 +110,12 @@ MetaInfo { } Type { - name: "QtDesktop.TextField" + name: "QtQuick.Controls.TextField" icon: ":/componentsplugin/images/textfield16.png" ItemLibraryEntry { name: "Text Field" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/textfield.png" version: "1.0" @@ -111,43 +124,43 @@ MetaInfo { } Type { - name: "QtDesktop.TextArea" + name: "QtQuick.Controls.TextArea" icon: ":/componentsplugin/images/textarea16.png" ItemLibraryEntry { name: "Text Area" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/textarea.png" version: "1.0" } } Type { - name: "QtDesktop.ProgressBar" + name: "QtQuick.Controls.ProgressBar" icon: ":/componentsplugin/images/progressbar16.png" ItemLibraryEntry { name: "Progress Bar" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/progressbar.png" version: "1.0" } } Type { - name: "QtDesktop.Slider" + name: "QtQuick.Controls.Slider" icon: ":/componentsplugin/images/sliderh16.png" ItemLibraryEntry { name: "Slider (Horizontal)" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/sliderh.png" version: "1.0" } ItemLibraryEntry { name: "Slider (Vertical)" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/sliderh.png" version: "1.0" Property { name: "orientation"; type: "int"; value: "0"; } @@ -155,19 +168,19 @@ MetaInfo { } Type { - name: "QtDesktop.ScrollBar" + name: "QtQuick.Controls.ScrollBar" icon: ":/componentsplugin/images/scrollbar16.png" ItemLibraryEntry { name: "Scroll Bar (Horizontal)" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/scrollbarh.png" version: "1.0" } ItemLibraryEntry { name: "Scroll Bar (Vertical)" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/componentsplugin/images/scrollbarv.png" version: "1.0" Property { name: "orientation"; type: "int"; value: "0"; } @@ -175,15 +188,15 @@ MetaInfo { } Type { - name: "QtDesktop.ScrollArea" - icon: ":/desktopplugin//images/window16.png" + name: "QtQuick.Controls.ScrollArea" + icon: ":/componentsplugin/images/window16.png" ItemLibraryEntry { name: "Scroll Area" - category: "Qt Quick - Components" - libraryIcon: ":/desktopplugin/images/window.png" + category: "Qt Quick - Controls" + libraryIcon: ":/componentsplugin/images/window.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "width"; type: "int"; value: 360; } Property { name: "height"; type: "int"; value: 300; } @@ -191,15 +204,15 @@ MetaInfo { } Type { - name: "QtDesktop.GroupBox" - icon: ":/desktopplugin//images/window16.png" + name: "QtQuick.Controls.GroupBox" + icon: ":/componentsplugin/images/window16.png" ItemLibraryEntry { name: "Group Box" - category: "Qt Quick - Components" - libraryIcon: ":/desktopplugin/images/window.png" + category: "Qt Quick - Controls" + libraryIcon: ":/componentsplugin/images/window.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "width"; type: "int"; value: 360; } Property { name: "height"; type: "int"; value: 300; } @@ -207,15 +220,15 @@ MetaInfo { } Type { - name: "QtDesktop.Frame" + name: "QtQuick.Controls.Frame" icon: ":/desktopplugin//images/window16.png" ItemLibraryEntry { name: "Frame" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/desktopplugin/images/window.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "width"; type: "int"; value: 360; } Property { name: "height"; type: "int"; value: 300; } @@ -223,15 +236,15 @@ MetaInfo { } Type { - name: "QtDesktop.ToolBar" + name: "QtQuick.Controls.ToolBar" icon: ":/desktopplugin/images/toolbar16.png" ItemLibraryEntry { name: "Tool Bar" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" libraryIcon: ":/desktopplugin/images/toolbar.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "width"; type: "int"; value: 360; } Property { name: "height"; type: "int"; value: 50; } @@ -239,15 +252,15 @@ MetaInfo { } Type { - name: "QtDesktop.Dial" + name: "QtQuick.Controls.Dial" //icon: ":/desktopplugin/images/progressbar16.png" ItemLibraryEntry { name: "Dial" - category: "Qt Quick - Components" + category: "Qt Quick - Controls" //libraryIcon: ":/desktopplugin/images/progressbar.png" version: "1.0" - requiredImport: "QtDesktop" + requiredImport: "QtQuick.Controls" Property { name: "width"; type: "int"; value: 100; } Property { name: "height"; type: "int"; value: 100; } diff --git a/src/plugins/qmldesigner/componentsplugin/componentsplugin.qrc b/src/plugins/qmldesigner/componentsplugin/componentsplugin.qrc index b2d718aa6b4..c139996ee00 100644 --- a/src/plugins/qmldesigner/componentsplugin/componentsplugin.qrc +++ b/src/plugins/qmldesigner/componentsplugin/componentsplugin.qrc @@ -36,12 +36,12 @@ images/window.png images/window16.png - - QtDesktop/ButtonSpecifics.qml - QtDesktop/TextFieldSpecifics.qml - QtDesktop/TextAreaSpecifics.qml - QtDesktop/ComboBoxSpecifics.qml - QtDesktop/CheckBoxSpecifics.qml - QtDesktop/RadioButtonSpecifics.qml + + Controls/ButtonSpecifics.qml + Controls/TextFieldSpecifics.qml + Controls/TextAreaSpecifics.qml + Controls/ComboBoxSpecifics.qml + Controls/CheckBoxSpecifics.qml + Controls/RadioButtonSpecifics.qml From b2ae8e4a30f54865a04fd6237a8a8695bbd923b8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 9 Apr 2013 12:30:28 +0200 Subject: [PATCH 12/36] QmlDesigner: fixing warning Change-Id: I73f47baf1fe48816c74574c068b1deaca4ce89e6 Reviewed-by: Marco Bubke --- .../qmldesigner/designercore/model/texttomodelmerger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 540e0d49a00..0e7107653ba 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -1358,7 +1358,7 @@ void ModelValidator::signalHandlerSourceDiffer(SignalHandlerProperty &modelPrope Q_ASSERT(0); } -void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString &javascript) +void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString & /*javascript*/) { Q_UNUSED(modelProperty) Q_ASSERT(modelProperty.isSignalHandlerProperty()); From 66f9337fdf9a7f41b901f6871c275ded8e6ed1e7 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 3 Apr 2013 12:57:40 +0200 Subject: [PATCH 13/36] Qt4RunConfiguration: Add missing .exe Broke in 3c6f76d16c142c2b98564fc9167b67564ead7fe5 Task-number: QTCREATORBUG-9046 Change-Id: I9bace8f8cefaefe9adf73aa3c5ebd93dae66e258 Reviewed-by: Eike Ziller Reviewed-by: Christian Kandeler --- src/libs/utils/hostosinfo.h | 2 +- src/plugins/qt4projectmanager/qt4nodes.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/hostosinfo.h b/src/libs/utils/hostosinfo.h index 25edc98b344..0bb642561bf 100644 --- a/src/libs/utils/hostosinfo.h +++ b/src/libs/utils/hostosinfo.h @@ -58,7 +58,7 @@ public: static bool isMacHost() { return hostOs() == HostOsMac; } static inline bool isAnyUnixHost(); - static QString appendExecutableSuffix(const QString &executable) + static QString withExecutableSuffix(const QString &executable) { QString finalName = executable; if (isWindowsHost()) diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 2028a8a56fa..77fd1e99347 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -2180,7 +2180,7 @@ TargetInformation Qt4ProFileNode::targetInformation(QtSupport::ProFileReader *re result.executable = QDir::cleanPath(destDir + QLatin1Char('/') + result.target); //qDebug() << "##### updateTarget sets:" << result.workingDir << result.executable; - Utils::HostOsInfo::appendExecutableSuffix(result.executable); + result.executable = Utils::HostOsInfo::withExecutableSuffix(result.executable); result.valid = true; if (readerBP) From c74bb8dfcab73bb18a06afdfd9ec998f0f068ab9 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 5 Apr 2013 16:58:06 +0200 Subject: [PATCH 14/36] Squish: Clean up Details: * removed unused functions * removed "QtQuickConstants" (Targets class is used for more than just Qt Quick) * removed Components class Change-Id: I2908348db3e5a627d63242f9524832812822f790 Reviewed-by: Robert Loehning --- tests/system/shared/classes.py | 54 +++++---------- tests/system/shared/project.py | 67 ++++++++----------- tests/system/shared/utils.py | 5 +- .../suite_debugger/tst_simple_debug/test.py | 4 +- .../tst_build_speedcrunch/test.py | 4 +- .../tst_create_proj_wizard/test.py | 3 +- .../tst_qtquick_creation/test.py | 2 +- .../tst_qtquick_creation2/test.py | 2 +- 8 files changed, 54 insertions(+), 87 deletions(-) diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index be4d94bfa86..53894a97074 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -1,53 +1,35 @@ # for easier re-usage (because Python hasn't an enum type) -class QtQuickConstants: - class Components: - BUILTIN = 1 - MEEGO_HARMATTAN = 2 - EXISTING_QML = 4 - - class Targets: - DESKTOP_474_GCC = 1 - SIMULATOR = 2 - MAEMO5 = 4 - HARMATTAN = 8 - EMBEDDED_LINUX = 16 - DESKTOP_474_MSVC2008 = 32 - DESKTOP_501_DEFAULT = 64 +class Targets: + DESKTOP_474_GCC = 1 + SIMULATOR = 2 + MAEMO5 = 4 + HARMATTAN = 8 + EMBEDDED_LINUX = 16 + DESKTOP_474_MSVC2008 = 32 + DESKTOP_501_DEFAULT = 64 @staticmethod def desktopTargetClasses(): - desktopTargets = QtQuickConstants.Targets.DESKTOP_474_GCC \ - | QtQuickConstants.Targets.DESKTOP_501_DEFAULT + desktopTargets = Targets.DESKTOP_474_GCC | Targets.DESKTOP_501_DEFAULT if platform.system() in ('Windows', 'Microsoft'): - desktopTargets |= QtQuickConstants.Targets.DESKTOP_474_MSVC2008 + desktopTargets |= Targets.DESKTOP_474_MSVC2008 return desktopTargets - @staticmethod - def getStringForComponents(components): - if components==QtQuickConstants.Components.BUILTIN: - return "Built-in elements only (for all platforms)" - elif components==QtQuickConstants.Components.MEEGO_HARMATTAN: - return "Qt Quick Components for Meego/Harmattan" - elif components==QtQuickConstants.Components.EXISTING_QML: - return "Use an existing .qml file" - else: - return None - @staticmethod def getStringForTarget(target): - if target==QtQuickConstants.Targets.DESKTOP_474_GCC: + if target == Targets.DESKTOP_474_GCC: return "Desktop 474 GCC" - elif target==QtQuickConstants.Targets.MAEMO5: + elif target == Targets.MAEMO5: return "Fremantle" - elif target==QtQuickConstants.Targets.SIMULATOR: + elif target == Targets.SIMULATOR: return "Qt Simulator" - elif target==QtQuickConstants.Targets.HARMATTAN: + elif target == Targets.HARMATTAN: return "Harmattan" - elif target==QtQuickConstants.Targets.EMBEDDED_LINUX: + elif target == Targets.EMBEDDED_LINUX: return "Embedded Linux" - elif target==QtQuickConstants.Targets.DESKTOP_474_MSVC2008: + elif target == Targets.DESKTOP_474_MSVC2008: return "Desktop 474 MSVC2008" - elif target==QtQuickConstants.Targets.DESKTOP_501_DEFAULT: + elif target == Targets.DESKTOP_501_DEFAULT: return "Desktop 501 default" else: return None @@ -57,7 +39,7 @@ class QtQuickConstants: if not isinstance(targets, (tuple,list)): test.fatal("Wrong usage... This function handles only tuples or lists.") return None - result = map(QtQuickConstants.getStringForTarget, targets) + result = map(Targets.getStringForTarget, targets) if None in result: test.fatal("You've passed at least one unknown target!") return result diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 626a7aa42b3..2700108acd1 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -12,7 +12,7 @@ def __handleProcessExited__(object, exitCode): global processExited processExited = True -def openQmakeProject(projectPath, targets=QtQuickConstants.desktopTargetClasses(), fromWelcome=False): +def openQmakeProject(projectPath, targets=Targets.desktopTargetClasses(), fromWelcome=False): cleanUpUserFiles(projectPath) if fromWelcome: mouseClick(waitForObject(":OpenProject_QStyleItem"), 5, 5, 0, Qt.LeftButton) @@ -112,7 +112,7 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True): # param checks turns tests in the function on if set to True # param available a list holding the available targets def __selectQtVersionDesktop__(checks, available=None): - checkedTargets = __chooseTargets__(QtQuickConstants.desktopTargetClasses(), available) + checkedTargets = __chooseTargets__(Targets.desktopTargetClasses(), available) if checks: cbObject = ("{type='QCheckBox' text='%s' unnamed='1' visible='1' " "container={type='Utils::DetailsWidget' visible='1' unnamed='1'}}") @@ -204,7 +204,7 @@ def createProject_Qt_Console(path, projectName, checks = True): return checkedTargets def createNewQtQuickApplication(workingDir, projectName = None, templateFile = None, - targets=QtQuickConstants.desktopTargetClasses(), qtQuickVersion=1, + targets=Targets.desktopTargetClasses(), qtQuickVersion=1, fromWelcome=False): if templateFile: available = __createProjectOrFileSelectType__(" Applications", "Qt Quick %d Application (from Existing QML File)" @@ -240,7 +240,7 @@ def createNewQmlExtension(workingDir): if workingDir == None: workingDir = tempDir() __createProjectSetNameAndPath__(workingDir) - checkedTargets = __chooseTargets__(QtQuickConstants.Targets.DESKTOP_474_GCC, available) + checkedTargets = __chooseTargets__(Targets.DESKTOP_474_GCC, available) nextButton = waitForObject(":Next_QPushButton") clickButton(nextButton) nameLineEd = waitForObject("{buddy={type='QLabel' text='Object Class-name:' unnamed='1' visible='1'} " @@ -253,51 +253,39 @@ def createNewQmlExtension(workingDir): __createProjectHandleLastPage__() return checkedTargets -# parameter components can only be one of the Constants defined in QtQuickConstants.Components -def __chooseComponents__(components=QtQuickConstants.Components.BUILTIN): - rbComponentToChoose = waitForObject("{type='QRadioButton' text='%s' visible='1'}" - % QtQuickConstants.getStringForComponents(components)) - if rbComponentToChoose.checked: - test.passes("Selected QRadioButton is '%s'" % QtQuickConstants.getStringForComponents(components)) - else: - clickButton(rbComponentToChoose) - test.verify(rbComponentToChoose.checked, "Selected QRadioButton is '%s'" - % QtQuickConstants.getStringForComponents(components)) - -# parameter target can be an OR'd value of QtQuickConstants.Targets +# parameter target can be an OR'd value of Targets # parameter availableTargets should be the result of __createProjectSelectType__() # or use None as a fallback -def __chooseTargets__(targets=QtQuickConstants.Targets.DESKTOP_474_GCC, availableTargets=None, +def __chooseTargets__(targets=Targets.DESKTOP_474_GCC, availableTargets=None, isMaddeDisabled=True): if availableTargets != None: available = availableTargets else: # following targets depend on the build environment - added for further/later tests - available = [QtQuickConstants.Targets.DESKTOP_474_GCC, QtQuickConstants.Targets.DESKTOP_501_DEFAULT, - QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.EMBEDDED_LINUX, - QtQuickConstants.Targets.SIMULATOR, QtQuickConstants.Targets.HARMATTAN] + available = [Targets.DESKTOP_474_GCC, Targets.DESKTOP_501_DEFAULT, Targets.MAEMO5, + Targets.EMBEDDED_LINUX, Targets.SIMULATOR, Targets.HARMATTAN] if platform.system() in ('Windows', 'Microsoft'): - available.remove(QtQuickConstants.Targets.EMBEDDED_LINUX) - available.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008) + available.remove(Targets.EMBEDDED_LINUX) + available.append(Targets.DESKTOP_474_MSVC2008) if isMaddeDisabled: for target in filter(lambda x: x in available, - (QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.HARMATTAN)): + (Targets.MAEMO5, Targets.HARMATTAN)): available.remove(target) checkedTargets = [] for current in available: mustCheck = targets & current == current try: - ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % QtQuickConstants.getStringForTarget(current), + ensureChecked("{type='QCheckBox' text='%s' visible='1'}" % Targets.getStringForTarget(current), mustCheck, 3000) if (mustCheck): checkedTargets.append(current) except LookupError: if mustCheck: - test.fail("Failed to check target '%s'." % QtQuickConstants.getStringForTarget(current)) + test.fail("Failed to check target '%s'." % Targets.getStringForTarget(current)) else: # Simulator has been added without knowing whether configured or not - so skip warning here? - if current != QtQuickConstants.Targets.SIMULATOR: - test.warning("Target '%s' is not set up correctly." % QtQuickConstants.getStringForTarget(current)) + if current != Targets.Targets.SIMULATOR: + test.warning("Target '%s' is not set up correctly." % Targets.getStringForTarget(current)) return checkedTargets # run and close an application @@ -453,7 +441,7 @@ def resetApplicationContextToCreator(): # Simulator must be handled in a special way, because this depends on the # configured Qt versions and Toolchains and cannot be looked up the same way # if you set getAsStrings to True this function returns a list of strings instead -# of the constants defined in QtQuickConstants.Targets +# of the constants defined in Targets def __getSupportedPlatforms__(text, getAsStrings=False): reqPattern = re.compile("requires qt (?P\d+\.\d+(\.\d+)?)", re.IGNORECASE) res = reqPattern.search(text) @@ -465,31 +453,30 @@ def __getSupportedPlatforms__(text, getAsStrings=False): supports = text[text.find('Supported Platforms'):].split(":")[1].strip().split(" ") result = [] if 'Desktop' in supports: - result.append(QtQuickConstants.Targets.DESKTOP_474_GCC) - result.append(QtQuickConstants.Targets.DESKTOP_501_DEFAULT) + result.append(Targets.DESKTOP_474_GCC) + result.append(Targets.DESKTOP_501_DEFAULT) if platform.system() in ("Linux", "Darwin"): - result.append(QtQuickConstants.Targets.EMBEDDED_LINUX) + result.append(Targets.EMBEDDED_LINUX) elif platform.system() in ('Windows', 'Microsoft'): - result.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008) + result.append(Targets.DESKTOP_474_MSVC2008) if 'MeeGo/Harmattan' in supports: - result.append(QtQuickConstants.Targets.HARMATTAN) + result.append(Targets.HARMATTAN) if 'Maemo/Fremantle' in supports: - result.append(QtQuickConstants.Targets.MAEMO5) + result.append(Targets.MAEMO5) if not re.search("custom Qt Creator plugin", text): - result.append(QtQuickConstants.Targets.SIMULATOR) + result.append(Targets.SIMULATOR) elif 'Platform independent' in text: # MAEMO5 and HARMATTAN could be wrong here - depends on having Madde plugin enabled or not - result = [QtQuickConstants.Targets.DESKTOP_474_GCC, QtQuickConstants.Targets.DESKTOP_501_DEFAULT, - QtQuickConstants.Targets.MAEMO5, QtQuickConstants.Targets.SIMULATOR, - QtQuickConstants.Targets.HARMATTAN] + result = [Targets.DESKTOP_474_GCC, Targets.DESKTOP_501_DEFAULT, Targets.MAEMO5, + Targets.SIMULATOR, Targets.HARMATTAN] if platform.system() in ('Windows', 'Microsoft'): - result.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008) + result.append(Targets.DESKTOP_474_MSVC2008) else: test.warning("Returning None (__getSupportedPlatforms__())", "Parsed text: '%s'" % text) return None, None if getAsStrings: - result = QtQuickConstants.getTargetsAsStrings(result) + result = Targets.getTargetsAsStrings(result) return result, version # copy example project (sourceExample is path to project) to temporary directory inside repository diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index d6d216f4d5b..3af2ffd5aed 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -344,8 +344,7 @@ def getConfiguredKits(isMaddeDisabled=True): targetInfo = result[targetName] if targetInfo[0] == "Maemo": result.update({targetName: - (QtQuickConstants.getStringForTarget(QtQuickConstants.Targets.MAEMO5), - targetInfo[1])}) + (Targets.getStringForTarget(Targets.MAEMO5), targetInfo[1])}) test.log("Configured kits: %s" % str(result)) return result @@ -409,7 +408,7 @@ def checkDebuggingLibrary(kitIDs): # end of internal function for iterateQtVersions kits, qtv = iterateKits(True, False, __getQtVersionForKit__) qtVersionsOfKits = zip(kits, qtv) - wantedKits = QtQuickConstants.getTargetsAsStrings(kitIDs) + wantedKits = Targets.getTargetsAsStrings(kitIDs) kitsQtV = dict([i for i in qtVersionsOfKits if i[0] in wantedKits]) tv, builtAndFailedList = iterateQtVersions(False, True, __checkDebugLibsInternalFunc__, kitsQtV) built = failed = 0 diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index e6751b42dbe..7dc1d0242ba 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -7,9 +7,9 @@ def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - targets = [QtQuickConstants.Targets.DESKTOP_474_GCC] + targets = [Targets.DESKTOP_474_GCC] if platform.system() in ('Windows', 'Microsoft'): - targets.append(QtQuickConstants.Targets.DESKTOP_474_MSVC2008) + targets.append(Targets.DESKTOP_474_MSVC2008) if not checkDebuggingLibrary(targets): test.fatal("Error while checking debugging libraries - leaving this test.") invokeMenuItem("File", "Exit") diff --git a/tests/system/suite_general/tst_build_speedcrunch/test.py b/tests/system/suite_general/tst_build_speedcrunch/test.py index 392c798808a..9925be73db4 100644 --- a/tests/system/suite_general/tst_build_speedcrunch/test.py +++ b/tests/system/suite_general/tst_build_speedcrunch/test.py @@ -17,9 +17,9 @@ def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - suitableKits = QtQuickConstants.Targets.DESKTOP_474_GCC + suitableKits = Targets.DESKTOP_474_GCC if platform.system() in ('Windows', 'Microsoft'): - suitableKits |= QtQuickConstants.Targets.DESKTOP_474_MSVC2008 + suitableKits |= Targets.DESKTOP_474_MSVC2008 checkedTargets = openQmakeProject(SpeedCrunchPath, suitableKits) waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}", "sourceFilesRefreshed(QStringList)") diff --git a/tests/system/suite_general/tst_create_proj_wizard/test.py b/tests/system/suite_general/tst_create_proj_wizard/test.py index 4286c507f99..f867b6c2297 100644 --- a/tests/system/suite_general/tst_create_proj_wizard/test.py +++ b/tests/system/suite_general/tst_create_proj_wizard/test.py @@ -38,8 +38,7 @@ def performTest(templateDir, qmlFile, isMaddeDisabled): comboBox = findObject("{name='comboBox' type='QComboBox' visible='1' " "window=':New_Core::Internal::NewDialog'}") targets = zip(*kits.values())[0] - maddeTargets = QtQuickConstants.getTargetsAsStrings([QtQuickConstants.Targets.MAEMO5, - QtQuickConstants.Targets.HARMATTAN]) + maddeTargets = Targets.getTargetsAsStrings([Targets.MAEMO5, Targets.HARMATTAN]) maddeInTargets = len(set(targets) & set(maddeTargets)) > 0 test.compare(comboBox.enabled, maddeInTargets, "Verifying whether combox is enabled.") test.compare(maddeInTargets, not isMaddeDisabled, "Verifying if kits are configured.") diff --git a/tests/system/suite_qtquick/tst_qtquick_creation/test.py b/tests/system/suite_qtquick/tst_qtquick_creation/test.py index 3557489e720..cf4c6919f6e 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation/test.py @@ -7,7 +7,7 @@ def main(): # using a temporary directory won't mess up a potentially existing workingDir = tempDir() checkedTargets, projectName = createNewQtQuickApplication(workingDir, - targets = QtQuickConstants.Targets.DESKTOP_474_GCC) + targets = Targets.DESKTOP_474_GCC) test.log("Building project") result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223) invokeMenuItem("Build", "Build All") diff --git a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py index 272da7d5f95..d7b828e659e 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation2/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation2/test.py @@ -12,7 +12,7 @@ def main(): workingDir = tempDir() checkedTargets, projectName = createNewQtQuickApplication(workingDir, None, os.path.join(prepareTemplate(sourceExample), qmlFile), - QtQuickConstants.Targets.DESKTOP_474_GCC) + Targets.DESKTOP_474_GCC) test.log("Building project") result = modifyRunSettingsForHookInto(projectName, len(checkedTargets), 11223) invokeMenuItem("Build","Build All") From 2a261588f4a1d6eb87b037fd2aa9166740f7b8cd Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 8 Apr 2013 14:05:17 +0200 Subject: [PATCH 15/36] Squish: Add helper functions to Target class Change-Id: Iba67cc28d29346689ca8443ce0b594056feaa0cf Reviewed-by: Robert Loehning --- tests/system/shared/classes.py | 13 +++++++++++++ .../system/suite_debugger/tst_simple_debug/test.py | 11 +++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index 53894a97074..60562376641 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -1,3 +1,5 @@ +import operator + # for easier re-usage (because Python hasn't an enum type) class Targets: DESKTOP_474_GCC = 1 @@ -44,6 +46,17 @@ class Targets: test.fatal("You've passed at least one unknown target!") return result + @staticmethod + def intToArray(targets): + available = [Targets.DESKTOP_474_GCC, Targets.SIMULATOR, Targets.MAEMO5, Targets.HARMATTAN, + Targets.EMBEDDED_LINUX, Targets.DESKTOP_474_MSVC2008, + Targets.DESKTOP_501_DEFAULT] + return filter(lambda x: x & targets == x, available) + + @staticmethod + def arrayToInt(targetArr): + return reduce(operator.or_, targetArr, 0) + # this class holds some constants for easier usage inside the Projects view class ProjectSettings: BUILD = 1 diff --git a/tests/system/suite_debugger/tst_simple_debug/test.py b/tests/system/suite_debugger/tst_simple_debug/test.py index 7dc1d0242ba..b5fd5fdc378 100644 --- a/tests/system/suite_debugger/tst_simple_debug/test.py +++ b/tests/system/suite_debugger/tst_simple_debug/test.py @@ -7,19 +7,14 @@ def main(): startApplication("qtcreator" + SettingsPath) if not startedWithoutPluginError(): return - targets = [Targets.DESKTOP_474_GCC] - if platform.system() in ('Windows', 'Microsoft'): - targets.append(Targets.DESKTOP_474_MSVC2008) - if not checkDebuggingLibrary(targets): + targets = Targets.desktopTargetClasses() + if not checkDebuggingLibrary(Targets.intToArray(targets)): test.fatal("Error while checking debugging libraries - leaving this test.") invokeMenuItem("File", "Exit") return # using a temporary directory won't mess up a potentially existing workingDir = tempDir() - targetsVal = 0 - for t in targets: - targetsVal |= t - checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targetsVal) + checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=targets) editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") if placeCursorToLine(editor, "MouseArea.*", True): type(editor, '') From 7b94ac13ed5bc3f5402535700785120c69f292c4 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 10:18:36 +0200 Subject: [PATCH 16/36] QmlDesigner.Model: Adding warnings The API is confusing so we give a warning. Change-Id: I7a26766609316772bebc3088d820d472243b2c74 Reviewed-by: Marco Bubke Reviewed-by: Robert Loehning --- src/plugins/qmldesigner/designercore/model/bindingproperty.cpp | 3 +++ src/plugins/qmldesigner/designercore/model/variantproperty.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp index 482a3e45d27..3346eef6a62 100644 --- a/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/bindingproperty.cpp @@ -62,6 +62,9 @@ void BindingProperty::setExpression(const QString &expression) if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); + if (isDynamic()) + qWarning() << "Calling BindingProperty::setExpression on dynamic property."; + if (name() == "id") { // the ID for a node is independent of the state, so it has to be set with ModelNode::setId throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, name()); } diff --git a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp index 37800f1b52f..8c1bb0fd73f 100644 --- a/src/plugins/qmldesigner/designercore/model/variantproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/variantproperty.cpp @@ -61,6 +61,9 @@ void VariantProperty::setValue(const QVariant &value) if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); + if (isDynamic()) + qWarning() << "Calling VariantProperty::setValue on dynamic property."; + if (value.isNull()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name()); From 86ae825033e039d69a6c9ad29d3fbc4236fe0caa Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 14:38:08 +0200 Subject: [PATCH 17/36] QmlJSStaticAnalysis: make PrototypeMessageData public We need this in the rewriter to avoid warning. Change-Id: Ia99583e080eed936d98517ce553294d3040f8cee Reviewed-by: Fawzi Mohamed --- src/libs/qmljs/qmljsstaticanalysismessage.cpp | 18 +++++++++--------- src/libs/qmljs/qmljsstaticanalysismessage.h | 10 ++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index 35544e587b0..6336bc21e29 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -43,14 +43,6 @@ class StaticAnalysisMessages Q_DECLARE_TR_FUNCTIONS(QmlJS::StaticAnalysisMessages) public: - class PrototypeMessageData { - public: - Type type; - Severity severity; - QString message; - int placeholders; - }; - void newMsg(Type type, Severity severity, const QString &message, int placeholders = 0) { PrototypeMessageData prototype; @@ -248,7 +240,7 @@ Message::Message(Type type, : location(location), type(type) { QTC_ASSERT(messages()->messages.contains(type), return); - const StaticAnalysisMessages::PrototypeMessageData &prototype = messages()->messages.value(type); + const PrototypeMessageData &prototype = prototypeForMessageType(type); severity = prototype.severity; message = prototype.message; if (prototype.placeholders == 0) { @@ -299,3 +291,11 @@ QRegExp Message::suppressionPattern() { return QRegExp(QLatin1String("@disable-check M(\\d+)")); } + +const PrototypeMessageData Message::prototypeForMessageType(Type type) +{ + QTC_CHECK(messages()->messages.contains(type)); + const PrototypeMessageData &prototype = messages()->messages.value(type); + + return prototype; +} diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.h b/src/libs/qmljs/qmljsstaticanalysismessage.h index eb21552d510..3cf29d7bba0 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.h +++ b/src/libs/qmljs/qmljsstaticanalysismessage.h @@ -131,6 +131,14 @@ enum Type ErrInvalidArrayValueLength = 323 }; +class QMLJS_EXPORT PrototypeMessageData { +public: + Type type; + Severity severity; + QString message; + int placeholders; +}; + class QMLJS_EXPORT Message { public: @@ -152,6 +160,8 @@ public: QString message; Type type; Severity severity; + + static const PrototypeMessageData prototypeForMessageType(Type type); }; } // namespace StaticAnalysis From 7543a0858286ac9ae27a5cfb5ea4d3e237981283 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 12:21:30 +0200 Subject: [PATCH 18/36] QmlDesigner: avoid warnings for StaticAnalysis The warnings were triggered by the constructor of Message. We use PrototypeMessageData which is just the pure data. Change-Id: Iaa85880000ccd936d98517ce5d3294d3040f8cee Reviewed-by: Thomas Hartmann --- .../qmldesigner/designercore/model/texttomodelmerger.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 0e7107653ba..2b517bb4a6d 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -776,9 +776,9 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH check.disableMessage(StaticAnalysis::ErrCouldNotResolvePrototypeOf); foreach (StaticAnalysis::Type type, StaticAnalysis::Message::allMessageTypes()) { - StaticAnalysis::Message message(type, AST::SourceLocation()); - if (message.severity == StaticAnalysis::MaybeWarning - || message.severity == StaticAnalysis::Warning) { + StaticAnalysis::PrototypeMessageData prototypeMessageData = StaticAnalysis::Message::prototypeForMessageType(type); + if (prototypeMessageData.severity == StaticAnalysis::MaybeWarning + || prototypeMessageData.severity == StaticAnalysis::Warning) { check.disableMessage(type); } } From 9c2a352027711519fb7dcc579f520717cd7ed115 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Thu, 4 Apr 2013 12:07:44 +0200 Subject: [PATCH 19/36] C++: fixed operator arrow of nested class of enclosing template Fixed: * code completion * highlighting * find usage * follow symbol Task-number: QTCREATORBUG-9005 Change-Id: I3fcc2638482ca1071c1aa7b6aab0d4dd128595bb Reviewed-by: Orgad Shaneh Reviewed-by: Erik Verbruggen --- src/libs/cplusplus/LookupContext.cpp | 23 +++++----- src/libs/cplusplus/LookupContext.h | 2 +- .../cplusplus/findusages/tst_findusages.cpp | 45 +++++++++++++++++++ 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index d747481dca9..12ee4933c33 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -1106,29 +1106,26 @@ bool ClassOrNamespace::NestedClassInstantiator::isInstantiateNestedClassNeeded(c bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Declaration *declaration) const { Type *memberType = declaration->type().type(); - NamedType *memberNamedType = findMemberNamedType(memberType); - if (memberNamedType) { - const Name *name = memberNamedType->name(); - if (_subst.contains(name)) - return true; - } - return false; + NamedType *namedType = findNamedType(memberType); + return namedType && _subst.contains(namedType->name()); } -bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Function * /*function*/) const +bool ClassOrNamespace::NestedClassInstantiator::containsTemplateType(Function *function) const { - //TODO: make implementation - return false; + Type *returnType = function->returnType().type(); + NamedType *namedType = findNamedType(returnType); + return namedType && _subst.contains(namedType->name()); + //TODO: in future we will need also check function arguments, for now returned value is enough } -NamedType *ClassOrNamespace::NestedClassInstantiator::findMemberNamedType(Type *memberType) const +NamedType *ClassOrNamespace::NestedClassInstantiator::findNamedType(Type *memberType) const { if (NamedType *namedType = memberType->asNamedType()) return namedType; else if (PointerType *pointerType = memberType->asPointerType()) - return findMemberNamedType(pointerType->elementType().type()); + return findNamedType(pointerType->elementType().type()); else if (ReferenceType *referenceType = memberType->asReferenceType()) - return findMemberNamedType(referenceType->elementType().type()); + return findNamedType(referenceType->elementType().type()); return 0; } diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h index d7f3b54285a..be5fb57f696 100644 --- a/src/libs/cplusplus/LookupContext.h +++ b/src/libs/cplusplus/LookupContext.h @@ -152,7 +152,7 @@ private: bool isInstantiateNestedClassNeeded(const QList &symbols) const; bool containsTemplateType(Declaration *declaration) const; bool containsTemplateType(Function *function) const; - NamedType *findMemberNamedType(Type *memberType) const; + NamedType *findNamedType(Type *memberType) const; QSet _alreadyConsideredNestedClassInstantiations; CreateBindings *_factory; diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp index f2098ab8386..c193c9639f0 100644 --- a/tests/auto/cplusplus/findusages/tst_findusages.cpp +++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp @@ -95,6 +95,7 @@ private Q_SLOTS: // templates void instantiateTemplateWithNestedClass(); void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006(); + void operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005(); }; void tst_FindUsages::inlineMethod() @@ -490,5 +491,49 @@ void tst_FindUsages::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG90 QCOMPARE(findUsages.usages().size(), 2); } +void tst_FindUsages::operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005() +{ + const QByteArray src = "\n" + "struct Foo { int foo; };\n" + "\n" + "template\n" + "struct Outer\n" + "{\n" + " struct Nested\n" + " {\n" + " T *operator->() { return 0; }\n" + " };\n" + "};\n" + "\n" + "void bug()\n" + "{\n" + " Outer::Nested nested;\n" + " nested->foo;\n" + "}\n" + ; + + Document::Ptr doc = Document::create("operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005"); + doc->setUtf8Source(src); + doc->parse(); + doc->check(); + + QVERIFY(doc->diagnosticMessages().isEmpty()); + QCOMPARE(doc->globalSymbolCount(), 3U); + + Snapshot snapshot; + snapshot.insert(doc); + + Class *classFoo = doc->globalSymbolAt(0)->asClass(); + QVERIFY(classFoo); + QCOMPARE(classFoo->memberCount(), 1U); + Declaration *fooDeclaration = classFoo->memberAt(0)->asDeclaration(); + QVERIFY(fooDeclaration); + QCOMPARE(fooDeclaration->name()->identifier()->chars(), "foo"); + + FindUsages findUsages(src, doc, snapshot); + findUsages(fooDeclaration); + QCOMPARE(findUsages.usages().size(), 2); +} + QTEST_APPLESS_MAIN(tst_FindUsages) #include "tst_findusages.moc" From bde666724083126808507e46bc840eb601631a13 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Sun, 7 Apr 2013 09:05:22 +0200 Subject: [PATCH 20/36] C++: name of function of class problem It fixes: * highlighing * find usage * follow symbol when function of class has the same name as: * local variable * template parameter * other struct/union/class/enum * function argument in function scope. Task-number: QTCREATORBUG-8902 Change-Id: Iddc0f764af689babb40d39460d174bac7b919b31 Reviewed-by: Orgad Shaneh Reviewed-by: Sergey Shambir Reviewed-by: Erik Verbruggen --- src/libs/cplusplus/LookupContext.cpp | 30 ++++- src/plugins/cpptools/cppchecksymbols.cpp | 14 +++ src/plugins/cpptools/cppchecksymbols.h | 2 + .../checksymbols/tst_checksymbols.cpp | 110 ++++++++++++++++++ 4 files changed, 150 insertions(+), 6 deletions(-) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 12ee4933c33..08340671445 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -335,8 +335,14 @@ QList LookupContext::lookup(const Name *name, Scope *scope) const if (name->identifier() != 0 && scope->isBlock()) { bindings()->lookupInScope(name, scope, &candidates, /*templateId = */ 0, /*binding=*/ 0); - if (! candidates.isEmpty()) - break; // it's a local. + if (! candidates.isEmpty()) { + // it's a local. + //for qualified it can be outside of the local scope + if (name->isQualifiedNameId()) + continue; + else + break; + } for (unsigned i = 0; i < scope->memberCount(); ++i) { if (UsingNamespaceDirective *u = scope->memberAt(i)->asUsingNamespaceDirective()) { @@ -352,8 +358,14 @@ QList LookupContext::lookup(const Name *name, Scope *scope) const } else if (Function *fun = scope->asFunction()) { bindings()->lookupInScope(name, fun, &candidates, /*templateId = */ 0, /*binding=*/ 0); - if (! candidates.isEmpty()) - break; // it's an argument or a template parameter. + if (! candidates.isEmpty()) { + // it's an argument or a template parameter. + //for qualified it can be outside of the local scope + if (name->isQualifiedNameId()) + continue; + else + break; + } if (fun->name() && fun->name()->isQualifiedNameId()) { if (ClassOrNamespace *binding = bindings()->lookupType(fun)) { @@ -379,8 +391,14 @@ QList LookupContext::lookup(const Name *name, Scope *scope) const } else if (Template *templ = scope->asTemplate()) { bindings()->lookupInScope(name, templ, &candidates, /*templateId = */ 0, /*binding=*/ 0); - if (! candidates.isEmpty()) - return candidates; // it's a template parameter. + if (! candidates.isEmpty()) { + // it's a template parameter. + //for qualified it can be outside of the local scope + if (name->isQualifiedNameId()) + continue; + else + break; + } } else if (scope->asNamespace() || scope->asClass() diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index fbf27666060..6ac5843c11e 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -1240,6 +1240,7 @@ bool CheckSymbols::maybeAddFunction(const QList &candidates, NameAST { unsigned startToken = ast->firstToken(); bool isDestructor = false; + bool isConstructor = false; if (DestructorNameAST *dtor = ast->asDestructorName()) { isDestructor = true; if (dtor->unqualified_name) @@ -1264,6 +1265,8 @@ bool CheckSymbols::maybeAddFunction(const QList &candidates, NameAST if (isDestructor != c->name()->isDestructorNameId()) continue; + isConstructor = isConstructorDeclaration(c); + Function *funTy = c->type()->asFunctionType(); if (! funTy) { //Try to find a template function @@ -1296,7 +1299,9 @@ bool CheckSymbols::maybeAddFunction(const QList &candidates, NameAST } if (matchType != Match_None) { + // decide how constructor and destructor should be highlighted if (highlightCtorDtorAsType + && (isConstructor || isDestructor) && maybeType(ast->name) && kind == SemanticInfo::FunctionUse) { return false; @@ -1399,3 +1404,12 @@ void CheckSymbols::flush() _usages.clear(); _usages.reserve(cap); } + +bool CheckSymbols::isConstructorDeclaration(Symbol *declaration) +{ + Class *clazz = declaration->enclosingClass(); + if (clazz && clazz->name()) + return declaration->name()->isEqualTo(clazz->name()); + + return false; +} diff --git a/src/plugins/cpptools/cppchecksymbols.h b/src/plugins/cpptools/cppchecksymbols.h index 2b69e000815..51c032bb9c3 100644 --- a/src/plugins/cpptools/cppchecksymbols.h +++ b/src/plugins/cpptools/cppchecksymbols.h @@ -165,6 +165,8 @@ protected: void flush(); private: + bool isConstructorDeclaration(Symbol *declaration); + Document::Ptr _doc; LookupContext _context; TypeOfExpression typeOfExpression; diff --git a/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp b/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp index 432fd2dad42..cbc66e2628e 100644 --- a/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp +++ b/tests/auto/cplusplus/checksymbols/tst_checksymbols.cpp @@ -176,6 +176,10 @@ private slots: void test_checksymbols_StaticUse(); void test_checksymbols_VariableHasTheSameNameAsEnumUse(); void test_checksymbols_NestedClassOfEnclosingTemplateUse(); + void test_checksymbols_8902_staticFunctionHighlightingAsMember_localVariable(); + void test_checksymbols_8902_staticFunctionHighlightingAsMember_functionArgument(); + void test_checksymbols_8902_staticFunctionHighlightingAsMember_templateParameter(); + void test_checksymbols_8902_staticFunctionHighlightingAsMember_struct(); void test_checksymbols_QTCREATORBUG8890_danglingPointer(); void test_checksymbols_QTCREATORBUG8974_danglingPointer(); @@ -446,6 +450,112 @@ void tst_CheckSymbols::test_checksymbols_NestedClassOfEnclosingTemplateUse() TestData::check(source, expectedUses); } +void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_localVariable() +{ + const QByteArray source = + "struct Foo\n" + "{\n" + " static int foo();\n" + "};\n" + "\n" + "void bar()\n" + "{\n" + " int foo = Foo::foo();\n" + "}\n" + ; + + const QList expectedUses = QList() + << Use(1, 8, 3, SemanticInfo::TypeUse) + << Use(3, 16, 3, SemanticInfo::FunctionUse) + << Use(6, 6, 3, SemanticInfo::FunctionUse) + << Use(8, 9, 3, SemanticInfo::LocalUse) + << Use(8, 15, 3, SemanticInfo::TypeUse) + << Use(8, 20, 3, SemanticInfo::FunctionUse) + ; + + TestData::check(source, expectedUses); +} + +void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_functionArgument() +{ + const QByteArray source = + "struct Foo\n" + "{\n" + " static int foo();\n" + "};\n" + "\n" + "void bar(int foo)\n" + "{\n" + " Foo::foo();\n" + "}\n" + ; + + const QList expectedUses = QList() + << Use(1, 8, 3, SemanticInfo::TypeUse) + << Use(3, 16, 3, SemanticInfo::FunctionUse) + << Use(6, 6, 3, SemanticInfo::FunctionUse) + << Use(6, 14, 3, SemanticInfo::LocalUse) + << Use(8, 5, 3, SemanticInfo::TypeUse) + << Use(8, 10, 3, SemanticInfo::FunctionUse) + ; + + TestData::check(source, expectedUses); +} + +void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_templateParameter() +{ + const QByteArray source = + "struct Foo\n" + "{\n" + " static int foo();\n" + "};\n" + "\n" + "template \n" + "void bar()\n" + "{\n" + " Foo::foo();\n" + "}\n" + ; + + const QList expectedUses = QList() + << Use(1, 8, 3, SemanticInfo::TypeUse) + << Use(3, 16, 3, SemanticInfo::FunctionUse) + << Use(6, 17, 3, SemanticInfo::TypeUse) + << Use(7, 6, 3, SemanticInfo::FunctionUse) + << Use(9, 5, 3, SemanticInfo::TypeUse) + << Use(9, 10, 3, SemanticInfo::FunctionUse) + ; + + TestData::check(source, expectedUses); +} + +void tst_CheckSymbols::test_checksymbols_8902_staticFunctionHighlightingAsMember_struct() +{ + const QByteArray source = + "struct Foo\n" + "{\n" + " static int foo();\n" + "};\n" + "\n" + "struct foo {};\n" + "void bar()\n" + "{\n" + " Foo::foo();\n" + "}\n" + ; + + const QList expectedUses = QList() + << Use(1, 8, 3, SemanticInfo::TypeUse) + << Use(3, 16, 3, SemanticInfo::FunctionUse) + << Use(6, 8, 3, SemanticInfo::TypeUse) + << Use(7, 6, 3, SemanticInfo::FunctionUse) + << Use(9, 5, 3, SemanticInfo::TypeUse) + << Use(9, 10, 3, SemanticInfo::FunctionUse) + ; + + TestData::check(source, expectedUses); +} + void tst_CheckSymbols::test_checksymbols_QTCREATORBUG8890_danglingPointer() { const QByteArray source = From eb30ab6604063550fea2d44a573299b95d459c3c Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Sun, 7 Apr 2013 17:48:16 +0200 Subject: [PATCH 21/36] C++: fixed code completion for namespace aliases Task-number: QTCREATORBUG-166 Change-Id: I7a19065a57bfb943e5fc4e2bd9bd81988c1175e3 Reviewed-by: Sergey Shambir Reviewed-by: Orgad Shaneh Reviewed-by: Erik Verbruggen --- src/libs/cplusplus/LookupContext.cpp | 3 +- src/plugins/cpptools/cppcompletion_test.cpp | 47 ++++++++++++++++++++ src/plugins/cpptools/cppcompletionassist.cpp | 4 +- src/plugins/cpptools/cpptoolsplugin.h | 1 + 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 08340671445..d0041d9537c 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -641,7 +641,8 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope, if (s->asNamespaceAlias() && binding) { ClassOrNamespace *targetNamespaceBinding = binding->lookupType(name); - if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() == 1) { + //there can be many namespace definitions + if (targetNamespaceBinding && targetNamespaceBinding->symbols().size() > 0) { Symbol *resolvedSymbol = targetNamespaceBinding->symbols().first(); item.setType(resolvedSymbol->type()); // override the type } diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 6e35e263dab..67af9b94977 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -1751,3 +1751,50 @@ void CppToolsPlugin::test_completion_typedef_using_templates2() QVERIFY(completions.contains(QLatin1String("Foo"))); QVERIFY(completions.contains(QLatin1String("bar"))); } + +void CppToolsPlugin::test_completion_namespace_alias_with_many_namespace_declarations() +{ + TestData data; + data.srcText = + "namespace NS1\n" + "{\n" + "namespace NS2\n" + "{\n" + "struct Foo1\n" + "{\n" + " int bar1;\n" + "};\n" + "}\n" + "}\n" + "namespace NS1\n" + "{\n" + "namespace NS2\n" + "{\n" + "struct Foo2\n" + "{\n" + " int bar2;\n" + "};\n" + "}\n" + "}\n" + "namespace NS = NS1::NS2;\n" + "int main()\n" + "{\n" + " @\n" + " // padding so we get the scope right\n" + "}\n" + ; + setup(&data); + + Utils::ChangeSet change; + QString txt = QLatin1String("NS::"); + change.insert(data.pos, txt); + QTextCursor cursor(data.doc); + change.apply(&cursor); + data.pos += txt.length(); + + QStringList completions = getCompletions(data); + + QCOMPARE(completions.size(), 2); + QVERIFY(completions.contains(QLatin1String("Foo1"))); + QVERIFY(completions.contains(QLatin1String("Foo2"))); +} diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index 72be9a4bf04..d9e12a95ec0 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -517,7 +517,9 @@ public: BasicProposalItem *operator()(Symbol *symbol) { - if (! symbol || ! symbol->name() || symbol->name()->isQualifiedNameId()) + //using declaration can be qualified + if (! symbol || ! symbol->name() || (symbol->name()->isQualifiedNameId() + && ! symbol->asUsingDeclaration())) return 0; BasicProposalItem *previousItem = switchCompletionItem(0); diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index fcb4d417e32..e5ef47ec3e2 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -126,6 +126,7 @@ private slots: void test_completion_template_specialization_with_pointer(); void test_completion_typedef_using_templates1(); void test_completion_typedef_using_templates2(); + void test_completion_namespace_alias_with_many_namespace_declarations(); void test_format_pointerdeclaration_in_simpledeclarations(); void test_format_pointerdeclaration_in_simpledeclarations_data(); From 3ed0a4b77f3af770409f26553d0f380edd05f351 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 14:45:58 +0200 Subject: [PATCH 22/36] C++: Also use O2 on Windows Change-Id: I4183765f654087a38b8ffe60d2b52c3be785f9e3 Reviewed-by: Erik Verbruggen --- src/libs/cplusplus/cplusplus.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/cplusplus/cplusplus.pro b/src/libs/cplusplus/cplusplus.pro index 4c272c5a6f2..5051814dbfd 100644 --- a/src/libs/cplusplus/cplusplus.pro +++ b/src/libs/cplusplus/cplusplus.pro @@ -4,6 +4,7 @@ TARGET = CPlusPlus DEFINES += NDEBUG #DEFINES += DEBUG_LOOKUP unix:QMAKE_CXXFLAGS_DEBUG += -O2 +win32:QMAKE_CXXFLAGS_DEBUG += -O2 include(../../qtcreatorlibrary.pri) include(cplusplus-lib.pri) From f8c23cf4d05dd8f7faf631afdf36fecde2d3b937 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 10:14:28 +0200 Subject: [PATCH 23/36] QmlDesigner.Rewriter: Fixing dynamic properties Dynamic properties were not properly rewritten. Change-Id: Icf2bdd41104aaaeb0473f0616958752dcb19fdb4 Reviewed-by: Marco Bubke --- .../filemanager/addpropertyvisitor.cpp | 9 +++++++-- .../filemanager/addpropertyvisitor.h | 4 +++- .../designercore/filemanager/qmlrefactoring.cpp | 8 ++++++-- .../designercore/filemanager/qmlrefactoring.h | 6 +++++- .../designercore/model/qmltextgenerator.cpp | 17 ++++++++++++++--- .../designercore/model/rewriteaction.cpp | 2 +- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp index df647e181f9..37af895cea9 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp @@ -42,13 +42,15 @@ AddPropertyVisitor::AddPropertyVisitor(QmlDesigner::TextModifier &modifier, const QmlDesigner::PropertyName &name, const QString &value, QmlRefactoring::PropertyType propertyType, - const PropertyNameList &propertyOrder): + const PropertyNameList &propertyOrder, + const QmlDesigner::TypeName &dynamicTypeName) : QMLRewriter(modifier), m_parentLocation(parentLocation), m_name(name), m_value(value), m_propertyType(propertyType), - m_propertyOrder(propertyOrder) + m_propertyOrder(propertyOrder), + m_dynamicTypeName(dynamicTypeName) { } @@ -147,6 +149,9 @@ void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializ Q_ASSERT(!"unknown property type"); } + if (!m_dynamicTypeName.isEmpty()) + newPropertyTemplate.prepend(QString(QLatin1String("property %1 ")).arg(QString::fromUtf8(m_dynamicTypeName))); + if (isOneLiner) { if (needsPreceedingSemicolon) newPropertyTemplate.prepend(QLatin1Char(';')); diff --git a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h index c5da91fbaa9..869edf50030 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h +++ b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.h @@ -45,7 +45,8 @@ public: const QmlDesigner::PropertyName &name, const QString &value, QmlDesigner::QmlRefactoring::PropertyType propertyType, - const PropertyNameList &propertyOrder); + const PropertyNameList &propertyOrder, + const QmlDesigner::TypeName &dynamicTypeName); protected: virtual bool visit(QmlJS::AST::UiObjectDefinition *ast); @@ -60,6 +61,7 @@ private: QString m_value; QmlRefactoring::PropertyType m_propertyType; PropertyNameList m_propertyOrder; + QmlDesigner::TypeName m_dynamicTypeName; }; } // namespace Internal diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp index a5646cdd02d..674e2a1aa7f 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp +++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.cpp @@ -103,12 +103,16 @@ bool QmlRefactoring::addToObjectMemberList(int parentLocation, const QString &co return visit(qmlDocument->qmlProgram()); } -bool QmlRefactoring::addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType) +bool QmlRefactoring::addProperty(int parentLocation, + const PropertyName &name, + const QString &value, + PropertyType propertyType, + const TypeName &dynamicTypeName) { if (parentLocation < 0) return false; - AddPropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType, m_propertyOrder); + AddPropertyVisitor visit(*textModifier, (quint32) parentLocation, name, value, propertyType, m_propertyOrder, dynamicTypeName); return visit(qmlDocument->qmlProgram()); } diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.h b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.h index 62359333791..c6376cfbf41 100644 --- a/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.h +++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrefactoring.h @@ -60,7 +60,11 @@ public: bool addToArrayMemberList(int parentLocation, const PropertyName &propertyName, const QString &content); bool addToObjectMemberList(int parentLocation, const QString &content); - bool addProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType); + bool addProperty(int parentLocation, + const PropertyName &name, + const QString &value, + PropertyType propertyType, + const TypeName &dynamicTypeName = TypeName()); bool changeProperty(int parentLocation, const PropertyName &name, const QString &value, PropertyType propertyType); bool changeObjectType(int nodeLocation, const QString &newType); diff --git a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp index 1fe6d0e0272..4fa4a8b82ba 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp @@ -230,10 +230,21 @@ QString QmlTextGenerator::propertyToQml(const AbstractProperty &property, int in { QString result; - if (property.isDefaultProperty()) + if (property.isDefaultProperty()) { result = toQml(property, indentDepth); - else - result = QString(indentDepth, QLatin1Char(' ')) + property.name() + QLatin1String(": ") + toQml(property, indentDepth); + } else { + if (property.isDynamic()) { + result = QString(indentDepth, QLatin1Char(' ')) + + QLatin1String("property ") + + property.dynamicTypeName() + + QLatin1String(" ") + + property.name() + + QLatin1String(": ") + + toQml(property, indentDepth); + } else { + result = QString(indentDepth, QLatin1Char(' ')) + property.name() + QLatin1String(": ") + toQml(property, indentDepth); + } + } result += QLatin1Char('\n'); diff --git a/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp b/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp index 91875e09797..41abf3d2cb7 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriteaction.cpp @@ -107,7 +107,7 @@ bool AddPropertyRewriteAction::execute(QmlRefactoring &refactoring, ModelNodePos << info(); } } else { - result = refactoring.addProperty(nodeLocation, m_property.name(), m_valueText, m_propertyType); + result = refactoring.addProperty(nodeLocation, m_property.name(), m_valueText, m_propertyType, m_property.dynamicTypeName()); if (!result) { qDebug() << "*** AddPropertyRewriteAction::execute failed in addProperty(" From f7d71a43c816f5b27fd56654ad943f712e7b08ab Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 10:15:58 +0200 Subject: [PATCH 24/36] QmlDesigner.ItemLibrary: crash fix for resources Dragging in Images from the resources tab was broken. Creating an Image has to work with QtQuick 1.0 and QtQuick 2.0. Change-Id: I60702a94ec5fc53805513775f5517c30f9e1b7cd Reviewed-by: Marco Bubke --- .../qmldesigner/designercore/model/qmlmodelview.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp index 0b41ad18eeb..1b438b2dfa5 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp @@ -124,7 +124,7 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c } } - if (!model()->imports().contains(newImport)) + if (!model()->hasImport(newImport, true, true)) model()->changeImports(QList() << newImport, QList()); QList > propertyPairList; @@ -140,8 +140,13 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c } propertyPairList.append(qMakePair(PropertyName("source"), QVariant(relativeImageName))); - newNode = createQmlItemNode("QtQuick.Image", -1, -1, propertyPairList); - parentNode.nodeAbstractProperty("data").reparentHere(newNode); + NodeMetaInfo metaInfo = model()->metaInfo("QtQuick.Image"); + if (metaInfo.isValid()) { + int minorVersion = metaInfo.minorVersion(); + int majorVersion = metaInfo.majorVersion(); + newNode = createQmlItemNode("QtQuick.Image", majorVersion, minorVersion, propertyPairList); + parentNode.nodeAbstractProperty("data").reparentHere(newNode); + } Q_ASSERT(newNode.isValid()); From 7a05f41c0e8ba2eb576b4aa738626fe91c2bca43 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 12:19:01 +0200 Subject: [PATCH 25/36] QmlDesigner: allow QtQuick 2.1 Change-Id: I2908388db3e5a627dd3242ff524832812822f799 Reviewed-by: Marco Bubke --- .../qmldesigner/designercore/model/texttomodelmerger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 2b517bb4a6d..b436ecdf851 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -69,7 +69,7 @@ namespace { static inline QStringList supportedVersionsList() { QStringList list; - list << QLatin1String("1.0") << QLatin1String("1.1") << QLatin1String("2.0"); + list << QLatin1String("1.0") << QLatin1String("1.1") << QLatin1String("2.0") << QLatin1String("2.1"); return list; } From ca340c6b4ec4b98e37b21a7f620e59c6b3b24b9e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 14:40:52 +0200 Subject: [PATCH 26/36] QmlDesigner.MetaInfo: fix for typeinfo from the cpp code model If the typeinfo is provided by the cpp code model if have to use the object value for the lookup. Task-number: QTCREATORBUG-8746 Change-Id: I42e55782ee16ddc255e2f919845a385ff1f3f636 Reviewed-by: Marco Bubke --- src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 20e4562c5fe..0a1b6ba0aa2 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -593,7 +593,7 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons return cppValue; } - return 0; + return value_cast(getObjectValue()); } const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const From 8139d43c294ef68460c6749a0d1aa5ad0ba37910 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 10 Apr 2013 15:03:02 +0200 Subject: [PATCH 27/36] Fix qml engine lockup when debugging an app run in terminal The default timeout for the timer is set to 0 for projects that have the 'run in terminal' option checked in the run settings. Make sure that this timeout is set to a reasonable number once the first connect fails, before we retry. Task-number: QTCREATORBUG-8931 Change-Id: Iaa8acb50d76f182ceda77f8e6923738ad79ff445 Reviewed-by: Friedemann Kleint Reviewed-by: Aurindam Jana --- src/plugins/debugger/qml/qmlengine.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 1c5690c700a..822a835a367 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -401,8 +401,10 @@ void QmlEngine::tryToConnect(quint16 port) if (state() == EngineRunRequested) { if (isSlaveEngine()) { // Probably cpp is being debugged and hence we did not get the output yet. - if (!masterEngine()->isDying()) + if (!masterEngine()->isDying()) { + m_noDebugOutputTimer.setInterval(4000); m_noDebugOutputTimer.start(); + } else appStartupFailed(tr("No application output received in time")); } else { From 6a6f3d2a53c1adb78b9f424f3998721d5b070349 Mon Sep 17 00:00:00 2001 From: "Guillermo A. Amaral" Date: Thu, 4 Apr 2013 01:29:47 -0700 Subject: [PATCH 28/36] Add support for 64-bit NDKs to Android Plugin. Currently the Android plugin only checks for the linux-x86 prebuilds in the 64-bit Android NDK (and mingw-and-ndk), this means Qt Creator goes bonkers because it can't find the toolchain and debugger for the kits it auto-detects/creates. A work around is to symlink linux-x86_64 to linux-x86 in every toolchain. Change-Id: I04522b65ef48b6090a9f6925e8e3420ad1d333ee Reviewed-by: Paul Olav Tvete Reviewed-by: Daniel Teske --- src/plugins/android/androidconfigurations.cpp | 39 ++++++++++++++++++- src/plugins/android/androidconfigurations.h | 18 ++------- src/plugins/android/androidqtversion.cpp | 7 +--- src/plugins/android/androidsettingswidget.cpp | 1 + src/plugins/android/androidtoolchain.cpp | 30 ++------------ 5 files changed, 46 insertions(+), 49 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index e1164e93bfe..9d17c5b7f61 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -81,6 +81,7 @@ namespace { const QLatin1String KeystoreLocationKey("KeystoreLocation"); const QLatin1String AutomaticKitCreationKey("AutomatiKitCreation"); const QLatin1String PartitionSizeKey("PartitionSize"); + const QLatin1String ToolchainHostKey("ToolchainHost"); const QLatin1String ArmToolchainPrefix("arm-linux-androideabi"); const QLatin1String X86ToolchainPrefix("x86"); const QLatin1String MipsToolchainPrefix("mipsel-linux-android"); @@ -152,6 +153,7 @@ AndroidConfig::AndroidConfig(const QSettings &settings) antLocation = FileName::fromString(settings.value(AntLocationKey).toString()); openJDKLocation = FileName::fromString(settings.value(OpenJDKLocationKey).toString()); keystoreLocation = FileName::fromString(settings.value(KeystoreLocationKey).toString()); + toolchainHost = settings.value(ToolchainHostKey).toString(); automaticKitCreation = settings.value(AutomaticKitCreationKey, true).toBool(); PersistentSettingsReader reader; @@ -163,6 +165,7 @@ AndroidConfig::AndroidConfig(const QSettings &settings) antLocation = FileName::fromString(reader.restoreValue(AntLocationKey).toString()); openJDKLocation = FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString()); keystoreLocation = FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString()); + toolchainHost = reader.restoreValue(ToolchainHostKey).toString(); QVariant v = reader.restoreValue(AutomaticKitCreationKey); if (v.isValid()) automaticKitCreation = v.toBool(); @@ -190,11 +193,16 @@ void AndroidConfig::save(QSettings &settings) const settings.setValue(KeystoreLocationKey, keystoreLocation.toString()); settings.setValue(PartitionSizeKey, partitionSize); settings.setValue(AutomaticKitCreationKey, automaticKitCreation); + settings.setValue(ToolchainHostKey, toolchainHost); } void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs) { m_config = devConfigs; + + if (m_config.toolchainHost.isEmpty()) + detectToolchainHost(); + save(); updateAvailablePlatforms(); updateAutomaticKitList(); @@ -277,7 +285,7 @@ FileName AndroidConfigurations::toolPath(Abi::Architecture architecture, const Q return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/%3/bin/%4") .arg(toolchainPrefix(architecture)) .arg(ndkToolChainVersion) - .arg(ToolchainHost) + .arg(m_config.toolchainHost) .arg(toolsPrefix(architecture))); } @@ -291,6 +299,11 @@ FileName AndroidConfigurations::readelfPath(Abi::Architecture architecture, cons return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-readelf" QTC_HOST_EXE_SUFFIX)); } +FileName AndroidConfigurations::gccPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const +{ + return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX)); +} + FileName AndroidConfigurations::gdbPath(Abi::Architecture architecture, const QString &ndkToolChainVersion) const { return toolPath(architecture, ndkToolChainVersion).append(QLatin1String("-gdb" QTC_HOST_EXE_SUFFIX)); @@ -301,6 +314,30 @@ FileName AndroidConfigurations::openJDKPath() const return m_config.openJDKLocation; } +void AndroidConfigurations::detectToolchainHost() +{ + QStringList hostPatterns; + switch (HostOsInfo::hostOs()) { + case HostOsInfo::HostOsLinux: + hostPatterns << QLatin1String("linux*"); + break; + case HostOsInfo::HostOsWindows: + hostPatterns << QLatin1String("windows*"); + break; + case HostOsInfo::HostOsMac: + hostPatterns << QLatin1String("darwin*"); + break; + default: /* unknown host */ return; + } + + FileName path = m_config.ndkLocation; + QDirIterator it(path.appendPath(QLatin1String("prebuilt")).toString(), hostPatterns, QDir::Dirs); + if (it.hasNext()) { + it.next(); + m_config.toolchainHost = it.fileName(); + } +} + FileName AndroidConfigurations::openJDKBinPath() const { FileName path = m_config.openJDKLocation; diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h index 50dce7a3edf..edd607fba14 100644 --- a/src/plugins/android/androidconfigurations.h +++ b/src/plugins/android/androidconfigurations.h @@ -42,21 +42,6 @@ QT_END_NAMESPACE namespace Android { namespace Internal { -#ifdef Q_OS_LINUX - const QLatin1String ToolchainHost("linux-x86"); -#else -# ifdef Q_OS_DARWIN - const QLatin1String ToolchainHost("darwin-x86"); -# else -# ifdef Q_OS_WIN32 - const QLatin1String ToolchainHost("windows"); -# else -# warning No Android supported OSs found - const QLatin1String ToolchainHost("linux-x86"); -# endif -# endif -#endif - class AndroidConfig { public: @@ -69,6 +54,7 @@ public: Utils::FileName antLocation; Utils::FileName openJDKLocation; Utils::FileName keystoreLocation; + QString toolchainHost; unsigned partitionSize; bool automaticKitCreation; }; @@ -95,6 +81,7 @@ public: Utils::FileName androidToolPath() const; Utils::FileName antToolPath() const; Utils::FileName emulatorToolPath() const; + Utils::FileName gccPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const; Utils::FileName gdbPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const; Utils::FileName openJDKPath() const; Utils::FileName keytoolPath() const; @@ -124,6 +111,7 @@ public slots: private: Utils::FileName toolPath(ProjectExplorer::Abi::Architecture architecture, const QString &ndkToolChainVersion) const; Utils::FileName openJDKBinPath() const; + void detectToolchainHost(); AndroidConfigurations(QObject *parent); void load(); diff --git a/src/plugins/android/androidqtversion.cpp b/src/plugins/android/androidqtversion.cpp index 91f9e30c86a..e92bc0240f0 100644 --- a/src/plugins/android/androidqtversion.cpp +++ b/src/plugins/android/androidqtversion.cpp @@ -103,13 +103,8 @@ QList AndroidQtVersion::detectQtAbis() const void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const { - QString ndk_host = QLatin1String( - Utils::HostOsInfo::isLinuxHost() ? "linux-x86" : - Utils::HostOsInfo::isWindowsHost() ? "windows" : - Utils::HostOsInfo::isMacHost() ? "darwin-x86" : ""); - // this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info) - env.set(QLatin1String("ANDROID_NDK_HOST"), ndk_host); + env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::instance().config().toolchainHost); env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::instance().config().ndkLocation.toUserOutput()); Qt4Project *qt4pro = qobject_cast(ProjectExplorerPlugin::instance()->currentProject()); diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index b41ad3225a1..8a0163df7d8 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -286,6 +286,7 @@ void AndroidSettingsWidget::sdkLocationEditingFinished() void AndroidSettingsWidget::ndkLocationEditingFinished() { Utils::FileName location = Utils::FileName::fromUserInput(m_ui->NDKLocationLineEdit->text()); + m_androidConfig.toolchainHost.clear(); // force toolchain host detection if (!checkNDK(location)) return; saveSettings(true); diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index 3b00796d19d..04ee7586409 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -111,21 +111,7 @@ void AndroidToolChain::addToEnvironment(Environment &env) const // TODO this vars should be configurable in projects -> build tab // TODO invalidate all .pro files !!! - QString ndkHost; - switch (HostOsInfo::hostOs()) { - case HostOsInfo::HostOsLinux: - ndkHost = QLatin1String("linux-x86"); - break; - case HostOsInfo::HostOsWindows: - ndkHost = QLatin1String("windows"); - break; - case HostOsInfo::HostOsMac: - ndkHost = QLatin1String("darwin-x86"); - break; - default: - break; - } - env.set(QLatin1String("ANDROID_NDK_HOST"), ndkHost); + env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::instance().config().toolchainHost); env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture())); env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture())); env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion); @@ -302,12 +288,7 @@ QList AndroidToolChainFact if (ati.architecture == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported continue; // AndroidToolChain *tc = new AndroidToolChain(arch, version, true); - ati.compilerCommand = ndkPath; - ati.compilerCommand.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4") - .arg(fileName) - .arg(ToolchainHost) - .arg(AndroidConfigurations::toolsPrefix(ati.architecture))); - ati.compilerCommand.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX)); + ati.compilerCommand = AndroidConfigurations::instance().gccPath(ati.architecture, ati.version); // tc->setCompilerCommand(compilerPath); result.append(ati); } @@ -334,12 +315,7 @@ QList AndroidToolChainFactory::createToolChainsForNdk(const Utils:: if (arch == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported continue; AndroidToolChain *tc = new AndroidToolChain(arch, version, true); - FileName compilerPath = ndkPath; - compilerPath.appendPath(QString::fromLatin1("toolchains/%1/prebuilt/%3/bin/%4") - .arg(fileName) - .arg(ToolchainHost) - .arg(AndroidConfigurations::toolsPrefix(arch))); - compilerPath.append(QLatin1String("-gcc" QTC_HOST_EXE_SUFFIX)); + FileName compilerPath = AndroidConfigurations::instance().gccPath(arch, version); tc->setCompilerCommand(compilerPath); result.append(tc); } From 02e11c6cd7570af2ef21d0f6cb559cc181a5bcdc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 10 Apr 2013 16:22:15 +0200 Subject: [PATCH 29/36] make Qt4ProFileNode::buildDir() return normalized paths QDir::absoluteFilePath(QString()) apparently appends a trailing slash Task-number: QTCREATORBUG-9096 Change-Id: I7c816590daa87df4b646e5cee75566c97b839b52 Reviewed-by: Daniel Teske --- src/plugins/qt4projectmanager/qt4nodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 77fd1e99347..8f88e221450 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -2260,7 +2260,7 @@ QString Qt4ProFileNode::buildDir(Qt4BuildConfiguration *bc) const bc = static_cast(m_project->activeTarget()->activeBuildConfiguration()); if (!bc) return QString(); - return QDir(bc->buildDirectory()).absoluteFilePath(relativeDir); + return QDir::cleanPath(QDir(bc->buildDirectory()).absoluteFilePath(relativeDir)); } void Qt4ProFileNode::updateCodeModelSupportFromBuild() From 8a9fc635556169dcd38d39f5821f7570f516f3fb Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 10 Apr 2013 15:34:50 +0200 Subject: [PATCH 30/36] QmlDesigner.Instances: blacklist certain properties For those properties the QQmlProperty constructor does crash. Change-Id: Ia78583e080ced936d98517ce0d3244d3040f8ceb Reviewed-by: Marco Bubke --- .../instances/objectnodeinstance.cpp | 38 ++++++++++++++++--- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp index b4c54a7e791..53dc355f368 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp @@ -54,6 +54,17 @@ #include #include +static bool isPropertyBlackListed(const QmlDesigner::PropertyName &propertyName) +{ + if (propertyName.contains(".") && propertyName.contains("__")) + return true; + + if (propertyName.count(".") > 1) + return true; + + return false; +} + namespace QmlDesigner { namespace Internal { @@ -536,6 +547,9 @@ void ObjectNodeInstance::refreshProperty(const PropertyName &name) bool ObjectNodeInstance::hasBindingForProperty(const PropertyName &name, bool *hasChanged) const { + if (isPropertyBlackListed(name)) + return false; + QQmlProperty property(object(), name, context()); bool hasBinding = QQmlPropertyPrivate::binding(property); @@ -604,6 +618,9 @@ QVariant ObjectNodeInstance::property(const PropertyName &name) const // TODO: handle model nodes + if (isPropertyBlackListed(name)) + return QVariant(); + QQmlProperty property(object(), name, context()); if (property.property().isEnumType()) { QVariant value = property.read(); @@ -666,6 +683,9 @@ PropertyNameList ObjectNodeInstance::propertyNames() const QString ObjectNodeInstance::instanceType(const PropertyName &name) const { + if (isPropertyBlackListed(name)) + return QLatin1String("undefined"); + QQmlProperty property(object(), name, context()); if (!property.isValid()) return QLatin1String("undefined"); @@ -785,7 +805,13 @@ static void disableTiledBackingStore(QObject *object) Q_UNUSED(object); } -PropertyNameList propertyNameForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList()) +static void addToPropertyNameListIfNotBlackListed(PropertyNameList *propertyNameList, const PropertyName &propertyName) +{ + if (!isPropertyBlackListed(propertyName)) + propertyNameList->append(propertyName); +} + +PropertyNameList propertyNameListForWritableProperties(QObject *object, const PropertyName &baseName = PropertyName(), QObjectList *inspectedObjects = new QObjectList()) { PropertyNameList propertyNameList; @@ -802,16 +828,16 @@ PropertyNameList propertyNameForWritableProperties(QObject *object, const Proper if (declarativeProperty.name() != "parent") { QObject *childObject = QQmlMetaType::toQObject(declarativeProperty.read()); if (childObject) - propertyNameList.append(propertyNameForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameListForWritableProperties(childObject, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } } else if (QQmlValueTypeFactory::valueType(metaProperty.userType())) { QQmlValueType *valueType = QQmlValueTypeFactory::valueType(metaProperty.userType()); valueType->setValue(metaProperty.read(object)); - propertyNameList.append(propertyNameForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); + propertyNameList.append(propertyNameListForWritableProperties(valueType, baseName + PropertyName(metaProperty.name()) + '.', inspectedObjects)); } if (metaProperty.isReadable() && metaProperty.isWritable()) { - propertyNameList.append(baseName + PropertyName(metaProperty.name())); + addToPropertyNameListIfNotBlackListed(&propertyNameList, baseName + PropertyName(metaProperty.name())); } } @@ -823,7 +849,7 @@ static void fixResourcePathsForObject(QObject *object) if (qgetenv("QMLDESIGNER_RC_PATHS").isEmpty()) return; - PropertyNameList propertyNameList = propertyNameForWritableProperties(object); + PropertyNameList propertyNameList = propertyNameListForWritableProperties(object); foreach (const PropertyName &propertyName, propertyNameList) { QQmlProperty property(object, propertyName, QQmlEngine::contextForObject(object)); @@ -1039,7 +1065,7 @@ void ObjectNodeInstance::deactivateState() void ObjectNodeInstance::populateResetHashes() { - PropertyNameList propertyNameList = propertyNameForWritableProperties(object()); + PropertyNameList propertyNameList = propertyNameListForWritableProperties(object()); foreach (const PropertyName &propertyName, propertyNameList) { QQmlProperty property(object(), propertyName, QQmlEngine::contextForObject(object())); From f42f73492fa636c6ca31bf11c1c4107e97a7f70e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 11 Apr 2013 12:03:35 +0200 Subject: [PATCH 31/36] QmlDesigner.Instances: function should be static No reason the export the symbol. Change-Id: I34a42f866333585774129021777265e8a7524555 Reviewed-by: Marco Bubke --- .../qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index f4db8ed8fc7..22971c6520b 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -448,7 +448,7 @@ void QuickItemNodeInstance::refresh() repositioning(quickItem()); } -void doComponentCompleteRecursive(QQuickItem *item) +static void doComponentCompleteRecursive(QQuickItem *item) { if (item) { if (DesignerSupport::isComponentComplete(item)) From 7406761f8fdbaa18d9b0c6cd68c43702ea8507e5 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 11 Apr 2013 12:05:00 +0200 Subject: [PATCH 32/36] QmlDesigner.Instances: disabling the cursor after completing The cursor should be disabled after component complete. Change-Id: I3ee089b23f43b42a478aaacc4073cbdfd0da2323 Reviewed-by: Marco Bubke --- .../qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 22971c6520b..94f8622491f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -278,8 +278,6 @@ static void disableTextCursor(QQuickItem *item) void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance) { - disableTextCursor(quickItem()); - if (instanceId() == 0) { DesignerSupport::setRootItem(nodeInstanceServer()->quickView(), quickItem()); } else { @@ -465,6 +463,8 @@ void QuickItemNodeInstance::doComponentComplete() { doComponentCompleteRecursive(quickItem()); + disableTextCursor(quickItem()); + quickItem()->update(); } From 269545bb35bb4fad187cd2bfba25713c81f5641b Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 10 Apr 2013 16:12:39 +0200 Subject: [PATCH 33/36] Todo: 10x speed-up open-file tracking. When idle-timer fires for the Todo plug-in, this method gets hit. When I have qtcreator.pro loaded, and 1 file open, and hit enter once, this change reduces time spend in this method from 223ms to 22ms of UI thread activity. Change-Id: I76234601d39605a85e89700d18dd017ac1b8a902 Reviewed-by: Eike Ziller --- src/plugins/todo/todoitemsprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp index 5a6a6bc33bb..060e8911c64 100644 --- a/src/plugins/todo/todoitemsprovider.cpp +++ b/src/plugins/todo/todoitemsprovider.cpp @@ -108,7 +108,7 @@ void TodoItemsProvider::createScanners() void TodoItemsProvider::setItemsListWithinStartupProject() { QHashIterator > it(m_itemsHash); - QStringList fileNames = m_startupProject->files(ProjectExplorer::Project::ExcludeGeneratedFiles); + QSet fileNames = QSet::fromList(m_startupProject->files(ProjectExplorer::Project::ExcludeGeneratedFiles)); while (it.hasNext()) { it.next(); if (fileNames.contains(it.key())) From eb3a0b0a1f63a70752cd9d8a3314f3605208e975 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Thu, 11 Apr 2013 14:08:52 +0200 Subject: [PATCH 34/36] Doc: fix typo: widget.xml > wizard.xml Task-number: QTCREATORBUG-7909 Change-Id: Ib04c10559e7945efc8fc8ddb320bd1300620fd33 Reviewed-by: Friedemann Kleint --- doc/src/projects/creator-projects-custom-wizards.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/projects/creator-projects-custom-wizards.qdoc b/doc/src/projects/creator-projects-custom-wizards.qdoc index d48e3441d36..09021ab7dde 100644 --- a/doc/src/projects/creator-projects-custom-wizards.qdoc +++ b/doc/src/projects/creator-projects-custom-wizards.qdoc @@ -299,7 +299,7 @@ \section1 Creating Class Wizards - The widget.xml file for a class wizard is very similar to that for a project + The wizard.xml file for a class wizard is very similar to that for a project wizard. The differences are discussed below. To create a class wizard: From 6d3e0fbd04b66e4ee4e41cd44daba63590b3125b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 11 Apr 2013 15:18:29 +0200 Subject: [PATCH 35/36] QmlDesigner: Fix compilation with namespaced Qt. Change-Id: I38613edf14cf72d38a7c7ca631f4d7f82c112288 Reviewed-by: Thomas Hartmann --- .../components/integration/stackedutilitypanelcontroller.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/qmldesigner/components/integration/stackedutilitypanelcontroller.h b/src/plugins/qmldesigner/components/integration/stackedutilitypanelcontroller.h index 25a27f32222..09028695c3f 100644 --- a/src/plugins/qmldesigner/components/integration/stackedutilitypanelcontroller.h +++ b/src/plugins/qmldesigner/components/integration/stackedutilitypanelcontroller.h @@ -32,7 +32,9 @@ #include "utilitypanelcontroller.h" +QT_BEGIN_NAMESPACE class QStackedWidget; +QT_END_NAMESPACE namespace QmlDesigner { From 567098f210a7f73b98f02132a545bd5b5420e5a4 Mon Sep 17 00:00:00 2001 From: Knut Petter Svendsen Date: Tue, 2 Apr 2013 13:03:24 +0200 Subject: [PATCH 36/36] ClearCase: Fixed get active VOBs The correct way to check if a VOB is active (mounted) is to check for a "*" in the output of "cleartool lsvob". On windows a directory for each active VOB exists under topLevel, but this is not true for unix where directories (mount points) for all VOBs exists always. Change-Id: Iccb0e38a39dfcae72326d68b9ff43b2555187f6c Reviewed-by: Orgad Shaneh --- src/plugins/clearcase/clearcaseplugin.cpp | 33 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp index 43023fa91fc..0da8dd8d0b7 100644 --- a/src/plugins/clearcase/clearcaseplugin.cpp +++ b/src/plugins/clearcase/clearcaseplugin.cpp @@ -555,21 +555,40 @@ QString ClearCasePlugin::ccGetPredecessor(const QString &version) const return response.stdOut; } +//! Get a list of paths to active VOBs. +//! Paths are relative to topLevel QStringList ClearCasePlugin::ccGetActiveVobs() const { QStringList res; QStringList args(QLatin1String("lsvob")); - args << QLatin1String("-short"); - QString topLevel = currentState().topLevel(); + const QString topLevel = currentState().topLevel(); const ClearCaseResponse response = runCleartool(topLevel, args, m_settings.timeOutMS(), SilentRun); if (response.error) return res; - foreach (QString dir, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) { - dir = dir.mid(1); // omit first slash - QFileInfo fi(topLevel, dir); - if (fi.exists()) - res.append(dir); + + // format of output unix: + // * /path/to/vob /path/to/vob/storage.vbs + // format of output windows: + // * \vob \\share\path\to\vob\storage.vbs + QString prefix = topLevel; + if (!prefix.endsWith(QLatin1Char('/'))) + prefix += QLatin1Char('/'); + + foreach (const QString &line, response.stdOut.split(QLatin1Char('\n'), QString::SkipEmptyParts)) { + const bool isActive = line.at(0) == QLatin1Char('*'); + if (!isActive) + continue; + + const QString dir = + QDir::fromNativeSeparators(line.mid(3, line.indexOf(QLatin1Char(' '), 3) - 3)); + const QString relativeDir = QDir(topLevel).relativeFilePath(dir); + + // Snapshot views does not necessarily have all active VOBs loaded, so we'll have to + // check if the dirs exists as well. Else the command will work, but the output will + // complain about the element not being loaded. + if (QFile::exists(prefix + relativeDir)) + res.append(relativeDir); } return res; }