diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2022-10-04 15:21:56 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2022-10-04 13:44:42 +0000 |
commit | 964f539e559f0bb51204a10ad6147bda3a1924d0 (patch) | |
tree | 056b43eeec5ea5cb4aac35fc6476089906ce5d21 /src/plugins | |
parent | 993fd2a92a9e90c9e06f161b40eb5b0201169ade (diff) | |
parent | 47887da778215045831d8284cf896e8934e75cda (diff) |
Merge remote-tracking branch 'origin/8.0' into 9.0
resolved conflicts:
* doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc
* src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
* src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp
* src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp
and compile fix in materialbrowserview.cpp
Change-Id: I686e7e93ded8ac1afc792942ded47cd9fe4341ed
Diffstat (limited to 'src/plugins')
45 files changed, 277 insertions, 127 deletions
diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 8daa59c34e..47ac8a746b 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -567,14 +567,16 @@ bool AndroidBuildApkStep::init() if (m_buildAAB) arguments << "--aab" << "--jarsigner"; + if (buildType() == BuildConfiguration::Release) { + arguments << "--release"; + } + QStringList argumentsPasswordConcealed = arguments; if (m_signPackage) { - arguments << "--release" - << "--sign" << m_keystorePath.toString() << m_certificateAlias + arguments << "--sign" << m_keystorePath.toString() << m_certificateAlias << "--storepass" << m_keystorePasswd; - argumentsPasswordConcealed << "--release" - << "--sign" << "******" + argumentsPasswordConcealed << "--sign" << "******" << "--storepass" << "******"; if (!m_certificatePasswd.isEmpty()) { arguments << "--keypass" << m_certificatePasswd; diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 03795b4d34..128de01afe 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -240,6 +240,9 @@ bool AndroidDeployQtStep::init() m_androiddeployqtArgs.addArg("--gradle"); + if (buildType() == BuildConfiguration::Release) + m_androiddeployqtArgs.addArgs({"--release"}); + if (androidBuildApkStep && androidBuildApkStep->signPackage()) { // The androiddeployqt tool is not really written to do stand-alone installations. // This hack forces it to use the correct filename for the apk file when installing diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index fb64084076..8245a2e94d 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -576,6 +576,8 @@ public: { menu()->clear(); + menu()->setEnabled(true); + const auto selection = selectionContext(); if (!selection.isValid()) return; @@ -585,11 +587,19 @@ public: return; ModelNode currentNode = selection.currentSingleSelectedNode(); + + if (!currentNode.isValid()) + return; + QmlObjectNode currentObjectNode(currentNode); QStringList signalsList = getSignalsList(currentNode); QList<SlotEntry> slotsList = getSlotsLists(currentNode); - currentNode.validId(); + + if (!currentNode.hasId()) { + menu()->setEnabled(false); + return; + } for (const ModelNode &connectionNode : currentObjectNode.getAllConnections()) { for (const AbstractProperty &property : connectionNode.properties()) { diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index eb994f6f9a..861397227e 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -1631,6 +1631,7 @@ void addMouseAreaFill(const SelectionContext &selectionContext) QmlDesigner::ModelNode mouseAreaNode = selectionContext.view()->createModelNode("QtQuick.MouseArea", itemMetaInfo.majorVersion(), itemMetaInfo.minorVersion()); + mouseAreaNode.validId(); modelNode.defaultNodeListProperty().reparentHere(mouseAreaNode); QmlItemNode mouseAreaItemNode(mouseAreaNode); diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index 327bd04132..c10799b6c5 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -315,6 +315,8 @@ void Edit3DWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent) void Edit3DWidget::dropEvent(QDropEvent *dropEvent) { + const QPointF pos = m_canvas->mapFrom(this, dropEvent->position()); + // handle dropping materials if (dropEvent->mimeData()->hasFormat(Constants::MIME_TYPE_MATERIAL)) { QByteArray data = dropEvent->mimeData()->data(Constants::MIME_TYPE_MATERIAL); @@ -323,13 +325,13 @@ void Edit3DWidget::dropEvent(QDropEvent *dropEvent) stream >> internalId; if (ModelNode matNode = m_view->modelNodeForInternalId(internalId)) - m_view->dropMaterial(matNode, dropEvent->position()); + m_view->dropMaterial(matNode, pos); return; } // handle dropping bundle materials if (dropEvent->mimeData()->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) { - m_view->dropBundleMaterial(dropEvent->position()); + m_view->dropBundleMaterial(pos); return; } diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp index 1f1dff4eef..c075a582e4 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp @@ -7,7 +7,8 @@ #include <designmodewidget.h> #include <qmldesignerplugin.h> #include <qmlobjectnode.h> -#include "variantproperty.h" +#include <variantproperty.h> +#include <qmltimelinekeyframegroup.h> #include "utils/qtcassert.h" namespace QmlDesigner { @@ -326,40 +327,84 @@ void MaterialBrowserModel::duplicateMaterial(int idx) void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §ion) { - ModelNode mat = m_materialList.at(idx); - QString matType = QString::fromLatin1(mat.type()); + m_copiedMaterial = m_materialList.at(idx); + + QTC_ASSERT(m_copiedMaterial.isValid(), return); + + QString matType = QString::fromLatin1(m_copiedMaterial.type()); if (matType.startsWith("QtQuick3D.")) matType.remove("QtQuick3D."); setCopiedMaterialType(matType); m_allPropsCopied = section == "All"; + QmlObjectNode mat(m_copiedMaterial); + + QSet<PropertyName> validProps; + PropertyNameList copiedProps; + + // Base state properties are always valid + const auto baseProps = m_copiedMaterial.propertyNames(); + for (const auto &baseProp : baseProps) + validProps.insert(baseProp); + + if (!mat.isInBaseState()) { + QmlPropertyChanges changes = mat.propertyChangeForCurrentState(); + if (changes.isValid()) { + const QList<AbstractProperty> changedProps = changes.targetProperties(); + for (const auto &changedProp : changedProps) + validProps.insert(changedProp.name()); + } + } + + if (mat.timelineIsActive()) { + const QList<QmlTimelineKeyframeGroup> keyframeGroups + = mat.currentTimeline().keyframeGroupsForTarget(m_copiedMaterial); + for (const auto &kfg : keyframeGroups) + validProps.insert(kfg.propertyName()); + } if (m_allPropsCopied || m_propertyGroupsObj.empty()) { - m_copiedMaterialProps = mat.properties(); + copiedProps = validProps.values(); } else { QJsonObject propsSpecObj = m_propertyGroupsObj.value(m_copiedMaterialType).toObject(); if (propsSpecObj.contains(section)) { // should always be true - m_copiedMaterialProps.clear(); const QJsonArray propNames = propsSpecObj.value(section).toArray(); // auto == QJsonValueConstRef after 04dc959d49e5e3 / Qt 6.4, QJsonValueRef before for (const auto &propName : propNames) - m_copiedMaterialProps.append(mat.property(propName.toString().toLatin1())); + copiedProps.append(propName.toString().toLatin1()); if (section == "Base") { // add QtQuick3D.Material base props as well QJsonObject propsMatObj = m_propertyGroupsObj.value("Material").toObject(); const QJsonArray propNames = propsMatObj.value("Base").toArray(); // auto == QJsonValueConstRef after 04dc959d49e5e3 / Qt 6.4, QJsonValueRef before for (const auto &propName : propNames) - m_copiedMaterialProps.append(mat.property(propName.toString().toLatin1())); + copiedProps.append(propName.toString().toLatin1()); } } } + + m_copiedMaterialProps.clear(); + for (const auto &propName : copiedProps) { + PropertyCopyData data; + data.name = propName; + data.isValid = m_allPropsCopied || validProps.contains(propName); + data.isBinding = mat.hasBindingProperty(propName); + if (data.isValid) { + if (data.isBinding) + data.value = mat.expression(propName); + else + data.value = mat.modelValue(propName); + } + m_copiedMaterialProps.append(data); + } } void MaterialBrowserModel::pasteMaterialProperties(int idx) { - emit pasteMaterialPropertiesTriggered(m_materialList.at(idx), m_copiedMaterialProps, m_allPropsCopied); + ModelNode targetMat = m_materialList.at(idx); + if (targetMat.isValid() && m_copiedMaterial.isValid() && targetMat != m_copiedMaterial) + emit pasteMaterialPropertiesTriggered(targetMat, m_copiedMaterialProps, m_allPropsCopied); } void MaterialBrowserModel::deleteMaterial(int idx) @@ -396,4 +441,11 @@ void MaterialBrowserModel::openMaterialEditor() QmlDesignerPlugin::instance()->mainWidget()->showDockWidget("MaterialEditor", true); } +// This is provided as invokable instead of property, as it is difficult to know when ModelNode +// becomes invalid. Much simpler to evaluate this on demand. +bool MaterialBrowserModel::isCopiedMaterialValid() const +{ + return m_copiedMaterial.isValid(); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h index 64b58c9be9..8635c1f1b0 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h @@ -70,6 +70,15 @@ public: Q_INVOKABLE void addNewMaterial(); Q_INVOKABLE void applyToSelected(qint64 internalId, bool add = false); Q_INVOKABLE void openMaterialEditor(); + Q_INVOKABLE bool isCopiedMaterialValid() const; + + struct PropertyCopyData + { + PropertyName name; + QVariant value; + bool isBinding = false; + bool isValid = false; + }; signals: void isEmptyChanged(); @@ -83,9 +92,10 @@ signals: void applyToSelectedTriggered(const QmlDesigner::ModelNode &material, bool add = false); void addNewMaterialTriggered(); void duplicateMaterialTriggered(const QmlDesigner::ModelNode &material); - void pasteMaterialPropertiesTriggered(const QmlDesigner::ModelNode &material, - const QList<QmlDesigner::AbstractProperty> &props, - bool all); + void pasteMaterialPropertiesTriggered( + const QmlDesigner::ModelNode &material, + const QList<QmlDesigner::MaterialBrowserModel::PropertyCopyData> &props, + bool all); private: bool isMaterialVisible(int idx) const; @@ -96,7 +106,8 @@ private: QStringList m_defaultMaterialSections; QStringList m_principledMaterialSections; QStringList m_customMaterialSections; - QList<AbstractProperty> m_copiedMaterialProps; + ModelNode m_copiedMaterial; + QList<PropertyCopyData> m_copiedMaterialProps; QHash<qint32, int> m_materialIndexHash; // internalId -> index QJsonObject m_propertyGroupsObj; diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index 791b42a059..f6f9bb498d 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -72,29 +72,43 @@ WidgetInfo MaterialBrowserView::widgetInfo() }); connect(matBrowserModel, &MaterialBrowserModel::pasteMaterialPropertiesTriggered, this, - [&] (const ModelNode &material, const QList<AbstractProperty> &props, bool all) { + [&] (const ModelNode &material, + const QList<QmlDesigner::MaterialBrowserModel::PropertyCopyData> &propDatas, + bool all) { QmlObjectNode mat(material); executeInTransaction(__FUNCTION__, [&] { if (all) { // all material properties copied // remove current properties - const PropertyNameList propNames = material.propertyNames(); - for (const PropertyName &propName : propNames) { + PropertyNameList propNames; + if (mat.isInBaseState()) { + propNames = material.propertyNames(); + } else { + QmlPropertyChanges changes = mat.propertyChangeForCurrentState(); + if (changes.isValid()) { + const QList<AbstractProperty> changedProps = changes.targetProperties(); + for (const auto &changedProp : changedProps) + propNames.append(changedProp.name()); + } + } + for (const PropertyName &propName : qAsConst(propNames)) { if (propName != "objectName") mat.removeProperty(propName); } } // apply pasted properties - for (const AbstractProperty &prop : props) { - if (prop.name() == "objectName") + for (const QmlDesigner::MaterialBrowserModel::PropertyCopyData &propData : propDatas) { + if (propData.name == "objectName") continue; - if (prop.isVariantProperty()) - mat.setVariantProperty(prop.name(), prop.toVariantProperty().value()); - else if (prop.isBindingProperty()) - mat.setBindingProperty(prop.name(), prop.toBindingProperty().expression()); - else if (!all) - mat.removeProperty(prop.name()); + if (propData.isValid) { + if (propData.isBinding) + mat.setBindingProperty(propData.name, propData.value.toString()); + else + mat.setVariantProperty(propData.name, propData.value); + } else { + mat.removeProperty(propData.name); + } } }); }); @@ -164,7 +178,8 @@ void MaterialBrowserView::applyBundleMaterialToDropTarget(const ModelNode &bundl newMatNode = bundleMat; } - if (m_bundleMaterialDropTarget.isValid()) { + if (m_bundleMaterialDropTarget.isValid() + && m_bundleMaterialDropTarget.metaInfo().isQtQuick3DModel()) { QmlObjectNode qmlObjNode(m_bundleMaterialDropTarget); if (m_bundleMaterialAddToSelected) { // TODO: unify this logic as it exist elsewhere also @@ -211,12 +226,12 @@ void MaterialBrowserView::modelAttached(Model *model) rootModelNode().metaInfo().isQtQuick3DMaterial()); m_hasQuick3DImport = model->hasImport("QtQuick3D"); - loadPropertyGroups(); // Project load is already very busy and may even trigger puppet reset, so let's wait a moment // before refreshing the model QTimer::singleShot(1000, this, [this]() { refreshModel(true); + loadPropertyGroups(); // Needs the delay because it uses metaInfo }); } @@ -429,7 +444,6 @@ void MaterialBrowserView::customNotification(const AbstractView *view, } else if (identifier == "drop_bundle_material") { m_bundleMaterialDropTarget = nodeList.first(); - ModelNode defaultMat = getBundleMaterialDefaultInstance(m_draggedBundleMaterial->type()); if (defaultMat.isValid()) applyBundleMaterialToDropTarget(defaultMat); diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp index 9df4a39b6e..c89ec4581f 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp @@ -110,15 +110,21 @@ bool MaterialBrowserWidget::eventFilter(QObject *obj, QEvent *event) } else if (m_bundleMaterialToDrag != nullptr) { QMouseEvent *me = static_cast<QMouseEvent *>(event); if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 20) { + QByteArray data; QMimeData *mimeData = new QMimeData; - mimeData->setData(Constants::MIME_TYPE_BUNDLE_MATERIAL, {}); + QDataStream stream(&data, QIODevice::WriteOnly); + stream << m_bundleMaterialToDrag->type(); + mimeData->setData(Constants::MIME_TYPE_BUNDLE_MATERIAL, data); mimeData->removeFormat("text/plain"); - model->startDrag(mimeData, m_bundleMaterialToDrag->icon().toLocalFile()); emit bundleMaterialDragStarted(m_bundleMaterialToDrag); + model->startDrag(mimeData, m_bundleMaterialToDrag->icon().toLocalFile()); m_bundleMaterialToDrag = {}; } } + } else if (event->type() == QMouseEvent::MouseButtonRelease) { + m_materialToDrag = {}; + m_bundleMaterialToDrag = {}; } return QObject::eventFilter(obj, event); diff --git a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp index b07a5c9178..7bd8fab01c 100644 --- a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp +++ b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp @@ -36,6 +36,8 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i // -> Attractor3D // Material // -> Model + // BundleMaterial + // -> Model if (insertInfo.isQtQuick3DTexture()) { if (parentInfo.isQtQuick3DDefaultMaterial() || parentInfo.isQtQuick3DPrincipledMaterial()) { @@ -83,6 +85,9 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i } else if (insertInfo.isQtQuick3DMaterial()) { if (parentInfo.isQtQuick3DParticles3DModel()) propertyList.append("materials"); +// TODO merge conflict between Change-Id: If3c58f82797beabe76baf99ea2dddc59032729df and Change-Id: Iff2dea66e253b412105427134bd49cb16ed76193 +// } else if (insertInfo.typeName().startsWith("ComponentBundles.MaterialBundle")) { +// if (parentInfo.isSubclassOf("QtQuick3D.Model")) } } diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 0f4c058100..449405fc0c 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -443,6 +443,7 @@ QStringList NavigatorTreeModel::mimeTypes() const const static QStringList types({Constants::MIME_TYPE_MODELNODE_LIST, Constants::MIME_TYPE_ITEM_LIBRARY_INFO, Constants::MIME_TYPE_MATERIAL, + Constants::MIME_TYPE_BUNDLE_MATERIAL, Constants::MIME_TYPE_ASSETS}); return types; @@ -540,6 +541,10 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *mimeData, handleItemLibraryItemDrop(mimeData, rowNumber, dropModelIndex); } else if (mimeData->hasFormat(Constants::MIME_TYPE_MATERIAL)) { handleMaterialDrop(mimeData, rowNumber, dropModelIndex); + } else if (mimeData->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) { + ModelNode targetNode(modelNodeForIndex(dropModelIndex)); + if (targetNode.isValid()) + m_view->emitCustomNotification("drop_bundle_material", {targetNode}); // To MaterialBrowserView } else if (mimeData->hasFormat(Constants::MIME_TYPE_ASSETS)) { const QStringList assetsPaths = QString::fromUtf8(mimeData->data(Constants::MIME_TYPE_ASSETS)).split(','); NodeAbstractProperty targetProperty; diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index e59960f3c1..143ac28eb4 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -260,6 +260,14 @@ void NavigatorView::dragStarted(QMimeData *mimeData) m_widget->setDragType(matNode.metaInfo().typeName()); m_widget->update(); + } else if (mimeData->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) { + QByteArray data = mimeData->data(Constants::MIME_TYPE_BUNDLE_MATERIAL); + QDataStream stream(data); + TypeName bundleMatType; + stream >> bundleMatType; + + m_widget->setDragType(bundleMatType); + m_widget->update(); } } diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp index acc6744e2c..f0a27f5a98 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp @@ -335,7 +335,8 @@ void DynamicPropertyRow::commitValue(const QVariant &value) QByteArrayLiteral("DynamicPropertiesModel::commitValue")); try { QmlObjectNode objectNode = variantProperty.parentQmlObjectNode(); - if (view->currentState().isBaseState() && !objectNode.timelineIsActive()) { + if (view->currentState().isBaseState() + && !(objectNode.timelineIsActive() && objectNode.currentTimeline().isRecording())) { if (variantProperty.value() != value) variantProperty.setDynamicTypeNameAndValue(variantProperty.dynamicTypeName(), value); } else { diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp index 84e7b8284e..15b35a5adb 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp @@ -446,7 +446,7 @@ QmlDesigner::AbstractView *GradientModel::view() const void GradientModel::resetPuppet() { - QTimer::singleShot(1000, [this]() { view()->resetPuppet(); }); + QTimer::singleShot(1000, view(), &QmlDesigner::AbstractView::resetPuppet); } QmlDesigner::ModelNode GradientModel::createGradientNode() diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 6c41274a51..a8625ca784 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -704,7 +704,7 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &metaTyp QString qmlInnerTemplate = ""; qmlInnerTemplate += "Section {\n"; - qmlInnerTemplate += "caption: \""+ QObject::tr("User Added Properties") + "\"\n"; + qmlInnerTemplate += "caption: \"" + QObject::tr("Exposed Custom Properties") + "\"\n"; qmlInnerTemplate += anchorLeftRight; qmlInnerTemplate += "leftPadding: 0\n"; qmlInnerTemplate += "rightPadding: 0\n"; diff --git a/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp index 826161fc0a..158ca4af0f 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp @@ -95,6 +95,7 @@ void StatesEditorModel::reset() QAbstractListModel::endResetModel(); evaluateExtend(); + emit baseStateChanged(); } QVariant StatesEditorModel::data(const QModelIndex &index, int role) const diff --git a/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h index e453ef212a..8442917c54 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h +++ b/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h @@ -122,7 +122,6 @@ public slots: void removeState(int nodeId); private: - StatesEditorWidget *statesEditorWidget() const; void resetModel(); void resetPropertyChangesModels(); void resetExtend(); diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 35b7afa3c7..23df15e047 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -34,9 +34,8 @@ void DesignerSettings::insert(const QHash<QByteArray, QVariant> &settingsHash) QVariant DesignerSettings::value(const QByteArray &key, const QVariant &defaultValue) const { - Q_UNUSED(defaultValue) QMutexLocker locker(&m_mutex); - return m_cache.value(key); + return m_cache.value(key, defaultValue); } void DesignerSettings::restoreValue(QSettings *settings, const QByteArray &key, const QVariant &defaultValue) diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.cpp b/src/plugins/qmlprofiler/debugmessagesmodel.cpp index 6023400591..2beebbeb12 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.cpp +++ b/src/plugins/qmlprofiler/debugmessagesmodel.cpp @@ -11,7 +11,7 @@ namespace Internal { DebugMessagesModel::DebugMessagesModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, DebugMessage, MaximumRangeType, ProfileDebugMessages, parent), + QmlProfilerTimelineModel(manager, DebugMessage, UndefinedRangeType, ProfileDebugMessages, parent), m_maximumMsgType(-1) { } diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index 267e6c2d98..00c9cbb36a 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -17,7 +17,7 @@ namespace Internal { InputEventsModel::InputEventsModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileInputEvents, parent), + QmlProfilerTimelineModel(manager, Event, UndefinedRangeType, ProfileInputEvents, parent), m_keyTypeId(-1), m_mouseTypeId(-1) { } @@ -128,6 +128,8 @@ int InputEventsModel::collapsedRow(int index) const void InputEventsModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { + if (type.detailType() >= MaximumInputEventType) + return; m_data.insert(insert(event.timestamp(), 0, type.detailType()), Item(static_cast<InputEventType>(event.number<qint32>(0)), event.number<qint32>(1), event.number<qint32>(2))); diff --git a/src/plugins/qmlprofiler/inputeventsmodel.h b/src/plugins/qmlprofiler/inputeventsmodel.h index 5a6342a205..2257c44d80 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.h +++ b/src/plugins/qmlprofiler/inputeventsmodel.h @@ -14,7 +14,7 @@ class InputEventsModel : public QmlProfilerTimelineModel public: struct Item { - Item(InputEventType type = MaximumInputEventType, int a = 0, int b = 0); + Item(InputEventType type = UndefinedInputEventType, int a = 0, int b = 0); InputEventType type; int a; int b; diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index a713626c5d..8beb399e74 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -13,7 +13,7 @@ namespace Internal { MemoryUsageModel::MemoryUsageModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, MemoryAllocation, MaximumRangeType, ProfileMemory, parent) + QmlProfilerTimelineModel(manager, MemoryAllocation, UndefinedRangeType, ProfileMemory, parent) { // Register additional features. The base class already registers the main feature. // Don't register initializer, finalizer, or clearer as the base class has done so already. @@ -121,7 +121,7 @@ QVariantMap MemoryUsageModel::details(int index) const void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { if (type.message() != MemoryAllocation) { - if (type.rangeType() != MaximumRangeType) { + if (type.rangeType() != UndefinedRangeType) { m_continuation = ContinueNothing; if (event.rangeStage() == RangeStart) m_rangeStack.push(RangeStackFrame(event.typeIndex(), event.timestamp())); diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index 532ec9b299..24ecf32f28 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -13,7 +13,7 @@ namespace Internal { PixmapCacheModel::PixmapCacheModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, PixmapCacheEvent, MaximumRangeType, ProfilePixmapCache, + QmlProfilerTimelineModel(manager, PixmapCacheEvent, UndefinedRangeType, ProfilePixmapCache, parent) { } diff --git a/src/plugins/qmlprofiler/qmleventtype.cpp b/src/plugins/qmlprofiler/qmleventtype.cpp index 25547dd8fa..535f240efb 100644 --- a/src/plugins/qmlprofiler/qmleventtype.cpp +++ b/src/plugins/qmlprofiler/qmleventtype.cpp @@ -17,7 +17,7 @@ static ProfileFeature qmlFeatureFromType(Message message, RangeType rangeType, i case AnimationFrame: return ProfileAnimations; default: - return MaximumProfileFeature; + return UndefinedProfileFeature; } } case PixmapCacheEvent: @@ -29,7 +29,11 @@ static ProfileFeature qmlFeatureFromType(Message message, RangeType rangeType, i case DebugMessage: return ProfileDebugMessages; case Quick3DEvent: - return ProfileQuick3D; + // Check if it's actually Quick3DEvent since old traces used MaximumMessage + // (whose value is now Quick3DEvent value) as undefined value + if (rangeType == UndefinedRangeType) + return ProfileQuick3D; + return featureFromRangeType(rangeType); default: return featureFromRangeType(rangeType); } @@ -46,6 +50,9 @@ QDataStream &operator>>(QDataStream &stream, QmlEventType &type) type.m_message = static_cast<Message>(message); type.m_rangeType = static_cast<RangeType>(rangeType); type.setFeature(qmlFeatureFromType(type.m_message, type.m_rangeType, type.m_detailType)); + // Update message if qmlFeatureFromType determined it is not Quick3D event + if (type.m_message == Quick3DEvent && type.feature() != ProfileQuick3D) + type.m_message = UndefinedMessage; return stream; } diff --git a/src/plugins/qmlprofiler/qmleventtype.h b/src/plugins/qmlprofiler/qmleventtype.h index e2d91c14f3..74aa91ba25 100644 --- a/src/plugins/qmlprofiler/qmleventtype.h +++ b/src/plugins/qmlprofiler/qmleventtype.h @@ -17,7 +17,7 @@ class QmlEventType : public Timeline::TraceEventType { public: static const qint32 staticClassId = 0x716d6c74; // 'qmlt'; - QmlEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType, + QmlEventType(Message message = UndefinedMessage, RangeType rangeType = UndefinedRangeType, int detailType = -1, const QmlEventLocation &location = QmlEventLocation(), const QString &data = QString(), const QString &displayName = QString()); diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index 8c43af70cd..f6bd6701e5 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -21,7 +21,7 @@ namespace Internal { QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileAnimations, parent) + QmlProfilerTimelineModel(manager, Event, UndefinedRangeType, ProfileAnimations, parent) { m_minNextStartTimes[0] = m_minNextStartTimes[1] = 0; } diff --git a/src/plugins/qmlprofiler/qmlprofilereventtypes.h b/src/plugins/qmlprofiler/qmlprofilereventtypes.h index db19aaf05d..8ad7e2ab27 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventtypes.h +++ b/src/plugins/qmlprofiler/qmlprofilereventtypes.h @@ -8,7 +8,8 @@ namespace QmlProfiler { enum Message { - Event, + UndefinedMessage = 0xff, + Event = 0, RangeStart, RangeData, RangeLocation, @@ -24,7 +25,8 @@ enum Message { }; enum EventType { - FramePaint, // unused + UndefinedEventType = 0xff, + FramePaint = 0, // unused Mouse, Key, AnimationFrame, // new Qt5 paint events @@ -35,7 +37,8 @@ enum EventType { }; enum Quick3DEventType { - Quick3DRenderFrame, + UndefinedQuick3DEventType = 0xff, + Quick3DRenderFrame = 0, Quick3DSynchronizeFrame, Quick3DPrepareFrame, Quick3DMeshLoad, @@ -50,7 +53,8 @@ enum Quick3DEventType { }; enum RangeType { - Painting, // old Qt4 paint events + UndefinedRangeType = 0xff, + Painting = 0, // old Qt4 paint events Compiling, Creating, Binding, @@ -61,7 +65,8 @@ enum RangeType { }; enum BindingType { - QmlBinding, + UndefinedBindingType = 0xff, + QmlBinding = 0, V8Binding, OptimizedBinding, QPainterEvent, @@ -70,7 +75,8 @@ enum BindingType { }; enum PixmapEventType { - PixmapSizeKnown, + UndefinedPixmapEventType = 0xff, + PixmapSizeKnown = 0, PixmapReferenceCountChanged, PixmapCacheCountChanged, PixmapLoadingStarted, @@ -81,7 +87,8 @@ enum PixmapEventType { }; enum InputEventType { - InputKeyPress, + UndefinedInputEventType = 0xff, + InputKeyPress = 0, InputKeyRelease, InputKeyUnknown, @@ -96,7 +103,8 @@ enum InputEventType { }; enum SceneGraphFrameType { - SceneGraphRendererFrame, // Render Thread + UndefinedSceheGraphFrameType = 0xff, + SceneGraphRendererFrame = 0, // Render Thread SceneGraphAdaptationLayerFrame, // Render Thread SceneGraphContextFrame, // Render Thread SceneGraphRenderLoopFrame, // Render Thread @@ -111,7 +119,8 @@ enum SceneGraphFrameType { }; enum MemoryType { - HeapPage, + UndefinedMemoryType = 0xff, + HeapPage = 0, LargeItem, SmallItem, @@ -119,14 +128,16 @@ enum MemoryType { }; enum AnimationThread { - GuiThread, + UndefinedAnimationThread = 0xff, + GuiThread = 0, RenderThread, MaximumAnimationThread }; enum ProfileFeature { - ProfileJavaScript, + UndefinedProfileFeature = 0xff, + ProfileJavaScript = 0, ProfileMemory, ProfilePixmapCache, ProfileSceneGraph, @@ -159,7 +170,7 @@ inline ProfileFeature featureFromRangeType(RangeType range) case Javascript: return ProfileJavaScript; default: - return MaximumProfileFeature; + return UndefinedProfileFeature; } } diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index 695685a066..90619b6125 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -377,7 +377,7 @@ QmlProfilerModelManager::rangeFilter(qint64 rangeStart, qint64 rangeEnd) const // Double-check if rangeStart has been crossed. Some versions of Qt send dirty data. qint64 adjustedTimestamp = event.timestamp(); if (event.timestamp() < rangeStart && !crossedRangeStart) { - if (type.rangeType() != MaximumRangeType) { + if (type.rangeType() != UndefinedRangeType) { if (event.rangeStage() == RangeStart) stack.push(event); else if (event.rangeStage() == RangeEnd && !stack.isEmpty()) @@ -398,7 +398,7 @@ QmlProfilerModelManager::rangeFilter(qint64 rangeStart, qint64 rangeEnd) const crossedRangeStart = true; } if (event.timestamp() > rangeEnd) { - if (type.rangeType() != MaximumRangeType) { + if (type.rangeType() != UndefinedRangeType) { if (event.rangeStage() == RangeEnd) { if (stack.isEmpty()) { QmlEvent endEvent(event); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index ff4dfb8a7a..98088b581a 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -23,7 +23,7 @@ namespace Internal { QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, MaximumMessage, range, featureFromRangeType(range), parent) + QmlProfilerTimelineModel(manager, UndefinedMessage, range, featureFromRangeType(range), parent) { m_expandedRowTypes << -1; } diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index d5de095f96..d6560533ba 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -148,7 +148,7 @@ void QmlProfilerTraceClientPrivate::processCurrentEvent() // all ranges are perfectly nested. This is why we can defer the type resolution until either // the range ends or a child range starts. With only the information in RangeStart we wouldn't // be able to uniquely identify the event type. - Message rangeStage = currentEvent.type.rangeType() == MaximumRangeType ? + Message rangeStage = currentEvent.type.rangeType() == UndefinedRangeType ? currentEvent.type.message() : currentEvent.event.rangeStage(); switch (rangeStage) { case RangeStart: @@ -311,7 +311,7 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features) d->currentEvent.event.setTimestamp(context.timestamp > 0 ? context.timestamp : 0); d->currentEvent.event.setTypeIndex(-1); d->currentEvent.event.setString(text); - d->currentEvent.type = QmlEventType(DebugMessage, MaximumRangeType, type, + d->currentEvent.type = QmlEventType(DebugMessage, UndefinedRangeType, type, QmlEventLocation(context.file, context.line, 1)); d->currentEvent.serverTypeId = 0; d->processCurrentEvent(); @@ -328,6 +328,8 @@ void QmlProfilerTraceClient::setFlushInterval(quint32 flushInterval) bool QmlProfilerTraceClientPrivate::updateFeatures(quint8 feature) { + if (feature == UndefinedProfileFeature) + return true; quint64 flag = 1ULL << feature; if (!(requestedFeatures & flag)) return false; diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index 629d692124..4b1e6badf8 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -59,7 +59,7 @@ Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == MaximumMessage * sizeof(const char *) static QPair<Message, RangeType> qmlTypeAsEnum(const QString &typeString) { - QPair<Message, RangeType> ret(MaximumMessage, MaximumRangeType); + QPair<Message, RangeType> ret(UndefinedMessage, UndefinedRangeType); for (int i = 0; i < MaximumMessage; ++i) { if (typeString == _(MESSAGE_STRINGS[i])) { @@ -75,7 +75,7 @@ static QPair<Message, RangeType> qmlTypeAsEnum(const QString &typeString) } } - if (ret.first == MaximumMessage && ret.second == MaximumRangeType) { + if (ret.first == UndefinedMessage && ret.second == UndefinedRangeType) { bool isNumber = false; int type = typeString.toUInt(&isNumber); if (isNumber && type < MaximumRangeType) @@ -288,7 +288,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream) int typeIndex = -1; - QPair<Message, RangeType> messageAndRange(MaximumMessage, MaximumRangeType); + QPair<Message, RangeType> messageAndRange(UndefinedMessage, UndefinedRangeType); int detailType = -1; QString displayName; QString data; @@ -296,7 +296,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream) int line = 0, column = 0; auto clearType = [&](){ - messageAndRange = QPair<Message, RangeType>(MaximumMessage, MaximumRangeType); + messageAndRange = QPair<Message, RangeType>(UndefinedMessage, UndefinedRangeType); detailType = -1; displayName.clear(); data.clear(); @@ -368,7 +368,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream) // confusing), even though they clearly aren't ranges. Convert that to something // sane here. if (detailType == 4) { - messageAndRange = QPair<Message, RangeType>(Event, MaximumRangeType); + messageAndRange = QPair<Message, RangeType>(Event, UndefinedRangeType); detailType = AnimationFrame; } } @@ -674,13 +674,13 @@ void QmlProfilerTraceFile::saveQtd(QIODevice *device) QStack<QmlEvent> stack; qint64 lastProgressTimestamp = traceStart(); modelManager()->replayQmlEvents([&](const QmlEvent &event, const QmlEventType &type) { - if (type.rangeType() != MaximumRangeType && event.rangeStage() == RangeStart) { + if (type.rangeType() != UndefinedRangeType && event.rangeStage() == RangeStart) { stack.push(event); return; } stream.writeStartElement(_("range")); - if (type.rangeType() != MaximumRangeType && event.rangeStage() == RangeEnd) { + if (type.rangeType() != UndefinedRangeType && event.rangeStage() == RangeEnd) { QmlEvent start = stack.pop(); stream.writeAttribute(_("startTime"), QString::number(start.timestamp())); stream.writeAttribute(_("duration"), diff --git a/src/plugins/qmlprofiler/qmltypedevent.cpp b/src/plugins/qmlprofiler/qmltypedevent.cpp index 0b2a184d48..88e7b5d64c 100644 --- a/src/plugins/qmlprofiler/qmltypedevent.cpp +++ b/src/plugins/qmlprofiler/qmltypedevent.cpp @@ -14,10 +14,10 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) stream >> time >> messageType; - if (messageType < 0 || messageType > MaximumMessage) - messageType = MaximumMessage; + if (messageType < 0 || messageType >= MaximumMessage) + messageType = UndefinedMessage; - RangeType rangeType = MaximumRangeType; + RangeType rangeType = UndefinedRangeType; if (!stream.atEnd()) { stream >> subtype; if (subtype >= 0 && subtype < MaximumRangeType) @@ -32,7 +32,9 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) switch (messageType) { case Event: { - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype); + if (subtype >= MaximumEventType) + subtype = UndefinedEventType; + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype); switch (subtype) { case StartTrace: case EndTrace: { @@ -76,7 +78,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) break; } case Complete: { - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype); break; } case SceneGraphFrame: { @@ -88,7 +90,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) params.push_back(param); } - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype); event.event.setNumbers<QVarLengthArray<qint64>, qint64>(params); break; } @@ -103,7 +105,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) refcount = 1; } - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype, + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype, QmlEventLocation(filename, 0, 0)); event.event.setNumbers<qint32>({width, height, refcount}); break; @@ -112,7 +114,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) qint64 delta; stream >> delta; - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype); event.event.setNumbers<qint64>({delta}); break; } @@ -125,7 +127,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) // otherwise it's the old binding type of 4 bytes } - event.type = QmlEventType(MaximumMessage, rangeType, -1); + event.type = QmlEventType(UndefinedMessage, rangeType, -1); event.event.setRangeStage(RangeStart); break; } @@ -133,7 +135,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) QString data; stream >> data; - event.type = QmlEventType(MaximumMessage, rangeType, -1, QmlEventLocation(), data); + event.type = QmlEventType(UndefinedMessage, rangeType, -1, QmlEventLocation(), data); event.event.setRangeStage(RangeData); if (!stream.atEnd()) stream >> event.serverTypeId; @@ -151,13 +153,13 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) stream >> event.serverTypeId; } - event.type = QmlEventType(MaximumMessage, rangeType, -1, + event.type = QmlEventType(UndefinedMessage, rangeType, -1, QmlEventLocation(filename, line, column)); event.event.setRangeStage(RangeLocation); break; } case RangeEnd: { - event.type = QmlEventType(MaximumMessage, rangeType, -1); + event.type = QmlEventType(UndefinedMessage, rangeType, -1); event.event.setRangeStage(RangeEnd); break; } @@ -170,13 +172,13 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) stream >> param; params.push_back(param); } - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype); event.event.setNumbers<QVarLengthArray<qint64>, qint64>(params); break; } default: event.event.setNumbers<char>({}); - event.type = QmlEventType(static_cast<Message>(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast<Message>(messageType), UndefinedRangeType, subtype); break; } diff --git a/src/plugins/qmlprofiler/quick3dmodel.cpp b/src/plugins/qmlprofiler/quick3dmodel.cpp index 48f6409fe1..110140d7de 100644 --- a/src/plugins/qmlprofiler/quick3dmodel.cpp +++ b/src/plugins/qmlprofiler/quick3dmodel.cpp @@ -12,7 +12,7 @@ namespace Internal { Quick3DModel::Quick3DModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, Quick3DEvent, MaximumRangeType, ProfileQuick3D, parent), + QmlProfilerTimelineModel(manager, Quick3DEvent, UndefinedRangeType, ProfileQuick3D, parent), m_maximumMsgType(-1) { } @@ -135,7 +135,9 @@ int Quick3DModel::collapsedRow(int index) const void Quick3DModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { - auto detailType = type.detailType(); + int detailType = type.detailType(); + if (detailType >= MaximumQuick3DFrameType) + return; qint64 eventDuration = event.number<qint64>(0); qint64 eventTime = event.timestamp() - eventDuration; QVector<quint64> numbers = event.numbers<QVector<quint64>>(); diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp index d6ddc9ed5c..af43e03e6f 100644 --- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp +++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp @@ -56,7 +56,7 @@ Q_STATIC_ASSERT(sizeof(StageLabels) == SceneGraphTimelineModel::SceneGraphTimelineModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, SceneGraphFrame, MaximumRangeType, ProfileSceneGraph, parent) + QmlProfilerTimelineModel(manager, SceneGraphFrame, UndefinedRangeType, ProfileSceneGraph, parent) { } diff --git a/src/plugins/qmlprofiler/tests/check.dat b/src/plugins/qmlprofiler/tests/check.dat Binary files differindex 7431903a1e..3895dfc182 100644 --- a/src/plugins/qmlprofiler/tests/check.dat +++ b/src/plugins/qmlprofiler/tests/check.dat diff --git a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp index 12effcf12f..72e06f728b 100644 --- a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp @@ -24,7 +24,7 @@ void DebugMessagesModelTest::initTestCase() QmlEvent event; event.setTimestamp(i); event.setString(QString::fromLatin1("message %1").arg(i)); - QmlEventType type(DebugMessage, MaximumRangeType, i % (QtMsgType::QtInfoMsg + 1), + QmlEventType type(DebugMessage, UndefinedRangeType, i % (QtMsgType::QtInfoMsg + 1), QmlEventLocation("somefile.js", i, 10 - i)); event.setTypeIndex(manager.numEventTypes()); manager.appendEventType(std::move(type)); diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp index 4fa4d14562..3547647ab0 100644 --- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp @@ -34,7 +34,7 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager, QmlEvent event; if (i < 5) { typeIndex = manager->appendEventType( - QmlEventType(MaximumMessage, + QmlEventType(UndefinedMessage, static_cast<RangeType>(static_cast<int>(Javascript) - i), -1, QmlEventLocation("somefile.js", i, 20 - i), QString("funcfunc"))); diff --git a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp index 76771f3722..0144616bab 100644 --- a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp @@ -20,8 +20,8 @@ static InputEventType inputType(int i) InputEventsModelTest::InputEventsModelTest(QObject *parent) : QObject(parent), model(&manager, &aggregator) { - keyTypeId = manager.appendEventType(QmlEventType(Event, MaximumRangeType, Key)); - mouseTypeId = manager.appendEventType(QmlEventType(Event, MaximumRangeType, Mouse)); + keyTypeId = manager.appendEventType(QmlEventType(Event, UndefinedRangeType, Key)); + mouseTypeId = manager.appendEventType(QmlEventType(Event, UndefinedRangeType, Mouse)); } void InputEventsModelTest::initTestCase() diff --git a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp index ff24db3c70..3e4c3213b9 100644 --- a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp @@ -20,11 +20,11 @@ void MemoryUsageModelTest::initTestCase() heapPageTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, HeapPage)); + manager.appendEventType(QmlEventType(MemoryAllocation, UndefinedRangeType, HeapPage)); smallItemTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, SmallItem)); + manager.appendEventType(QmlEventType(MemoryAllocation, UndefinedRangeType, SmallItem)); largeItemTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, LargeItem)); + manager.appendEventType(QmlEventType(MemoryAllocation, UndefinedRangeType, LargeItem)); auto addMemoryEvents = [&]() { QmlEvent event; @@ -53,7 +53,7 @@ void MemoryUsageModelTest::initTestCase() addMemoryEvents(); rangeTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MaximumMessage, Javascript, -1, + manager.appendEventType(QmlEventType(UndefinedMessage, Javascript, -1, QmlEventLocation(QString("somefile.js"), 10, 20), QString("funcfunc"))); diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp index c7262e1876..0f021d2ac5 100644 --- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp @@ -22,7 +22,7 @@ void PixmapCacheModelTest::initTestCase() for (int i = 0; i < MaximumPixmapEventType; ++i) { eventTypeIndices[i] = manager.numEventTypes(); - manager.appendEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i, + manager.appendEventType(QmlEventType(PixmapCacheEvent, UndefinedRangeType, i, QmlEventLocation("dings.png", 0, 0))); } @@ -37,7 +37,7 @@ void PixmapCacheModelTest::initTestCase() for (int i = 0; i < MaximumPixmapEventType; ++i) { eventTypeIndices[i + MaximumPixmapEventType] = manager.numEventTypes(); - manager.appendEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i, + manager.appendEventType(QmlEventType(PixmapCacheEvent, UndefinedRangeType, i, QmlEventLocation("blah.png", 0, 0))); } diff --git a/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp b/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp index 3c70fe4d8e..f8a1a8b8d6 100644 --- a/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp @@ -15,13 +15,13 @@ QmlEventTypeTest::QmlEventTypeTest(QObject *parent) : QObject(parent) void QmlEventTypeTest::testAccessors() { QmlEventType type; - QCOMPARE(type.message(), MaximumMessage); - QCOMPARE(type.rangeType(), MaximumRangeType); + QCOMPARE(type.message(), UndefinedMessage); + QCOMPARE(type.rangeType(), UndefinedMessage); QCOMPARE(type.detailType(), -1); QVERIFY(!type.location().isValid()); QVERIFY(type.data().isEmpty()); QVERIFY(type.displayName().isEmpty()); - QCOMPARE(static_cast<ProfileFeature>(type.feature()), MaximumProfileFeature); + QCOMPARE(static_cast<ProfileFeature>(type.feature()), UndefinedProfileFeature); type.setLocation(QmlEventLocation("blah.js", 12, 13)); QCOMPARE(type.location().filename(), QString("blah.js")); @@ -34,9 +34,9 @@ void QmlEventTypeTest::testAccessors() type.setDisplayName("disdis"); QCOMPARE(type.displayName(), QString("disdis")); - QmlEventType type2(MaximumMessage, Javascript, 12, QmlEventLocation("lala.js", 2, 3), "nehhh", + QmlEventType type2(UndefinedMessage, Javascript, 12, QmlEventLocation("lala.js", 2, 3), "nehhh", "brbr"); - QCOMPARE(type2.message(), MaximumMessage); + QCOMPARE(type2.message(), UndefinedMessage); QCOMPARE(type2.rangeType(), Javascript); QCOMPARE(type2.detailType(), 12); QCOMPARE(type2.location(), QmlEventLocation("lala.js", 2, 3)); @@ -49,23 +49,23 @@ void QmlEventTypeTest::testFeature() { const quint8 features[][MaximumEventType] = { // Event - {MaximumProfileFeature, ProfileInputEvents, ProfileInputEvents, - ProfileAnimations, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, ProfileInputEvents, ProfileInputEvents, + ProfileAnimations, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeStart - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeData - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeLocation - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeEnd - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // Complete - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // PixmapCacheEvent {ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache}, @@ -85,13 +85,13 @@ void QmlEventTypeTest::testFeature() for (int i = 0; i < MaximumMessage; ++i) { for (int j = 0; j < MaximumEventType; ++j) { - QmlEventType type(static_cast<Message>(i), MaximumRangeType, j); + QmlEventType type(static_cast<Message>(i), UndefinedRangeType, j); QCOMPARE(type.feature(), features[i][j]); } } for (int i = 0; i < MaximumRangeType; ++i) { - QmlEventType type(MaximumMessage, static_cast<RangeType>(i)); + QmlEventType type(UndefinedMessage, static_cast<RangeType>(i)); QCOMPARE(static_cast<ProfileFeature>(type.feature()), featureFromRangeType(static_cast<RangeType>(i))); } @@ -99,7 +99,7 @@ void QmlEventTypeTest::testFeature() void QmlEventTypeTest::testStreamOps() { - QmlEventType type(MaximumMessage, Javascript, -1, QmlEventLocation("socken.js", 12, 13), + QmlEventType type(UndefinedMessage, Javascript, -1, QmlEventLocation("socken.js", 12, 13), "lalala", "lelele"); QBuffer wbuffer; diff --git a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp index 9d3d8f7b43..a752107269 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp @@ -25,7 +25,7 @@ void QmlProfilerAnimationsModelTest::initTestCase() QmlEvent event; event.setTypeIndex(manager.appendEventType( - QmlEventType(Event, MaximumRangeType, AnimationFrame))); + QmlEventType(Event, UndefinedRangeType, AnimationFrame))); for (int i = 0; i < 10; ++i) { event.setTimestamp(i); diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp index 84416c7b91..4067dd8a76 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp @@ -27,7 +27,7 @@ DummyModel::DummyModel(QmlProfilerModelManager *manager, void DummyModel::loadData() { - QmlEventType type(MaximumMessage, Binding); + QmlEventType type(UndefinedMessage, Binding); const int typeIndex = modelManager()->appendEventType(QmlEventType(type)); QCOMPARE(typeIndex, 0); diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp index 8780708156..b57db7bcfa 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp @@ -57,9 +57,13 @@ void QmlProfilerTraceClientTest::testMessageReceived() modelManager.replayQmlEvents([&](const QmlEvent &event, const QmlEventType &type) { qint64 timestamp; - qint32 message; - qint32 rangeType; + quint8 message; + quint8 rangeType; checkStream >> timestamp >> message >> rangeType; + QVERIFY(message != MaximumMessage); + QVERIFY(rangeType != MaximumRangeType); + QVERIFY(type.message() != MaximumMessage); + QVERIFY(type.rangeType() != MaximumRangeType); QCOMPARE(event.timestamp(), timestamp); QCOMPARE(type.message(), static_cast<Message>(message)); QCOMPARE(type.rangeType(), static_cast<RangeType>(rangeType)); diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 021f0b9cce..5aef0531dc 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -120,7 +120,8 @@ void UpdateInfoPlugin::doAutoCheckForUpdates() void UpdateInfoPlugin::startCheckForUpdates() { - stopCheckForUpdates(); + if (d->m_maintenanceToolProcess) + return; // do not trigger while update task is already running QFutureInterface<void> futureIf; FutureProgress *futureProgress |