QmlDesigner: Categorize application output for Connection Editor

Task-number: QDS-13244
Change-Id: I54ed1485a9b5781e4c16f121521d6462cfecd1d0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Ali Kianian
2024-07-19 12:13:37 +03:00
parent d4d6d13098
commit 0da625b616
7 changed files with 32 additions and 23 deletions

View File

@@ -6,6 +6,7 @@
#include "backendmodel.h"
#include "bindingproperty.h"
#include "connectioneditorutils.h"
#include "connectionview.h"
#include "exception.h"
#include "nodemetainfo.h"
@@ -203,7 +204,7 @@ void BackendModel::addNewBackend()
if (dialog.applied()) {
QStringList importSplit = dialog.importString().split(" ");
if (importSplit.size() != 2) {
qWarning() << Q_FUNC_INFO << "invalid import" << importSplit;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid import" << importSplit;
QTC_ASSERT(false, return);
}
@@ -278,7 +279,7 @@ void BackendModel::updatePropertyName(int rowNumber)
rootModelNode.removeProperty(oldName);
rootModelNode.bindingProperty(newName).setDynamicTypeNameAndExpression(typeName, expression);
} else {
qWarning() << Q_FUNC_INFO << oldName << newName << "failed...";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << oldName << newName << "failed...";
QTC_ASSERT(false, return);
}
});
@@ -290,7 +291,7 @@ void BackendModel::handleDataChanged(const QModelIndex &topLeft, const QModelInd
return;
if (topLeft != bottomRight) {
qWarning() << "BackendModel::handleDataChanged multi edit?";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "multi edit?";
return;
}
@@ -307,7 +308,8 @@ void BackendModel::handleDataChanged(const QModelIndex &topLeft, const QModelInd
updatePropertyName(currentRow);
} break;
default: qWarning() << "BindingModel::handleDataChanged column" << currentColumn;
default:
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "column" << currentColumn;
}
m_lock = false;

View File

