forked from qt-creator/qt-creator
QmlDesiger: Use ProjectExplorer::Target instead of Project plus Kit
A Target is pretty much exactly that. Change-Id: Icd6041428ecd616906d5fbf74a5b87ea4b5c8103 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -76,7 +76,7 @@ DesignDocument::DesignDocument(QObject *parent) :
|
|||||||
m_subComponentManager(new SubComponentManager(m_documentModel.data(), this)),
|
m_subComponentManager(new SubComponentManager(m_documentModel.data(), this)),
|
||||||
m_rewriterView (new RewriterView(RewriterView::Amend, m_documentModel.data())),
|
m_rewriterView (new RewriterView(RewriterView::Amend, m_documentModel.data())),
|
||||||
m_documentLoaded(false),
|
m_documentLoaded(false),
|
||||||
m_currentKit(nullptr)
|
m_currentTarget(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,9 +216,9 @@ Utils::FilePath DesignDocument::fileName() const
|
|||||||
return Utils::FilePath();
|
return Utils::FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
Kit *DesignDocument::currentKit() const
|
ProjectExplorer::Target *DesignDocument::currentTarget() const
|
||||||
{
|
{
|
||||||
return m_currentKit;
|
return m_currentTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DesignDocument::isDocumentLoaded() const
|
bool DesignDocument::isDocumentLoaded() const
|
||||||
@@ -551,8 +551,8 @@ void DesignDocument::setEditor(Core::IEditor *editor)
|
|||||||
connect(editor->document(), &Core::IDocument::filePathChanged,
|
connect(editor->document(), &Core::IDocument::filePathChanged,
|
||||||
this, &DesignDocument::updateFileName);
|
this, &DesignDocument::updateFileName);
|
||||||
|
|
||||||
updateActiveQtVersion();
|
updateActiveTarget();
|
||||||
updateCurrentProject();
|
updateActiveTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *DesignDocument::editor() const
|
Core::IEditor *DesignDocument::editor() const
|
||||||
@@ -594,53 +594,38 @@ void DesignDocument::redo()
|
|||||||
viewManager().resetPropertyEditorView();
|
viewManager().resetPropertyEditorView();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Kit *getActiveKit(DesignDocument *designDocument)
|
static Target *getActiveTarget(DesignDocument *designDocument)
|
||||||
{
|
{
|
||||||
ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(designDocument->fileName());
|
Project *currentProject = SessionManager::projectForFile(designDocument->fileName());
|
||||||
|
|
||||||
if (!currentProject)
|
if (!currentProject)
|
||||||
currentProject = ProjectExplorer::ProjectTree::currentProject();
|
currentProject = ProjectTree::currentProject();
|
||||||
|
|
||||||
if (!currentProject)
|
if (!currentProject)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
||||||
QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
||||||
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
|
designDocument, &DesignDocument::updateActiveTarget, Qt::UniqueConnection);
|
||||||
|
|
||||||
QObject::connect(currentProject, &Project::activeTargetChanged,
|
QObject::connect(currentProject, &Project::activeTargetChanged,
|
||||||
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
|
designDocument, &DesignDocument::updateActiveTarget, Qt::UniqueConnection);
|
||||||
|
|
||||||
QObject::connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
|
|
||||||
designDocument, &DesignDocument::updateCurrentProject, Qt::UniqueConnection);
|
|
||||||
|
|
||||||
QObject::connect(currentProject, &Project::activeTargetChanged,
|
|
||||||
designDocument, &DesignDocument::updateCurrentProject, Qt::UniqueConnection);
|
|
||||||
|
|
||||||
|
|
||||||
Target *target = currentProject->activeTarget();
|
Target *target = currentProject->activeTarget();
|
||||||
|
|
||||||
if (!target)
|
if (!target || !target->kit()->isValid())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!target->kit() || !target->kit()->isValid())
|
|
||||||
return nullptr;
|
|
||||||
QObject::connect(target, &Target::kitChanged,
|
QObject::connect(target, &Target::kitChanged,
|
||||||
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);
|
designDocument, &DesignDocument::updateActiveTarget, Qt::UniqueConnection);
|
||||||
|
|
||||||
return target->kit();
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignDocument::updateActiveQtVersion()
|
void DesignDocument::updateActiveTarget()
|
||||||
{
|
{
|
||||||
m_currentKit = getActiveKit(this);
|
m_currentTarget = getActiveTarget(this);
|
||||||
viewManager().setNodeInstanceViewKit(m_currentKit);
|
viewManager().setNodeInstanceViewTarget(m_currentTarget);
|
||||||
}
|
|
||||||
|
|
||||||
void DesignDocument::updateCurrentProject()
|
|
||||||
{
|
|
||||||
ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(fileName());
|
|
||||||
viewManager().setNodeInstanceViewProject(currentProject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignDocument::contextHelp(const Core::IContext::HelpCallback &callback) const
|
void DesignDocument::contextHelp(const Core::IContext::HelpCallback &callback) const
|
||||||
|
|||||||
@@ -39,12 +39,11 @@
|
|||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QWidget;
|
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -91,7 +90,7 @@ public:
|
|||||||
TextEditor::BaseTextEditor *textEditor() const;
|
TextEditor::BaseTextEditor *textEditor() const;
|
||||||
QPlainTextEdit *plainTextEdit() const;
|
QPlainTextEdit *plainTextEdit() const;
|
||||||
Utils::FilePath fileName() const;
|
Utils::FilePath fileName() const;
|
||||||
ProjectExplorer::Kit *currentKit() const;
|
ProjectExplorer::Target *currentTarget() const;
|
||||||
bool isDocumentLoaded() const;
|
bool isDocumentLoaded() const;
|
||||||
|
|
||||||
void resetToDocumentModel();
|
void resetToDocumentModel();
|
||||||
@@ -115,8 +114,7 @@ public:
|
|||||||
void selectAll();
|
void selectAll();
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
void updateActiveQtVersion();
|
void updateActiveTarget();
|
||||||
void updateCurrentProject();
|
|
||||||
void changeToSubComponent(const ModelNode &componentNode);
|
void changeToSubComponent(const ModelNode &componentNode);
|
||||||
void changeToMaster();
|
void changeToMaster();
|
||||||
|
|
||||||
@@ -152,7 +150,7 @@ private: // variables
|
|||||||
QScopedPointer<RewriterView> m_rewriterView;
|
QScopedPointer<RewriterView> m_rewriterView;
|
||||||
|
|
||||||
bool m_documentLoaded;
|
bool m_documentLoaded;
|
||||||
ProjectExplorer::Kit *m_currentKit;
|
ProjectExplorer::Target *m_currentTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -40,16 +40,8 @@
|
|||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QDeclarativeEngine;
|
|
||||||
class QGraphicsView;
|
|
||||||
class QFileSystemWatcher;
|
|
||||||
class QPainter;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Target;
|
||||||
class Project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -131,8 +123,7 @@ public:
|
|||||||
|
|
||||||
QImage statePreviewImage(const ModelNode &stateNode) const;
|
QImage statePreviewImage(const ModelNode &stateNode) const;
|
||||||
|
|
||||||
void setKit(ProjectExplorer::Kit *kit);
|
void setTarget(ProjectExplorer::Target *newTarget);
|
||||||
void setProject(ProjectExplorer::Project *project);
|
|
||||||
|
|
||||||
void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
|
void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector);
|
||||||
|
|
||||||
@@ -208,8 +199,7 @@ private: //variables
|
|||||||
QImage m_baseStatePreviewImage;
|
QImage m_baseStatePreviewImage;
|
||||||
QElapsedTimer m_lastCrashTime;
|
QElapsedTimer m_lastCrashTime;
|
||||||
NodeInstanceServerInterface::RunModus m_runModus;
|
NodeInstanceServerInterface::RunModus m_runModus;
|
||||||
ProjectExplorer::Kit *m_currentKit = nullptr;
|
ProjectExplorer::Target *m_currentTarget = nullptr;
|
||||||
ProjectExplorer::Project *m_currentProject = nullptr;
|
|
||||||
int m_restartProcessTimerId;
|
int m_restartProcessTimerId;
|
||||||
RewriterTransaction m_puppetTransaction;
|
RewriterTransaction m_puppetTransaction;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Target;
|
||||||
class Project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -66,8 +65,7 @@ public:
|
|||||||
void setItemLibraryViewResourcePath(const QString &resourcePath);
|
void setItemLibraryViewResourcePath(const QString &resourcePath);
|
||||||
void setComponentNode(const ModelNode &componentNode);
|
void setComponentNode(const ModelNode &componentNode);
|
||||||
void setComponentViewToMaster();
|
void setComponentViewToMaster();
|
||||||
void setNodeInstanceViewKit(ProjectExplorer::Kit *kit);
|
void setNodeInstanceViewTarget(ProjectExplorer::Target *target);
|
||||||
void setNodeInstanceViewProject(ProjectExplorer::Project *project);
|
|
||||||
|
|
||||||
void resetPropertyEditorView();
|
void resetPropertyEditorView();
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ void NodeInstanceServerProxy::showCannotConnectToPuppetWarningAndSwitchToEditMod
|
|||||||
|
|
||||||
NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView,
|
NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView,
|
||||||
RunModus runModus,
|
RunModus runModus,
|
||||||
ProjectExplorer::Kit *kit,
|
ProjectExplorer::Target *target)
|
||||||
ProjectExplorer::Project *project)
|
|
||||||
: NodeInstanceServerInterface(nodeInstanceView),
|
: NodeInstanceServerInterface(nodeInstanceView),
|
||||||
m_localServer(new QLocalServer(this)),
|
m_localServer(new QLocalServer(this)),
|
||||||
m_nodeInstanceView(nodeInstanceView),
|
m_nodeInstanceView(nodeInstanceView),
|
||||||
@@ -117,7 +116,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
|
|||||||
m_localServer->listen(socketToken);
|
m_localServer->listen(socketToken);
|
||||||
m_localServer->setMaxPendingConnections(3);
|
m_localServer->setMaxPendingConnections(3);
|
||||||
|
|
||||||
PuppetCreator puppetCreator(kit, project, nodeInstanceView->model());
|
PuppetCreator puppetCreator(target, nodeInstanceView->model());
|
||||||
puppetCreator.setQrcMappingString(qrcMappingString());
|
puppetCreator.setQrcMappingString(qrcMappingString());
|
||||||
|
|
||||||
puppetCreator.createQml2PuppetExecutableIfMissing();
|
puppetCreator.createQml2PuppetExecutableIfMissing();
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ class QProcess;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Target;
|
||||||
class Project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -63,8 +62,7 @@ public:
|
|||||||
|
|
||||||
explicit NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView,
|
explicit NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView,
|
||||||
RunModus runModus,
|
RunModus runModus,
|
||||||
ProjectExplorer::Kit *kit,
|
ProjectExplorer::Target *target);
|
||||||
ProjectExplorer::Project *project);
|
|
||||||
~NodeInstanceServerProxy() override;
|
~NodeInstanceServerProxy() override;
|
||||||
void createInstances(const CreateInstancesCommand &command) override;
|
void createInstances(const CreateInstancesCommand &command) override;
|
||||||
void changeFileUrl(const ChangeFileUrlCommand &command) override;
|
void changeFileUrl(const ChangeFileUrlCommand &command) override;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ NodeInstanceView::~NodeInstanceView()
|
|||||||
{
|
{
|
||||||
removeAllInstanceNodeRelationships();
|
removeAllInstanceNodeRelationships();
|
||||||
delete nodeInstanceServer();
|
delete nodeInstanceServer();
|
||||||
m_currentKit = nullptr;
|
m_currentTarget = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//\{
|
//\{
|
||||||
@@ -173,7 +173,7 @@ bool static parentTakesOverRendering(const ModelNode &modelNode)
|
|||||||
void NodeInstanceView::modelAttached(Model *model)
|
void NodeInstanceView::modelAttached(Model *model)
|
||||||
{
|
{
|
||||||
AbstractView::modelAttached(model);
|
AbstractView::modelAttached(model);
|
||||||
auto server = new NodeInstanceServerProxy(this, m_runModus, m_currentKit, m_currentProject);
|
auto server = new NodeInstanceServerProxy(this, m_runModus, m_currentTarget);
|
||||||
m_nodeInstanceServer = server;
|
m_nodeInstanceServer = server;
|
||||||
m_lastCrashTime.start();
|
m_lastCrashTime.start();
|
||||||
connect(server, &NodeInstanceServerProxy::processCrashed, this, &NodeInstanceView::handleCrash);
|
connect(server, &NodeInstanceServerProxy::processCrashed, this, &NodeInstanceView::handleCrash);
|
||||||
@@ -256,7 +256,7 @@ void NodeInstanceView::restartProcess()
|
|||||||
if (model()) {
|
if (model()) {
|
||||||
delete nodeInstanceServer();
|
delete nodeInstanceServer();
|
||||||
|
|
||||||
auto server = new NodeInstanceServerProxy(this, m_runModus, m_currentKit, m_currentProject);
|
auto server = new NodeInstanceServerProxy(this, m_runModus, m_currentTarget);
|
||||||
m_nodeInstanceServer = server;
|
m_nodeInstanceServer = server;
|
||||||
connect(server, &NodeInstanceServerProxy::processCrashed, this, &NodeInstanceView::handleCrash);
|
connect(server, &NodeInstanceServerProxy::processCrashed, this, &NodeInstanceView::handleCrash);
|
||||||
|
|
||||||
@@ -1300,18 +1300,10 @@ QImage NodeInstanceView::statePreviewImage(const ModelNode &stateNode) const
|
|||||||
return m_statePreviewImage.value(stateNode);
|
return m_statePreviewImage.value(stateNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeInstanceView::setKit(ProjectExplorer::Kit *newKit)
|
void NodeInstanceView::setTarget(ProjectExplorer::Target *newTarget)
|
||||||
{
|
{
|
||||||
if (m_currentKit != newKit) {
|
if (m_currentTarget != newTarget) {
|
||||||
m_currentKit = newKit;
|
m_currentTarget = newTarget;
|
||||||
restartProcess();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NodeInstanceView::setProject(ProjectExplorer::Project *project)
|
|
||||||
{
|
|
||||||
if (m_currentProject != project) {
|
|
||||||
m_currentProject = project;
|
|
||||||
restartProcess();
|
restartProcess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml2PuppetForKitPupp
|
|||||||
|
|
||||||
QByteArray PuppetCreator::qtHash() const
|
QByteArray PuppetCreator::qtHash() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
|
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
||||||
if (currentQtVersion) {
|
if (currentQtVersion) {
|
||||||
return QCryptographicHash::hash(currentQtVersion->dataPath().toString().toUtf8(),
|
return QCryptographicHash::hash(currentQtVersion->dataPath().toString().toUtf8(),
|
||||||
QCryptographicHash::Sha1)
|
QCryptographicHash::Sha1)
|
||||||
@@ -102,7 +102,7 @@ QByteArray PuppetCreator::qtHash() const
|
|||||||
|
|
||||||
QDateTime PuppetCreator::qtLastModified() const
|
QDateTime PuppetCreator::qtLastModified() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
|
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
||||||
if (currentQtVersion)
|
if (currentQtVersion)
|
||||||
return currentQtVersion->libraryPath().toFileInfo().lastModified();
|
return currentQtVersion->libraryPath().toFileInfo().lastModified();
|
||||||
|
|
||||||
@@ -140,10 +140,10 @@ QDateTime PuppetCreator::puppetSourceLastModified() const
|
|||||||
bool PuppetCreator::useOnlyFallbackPuppet() const
|
bool PuppetCreator::useOnlyFallbackPuppet() const
|
||||||
{
|
{
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
if (!m_kit || !m_kit->isValid())
|
if (!m_target || !m_target->kit()->isValid())
|
||||||
qWarning() << "Invalid kit for QML puppet";
|
qWarning() << "Invalid kit for QML puppet";
|
||||||
return m_designerSettings.value(DesignerSettingsKey::USE_DEFAULT_PUPPET
|
return m_designerSettings.value(DesignerSettingsKey::USE_DEFAULT_PUPPET).toBool()
|
||||||
).toBool() || m_kit == nullptr || !m_kit->isValid();
|
|| m_target == nullptr || !m_target->kit()->isValid();
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@@ -152,8 +152,8 @@ bool PuppetCreator::useOnlyFallbackPuppet() const
|
|||||||
QString PuppetCreator::getStyleConfigFileName() const
|
QString PuppetCreator::getStyleConfigFileName() const
|
||||||
{
|
{
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
if (m_currentProject) {
|
if (m_target) {
|
||||||
for (const Utils::FilePath &fileName : m_currentProject->files(ProjectExplorer::Project::SourceFiles)) {
|
for (const Utils::FilePath &fileName : m_target->project()->files(ProjectExplorer::Project::SourceFiles)) {
|
||||||
if (fileName.fileName() == "qtquickcontrols2.conf")
|
if (fileName.fileName() == "qtquickcontrols2.conf")
|
||||||
return fileName.toString();
|
return fileName.toString();
|
||||||
}
|
}
|
||||||
@@ -162,17 +162,14 @@ QString PuppetCreator::getStyleConfigFileName() const
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit,
|
PuppetCreator::PuppetCreator(ProjectExplorer::Target *target, const Model *model)
|
||||||
ProjectExplorer::Project *project,
|
|
||||||
const Model *model)
|
|
||||||
|
|
||||||
: m_kit(kit)
|
: m_target(target)
|
||||||
, m_availablePuppetType(FallbackPuppet)
|
, m_availablePuppetType(FallbackPuppet)
|
||||||
, m_model(model)
|
, m_model(model)
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
, m_designerSettings(QmlDesignerPlugin::instance()->settings())
|
, m_designerSettings(QmlDesignerPlugin::instance()->settings())
|
||||||
#endif
|
#endif
|
||||||
, m_currentProject(project)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,18 +327,18 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
|
|||||||
if (!useOnlyFallbackPuppet()) {
|
if (!useOnlyFallbackPuppet()) {
|
||||||
// check if there was an already failing try to get the UserSpacePuppet
|
// check if there was an already failing try to get the UserSpacePuppet
|
||||||
// -> imagine as result a FallbackPuppet and nothing will happen again
|
// -> imagine as result a FallbackPuppet and nothing will happen again
|
||||||
if (m_qml2PuppetForKitPuppetHash.value(m_kit->id(), UserSpacePuppet) == UserSpacePuppet ) {
|
if (m_qml2PuppetForKitPuppetHash.value(m_target->id(), UserSpacePuppet) == UserSpacePuppet ) {
|
||||||
if (checkPuppetIsReady(qml2PuppetPath(UserSpacePuppet))) {
|
if (checkPuppetIsReady(qml2PuppetPath(UserSpacePuppet))) {
|
||||||
m_availablePuppetType = UserSpacePuppet;
|
m_availablePuppetType = UserSpacePuppet;
|
||||||
} else {
|
} else {
|
||||||
if (m_kit->isValid()) {
|
if (m_target->kit()->isValid()) {
|
||||||
bool buildSucceeded = build(qml2PuppetProjectFile());
|
bool buildSucceeded = build(qml2PuppetProjectFile());
|
||||||
if (buildSucceeded)
|
if (buildSucceeded)
|
||||||
m_availablePuppetType = UserSpacePuppet;
|
m_availablePuppetType = UserSpacePuppet;
|
||||||
} else {
|
} else {
|
||||||
warnAboutInvalidKit();
|
warnAboutInvalidKit();
|
||||||
}
|
}
|
||||||
m_qml2PuppetForKitPuppetHash.insert(m_kit->id(), m_availablePuppetType);
|
m_qml2PuppetForKitPuppetHash.insert(m_target->id(), m_availablePuppetType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,8 +415,8 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
|||||||
static const QString pathSep = Utils::HostOsInfo::pathListSeparator();
|
static const QString pathSep = Utils::HostOsInfo::pathListSeparator();
|
||||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||||
if (!useOnlyFallbackPuppet())
|
if (!useOnlyFallbackPuppet())
|
||||||
m_kit->addToEnvironment(environment);
|
m_target->kit()->addToEnvironment(environment);
|
||||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_kit);
|
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
||||||
if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet!
|
if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet!
|
||||||
// Update PATH to include QT_HOST_BINS
|
// Update PATH to include QT_HOST_BINS
|
||||||
const Utils::FilePath qtBinPath = qt->hostBinPath();
|
const Utils::FilePath qtBinPath = qt->hostBinPath();
|
||||||
@@ -490,13 +487,11 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
|||||||
|
|
||||||
QStringList customFileSelectors;
|
QStringList customFileSelectors;
|
||||||
|
|
||||||
if (m_currentProject && m_currentProject->activeTarget()) {
|
if (m_target) {
|
||||||
QStringList designerImports = m_currentProject->activeTarget()
|
QStringList designerImports = m_target->additionalData("QmlDesignerImportPath").toStringList();
|
||||||
->additionalData("QmlDesignerImportPath").toStringList();
|
|
||||||
importPaths.append(designerImports);
|
importPaths.append(designerImports);
|
||||||
|
|
||||||
customFileSelectors = m_currentProject->activeTarget()
|
customFileSelectors = m_target->additionalData("CustomFileSelectorsData").toStringList();
|
||||||
->additionalData("CustomFileSelectorsData").toStringList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_availablePuppetType == FallbackPuppet)
|
if (m_availablePuppetType == FallbackPuppet)
|
||||||
@@ -519,10 +514,10 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
|
|||||||
QString PuppetCreator::buildCommand() const
|
QString PuppetCreator::buildCommand() const
|
||||||
{
|
{
|
||||||
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
Utils::Environment environment = Utils::Environment::systemEnvironment();
|
||||||
m_kit->addToEnvironment(environment);
|
m_target->kit()->addToEnvironment(environment);
|
||||||
|
|
||||||
ProjectExplorer::ToolChain *toolChain
|
ProjectExplorer::ToolChain *toolChain
|
||||||
= ProjectExplorer::ToolChainKitAspect::toolChain(m_kit,
|
= ProjectExplorer::ToolChainKitAspect::toolChain(m_target->kit(),
|
||||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||||
|
|
||||||
if (toolChain)
|
if (toolChain)
|
||||||
@@ -533,7 +528,7 @@ QString PuppetCreator::buildCommand() const
|
|||||||
|
|
||||||
QString PuppetCreator::qmakeCommand() const
|
QString PuppetCreator::qmakeCommand() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
|
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
||||||
if (currentQtVersion)
|
if (currentQtVersion)
|
||||||
return currentQtVersion->qmakeCommand().toString();
|
return currentQtVersion->qmakeCommand().toString();
|
||||||
|
|
||||||
@@ -620,7 +615,7 @@ static bool nonEarlyQt5Version(const QtSupport::QtVersionNumber ¤tQtVersio
|
|||||||
|
|
||||||
bool PuppetCreator::qtIsSupported() const
|
bool PuppetCreator::qtIsSupported() const
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
|
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_target->kit());
|
||||||
|
|
||||||
return currentQtVersion
|
return currentQtVersion
|
||||||
&& currentQtVersion->isValid()
|
&& currentQtVersion->isValid()
|
||||||
|
|||||||
@@ -33,8 +33,7 @@
|
|||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Target;
|
||||||
class Project;
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
@@ -50,9 +49,7 @@ public:
|
|||||||
UserSpacePuppet
|
UserSpacePuppet
|
||||||
};
|
};
|
||||||
|
|
||||||
PuppetCreator(ProjectExplorer::Kit *kit,
|
PuppetCreator(ProjectExplorer::Target *target, const Model *model);
|
||||||
ProjectExplorer::Project *project,
|
|
||||||
const Model *model);
|
|
||||||
|
|
||||||
void createQml2PuppetExecutableIfMissing();
|
void createQml2PuppetExecutableIfMissing();
|
||||||
|
|
||||||
@@ -106,7 +103,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable QString m_compileLog;
|
mutable QString m_compileLog;
|
||||||
ProjectExplorer::Kit *m_kit = nullptr;
|
ProjectExplorer::Target *m_target = nullptr;
|
||||||
PuppetType m_availablePuppetType;
|
PuppetType m_availablePuppetType;
|
||||||
static QHash<Core::Id, PuppetType> m_qml2PuppetForKitPuppetHash;
|
static QHash<Core::Id, PuppetType> m_qml2PuppetForKitPuppetHash;
|
||||||
const Model *m_model = nullptr;
|
const Model *m_model = nullptr;
|
||||||
@@ -114,7 +111,6 @@ private:
|
|||||||
const DesignerSettings m_designerSettings;
|
const DesignerSettings m_designerSettings;
|
||||||
#endif
|
#endif
|
||||||
QString m_qrcMapping;
|
QString m_qrcMapping;
|
||||||
ProjectExplorer::Project *m_currentProject = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ void ViewManager::attachNodeInstanceView()
|
|||||||
|
|
||||||
qCInfo(viewBenchmark) << Q_FUNC_INFO;
|
qCInfo(viewBenchmark) << Q_FUNC_INFO;
|
||||||
|
|
||||||
setNodeInstanceViewKit(currentDesignDocument()->currentKit());
|
setNodeInstanceViewTarget(currentDesignDocument()->currentTarget());
|
||||||
currentModel()->setNodeInstanceView(&d->nodeInstanceView);
|
currentModel()->setNodeInstanceView(&d->nodeInstanceView);
|
||||||
|
|
||||||
qCInfo(viewBenchmark) << "NodeInstanceView:" << time.elapsed();
|
qCInfo(viewBenchmark) << "NodeInstanceView:" << time.elapsed();
|
||||||
@@ -328,14 +328,9 @@ void ViewManager::setComponentViewToMaster()
|
|||||||
d->componentView.setComponentToMaster();
|
d->componentView.setComponentToMaster();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewManager::setNodeInstanceViewKit(ProjectExplorer::Kit *kit)
|
void ViewManager::setNodeInstanceViewTarget(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
d->nodeInstanceView.setKit(kit);
|
d->nodeInstanceView.setTarget(target);
|
||||||
}
|
|
||||||
|
|
||||||
void QmlDesigner::ViewManager::setNodeInstanceViewProject(ProjectExplorer::Project *project)
|
|
||||||
{
|
|
||||||
d->nodeInstanceView.setProject(project);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<WidgetInfo> ViewManager::widgetInfos() const
|
QList<WidgetInfo> ViewManager::widgetInfos() const
|
||||||
|
|||||||
@@ -434,8 +434,8 @@ void QmlDesignerPlugin::activateAutoSynchronization()
|
|||||||
if (!currentDesignDocument()->isDocumentLoaded())
|
if (!currentDesignDocument()->isDocumentLoaded())
|
||||||
currentDesignDocument()->loadDocument(currentDesignDocument()->plainTextEdit());
|
currentDesignDocument()->loadDocument(currentDesignDocument()->plainTextEdit());
|
||||||
|
|
||||||
currentDesignDocument()->updateActiveQtVersion();
|
currentDesignDocument()->updateActiveTarget();
|
||||||
currentDesignDocument()->updateCurrentProject();
|
currentDesignDocument()->updateActiveTarget();
|
||||||
d->mainWidget.enableWidgets();
|
d->mainWidget.enableWidgets();
|
||||||
currentDesignDocument()->attachRewriterToModel();
|
currentDesignDocument()->attachRewriterToModel();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user