From 52316578f837ca38c6631222808af4288affe40f Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Thu, 18 Jun 2020 08:49:29 +0200 Subject: [PATCH] qml: introduce QmlMultiLanguageAspect This aspect is only available if the special multilanguage plugin is available. Translation changes in that plugin changes this aspect, which results in environment variables which activate the use of a multilanguage created sqlite to provide the translations. Change-Id: I38250b69165eb7ec3e4f82dc34b3cc4ba0a33f8f Reviewed-by: hjk Reviewed-by: Tim Jenssen --- .../instances/nodeinstanceview.cpp | 20 ++- .../designercore/instances/puppetcreator.cpp | 33 ++--- .../designercore/instances/puppetcreator.h | 1 - src/plugins/qmldesigner/designersettings.cpp | 1 - src/plugins/qmldesigner/designersettings.h | 1 - .../qmldesigner/qmldesigner_dependencies.pri | 1 + .../qmlpreviewplugin/qmlpreviewactions.cpp | 6 +- .../qmlpreview/qmlpreviewruncontrol.cpp | 8 +- src/plugins/qmlprojectmanager/CMakeLists.txt | 1 + .../qmlmultilanguageaspect.cpp | 128 ++++++++++++++++++ .../qmlmultilanguageaspect.h | 57 ++++++++ .../qmlprojectmanager/qmlprojectmanager.pro | 2 + .../qmlprojectmanager/qmlprojectmanager.qbs | 1 + .../qmlprojectmanagerconstants.h | 2 + .../qmlprojectrunconfiguration.cpp | 55 +++++--- 15 files changed, 264 insertions(+), 53 deletions(-) create mode 100644 src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp create mode 100644 src/plugins/qmlprojectmanager/qmlmultilanguageaspect.h diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 96dd127f28d..d87bc128d2b 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -83,6 +83,10 @@ #include #endif +#include + +#include + #include #include @@ -542,7 +546,12 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, } } else if (node.isRootNode() && name == "language@Internal") { const QString languageAsString = value.toString(); - DesignerSettings::setValue(DesignerSettingsKey::LAST_USED_TRANSLATION_LANGUAGE, languageAsString); + if (m_currentTarget) { + if (auto rc = m_currentTarget->activeRunConfiguration()) { + if (auto multiLanguageAspect = rc->aspect()) + multiLanguageAspect->setLastUsedLanguage(languageAsString); + } + } nodeInstanceServer()->changeLanguage({languageAsString}); } else if (node.isRootNode() && name == "previewSize@Internal") { nodeInstanceServer()->changePreviewImageSize(value.toSize()); @@ -984,6 +993,13 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand() } } + QString lastUsedLanguage; + if (m_currentTarget) { + if (auto rc = m_currentTarget->activeRunConfiguration()) { + if (auto multiLanguageAspect = rc->aspect()) + lastUsedLanguage = multiLanguageAspect->lastUsedLanguage(); + } + } return CreateSceneCommand( instanceContainerList, @@ -996,7 +1012,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand() mockupTypesVector, model()->fileUrl(), m_edit3DToolStates[model()->fileUrl()], - DesignerSettings::getValue(DesignerSettingsKey::LAST_USED_TRANSLATION_LANGUAGE).toString() + lastUsedLanguage ); } diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index a33d7f1f5a0..943e21e6f7f 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -36,17 +36,20 @@ #include +#include +#include + #include #include #include #include #include -#include -#include + +#include + #include #include #include -#include #include #include @@ -162,18 +165,6 @@ QString PuppetCreator::getStyleConfigFileName() const return QString(); } -QString PuppetCreator::getMultilanguageDatabaseFilePath() const -{ -#ifndef QMLDESIGNER_TEST - if (m_target) { - auto filePath = m_target->project()->projectDirectory().pathAppended("/multilanguage-experimental-v1.db"); - if (filePath.exists()) - return filePath.toString(); - } -#endif - return {}; -} - PuppetCreator::PuppetCreator(ProjectExplorer::Target *target, const Model *model) : m_target(target) @@ -494,11 +485,6 @@ QProcessEnvironment PuppetCreator::processEnvironment() const environment.set("QMLDESIGNER_RC_PATHS", m_qrcMapping); } - const QString multilanguageDatabaseFilePath = getMultilanguageDatabaseFilePath(); - - if (!multilanguageDatabaseFilePath.isEmpty()) - environment.set("QT_MULTILANGUAGE_DATABASE", multilanguageDatabaseFilePath); - #ifndef QMLDESIGNER_TEST auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView(); view->emitCustomNotification("PuppetStatus", {}, {QVariant(m_qrcMapping)}); @@ -525,6 +511,13 @@ QProcessEnvironment PuppetCreator::processEnvironment() const importPaths.append(designerImports); customFileSelectors = m_target->additionalData("CustomFileSelectorsData").toStringList(); + + if (auto *rc = m_target->activeRunConfiguration()) { + if (auto multiLanguageAspect = rc->aspect()) { + if (!multiLanguageAspect->databaseFilePath().isEmpty()) + environment.set("QT_MULTILANGUAGE_DATABASE", multiLanguageAspect->databaseFilePath().toString()); + } + } } customFileSelectors.append("DesignMode"); diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h index f8033fd3e19..bafea8fa3e6 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h @@ -102,7 +102,6 @@ protected: bool useOnlyFallbackPuppet() const; QString getStyleConfigFileName() const; - QString getMultilanguageDatabaseFilePath() const; private: mutable QString m_compileLog; diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 96504f3a1cc..91091c53d66 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -85,7 +85,6 @@ void DesignerSettings::fromSettings(QSettings *settings) restoreValue(settings, DesignerSettingsKey::SIMPLE_COLOR_PALETTE_CONTENT, QStringList()); restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true); restoreValue(settings, DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER, true); - restoreValue(settings, DesignerSettingsKey::LAST_USED_TRANSLATION_LANGUAGE, "en"); settings->endGroup(); settings->endGroup(); diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index 746465386d7..42bc957b96c 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -69,7 +69,6 @@ const char ENABLE_TIMELINEVIEW[] = "EnableTimelineView"; const char SIMPLE_COLOR_PALETTE_CONTENT[] = "SimpleColorPaletteContent"; const char ALWAYS_DESIGN_MODE[] = "AlwaysDesignMode"; const char DISABLE_ITEM_LIBRARY_UPDATE_TIMER[] = "DisableItemLibraryUpdateTimer"; -const char LAST_USED_TRANSLATION_LANGUAGE[] = "LastUsedTranslationLanguage"; } class QMLDESIGNERCORE_EXPORT DesignerSettings : public QHash diff --git a/src/plugins/qmldesigner/qmldesigner_dependencies.pri b/src/plugins/qmldesigner/qmldesigner_dependencies.pri index cba0186ce73..321d2c2b071 100644 --- a/src/plugins/qmldesigner/qmldesigner_dependencies.pri +++ b/src/plugins/qmldesigner/qmldesigner_dependencies.pri @@ -11,6 +11,7 @@ QTC_PLUGIN_DEPENDS += \ qtsupport \ projectexplorer \ qmakeprojectmanager \ + qmlprojectmanager \ resourceeditor INCLUDEPATH *= \ diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp index c0da2f8b8c6..190d52b349d 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp @@ -48,12 +48,10 @@ const Utils::Icon previewIcon({ static void handleAction(const SelectionContext &context) { if (context.view()->isAttached()) { - if (context.toggled()) { - QmlPreviewPlugin::setLanguageLocale(DesignerSettings::getValue(DesignerSettingsKey::LAST_USED_TRANSLATION_LANGUAGE).toString()); + if (context.toggled()) ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE); - } else { + else QmlPreviewPlugin::stopAllRunControls(); - } } } diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index a6437d62f96..f1caffa1a7a 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -152,10 +153,9 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC } } - if (runControl->project()) { - auto multilanguageDatabaseFilePath = runControl->project()->projectDirectory().pathAppended("/multilanguage-experimental-v1.db"); - if (multilanguageDatabaseFilePath.exists()) - runnable.environment.set("QT_MULTILANGUAGE_DATABASE", multilanguageDatabaseFilePath.toString()); + if (auto multiLanguageAspect = runControl->aspect()) { + if (!multiLanguageAspect->databaseFilePath().isEmpty()) + runnable.environment.set("QT_MULTILANGUAGE_DATABASE", multiLanguageAspect->databaseFilePath().toString()); } Utils::QtcProcess::addArg(&runnable.commandLineArguments, diff --git a/src/plugins/qmlprojectmanager/CMakeLists.txt b/src/plugins/qmlprojectmanager/CMakeLists.txt index 1d8527c221a..fa037362a50 100644 --- a/src/plugins/qmlprojectmanager/CMakeLists.txt +++ b/src/plugins/qmlprojectmanager/CMakeLists.txt @@ -6,6 +6,7 @@ add_qtc_plugin(QmlProjectManager fileformat/qmlprojectfileformat.cpp fileformat/qmlprojectfileformat.h fileformat/qmlprojectitem.cpp fileformat/qmlprojectitem.h qmlmainfileaspect.cpp qmlmainfileaspect.h + qmlmultilanguageaspect.cpp qmlmultilanguageaspect.h qmlproject.cpp qmlproject.h qmlproject.qrc qmlprojectconstants.h diff --git a/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp b/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp new file mode 100644 index 00000000000..64dd8a93d60 --- /dev/null +++ b/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "qmlmultilanguageaspect.h" + +#include +#include + +#include +#include +#include + +static bool isMultilanguagePresent() +{ + const QVector specs = ExtensionSystem::PluginManager::plugins(); + return std::find_if(specs.begin(), + specs.end(), + [](ExtensionSystem::PluginSpec *spec) { + return spec->name() == "MultiLanguage"; + }) + != specs.end(); +} + +static Utils::FilePath getMultilanguageDatabaseFilePath(ProjectExplorer::Target *target) +{ + if (target) { + auto filePath = target->project()->projectDirectory().pathAppended("/multilanguage-experimental-v1.db"); + if (filePath.exists()) + return filePath; + } + return {}; +} + +static QObject *getPreviewPlugin() +{ + auto pluginIt = std::find_if(ExtensionSystem::PluginManager::plugins().begin(), + ExtensionSystem::PluginManager::plugins().end(), + [](const ExtensionSystem::PluginSpec *p) { + return p->name() == "QmlPreview"; + }); + + if (pluginIt != ExtensionSystem::PluginManager::plugins().constEnd()) + return (*pluginIt)->plugin(); + + return nullptr; +} + + +namespace QmlProjectManager { + +QmlMultiLanguageAspect::QmlMultiLanguageAspect(ProjectExplorer::Target *target) + : m_target(target) +{ + setVisible(isMultilanguagePresent()); + setSettingsKey(Constants::USE_MULTILANGUAGE_KEY); + setLabel(tr("Use MultiLanguage translation database."), BaseBoolAspect::LabelPlacement::AtCheckBox); + setToolTip(tr("Enable loading application with special desktop SQLite translation database.")); + + setDefaultValue(!databaseFilePath().isEmpty()); + QVariantMap getDefaultValues; + fromMap(getDefaultValues); + + if (auto previewPlugin = getPreviewPlugin()) + connect(previewPlugin, SIGNAL(localeChanged(QString)), this, SLOT(setLastUsedLanguage(QString))); +} + +QmlMultiLanguageAspect::~QmlMultiLanguageAspect() +{ +} + +void QmlMultiLanguageAspect::setLastUsedLanguage(const QString &language) +{ + if (auto previewPlugin = getPreviewPlugin()) + previewPlugin->setProperty("locale", language); + if (m_lastUsedLanguage != language) { + m_lastUsedLanguage = language; + emit changed(); + } +} + +QString QmlMultiLanguageAspect::lastUsedLanguage() const +{ + return m_lastUsedLanguage; +} + +Utils::FilePath QmlMultiLanguageAspect::databaseFilePath() const +{ + if (m_databaseFilePath.isEmpty()) + m_databaseFilePath = getMultilanguageDatabaseFilePath(m_target); + return m_databaseFilePath; +} + +void QmlMultiLanguageAspect::toMap(QVariantMap &map) const +{ + BaseBoolAspect::toMap(map); + if (!m_lastUsedLanguage.isEmpty()) + map.insert(Constants::LAST_USED_LANGUAGE, m_lastUsedLanguage); +} + +void QmlMultiLanguageAspect::fromMap(const QVariantMap &map) +{ + BaseBoolAspect::fromMap(map); + setLastUsedLanguage(map.value(Constants::LAST_USED_LANGUAGE, "en").toString()); +} + +} // namespace QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.h b/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.h new file mode 100644 index 00000000000..163552caf0d --- /dev/null +++ b/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include "qmlprojectmanager_global.h" + +#include + +#include + +namespace QmlProjectManager { + +class QMLPROJECTMANAGER_EXPORT QmlMultiLanguageAspect : public ProjectExplorer::BaseBoolAspect +{ + Q_OBJECT +public: + explicit QmlMultiLanguageAspect(ProjectExplorer::Target *target); + ~QmlMultiLanguageAspect() override; + + QString lastUsedLanguage() const; + Utils::FilePath databaseFilePath() const; + void toMap(QVariantMap &map) const final; + void fromMap(const QVariantMap &map) final; + +public slots: + void setLastUsedLanguage(const QString &language); + +private: + ProjectExplorer::Target *m_target = nullptr; + mutable Utils::FilePath m_databaseFilePath; + QString m_lastUsedLanguage; +}; + +} // namespace QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.pro b/src/plugins/qmlprojectmanager/qmlprojectmanager.pro index 049c5a801b7..330d93d6012 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanager.pro +++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.pro @@ -7,6 +7,7 @@ DEFINES += QMLPROJECTMANAGER_LIBRARY HEADERS += \ qmlmainfileaspect.h \ + qmlmultilanguageaspect.h \ qmlproject.h \ qmlprojectplugin.h \ qmlprojectconstants.h \ @@ -17,6 +18,7 @@ HEADERS += \ SOURCES += \ qmlmainfileaspect.cpp \ + qmlmultilanguageaspect.cpp \ qmlproject.cpp \ qmlprojectplugin.cpp \ qmlprojectnodes.cpp \ diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs index 8d466ab2621..1a160bff1cd 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs +++ b/src/plugins/qmlprojectmanager/qmlprojectmanager.qbs @@ -16,6 +16,7 @@ QtcPlugin { name: "General" files: [ "qmlmainfileaspect.cpp", "qmlmainfileaspect.h", + "qmlmultilanguageaspect.cpp", "qmlmultilanguageaspect.h", "qmlproject.cpp", "qmlproject.h", "qmlproject.qrc", "qmlprojectconstants.h", diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h b/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h index cddac079dc8..2abdb9fa34b 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h +++ b/src/plugins/qmlprojectmanager/qmlprojectmanagerconstants.h @@ -34,6 +34,8 @@ const char QML_PROJECT_ID[] = "QmlProjectManager.QmlProject"; const char QML_VIEWER_ARGUMENTS_KEY[] = "QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments"; const char QML_VIEWER_TARGET_DISPLAY_NAME[] = "QML Viewer"; const char QML_MAINSCRIPT_KEY[] = "QmlProjectManager.QmlRunConfiguration.MainScript"; +const char USE_MULTILANGUAGE_KEY[] = "QmlProjectManager.QmlRunConfiguration.UseMultiLanguage"; +const char LAST_USED_LANGUAGE[] = "QmlProjectManager.QmlRunConfiguration.LastUsedLanguage"; const char USER_ENVIRONMENT_CHANGES_KEY[] = "QmlProjectManager.QmlRunConfiguration.UserEnvironmentChanges"; } // namespace Constants diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 5afb957789c..8ec0c29246f 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -27,7 +27,7 @@ #include "qmlproject.h" #include "qmlprojectmanagerconstants.h" #include "qmlmainfileaspect.h" -#include "qmlmainfileaspect.h" +#include "qmlmultilanguageaspect.h" #include #include @@ -59,6 +59,7 @@ using namespace QtSupport; using namespace Utils; namespace QmlProjectManager { +class QmlMultiLanguageAspect; namespace Internal { // QmlProjectRunConfiguration @@ -81,30 +82,12 @@ private: BaseStringAspect *m_qmlViewerAspect = nullptr; QmlMainFileAspect *m_qmlMainFileAspect = nullptr; + QmlMultiLanguageAspect *m_multiLanguageAspect = nullptr; }; QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id) : RunConfiguration(target, id) { - auto envAspect = addAspect(); - - auto envModifier = [this](Environment env) { - if (auto bs = dynamic_cast(activeBuildSystem())) - env.modify(bs->environment()); - return env; - }; - - const Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(target->kit()); - if (deviceTypeId == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { - envAspect->addPreferredBaseEnvironment(tr("System Environment"), [envModifier] { - return envModifier(Environment::systemEnvironment()); - }); - } - - envAspect->addSupportedBaseEnvironment(tr("Clean Environment"), [envModifier] { - return envModifier(Environment()); - }); - m_qmlViewerAspect = addAspect(); m_qmlViewerAspect->setLabelText(tr("QML Viewer:")); m_qmlViewerAspect->setPlaceHolderText(commandLine().executable().toString()); @@ -123,6 +106,34 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id) connect(target, &Target::kitChanged, this, &RunConfiguration::update); + m_multiLanguageAspect = addAspect(target); + + auto envAspect = addAspect(); + connect(m_multiLanguageAspect, &QmlMultiLanguageAspect::changed, envAspect, &EnvironmentAspect::environmentChanged); + + auto envModifier = [this](Environment env) { + if (auto bs = dynamic_cast(activeBuildSystem())) + env.modify(bs->environment()); + + if (m_multiLanguageAspect && m_multiLanguageAspect->value() && !m_multiLanguageAspect->databaseFilePath().isEmpty()) { + env.set("QT_MULTILANGUAGE_DATABASE", m_multiLanguageAspect->databaseFilePath().toString()); + env.set("QT_MULTILANGUAGE_LANGUAGE", m_multiLanguageAspect->lastUsedLanguage()); + } + return env; + }; + + const Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(target->kit()); + if (deviceTypeId == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { + envAspect->addPreferredBaseEnvironment(tr("System Environment"), [envModifier] { + return envModifier(Environment::systemEnvironment()); + }); + } + + envAspect->addSupportedBaseEnvironment(tr("Clean Environment"), [envModifier] { + Environment environment; + return envModifier(environment); + }); + setDisplayName(tr("QML Scene", "QMLRunConfiguration display name.")); update(); } @@ -208,6 +219,10 @@ QString QmlProjectRunConfiguration::commandLineArguments() const const QString main = bs->targetFile(FilePath::fromString(mainScript())).toString(); if (!main.isEmpty()) QtcProcess::addArg(&args, main, osType); + + if (m_multiLanguageAspect && m_multiLanguageAspect->value()) + QtcProcess::addArg(&args, "-qmljsdebugger=file:unused_if_debugger_arguments_added,services:DebugTranslation", osType); + return args; }