@@ -89,7 +89,7 @@ void BindingModel::add()
}
}
} else {
qWarning() << __FUNCTION__ << " Requires exactly one selected node";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "Requires exactly one selected node";
}
}

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "connectioneditorevaluator.h"
#include "connectioneditorutils.h"
#include "qmljs/parser/qmljsast_p.h"
#include "qmljs/qmljsdocument.h"
@@ -254,7 +255,7 @@ protected:
void throwRecursionDepthError() override
{
checkValidityAndReturn(false, "Recursion depth problem");
qDebug() << Q_FUNC_INFO << this;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "Recursion depth error";
}
void checkAndResetVariable()
@@ -477,7 +478,7 @@ protected:
void throwRecursionDepthError() override
{
setFailed();
qDebug() << Q_FUNC_INFO << this;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "Recursion depth error";
}
void checkAndResetCal()
@@ -617,7 +618,7 @@ protected:
void throwRecursionDepthError() override
{
m_failed = true;
qDebug() << Q_FUNC_INFO << this;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "Recursion depth error";
}
private:
@@ -1082,7 +1083,7 @@ void ConnectionEditorEvaluator::endVisit(QmlJS::AST::StatementList * /*statement
void ConnectionEditorEvaluator::throwRecursionDepthError()
{
d->checkValidityAndReturn(false, "Recursion depth problem");
qDebug() << Q_FUNC_INFO << this;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "Recursion depth error";
}
bool ConnectionEditorEvaluatorPrivate::checkValidityAndReturn(bool valid, const QString &parseError)
@@ -1091,7 +1092,7 @@ bool ConnectionEditorEvaluatorPrivate::checkValidityAndReturn(bool valid, const
if (m_checkStatus != Status::Failed) {
setStatus(Status::Failed);
m_errorString = parseError;
qDebug() << Q_FUNC_INFO << "Error: " << parseError;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "Parse error" << parseError;
}
}

View File

@@ -24,6 +24,8 @@
namespace QmlDesigner {
Q_LOGGING_CATEGORY(ConnectionEditorLog, "qtc.qtquickdesigner.connectioneditor", QtWarningMsg)
void callLater(const std::function<void()> &fun)
{
QTimer::singleShot(0, fun);
@@ -78,7 +80,7 @@ NodeMetaInfo dynamicTypeNameToNodeMetaInfo(const TypeName &typeName, Model *mode
else if (typeName == "var" || typeName == "variant")
return model->metaInfo("QML.variant");
else
qWarning() << __FUNCTION__ << " type " << typeName << "not found";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "type" << typeName << "not found";
return {};
}
@@ -330,7 +332,7 @@ QStringList availableTargetProperties(const BindingProperty &bindingProperty)
{
const ModelNode modelNode = bindingProperty.parentModelNode();
if (!modelNode.isValid()) {
qWarning() << __FUNCTION__ << " invalid model node";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid model node";
return {};
}
@@ -372,7 +374,7 @@ QStringList availableSourceProperties(const QString &id,
} else if (auto metaInfo = targetProperty.parentModelNode().metaInfo(); metaInfo.isValid()) {
targetType = metaInfo.property(targetProperty.name()).propertyType();
} else
qWarning() << __FUNCTION__ << " no meta info for target node";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "no meta info for target node";
QStringList possibleProperties;
if (!modelNode.isValid()) {
@@ -384,7 +386,7 @@ QStringList availableSourceProperties(const QString &id,
}
return possibleProperties;
}
qWarning() << __FUNCTION__ << " invalid model node: " << id;
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid model node:" << id;
return {};
}
@@ -410,7 +412,7 @@ QStringList availableSourceProperties(const QString &id,
possibleProperties.push_back(QString::fromUtf8(property.name()));
}
} else {
qWarning() << __FUNCTION__ << " no meta info for source node";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "no meta info for source node";
}
return possibleProperties;

View File

@@ -7,11 +7,14 @@
#include "propertymetainfo.h"
#include <QList>
#include <QLoggingCategory>
#include <QString>
#include <QVariant>
namespace QmlDesigner {
Q_DECLARE_LOGGING_CATEGORY(ConnectionEditorLog)
class AbstractView;
class AbstractProperty;
class BindingProperty;

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "connectionmodel.h"
#include "connectioneditorutils.h"
#include "connectionview.h"
#include "utils/algorithm.h"
@@ -201,7 +202,7 @@ void ConnectionModel::updateSignalName(int rowNumber)
SignalHandlerProperty newSignalHandlerProperty = connectionNode.signalHandlerProperty(newName);
updateCustomData(idItem, newSignalHandlerProperty);
} else {
qWarning() << "BindingModel::updatePropertyName invalid property name";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid property name";
}
}
@@ -251,7 +252,7 @@ void ConnectionModel::updateTargetNode(int rowNumber)
});
} else {
qWarning() << "BindingModel::updatePropertyName invalid target id";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid target id";
}
}
@@ -532,7 +533,7 @@ ConnectionModelBackendDelegate *ConnectionModel::delegate()
void ConnectionModel::handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
if (topLeft != bottomRight) {
qWarning() << "ConnectionModel::handleDataChanged multi edit?";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "multi edit?";
return;
}
@@ -551,8 +552,8 @@ void ConnectionModel::handleDataChanged(const QModelIndex &topLeft, const QModel
case SourceRow: {
updateSource(currentRow);
} break;
default: qWarning() << "ConnectionModel::handleDataChanged column" << currentColumn;
default:
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "column" << currentColumn;
}
m_lock = false;
@@ -1694,9 +1695,9 @@ QVariant ConditionListModel::data(const QModelIndex &index, int role) const
return m_tokens.at(index.row()).value;
}
qWarning() << Q_FUNC_INFO << "invalid role";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid role";
} else {
qWarning() << Q_FUNC_INFO << "invalid index";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "invalid index";
}
return QVariant();

View File

@@ -68,7 +68,7 @@ void DynamicPropertiesModel::add()
showErrorMessage(e.description());
}
} else {
qWarning() << "DynamicPropertiesModel::add not one node selected";
qCWarning(ConnectionEditorLog) << __FUNCTION__ << "not one node selected";
}
}