forked from qt-creator/qt-creator
QmlDesigner: Implement ProjectStorageErrorNotifier
* This patch adds forwarding of the errors of the ProjectStorage to our UI. We create build issues that will be forwarded to our output pane. * This required breaking dependecies annd moving ProjectStorageErrorNotifier out of DesignerCore. * Moved QmlDesignerProjectManager and ProjectStorageErrorNotifier to project folder to avoid polution of main folder. * Adjusting includes and export macros. Task-number: QDS-14880 Change-Id: Id8628e274086a9cb63ac8fcd416e4b0d508b10eb Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
2bb235da40
commit
3ca60700ce
@@ -104,7 +104,6 @@ add_qtc_plugin(QmlDesigner
|
||||
qmldesignericons.h
|
||||
qmldesignerplugin.cpp qmldesignerplugin.h
|
||||
qmldesignerexternaldependencies.cpp qmldesignerexternaldependencies.h
|
||||
qmldesignerprojectmanager.cpp qmldesignerprojectmanager.h
|
||||
settingspage.cpp settingspage.h
|
||||
shortcutmanager.cpp shortcutmanager.h
|
||||
designermcumanager.cpp designermcumanager.h
|
||||
@@ -133,6 +132,16 @@ if (QTC_STATIC_BUILD AND TARGET QmlDesigner)
|
||||
extend_qtc_target(QmlDesigner PUBLIC_DEPENDS TextEditor)
|
||||
endif()
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
PUBLIC_INCLUDES project
|
||||
SOURCES_PREFIX project
|
||||
SOURCES
|
||||
qmldesignerprojectmanager.cpp
|
||||
qmldesignerprojectmanager.h
|
||||
projectstorageerrornotifier.cpp
|
||||
projectstorageerrornotifier.h
|
||||
)
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
PUBLIC_INCLUDES instances
|
||||
SOURCES_PREFIX instances
|
||||
|
@@ -399,7 +399,6 @@ extend_qtc_library(QmlDesignerCore
|
||||
projectstorageupdater.cpp projectstorageupdater.h
|
||||
projectstorage.cpp projectstorage.h
|
||||
projectstorageerrornotifierinterface.h
|
||||
projectstorageerrornotifier.cpp projectstorageerrornotifier.h
|
||||
typeannotationreader.cpp typeannotationreader.h
|
||||
qmldocumentparserinterface.h
|
||||
qmltypesparserinterface.h
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "commontypecache.h"
|
||||
#include "projectstorageerrornotifier.h"
|
||||
#include "projectstorageerrornotifierinterface.h"
|
||||
#include "projectstorageexceptions.h"
|
||||
#include "projectstorageinterface.h"
|
||||
#include "projectstoragetypes.h"
|
||||
|
@@ -1,43 +0,0 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "projectstorageerrornotifier.h"
|
||||
|
||||
#include "sourcepathstorage/sourcepathcache.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
void ProjectStorageErrorNotifier::typeNameCannotBeResolved(Utils::SmallStringView typeName,
|
||||
SourceId sourceId)
|
||||
{
|
||||
qDebug() << "Missing type name: " << typeName
|
||||
<< " in file: " << m_pathCache.sourcePath(sourceId).toStringView();
|
||||
}
|
||||
|
||||
void ProjectStorageErrorNotifier::missingDefaultProperty(Utils::SmallStringView typeName,
|
||||
Utils::SmallStringView propertyName,
|
||||
SourceId sourceId)
|
||||
|
||||
{
|
||||
qDebug() << "Missing default property: " << propertyName << " in type: " << typeName
|
||||
<< " in file: " << m_pathCache.sourcePath(sourceId).toStringView();
|
||||
}
|
||||
|
||||
void ProjectStorageErrorNotifier::propertyNameDoesNotExists(Utils::SmallStringView propertyName,
|
||||
SourceId sourceId)
|
||||
{
|
||||
qDebug() << "Missing property: " << propertyName
|
||||
<< " in file: " << m_pathCache.sourcePath(sourceId).toStringView();
|
||||
}
|
||||
|
||||
void ProjectStorageErrorNotifier::qmlDocumentDoesNotExistsForQmldirEntry(Utils::SmallStringView typeName,
|
||||
Storage::Version,
|
||||
SourceId qmlDocumentSourceId,
|
||||
SourceId qmldirSourceId)
|
||||
{
|
||||
qDebug() << "Not existing Qml Document "
|
||||
<< m_pathCache.sourcePath(qmlDocumentSourceId).toStringView() << " for type "
|
||||
<< typeName << " in file: " << m_pathCache.sourcePath(qmldirSourceId).toStringView();
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "filestatus.h"
|
||||
#include "projectstorageerrornotifier.h"
|
||||
#include "projectstorageerrornotifierinterface.h"
|
||||
#include "projectstorageids.h"
|
||||
#include "projectstoragepathwatchernotifierinterface.h"
|
||||
#include "projectstoragepathwatchertypes.h"
|
||||
|
@@ -0,0 +1,74 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "projectstorageerrornotifier.h"
|
||||
|
||||
#include <qmldesigner/qmldesignertr.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
#include <sourcepathstorage/sourcepathcache.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
namespace {
|
||||
|
||||
void logIssue(ProjectExplorer::Task::TaskType type, const QString &message, const SourcePath &sourcePath)
|
||||
{
|
||||
const Utils::Id category = ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM;
|
||||
|
||||
Utils::FilePath filePath = Utils::FilePath::fromUserInput(sourcePath.toQString());
|
||||
ProjectExplorer::Task task(type, message, filePath, -1, category);
|
||||
ProjectExplorer::TaskHub::addTask(task);
|
||||
ProjectExplorer::TaskHub::requestPopup();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void ProjectStorageErrorNotifier::typeNameCannotBeResolved(Utils::SmallStringView typeName,
|
||||
SourceId sourceId)
|
||||
{
|
||||
const QString typeNameString{typeName};
|
||||
|
||||
logIssue(ProjectExplorer::Task::Warning,
|
||||
Tr::tr("Missing type %1 name.").arg(typeNameString),
|
||||
m_pathCache.sourcePath(sourceId));
|
||||
}
|
||||
|
||||
void ProjectStorageErrorNotifier::missingDefaultProperty(Utils::SmallStringView typeName,
|
||||
Utils::SmallStringView propertyName,
|
||||
SourceId sourceId)
|
||||
|
||||
{
|
||||
const QString typeNameString{typeName};
|
||||
const QString propertyNameString{propertyName};
|
||||
|
||||
logIssue(ProjectExplorer::Task::Warning,
|
||||
Tr::tr("Missing default property: %1 in type %2.").arg(propertyNameString).arg(typeNameString),
|
||||
m_pathCache.sourcePath(sourceId));
|
||||
}
|
||||
|
||||
void ProjectStorageErrorNotifier::propertyNameDoesNotExists(Utils::SmallStringView propertyName,
|
||||
SourceId sourceId)
|
||||
{
|
||||
const QString propertyNameString{propertyName};
|
||||
|
||||
logIssue(ProjectExplorer::Task::Warning,
|
||||
Tr::tr("Missing property %1 in type %2.").arg(propertyNameString),
|
||||
m_pathCache.sourcePath(sourceId));
|
||||
}
|
||||
|
||||
void ProjectStorageErrorNotifier::qmlDocumentDoesNotExistsForQmldirEntry(Utils::SmallStringView typeName,
|
||||
Storage::Version,
|
||||
SourceId qmlDocumentSourceId,
|
||||
SourceId qmldirSourceId)
|
||||
{
|
||||
const QString typeNameString{typeName};
|
||||
const QString missingPath = m_pathCache.sourcePath(qmlDocumentSourceId).toQString();
|
||||
logIssue(ProjectExplorer::Task::Warning,
|
||||
Tr::tr("Not existing Qml Document %1 for type %2.").arg(missingPath).arg(typeNameString),
|
||||
m_pathCache.sourcePath(qmldirSourceId));
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
@@ -3,15 +3,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "projectstorageerrornotifierinterface.h"
|
||||
#include <qmldesigner_global.h>
|
||||
|
||||
#include <projectstorage/projectstorageerrornotifierinterface.h>
|
||||
|
||||
#include <modelfwd.h>
|
||||
#include <qmldesignercorelib_exports.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class QMLDESIGNERCORE_EXPORT ProjectStorageErrorNotifier final
|
||||
: public ProjectStorageErrorNotifierInterface
|
||||
class QMLDESIGNER_EXPORT ProjectStorageErrorNotifier final : public ProjectStorageErrorNotifierInterface
|
||||
{
|
||||
public:
|
||||
ProjectStorageErrorNotifier(PathCacheType &pathCache)
|
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmldesignerprojectmanager.h"
|
||||
#include "projectstorageerrornotifier.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -12,7 +13,6 @@
|
||||
#include <projectstorage/filestatuscache.h>
|
||||
#include <projectstorage/filesystem.h>
|
||||
#include <projectstorage/projectstorage.h>
|
||||
#include <projectstorage/projectstorageerrornotifier.h>
|
||||
#include <projectstorage/projectstoragepathwatcher.h>
|
||||
#include <projectstorage/projectstorageupdater.h>
|
||||
#include <projectstorage/qmldocumentparser.h>
|
@@ -351,7 +351,6 @@ extend_qtc_library(TestDesignerCore
|
||||
projectstorageupdater.cpp projectstorageupdater.h
|
||||
projectstorage.cpp projectstorage.h
|
||||
projectstorageerrornotifierinterface.h
|
||||
projectstorageerrornotifier.cpp projectstorageerrornotifier.h
|
||||
typeannotationreader.cpp typeannotationreader.h
|
||||
qmldocumentparserinterface.h
|
||||
qmltypesparserinterface.h
|
||||
|
Reference in New Issue
Block a user