diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-10-08 12:04:06 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-10-08 12:04:06 +0200 |
commit | 9828e6887ed4e31c206505ce8f5b0a452b44ae74 (patch) | |
tree | 624dfc74416d90fea0bfd927055336aea2355416 /src | |
parent | c68f49fefaab4251c70c4ccaece0dd52993b653a (diff) | |
parent | e61152bf56fba1da4e6457dc801b7ac4b4216edb (diff) |
Merge remote-tracking branch 'origin/4.14' into master
Change-Id: Ie53b4c2516d80a653d51bc6b666040c586ce44ab
Diffstat (limited to 'src')
48 files changed, 887 insertions, 440 deletions
diff --git a/src/libs/3rdparty/cplusplus/CMakeLists.txt b/src/libs/3rdparty/cplusplus/CMakeLists.txt index 11ba09cab62..b8a8607a8c3 100644 --- a/src/libs/3rdparty/cplusplus/CMakeLists.txt +++ b/src/libs/3rdparty/cplusplus/CMakeLists.txt @@ -1,7 +1,6 @@ add_qtc_library(3rd_cplusplus OBJECT PUBLIC_DEPENDS Qt5::Core Utils DEFINES CPLUSPLUS_BUILD_LIB - INCLUDES "${PROJECT_SOURCE_DIR}/src/libs" SOURCES AST.cpp AST.h ASTClone.cpp diff --git a/src/libs/cplusplus/CMakeLists.txt b/src/libs/cplusplus/CMakeLists.txt index 829534acd40..9ca49291d4c 100644 --- a/src/libs/cplusplus/CMakeLists.txt +++ b/src/libs/cplusplus/CMakeLists.txt @@ -6,7 +6,6 @@ add_qtc_library(CPlusPlus DEPENDS Utils Qt5::Concurrent DEFINES CPLUSPLUS_BUILD_LIB PUBLIC_DEPENDS 3rd_cplusplus Qt5::Gui - PUBLIC_INCLUDES src/libs/3rdparty SOURCES ASTParent.cpp ASTParent.h ASTPath.cpp ASTPath.h diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt index 33abce755f8..30e5edf12fc 100644 --- a/src/libs/sqlite/CMakeLists.txt +++ b/src/libs/sqlite/CMakeLists.txt @@ -17,6 +17,7 @@ add_qtc_library(Sqlite ../3rdparty/sqlite SOURCES ../3rdparty/sqlite/sqlite3.c + ../3rdparty/sqlite/sqlite3.h ../3rdparty/sqlite/carray.c constraints.h createtablesqlstatementbuilder.cpp createtablesqlstatementbuilder.h @@ -25,6 +26,7 @@ add_qtc_library(Sqlite sqlitecolumn.h sqlitedatabase.cpp sqlitedatabase.h sqlitedatabasebackend.cpp sqlitedatabasebackend.h + sqlitedatabaseinterface.h sqliteexception.cpp sqliteexception.h sqliteglobal.cpp sqliteglobal.h sqliteindex.h @@ -34,10 +36,12 @@ add_qtc_library(Sqlite sqlitesessions.cpp sqlitesessions.h sqlitetable.h sqlitetransaction.h - sqlitewritestatement.cpp sqlitewritestatement.h + sqlitetransaction.h sqlitevalue.h + sqlitewritestatement.cpp sqlitewritestatement.h sqlstatementbuilder.cpp sqlstatementbuilder.h sqlstatementbuilderexception.h + tableconstraints.h utf8string.cpp utf8string.h utf8stringvector.cpp utf8stringvector.h ) diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index 71628e51269..217a3abfa70 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -886,8 +886,10 @@ void SelectionAspect::addToLayout(LayoutBuilder &builder) d->m_buttons.append(button); d->m_buttonGroup->addButton(button); connect(button, &QAbstractButton::clicked, this, [this, i] { - d->m_value = i; - emit changed(); + if (d->m_value != i) { + d->m_value = i; + emit changed(); + } }); } break; @@ -899,7 +901,12 @@ void SelectionAspect::addToLayout(LayoutBuilder &builder) for (int i = 0, n = d->m_options.size(); i < n; ++i) d->m_comboBox->addItem(d->m_options.at(i).displayName); connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::activated), this, - [this](int index) { d->m_value = index; emit changed(); }); + [this](int index) { + if (d->m_value != index) { + d->m_value = index; + emit changed(); + } + }); d->m_comboBox->setCurrentIndex(d->m_value); builder.addItems({d->m_label.data(), d->m_comboBox.data()}); break; diff --git a/src/libs/utils/images/download.png b/src/libs/utils/images/download.png Binary files differnew file mode 100644 index 00000000000..c95b062add5 --- /dev/null +++ b/src/libs/utils/images/download.png diff --git a/src/libs/utils/images/download@2x.png b/src/libs/utils/images/download@2x.png Binary files differnew file mode 100644 index 00000000000..2fe43f05ccd --- /dev/null +++ b/src/libs/utils/images/download@2x.png diff --git a/src/libs/utils/images/download_arrow.png b/src/libs/utils/images/download_arrow.png Binary files differdeleted file mode 100644 index c73bf628f4b..00000000000 --- a/src/libs/utils/images/download_arrow.png +++ /dev/null diff --git a/src/libs/utils/images/download_arrow@2x.png b/src/libs/utils/images/download_arrow@2x.png Binary files differdeleted file mode 100644 index aabf6fce787..00000000000 --- a/src/libs/utils/images/download_arrow@2x.png +++ /dev/null diff --git a/src/libs/utils/images/download_base.png b/src/libs/utils/images/download_base.png Binary files differdeleted file mode 100644 index 25163bef64c..00000000000 --- a/src/libs/utils/images/download_base.png +++ /dev/null diff --git a/src/libs/utils/images/download_base@2x.png b/src/libs/utils/images/download_base@2x.png Binary files differdeleted file mode 100644 index a5e7405ac3d..00000000000 --- a/src/libs/utils/images/download_base@2x.png +++ /dev/null diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc index 180c5e5b43b..da1778f08ad 100644 --- a/src/libs/utils/utils.qrc +++ b/src/libs/utils/utils.qrc @@ -231,10 +231,8 @@ <file>images/dir.png</file> <file>images/online.png</file> <file>images/online@2x.png</file> - <file>images/download_arrow.png</file> - <file>images/download_arrow@2x.png</file> - <file>images/download_base.png</file> - <file>images/download_base@2x.png</file> + <file>images/download.png</file> + <file>images/download@2x.png</file> <file alias="mimetypes/freedesktop.org.xml" compression-algorithm="best">../3rdparty/xdg/freedesktop.org.xml</file> </qresource> <qresource prefix="/codemodel"> diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index 04d35829626..3fa626551b8 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -203,8 +203,7 @@ const Icon ONLINE({ const Icon ONLINE_TOOLBAR({ {QLatin1String(":/utils/images/online.png"), Theme::IconsBaseColor}}); const Icon DOWNLOAD({ - {QLatin1String(":/utils/images/download_arrow.png"), Theme::IconsRunColor}, - {QLatin1String(":/utils/images/download_base.png"), Theme::PanelTextColorDark}}, Icon::Tint); + {QLatin1String(":/utils/images/download.png"), Theme::PanelTextColorMid}}, Icon::Tint); const Icon WARNING({ {QLatin1String(":/utils/images/warningfill.png"), Theme::BackgroundColorNormal}, diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index 386c22c73c3..f91ad9e097b 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -395,7 +395,7 @@ int TestResultModel::resultTypeCount(ResultType type) const { int result = 0; - for (const auto &id : m_reportedSummary.keys()) { + for (const auto &id : m_testResultCount.keys()) { // if we got a result count from the framework prefer that over our counted results int reported = m_reportedSummary[id].value(type); result += reported != 0 ? reported : m_testResultCount.value(id).value(type); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 0853a46d93e..931d7835236 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3228,7 +3228,7 @@ public: : CppQuickFixOperation(interface), m_class(theClass), m_member(member), m_type(type) { setDescription(QCoreApplication::translate("CppTools::Quickfix", - "Add class member \"%1\"").arg(m_member)); + "Add Class Member \"%1\"").arg(m_member)); } private: @@ -3238,7 +3238,7 @@ private: if (type.isEmpty()) { type = QInputDialog::getText( Core::ICore::dialogParent(), - QCoreApplication::translate("CppTools::Quickfix","Please provide the type"), + QCoreApplication::translate("CppTools::Quickfix","Provide the type"), QCoreApplication::translate("CppTools::Quickfix","Data type:"), QLineEdit::Normal); } @@ -7568,13 +7568,13 @@ public: if (m_removeAllAtGlobalScope) { setDescription(QApplication::translate( "CppTools::QuickFix", - "Remove all occurrences of 'using namespace %1' at the global scope " - "and adjust type names accordingly") + "Remove All Occurrences of \"using namespace %1\" in Global Scope " + "and Adjust Type Names Accordingly") .arg(name)); } else { setDescription(QApplication::translate("CppTools::QuickFix", - "Remove 'using namespace %1' and " - "adjust type names accordingly") + "Remove \"using namespace %1\" and " + "Adjust Type Names Accordingly") .arg(name)); } } diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 80b1611b8d5..e8a4ecf844c 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -929,9 +929,14 @@ static bool isOnlyControlModifier(const Qt::KeyboardModifiers &mods) return (mods ^ ControlModifier) == Qt::NoModifier; } -static bool hasControlModifier(const Qt::KeyboardModifiers &mods) +static bool isAcceptableModifier(const Qt::KeyboardModifiers &mods) { - return mods.testFlag(ControlModifier); + if (mods & ControlModifier) { + // Generally, CTRL is not fine, except in combination with ALT. + // See QTCREATORBUG-24673 + return mods & AltModifier; + } + return true; } @@ -1106,7 +1111,7 @@ public: bool is(int c) const { - return m_xkey == c && !hasControlModifier(m_modifiers); + return m_xkey == c && isAcceptableModifier(m_modifiers); } bool isControl() const diff --git a/src/plugins/projectexplorer/buildstepspage.cpp b/src/plugins/projectexplorer/buildstepspage.cpp index 25685ea9933..cc642d0d934 100644 --- a/src/plugins/projectexplorer/buildstepspage.cpp +++ b/src/plugins/projectexplorer/buildstepspage.cpp @@ -224,32 +224,6 @@ BuildStepListWidget::~BuildStepListWidget() m_buildStepsData.clear(); } -void BuildStepListWidget::updateSummary() -{ - auto step = qobject_cast<BuildStep *>(sender()); - if (step) { - foreach (const BuildStepsWidgetData *s, m_buildStepsData) { - if (s->step == step) { - s->detailsWidget->setSummaryText(step->summaryText()); - break; - } - } - } -} - -void BuildStepListWidget::updateEnabledState() -{ - auto step = qobject_cast<BuildStep *>(sender()); - if (step) { - foreach (const BuildStepsWidgetData *s, m_buildStepsData) { - if (s->step == step) { - s->toolWidget->setBuildStepEnabled(step->enabled()); - break; - } - } - } -} - void BuildStepListWidget::updateAddBuildStepMenu() { QMenu *menu = m_addButton->menu(); @@ -285,11 +259,14 @@ void BuildStepListWidget::addBuildStep(int pos) m_vbox->insertWidget(pos, s->detailsWidget); - connect(s->step, &BuildStep::updateSummary, - this, &BuildStepListWidget::updateSummary); + connect(s->step, &BuildStep::updateSummary, this, [s] { + s->detailsWidget->setSummaryText(s->step->summaryText()); + }); + + connect(s->step, &BuildStep::enabledChanged, this, [s] { + s->toolWidget->setBuildStepEnabled(s->step->enabled()); + }); - connect(s->step, &BuildStep::enabledChanged, - this, &BuildStepListWidget::updateEnabledState); // Expand new build steps by default const bool expand = newStep->hasUserExpansionState() diff --git a/src/plugins/projectexplorer/buildstepspage.h b/src/plugins/projectexplorer/buildstepspage.h index 0f8ee879ec0..f23a0d2bdde 100644 --- a/src/plugins/projectexplorer/buildstepspage.h +++ b/src/plugins/projectexplorer/buildstepspage.h @@ -98,8 +98,6 @@ public: private: void updateAddBuildStepMenu(); void addBuildStep(int pos); - void updateSummary(); - void updateEnabledState(); void stepMoved(int from, int to); void removeBuildStep(int pos); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 28f82017f29..33ecc6d0f33 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -52,6 +52,12 @@ namespace ProjectExplorer { /*! \class ProjectExplorer::TerminalAspect + \inmodule QtCreator + + \brief The TerminalAspect class lets a user specify that an executable + should be run in a separate terminal. + + The initial value is provided as a hint from the build systems. */ TerminalAspect::TerminalAspect() @@ -64,6 +70,9 @@ TerminalAspect::TerminalAspect() this, &TerminalAspect::calculateUseTerminal); } +/*! + \reimp +*/ void TerminalAspect::addToLayout(LayoutBuilder &builder) { QTC_CHECK(!m_checkBox); @@ -77,6 +86,9 @@ void TerminalAspect::addToLayout(LayoutBuilder &builder) }); } +/*! + \reimp +*/ void TerminalAspect::fromMap(const QVariantMap &map) { if (map.contains(settingsKey())) { @@ -90,6 +102,9 @@ void TerminalAspect::fromMap(const QVariantMap &map) m_checkBox->setChecked(m_useTerminal); } +/*! + \reimp +*/ void TerminalAspect::toMap(QVariantMap &data) const { if (m_userSet) @@ -114,17 +129,26 @@ void TerminalAspect::calculateUseTerminal() m_checkBox->setChecked(m_useTerminal); } +/*! + Returns whether a separate terminal should be used. +*/ bool TerminalAspect::useTerminal() const { return m_useTerminal; } +/*! + Sets the initial value to \a hint. +*/ void TerminalAspect::setUseTerminalHint(bool hint) { m_useTerminalHint = hint; calculateUseTerminal(); } +/*! + Returns whether the user set the value. +*/ bool TerminalAspect::isUserSet() const { return m_userSet; @@ -132,6 +156,10 @@ bool TerminalAspect::isUserSet() const /*! \class ProjectExplorer::WorkingDirectoryAspect + \inmodule QtCreator + + \brief The WorkingDirectoryAspect class lets the user specify a + working directory for running the executable. */ WorkingDirectoryAspect::WorkingDirectoryAspect() @@ -141,6 +169,9 @@ WorkingDirectoryAspect::WorkingDirectoryAspect() setSettingsKey("RunConfiguration.WorkingDirectory"); } +/*! + \reimp +*/ void WorkingDirectoryAspect::addToLayout(LayoutBuilder &builder) { QTC_CHECK(!m_chooser); @@ -187,6 +218,9 @@ void WorkingDirectoryAspect::resetPath() m_chooser->setFilePath(m_defaultWorkingDirectory); } +/*! + \reimp +*/ void WorkingDirectoryAspect::fromMap(const QVariantMap &map) { m_workingDirectory = FilePath::fromString(map.value(settingsKey()).toString()); @@ -199,6 +233,9 @@ void WorkingDirectoryAspect::fromMap(const QVariantMap &map) m_chooser->setFilePath(m_workingDirectory.isEmpty() ? m_defaultWorkingDirectory : m_workingDirectory); } +/*! + \reimp +*/ void WorkingDirectoryAspect::toMap(QVariantMap &data) const { const QString wd = m_workingDirectory == m_defaultWorkingDirectory @@ -207,6 +244,11 @@ void WorkingDirectoryAspect::toMap(QVariantMap &data) const data.insert(keyForDefaultWd(), m_defaultWorkingDirectory.toString()); } +/*! + Returns the selected directory. + + Macros in the value are expanded using \a expander. +*/ FilePath WorkingDirectoryAspect::workingDirectory(const MacroExpander *expander) const { const Utils::Environment env = m_envAspect ? m_envAspect->environment() @@ -222,11 +264,19 @@ FilePath WorkingDirectoryAspect::defaultWorkingDirectory() const return m_defaultWorkingDirectory; } +/*! + Returns the selected directory. + + Macros in the value are not expanded. +*/ FilePath WorkingDirectoryAspect::unexpandedWorkingDirectory() const { return m_workingDirectory; } +/*! + Sets the default value to \a defaultWorkingDir. +*/ void WorkingDirectoryAspect::setDefaultWorkingDirectory(const FilePath &defaultWorkingDir) { if (defaultWorkingDir == m_defaultWorkingDirectory) @@ -244,6 +294,9 @@ void WorkingDirectoryAspect::setDefaultWorkingDirectory(const FilePath &defaultW } } +/*! + \internal +*/ PathChooser *WorkingDirectoryAspect::pathChooser() const { return m_chooser; @@ -252,6 +305,10 @@ PathChooser *WorkingDirectoryAspect::pathChooser() const /*! \class ProjectExplorer::ArgumentsAspect + \inmodule QtCreator + + \brief The ArgumentsAspect class lets a user specify command line + arguments for an executable. */ ArgumentsAspect::ArgumentsAspect() @@ -259,8 +316,14 @@ ArgumentsAspect::ArgumentsAspect() setDisplayName(tr("Arguments")); setId("ArgumentsAspect"); setSettingsKey("RunConfiguration.Arguments"); + m_labelText = tr("Command line arguments:"); } +/*! + Returns the main value of this aspect. + + Macros in the value are expanded using \a expander. +*/ QString ArgumentsAspect::arguments(const MacroExpander *expander) const { QTC_ASSERT(expander, return m_arguments); @@ -273,11 +336,19 @@ QString ArgumentsAspect::arguments(const MacroExpander *expander) const return expanded; } +/*! + Returns the main value of this aspect. + + Macros in the value are not expanded. +*/ QString ArgumentsAspect::unexpandedArguments() const { return m_arguments; } +/*! + Sets the main value of this aspect to \a arguments. +*/ void ArgumentsAspect::setArguments(const QString &arguments) { if (arguments != m_arguments) { @@ -290,11 +361,26 @@ void ArgumentsAspect::setArguments(const QString &arguments) m_multiLineChooser->setPlainText(arguments); } +/*! + Sets the displayes label text to \a labelText. +*/ +void ArgumentsAspect::setLabelText(const QString &labelText) +{ + m_labelText = labelText; +} + +/*! + Adds a button to reset the main value of this aspect to the value + computed by \a resetter. +*/ void ArgumentsAspect::setResetter(const std::function<QString()> &resetter) { m_resetter = resetter; } +/*! + Resets the main value of this aspect. +*/ void ArgumentsAspect::resetArguments() { QString arguments; @@ -303,6 +389,9 @@ void ArgumentsAspect::resetArguments() setArguments(arguments); } +/*! + \reimp +*/ void ArgumentsAspect::fromMap(const QVariantMap &map) { QVariant args = map.value(settingsKey()); @@ -322,12 +411,18 @@ void ArgumentsAspect::fromMap(const QVariantMap &map) m_multiLineChooser->setPlainText(m_arguments); } +/*! + \reimp +*/ void ArgumentsAspect::toMap(QVariantMap &map) const { map.insert(settingsKey(), m_arguments); map.insert(settingsKey() + ".multi", m_multiLine); } +/*! + \internal +*/ QWidget *ArgumentsAspect::setupChooser() { if (m_multiLine) { @@ -348,10 +443,12 @@ QWidget *ArgumentsAspect::setupChooser() return m_chooser.data(); } +/*! + \reimp +*/ void ArgumentsAspect::addToLayout(LayoutBuilder &builder) { QTC_CHECK(!m_chooser && !m_multiLineChooser && !m_multiLineButton); - builder.addItem(tr("Command line arguments:")); const auto container = new QWidget; const auto containerLayout = new QHBoxLayout(container); @@ -394,11 +491,18 @@ void ArgumentsAspect::addToLayout(LayoutBuilder &builder) containerLayout->setAlignment(m_resetButton, Qt::AlignTop); } - builder.addItem(container); + builder.addItems({m_labelText, container}); } /*! \class ProjectExplorer::ExecutableAspect + \inmodule QtCreator + + \brief The ExecutableAspect class provides a building block to provide an + executable for a RunConfiguration. + + It combines a StringAspect that is typically updated automatically + by the build system's parsing results with an optional manual override. */ ExecutableAspect::ExecutableAspect() @@ -414,12 +518,21 @@ ExecutableAspect::ExecutableAspect() this, &ExecutableAspect::changed); } +/*! + \internal +*/ ExecutableAspect::~ExecutableAspect() { delete m_alternativeExecutable; m_alternativeExecutable = nullptr; } +/*! + Sets the display style of the paths to the default used on \a osType, + backslashes on Windows, forward slashes elsewhere. + + \sa Utils::StringAspect::setDisplayFilter() +*/ void ExecutableAspect::setExecutablePathStyle(OsType osType) { m_executable.setDisplayFilter([osType](const QString &pathName) { @@ -427,6 +540,11 @@ void ExecutableAspect::setExecutablePathStyle(OsType osType) }); } +/*! + Sets the settings key for history completion to \a historyCompleterKey. + + \sa Utils::PathChooser::setHistoryCompleter() +*/ void ExecutableAspect::setHistoryCompleter(const QString &historyCompleterKey) { m_executable.setHistoryCompleter(historyCompleterKey); @@ -434,6 +552,11 @@ void ExecutableAspect::setHistoryCompleter(const QString &historyCompleterKey) m_alternativeExecutable->setHistoryCompleter(historyCompleterKey); } +/*! + Sets the acceptable kind of path values to \a expectedKind. + + \sa Utils::PathChooser::setExpectedKind() +*/ void ExecutableAspect::setExpectedKind(const PathChooser::Kind expectedKind) { m_executable.setExpectedKind(expectedKind); @@ -441,6 +564,13 @@ void ExecutableAspect::setExpectedKind(const PathChooser::Kind expectedKind) m_alternativeExecutable->setExpectedKind(expectedKind); } +/*! + Sets the environment in which paths will be searched when the expected kind + of paths is chosen as PathChooser::Command or PathChooser::ExistingCommand + to \a env. + + \sa Utils::StringAspect::setEnvironment() +*/ void ExecutableAspect::setEnvironment(const Environment &env) { m_executable.setEnvironment(env); @@ -448,11 +578,25 @@ void ExecutableAspect::setEnvironment(const Environment &env) m_alternativeExecutable->setEnvironment(env); } +/*! + Sets the display \a style for aspect. + + \sa Utils::StringAspect::setDisplayStyle() +*/ void ExecutableAspect::setDisplayStyle(StringAspect::DisplayStyle style) { m_executable.setDisplayStyle(style); } +/*! + Makes an auto-detected executable overridable by the user. + + The \a overridingKey specifies the settings key for the user-provided executable, + the \a useOverridableKey the settings key for the fact that it + is actually overridden the user. + + \sa Utils::StringAspect::makeCheckable() +*/ void ExecutableAspect::makeOverridable(const QString &overridingKey, const QString &useOverridableKey) { QTC_ASSERT(!m_alternativeExecutable, return); @@ -466,6 +610,13 @@ void ExecutableAspect::makeOverridable(const QString &overridingKey, const QStri this, &ExecutableAspect::changed); } +/*! + Returns the path of the executable specified by this aspect. In case + the user selected a manual override this will be the value specified + by the user. + + \sa makeOverridable() + */ FilePath ExecutableAspect::executable() const { if (m_alternativeExecutable && m_alternativeExecutable->isChecked()) @@ -474,6 +625,9 @@ FilePath ExecutableAspect::executable() const return m_executable.filePath(); } +/*! + \reimp +*/ void ExecutableAspect::addToLayout(LayoutBuilder &builder) { m_executable.addToLayout(builder); @@ -481,28 +635,49 @@ void ExecutableAspect::addToLayout(LayoutBuilder &builder) m_alternativeExecutable->addToLayout(builder.finishRow()); } +/*! + Sets the label text for the main chooser to + \a labelText. + + \sa Utils::StringAspect::setLabelText() +*/ void ExecutableAspect::setLabelText(const QString &labelText) { m_executable.setLabelText(labelText); } +/*! + Sets the place holder text for the main chooser to + \a placeHolderText. + + \sa Utils::StringAspect::setPlaceHolderText() +*/ void ExecutableAspect::setPlaceHolderText(const QString &placeHolderText) { m_executable.setPlaceHolderText(placeHolderText); } +/*! + Sets the value of the main chooser to \a executable. +*/ void ExecutableAspect::setExecutable(const FilePath &executable) { m_executable.setFilePath(executable); m_executable.setShowToolTipOnLabel(true); } +/*! + Sets the settings key to \a key. +*/ void ExecutableAspect::setSettingsKey(const QString &key) { BaseAspect::setSettingsKey(key); m_executable.setSettingsKey(key); } +/*! + \reimp +*/ void ExecutableAspect::fromMap(const QVariantMap &map) { m_executable.fromMap(map); @@ -510,6 +685,9 @@ void ExecutableAspect::fromMap(const QVariantMap &map) m_alternativeExecutable->fromMap(map); } +/*! + \reimp +*/ void ExecutableAspect::toMap(QVariantMap &map) const { m_executable.toMap(map); @@ -520,6 +698,14 @@ void ExecutableAspect::toMap(QVariantMap &map) const /*! \class ProjectExplorer::UseLibraryPathsAspect + \inmodule QtCreator + + \brief The UseLibraryPathsAspect class lets a user specify whether build + library search paths should be added to the relevant environment + variables. + + This modifies DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH on Mac, PATH + on Windows and LD_LIBRARY_PATH everywhere else. */ UseLibraryPathsAspect::UseLibraryPathsAspect() @@ -538,8 +724,13 @@ UseLibraryPathsAspect::UseLibraryPathsAspect() setValue(ProjectExplorerPlugin::projectExplorerSettings().addLibraryPathsToRunEnv); } + /*! \class ProjectExplorer::UseDyldSuffixAspect + \inmodule QtCreator + + \brief The UseDyldSuffixAspect class lets a user specify whether the + DYLD_IMAGE_SUFFIX environment variable should be used on Mac. */ UseDyldSuffixAspect::UseDyldSuffixAspect() diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index 038341c4f6f..d76580698c6 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -81,7 +81,7 @@ public: Utils::FilePath workingDirectory(const Utils::MacroExpander *expander) const; Utils::FilePath defaultWorkingDirectory() const; Utils::FilePath unexpandedWorkingDirectory() const; - void setDefaultWorkingDirectory(const Utils::FilePath &defaultWorkingDir); + void setDefaultWorkingDirectory(const Utils::FilePath &defaultWorkingDirectory); Utils::PathChooser *pathChooser() const; private: @@ -111,6 +111,7 @@ public: QString unexpandedArguments() const; void setArguments(const QString &arguments); + void setLabelText(const QString &labelText); void setResetter(const std::function<QString()> &resetter); void resetArguments(); @@ -121,6 +122,7 @@ private: QWidget *setupChooser(); QString m_arguments; + QString m_labelText; QPointer<Utils::FancyLineEdit> m_chooser; QPointer<QPlainTextEdit> m_multiLineChooser; QPointer<Utils::ExpandButton> m_multiLineButton; diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index adc99837890..620b3645f70 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -52,6 +52,7 @@ #include <utils/algorithm.h> #include <utils/hostosinfo.h> +#include <utils/layoutbuilder.h> #include <utils/qtcprocess.h> #include <utils/utilsicons.h> #include <utils/variablechooser.h> @@ -81,6 +82,17 @@ QMakeStep::QMakeStep(BuildStepList *bsl, Utils::Id id) : AbstractProcessStep(bsl, id) { setLowPriority(); + + auto updateSummary = [this] { + BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit()); + if (!qtVersion) + return tr("<b>qmake:</b> No Qt version set. Cannot run qmake."); + const QString program = qtVersion->qmakeCommand().fileName(); + return tr("<b>qmake:</b> %1 %2").arg(program, project()->projectFilePath().fileName()); + }; + setSummaryUpdater(updateSummary); + + connect(target(), &Target::kitChanged, this, updateSummary); } QmakeBuildConfiguration *QMakeStep::qmakeBuildConfiguration() const @@ -532,23 +544,14 @@ QWidget *QMakeStep::createConfigWidget() abisListWidget = new QListWidget(widget); qmakeAdditonalArgumentsLineEdit->setText(m_userArgs); - auto formLayout = new QFormLayout(widget); - formLayout->addRow(label_0, buildConfigurationWidget); - formLayout->addRow(qmakeArgsLabel, qmakeAdditonalArgumentsLineEdit); - formLayout->addRow(label, qmakeArgumentsEdit); - formLayout->addRow(abisLabel, abisListWidget); + LayoutBuilder builder(widget); + builder.addRow({label_0, buildConfigurationWidget}); + builder.addRow({qmakeArgsLabel, qmakeAdditonalArgumentsLineEdit}); + builder.addRow({label, qmakeArgumentsEdit}); + builder.addRow({abisLabel, abisListWidget}); qmakeBuildConfigChanged(); - auto updateSummary = [this] { - BaseQtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit()); - if (!qtVersion) - return tr("<b>qmake:</b> No Qt version set. Cannot run qmake."); - const QString program = qtVersion->qmakeCommand().fileName(); - return tr("<b>qmake:</b> %1 %2").arg(program, project()->projectFilePath().fileName()); - }; - setSummaryUpdater(updateSummary); - updateSummary(); updateAbiWidgets(); updateEffectiveQMakeCall(); @@ -557,24 +560,27 @@ QWidget *QMakeStep::createConfigWidget() this, &QMakeStep::qmakeArgumentsLineEdited); connect(buildConfigurationComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QMakeStep::buildConfigurationSelected); + connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged, - this, [this] { + widget, [this] { linkQmlDebuggingLibraryChanged(); askForRebuild(tr("QML Debugging")); }); + connect(project(), &Project::projectLanguagesUpdated, - this, &QMakeStep::linkQmlDebuggingLibraryChanged); + widget, [this] { linkQmlDebuggingLibraryChanged(); }); connect(target(), &Target::parsingFinished, - qmakeArgumentsEdit, [this]() { updateEffectiveQMakeCall(); }); + widget, [this] { updateEffectiveQMakeCall(); }); connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::useQtQuickCompilerChanged, - this, &QMakeStep::useQtQuickCompilerChanged); + widget, [this] { useQtQuickCompilerChanged(); }); connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::separateDebugInfoChanged, - this, &QMakeStep::separateDebugInfoChanged); + widget, [this] { separateDebugInfoChanged(); }); connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmakeBuildConfigurationChanged, - this, &QMakeStep::qmakeBuildConfigChanged); - connect(target(), &Target::kitChanged, this, &QMakeStep::qtVersionChanged); - connect(target(), &Target::kitChanged, this, updateSummary); - connect(abisListWidget, &QListWidget::itemChanged, this, [this]{ + widget, [this] { qmakeBuildConfigChanged(); }); + connect(target(), &Target::kitChanged, + widget, [this] { qtVersionChanged(); }); + + connect(abisListWidget, &QListWidget::itemChanged, this, [this] { abisChanged(); if (QmakeBuildConfiguration *bc = qmakeBuildConfiguration()) BuildManager::buildLists({bc->cleanSteps()}); diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 3d09bd2d193..11be30c80e1 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -1,3 +1,8 @@ +set(QmlDesignerPluginInstallPrefix "${IDE_PLUGIN_PATH}/qmldesigner") +if (APPLE) + set(QmlDesignerPluginInstallPrefix "${IDE_PLUGIN_PATH}/QmlDesigner") +endif() + add_qtc_plugin(QmlDesigner DEPENDS QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem @@ -25,21 +30,17 @@ add_qtc_plugin(QmlDesigner settingspage.cpp settingspage.h settingspage.ui shortcutmanager.cpp shortcutmanager.h switchsplittabwidget.cpp switchsplittabwidget.h + designermcumanager.cpp designermcumanager.h EXPLICIT_MOC components/propertyeditor/propertyeditorvalue.h components/connectioneditor/connectionviewwidget.h SKIP_DEBUG_CMAKE_FILE_CHECK EXTRA_TRANSLATIONS "${PROJECT_SOURCE_DIR}/share/qtcreator/qmldesigner" + PROPERTIES + QMLDESIGNER_PLUGIN_PATH "${QmlDesignerPluginInstallPrefix}" ) -set(QmlDesignerPluginInstallPrefix "${IDE_PLUGIN_PATH}/qmldesigner") -if (APPLE) - set(QmlDesignerPluginInstallPrefix "${IDE_PLUGIN_PATH}/QmlDesigner") -endif() - -extend_qtc_plugin(QmlDesigner PROPERTIES QMLDESIGNER_PLUGIN_PATH "${QmlDesignerPluginInstallPrefix}") - add_qtc_plugin(assetexporterplugin CONDITION TARGET QmlDesigner DEPENDS Core ProjectExplorer QmlDesigner Utils Qt5::Qml diff --git a/src/plugins/qmldesigner/components/importmanager/importswidget.cpp b/src/plugins/qmldesigner/components/importmanager/importswidget.cpp index d69511acd67..283a0501150 100644 --- a/src/plugins/qmldesigner/components/importmanager/importswidget.cpp +++ b/src/plugins/qmldesigner/components/importmanager/importswidget.cpp @@ -29,6 +29,7 @@ #include <designdocument.h> #include <qmldesignerplugin.h> +#include <designermcumanager.h> #include <utils/algorithm.h> @@ -94,20 +95,20 @@ void ImportsWidget::setPossibleImports(QList<Import> possibleImports) Utils::sort(possibleImports, importLess); m_addImportComboBox->clear(); - const DesignDocument *designDocument = QmlDesignerPlugin::instance()->currentDesignDocument(); - const bool isQtForMCUs = designDocument && designDocument->isQtForMCUsProject(); + const DesignerMcuManager &mcuManager = DesignerMcuManager::instance(); + const bool isQtForMCUs = mcuManager.isMCUProject(); QList<Import> filteredImports; - const QStringList mcuPostiveList = {"QtQuick", "QtQuick.Controls", "QtQuick.Timeline"}; - const QStringList mcuNegativeList = {"FlowView"}; + const QStringList mcuAllowedList = mcuManager.allowedImports(); + const QStringList mcuBannedList = mcuManager.bannedImports(); if (isQtForMCUs) { filteredImports = Utils::filtered(possibleImports, - [mcuPostiveList, mcuNegativeList](const Import &import) { - return (mcuPostiveList.contains(import.url()) + [mcuAllowedList, mcuBannedList](const Import &import) { + return (mcuAllowedList.contains(import.url()) || !import.url().startsWith("Qt")) - && !mcuNegativeList.contains(import.url()); + && !mcuBannedList.contains(import.url()); }); } else { filteredImports = possibleImports; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp index 7f09bc0b493..a01ce38fc72 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp @@ -35,6 +35,7 @@ #include <designdocument.h> #include <qmldesignerplugin.h> +#include <designermcumanager.h> #include <utils/algorithm.h> #include <utils/qtcassert.h> @@ -200,52 +201,12 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model) forceVisiblity = isItem; } - DesignDocument *designDocument = QmlDesignerPlugin::instance() - ->documentManager() - .currentDesignDocument(); - - if (designDocument && designDocument->isQtForMCUsProject()) { - const QList<TypeName> blockTypes = {"QtQuick.AnimatedImage", - "QtQuick.BorderImage", - "QtQuick.FocusScope", - "QtQuick.TextInput", - "QtQuick.TextEdit", - "QtQuick.Flow", - "QtQuick.Grid", - "QtQuick.GridView", - "QtQuick.PathView", - "QtQuick.Controls", - "QtQuick.Controls.BusyIndicator", - "QtQuick.Controls.ButtonGroup", - "QtQuick.Controls.CheckDelegate", - "QtQuick.Controls.Container", - "QtQuick.Controls.ComboBox", - "QtQuick.Controls.DelayButton", - "QtQuick.Controls.Frame", - "QtQuick.Controls.GroupBox", - "QtQuick.Controls.ItemDelegate", - "QtQuick.Controls.Label", - "QtQuick.Controls.Page", - "QtQuick.Controls.PageIndicator", - "QtQuick.Controls.Pane", - "QtQuick.Controls.RadioDelegate", - "QtQuick.Controls.RangeSlider", - "QtQuick.Controls.RoundButton", - "QtQuick.Controls.ScrollView", - "QtQuick.Controls.SpinBox", - "QtQuick.Controls.StackView", - "QtQuick.Controls.SwipeDelegate", - "QtQuick.Controls.SwitchDelegate", - "QtQuick.Controls.ToolBar", - "QtQuick.Controls.ToolButton", - "QtQuick.Controls.TabBar", - "QtQuick.Controls.TabButton", - "QtQuick.Controls.TextArea", - "QtQuick.Controls.TextField", - "QtQuick.Controls.ToolSeparator", - "QtQuick.Controls.Tumbler"}; - - if (blockTypes.contains(entry.typeName())) + const DesignerMcuManager &mcuManager = DesignerMcuManager::instance(); + + if (mcuManager.isMCUProject()) { + const QSet<QString> blockTypes = mcuManager.bannedItems(); + + if (blockTypes.contains(QString::fromUtf8(entry.typeName()))) valid = false; } diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 8526e8a1f51..45e56011351 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -39,6 +39,7 @@ #include <qmldesignerplugin.h> #include <qmldesignerconstants.h> #include <designeractionmanager.h> +#include <designermcumanager.h> #include <utils/algorithm.h> #include <utils/flowlayout.h> @@ -351,8 +352,9 @@ void ItemLibraryWidget::reloadQmlSource() void ItemLibraryWidget::setupImportTagWidget() { QTC_ASSERT(m_model, return); - const DesignDocument *designDocument = QmlDesignerPlugin::instance()->currentDesignDocument(); - const bool isQtForMCUs = designDocument && designDocument->isQtForMCUsProject(); + + const DesignerMcuManager &mcuManager = DesignerMcuManager::instance(); + const bool isQtForMCUs = mcuManager.isMCUProject(); const QStringList imports = m_model->metaInfo().itemLibraryInfo()->showTagsForImports(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 56a17e3d11c..dd507df5ea7 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -32,6 +32,8 @@ #include <nodemetainfo.h> #include <qmldesignerplugin.h> #include <qmlobjectnode.h> +#include <designermcumanager.h> +#include <qmlitemnode.h> #include <utils/qtcassert.h> @@ -261,76 +263,12 @@ bool PropertyEditorValue::isTranslated() const return false; } -static bool itemOrImage(const QmlDesigner::NodeMetaInfo &metaInfo) +static bool isAllowedSubclassType(const QString &type, const QmlDesigner::NodeMetaInfo &metaInfo) { if (!metaInfo.isValid()) return false; - if (metaInfo.isSubclassOf("QtQuick.Image") || metaInfo.isSubclassOf("QtQuick.Text")) - return true; - - return false; -} - -static QList<QByteArray> prepareNonMcuProperties() -{ - QList<QByteArray> result; - - //Builtins: - const QList<QByteArray> itemProperties = {"layer", "opacity", "gradient", "smooth", "antialiasing", - "border", "baselineOffset", "focus", "activeFocusOnTab"}; - const QList<QByteArray> mouseAreaProperties = {"propagateComposedEvents", "preventStealing", "cursorShape", - "scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"}; - const QList<QByteArray> flickableProperties = {"boundsBehavior", "boundsMovement", - "flickDeceleration", "flickableDirection", - "leftMargin", "rightMargin", "bottomMargin", "topMargin", - "originX", "originY", - "pixelAligned", "pressDelay", "synchronousDrag"}; - const QList<QByteArray> imageProperties = {"mirror", "mipmap", "cache", "autoTransform", "asynchronous", - "sourceSize", "smooth"}; - const QList<QByteArray> textProperties = {"elide", "lineHeight", "lineHeightMode", "wrapMode", "style", - "styleColor", "minimumPointSize", "minimumPixelSize", "styleColor", - "fontSizeMode", "renderType", "textFormat", "maximumLineCount"}; - const QList<QByteArray> paddingProperties = {"bottomPadding", "topPadding", "leftPadding", "rightPadding"}; - const QList<QByteArray> columnRowProperties = {"layoutDirection"}; - const QList<QByteArray> listViewProperties = {"cacheBuffer", "highlightRangeMode", "highlightMoveDuration", - "highlightResizeDuration", "preferredHighlightBegin", "layoutDirection", - "preferredHighlightEnd", "highlightFollowsCurrentItem", "keyNavigationWraps", - "snapMode", "highlightMoveVelocity", "highlightResizeVelocity"}; - //Animations: - const QList<QByteArray> animationProperties = {"paused"}; - - //QtQuick.Controls: - const QList<QByteArray> controlProperties = {"focusPolicy", "hoverEnabled", "wheelEnabled"}; - const QList<QByteArray> abstractButtonProperties = {"display", "autoExclusive"}; - const QList<QByteArray> buttonProperties = {"flat", "highlighted"}; - const QList<QByteArray> dialProperties = {}; //nothing in propeditor - const QList<QByteArray> progressBarProperties = {"indeterminate"}; - const QList<QByteArray> radioButton = {}; //nothing in propeditor - const QList<QByteArray> sliderProperties = {"live", "snapMode", "touchDragThreshold"}; - const QList<QByteArray> swipeViewProperties = {}; //nothing in propeditor - const QList<QByteArray> switchProperties = {}; //nothing in propeditor - - result.append(itemProperties); - result.append(mouseAreaProperties); - result.append(flickableProperties); - result.append(imageProperties); - result.append(textProperties); - result.append(paddingProperties); - result.append(columnRowProperties); - result.append(listViewProperties); - result.append(animationProperties); - result.append(controlProperties); - result.append(abstractButtonProperties); - result.append(buttonProperties); - result.append(dialProperties); - result.append(progressBarProperties); - result.append(radioButton); - result.append(sliderProperties); - result.append(swipeViewProperties); - result.append(switchProperties); - - return result; + return (metaInfo.isSubclassOf(type.toUtf8())); } bool PropertyEditorValue::isAvailable() const @@ -338,31 +276,46 @@ bool PropertyEditorValue::isAvailable() const if (!m_modelNode.isValid()) return true; - const QList<QByteArray> nonMcuProperties = prepareNonMcuProperties(); - - const QByteArray fontPrefix = {"font"}; - const QList<QByteArray> nonMcuFontProperties = {"wordSpacing", "letterSpacing", "hintingPreference", - "kerning", "preferShaping", "capitalization", - "strikeout", "underline", "styleName"}; - - const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"}; - - const QList<QByteArray> list = name().split('.'); - const QByteArray pureName = list.constFirst(); - - QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() - ->documentManager() - .currentDesignDocument(); - - if (designDocument && designDocument->isQtForMCUsProject()) { - if (pureName == fontPrefix) { - if (nonMcuFontProperties.contains(list.constLast())) - return false; + const QmlDesigner::DesignerMcuManager &mcuManager = QmlDesigner::DesignerMcuManager::instance(); + + if (mcuManager.isMCUProject()) { + const QSet<QString> nonMcuProperties = mcuManager.bannedProperties(); + const auto mcuAllowedItemProperties = mcuManager.allowedItemProperties(); + const auto mcuBannedComplexProperties = mcuManager.bannedComplexProperties(); + + const QList<QByteArray> list = name().split('.'); + const QByteArray pureName = list.constFirst(); + const QString pureNameStr = QString::fromUtf8(pureName); + + const QByteArray ending = list.constLast(); + const QString endingStr = QString::fromUtf8(ending); + + //allowed item properties: + const auto itemTypes = mcuAllowedItemProperties.keys(); + for (const auto &itemType : itemTypes) { + if (isAllowedSubclassType(itemType, m_modelNode.metaInfo())) { + const QmlDesigner::DesignerMcuManager::ItemProperties allowedItemProps = + mcuAllowedItemProperties.value(itemType); + if (allowedItemProps.properties.contains(pureNameStr)) { + if (QmlDesigner::QmlItemNode::isValidQmlItemNode(m_modelNode)) { + const bool itemHasChildren = QmlDesigner::QmlItemNode(m_modelNode).hasChildren(); + + if (allowedItemProps.allowChildren == itemHasChildren) + return true; + } + } + } } - if (nonMcuProperties.contains(pureName)) + + //banned properties: + //with prefixes: + if (mcuBannedComplexProperties.value(pureNameStr).contains(endingStr)) return false; - if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo())) + + //general group: + if (nonMcuProperties.contains(pureNameStr)) return false; + } return true; diff --git a/src/plugins/qmldesigner/designermcumanager.cpp b/src/plugins/qmldesigner/designermcumanager.cpp new file mode 100644 index 00000000000..d173ab6766c --- /dev/null +++ b/src/plugins/qmldesigner/designermcumanager.cpp @@ -0,0 +1,267 @@ +/**************************************************************************** +** +** 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 "designermcumanager.h" +#include "qmldesignerconstants.h" +#include "qmldesignerplugin.h" +#include "designersettings.h" +#include "designdocument.h" + +#include <qmljs/qmljssimplereader.h> + +#include <utils/qtcassert.h> + +namespace QmlDesigner { + +static QString readProperty(const QString property, const QmlJS::SimpleReaderNode::Ptr &node) +{ + const QVariant propertyVar = node->property(property); + + if (!propertyVar.isNull() && propertyVar.isValid()) + return propertyVar.value<QString>(); + + return {}; +} + +static QStringList readPropertyList(const QString &property, const QmlJS::SimpleReaderNode::Ptr &node) +{ + const QVariant propertyVar = node->property(property); + + if (!propertyVar.isNull() && propertyVar.isValid()) + return propertyVar.value<QStringList>(); + + return {}; +} + +DesignerMcuManager &DesignerMcuManager::instance() +{ + static DesignerMcuManager instance; + + return instance; +} + +QString DesignerMcuManager::mcuResourcesPath() +{ + return Core::ICore::resourcePath() + QStringLiteral("/qmldesigner/qt4mcu"); +} + +bool DesignerMcuManager::isMCUProject() const +{ + QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() + ->documentManager().currentDesignDocument(); + if (designDocument) + return designDocument->isQtForMCUsProject(); + + return false; +} + +void DesignerMcuManager::readMetadata() +{ + const QString mainMetadataFileName = "metadata.qml"; + + m_defaultVersion = {}; + m_versionsList.clear(); + + QmlJS::SimpleReader reader; + const QmlJS::SimpleReaderNode::Ptr metadata = + reader.readFile(mcuResourcesPath() + "/" + mainMetadataFileName); + if (!metadata) { + qWarning() << "Designer MCU metadata:" << reader.errors(); + return; + } + + const QmlJS::SimpleReaderNode::List versions = metadata->children(); + + if (versions.isEmpty()) { + qWarning() << "Designer MCU metadata: metadata list is empty"; + return; + } + + const QVariant defaultVersion = metadata->property("defaultVersion"); + if (!defaultVersion.isNull() && defaultVersion.isValid()) { + for (const auto& version : versions) { + Version newVersion; + + const QVariant vId = version->property("id"); + if (vId.isNull() || !vId.isValid()) + continue; + + const QVariant vName = version->property("name"); + if (!vName.isNull() && vName.isValid()) + newVersion.name = vName.value<QString>(); + else + continue; + + const QVariant vPath = version->property("path"); + if (!vPath.isNull() && vPath.isValid()) + newVersion.fileName = vPath.value<QString>(); + else + continue; + + m_versionsList.push_back(newVersion); + + if (vId == defaultVersion) + m_defaultVersion = newVersion; + } + } +} + +void DesignerMcuManager::readVersionData(const DesignerMcuManager::Version &version) +{ + m_currentVersion = {}; + m_bannedItems.clear(); + m_allowedImports.clear(); + m_bannedImports.clear(); + m_bannedProperties.clear(); + m_allowedItemProperties.clear(); + m_bannedComplexProperties.clear(); + + QmlJS::SimpleReader reader; + const QmlJS::SimpleReaderNode::Ptr versionData = + reader.readFile(mcuResourcesPath() + "/" + version.fileName); + if (!versionData) { + qWarning() << "Designer MCU metadata:" << reader.errors(); + return; + } + + const QmlJS::SimpleReaderNode::List info = versionData->children(); + + if (info.isEmpty()) { + qWarning() << "Designer MCU metadata: metadata list is empty"; + return; + } + + for (const auto& child : info) { + //handling specific item types: + if (child->name() == "ComplexProperty") { + if (child->propertyNames().contains("prefix") + && child->propertyNames().contains("bannedProperties")) { + const QString complexPropPrefix(readProperty("prefix", child)); + const QStringList complexPropBans(readPropertyList("bannedProperties", child)); + + if (!complexPropPrefix.isEmpty() && !complexPropBans.isEmpty()) + m_bannedComplexProperties.insert(complexPropPrefix, complexPropBans); + } + + continue; + } + + //handling allowed properties: + if (child->propertyNames().contains("allowedProperties")) { + ItemProperties allowedProperties; + + const QVariant childrenPropertyVar = child->property("allowChildren"); + + if (!childrenPropertyVar.isNull() && childrenPropertyVar.isValid()) + allowedProperties.allowChildren = childrenPropertyVar.toBool(); + + allowedProperties.properties = readPropertyList("allowedProperties", child); + + if (!allowedProperties.properties.isEmpty()) + m_allowedItemProperties.insert(child->name(), allowedProperties); + } + + //handling banned properties: + const QStringList bannedProperties = readPropertyList("bannedProperties", child); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + m_bannedProperties.unite(QSet<QString>(bannedProperties.begin(), bannedProperties.end())); +#elif + m_bannedProperties.unite(QSet<QString>::fromList(bannedProperties)); +#endif + + } + + const QList<QString> bannedItems = readPropertyList("bannedItems", versionData); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + m_bannedItems = QSet<QString>(bannedItems.begin(), bannedItems.end()); +#elif + m_bannedItems = QSet<QString>::fromList(bannedItems); +#endif + + m_allowedImports = readPropertyList("allowedImports", versionData); + m_bannedImports = readPropertyList("bannedImports", versionData); + m_currentVersion = version; +} + +DesignerMcuManager::Version DesignerMcuManager::currentVersion() const +{ + return m_currentVersion; +} + +DesignerMcuManager::Version DesignerMcuManager::defaultVersion() const +{ + return m_defaultVersion; +} + +DesignerMcuManager::VersionsList DesignerMcuManager::versions() const +{ + return m_versionsList; +} + +QSet<QString> DesignerMcuManager::bannedItems() const +{ + return m_bannedItems; +} + +QSet<QString> DesignerMcuManager::bannedProperties() const +{ + return m_bannedProperties; +} + +QStringList DesignerMcuManager::allowedImports() const +{ + return m_allowedImports; +} + +QStringList DesignerMcuManager::bannedImports() const +{ + return m_bannedImports; +} + +QHash<QString, DesignerMcuManager::ItemProperties> DesignerMcuManager::allowedItemProperties() const +{ + return m_allowedItemProperties; +} + +QHash<QString, QStringList> DesignerMcuManager::bannedComplexProperties() const +{ + return m_bannedComplexProperties; +} + +DesignerMcuManager::DesignerMcuManager() +{ + readMetadata(); + + readVersionData(m_defaultVersion); +} + +DesignerMcuManager::~DesignerMcuManager() +{ + +} + +} // QmlDesigner diff --git a/src/plugins/qmldesigner/designermcumanager.h b/src/plugins/qmldesigner/designermcumanager.h new file mode 100644 index 00000000000..74f578afae2 --- /dev/null +++ b/src/plugins/qmldesigner/designermcumanager.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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 <coreplugin/icore.h> + +#include <QString> +#include <QStringList> +#include <QSet> +#include <QHash> + +namespace QmlDesigner { + +class DesignerMcuManager +{ +public: + struct Version { + QString name; + QString fileName; + }; + using VersionsList = QList<Version>; + + struct ItemProperties { + QStringList properties; + bool allowChildren = true; + }; + + static DesignerMcuManager& instance(); + + static QString mcuResourcesPath(); + + bool isMCUProject() const; + + void readMetadata(); + void readVersionData(const DesignerMcuManager::Version &version); + + DesignerMcuManager::Version currentVersion() const; + DesignerMcuManager::Version defaultVersion() const; + DesignerMcuManager::VersionsList versions() const; + + QSet<QString> bannedItems() const; + QSet<QString> bannedProperties() const; + + QStringList allowedImports() const; + QStringList bannedImports() const; + + QHash<QString, ItemProperties> allowedItemProperties() const; + QHash<QString, QStringList> bannedComplexProperties() const; + + DesignerMcuManager(DesignerMcuManager const&) = delete; + void operator=(DesignerMcuManager const&) = delete; + +private: + DesignerMcuManager(); + ~DesignerMcuManager(); + +private: + DesignerMcuManager::Version m_currentVersion; + DesignerMcuManager::Version m_defaultVersion; + + QSet<QString> m_bannedItems; + QSet<QString> m_bannedProperties; + QStringList m_allowedImports; + QStringList m_bannedImports; + QHash<QString, ItemProperties> m_allowedItemProperties; + QHash<QString, QStringList> m_bannedComplexProperties; + + DesignerMcuManager::VersionsList m_versionsList; + +}; + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pri b/src/plugins/qmldesigner/qmldesignerplugin.pri index 9eba4c9a811..8c99395c58d 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.pri +++ b/src/plugins/qmldesigner/qmldesignerplugin.pri @@ -10,7 +10,8 @@ HEADERS += $$PWD/qmldesignerconstants.h \ $$PWD/documentmanager.h \ $$PWD/documentwarningwidget.h \ $$PWD/qmldesignericons.h \ - $$PWD/openuiqmlfiledialog.h + $$PWD/openuiqmlfiledialog.h \ + $$PWD/designermcumanager.h SOURCES += $$PWD/qmldesignerplugin.cpp \ $$PWD/shortcutmanager.cpp \ @@ -22,7 +23,8 @@ SOURCES += $$PWD/qmldesignerplugin.cpp \ $$PWD/designmodecontext.cpp \ $$PWD/documentmanager.cpp \ $$PWD/documentwarningwidget.cpp \ - $$PWD/openuiqmlfiledialog.cpp + $$PWD/openuiqmlfiledialog.cpp \ + $$PWD/designermcumanager.cpp FORMS += $$PWD/settingspage.ui \ $$PWD/openuiqmlfiledialog.ui diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index f95f853c7d6..ea57599bd08 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -928,6 +928,8 @@ Project { "settingspage.ui", "shortcutmanager.cpp", "shortcutmanager.h", + "designermcumanager.cpp", + "designermcumanager.h", ] } } diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp index 616678d8557..75d26a02155 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp @@ -217,6 +217,8 @@ SwitchLanguageComboboxAction::SwitchLanguageComboboxAction(QObject *parent) QWidget *SwitchLanguageComboboxAction::createWidget(QWidget *parent) { QPointer<QComboBox> comboBox = new QComboBox(parent); + // FIXME: this combobox does not work at the moment + comboBox->setDisabled(true); const QString toolTip(tr("Switch the language used by preview.")); comboBox->setToolTip(toolTip); comboBox->addItem(tr("Default")); diff --git a/src/plugins/qmlpreview/qmldebugtranslationclient.cpp b/src/plugins/qmlpreview/qmldebugtranslationclient.cpp index d62d3d0d204..6ebc13d8f8a 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationclient.cpp +++ b/src/plugins/qmlpreview/qmldebugtranslationclient.cpp @@ -36,24 +36,24 @@ QmlDebugTranslationClient::QmlDebugTranslationClient(QmlDebug::QmlDebugConnectio { } -void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &locale) +void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &localeIsoCode) { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(ChangeLanguage) << url << locale; + packet << static_cast<qint8>(Command::ChangeLanguage) << url << localeIsoCode; sendMessage(packet.data()); } void QmlDebugTranslationClient::changeWarningColor(const QColor &warningColor) { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(ChangeWarningColor) << warningColor; + packet << static_cast<qint8>(Command::ChangeWarningColor) << warningColor; sendMessage(packet.data()); } void QmlDebugTranslationClient::changeElidedTextWarningString(const QString &warningString) { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(ChangeElidedTextWarningString) << warningString; + packet << static_cast<qint8>(Command::ChangeElidedTextWarningString) << warningString; sendMessage(packet.data()); } @@ -68,21 +68,21 @@ void QmlDebugTranslationClient::changeElideWarning(bool elideWarning) void QmlDebugTranslationClient::setDebugTranslationServiceLogFile(const QString &logFilePath) { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(SetDebugTranslationServiceLogFile) << logFilePath; + packet << static_cast<qint8>(Command::SetDebugTranslationServiceLogFile) << logFilePath; sendMessage(packet.data()); } void QmlDebugTranslationClient::enableElidedTextWarning() { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(EnableElidedTextWarning); + packet << static_cast<qint8>(Command::EnableElidedTextWarning); sendMessage(packet.data()); } void QmlDebugTranslationClient::disableElidedTextWarning() { QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(DisableElidedTextWarning); + packet << static_cast<qint8>(Command::DisableElidedTextWarning); sendMessage(packet.data()); } @@ -91,7 +91,7 @@ void QmlDebugTranslationClient::messageReceived(const QByteArray &data) QmlDebug::QPacket packet(dataStreamVersion(), data); qint8 command; packet >> command; - qDebug() << "invalid command" << command; + qDebug() << Q_FUNC_INFO << "invalid command" << command; } void QmlDebugTranslationClient::stateChanged(QmlDebug::QmlDebugClient::State state) diff --git a/src/plugins/qmlpreview/qmldebugtranslationclient.h b/src/plugins/qmlpreview/qmldebugtranslationclient.h index 2b69e99b0a6..db00b6f0056 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationclient.h +++ b/src/plugins/qmlpreview/qmldebugtranslationclient.h @@ -35,19 +35,20 @@ class QMLPREVIEW_EXPORT QmlDebugTranslationClient : public QmlDebug::QmlDebugCli Q_OBJECT public: //needs to be in sync with QQmlDebugTranslationClient in qtdeclarative/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.h - enum Command { + enum class Command { ChangeLanguage, + MissingTranslationsChecked, + EnableElidedTextWarning, + DisableElidedTextWarning, ChangeWarningColor, ChangeElidedTextWarningString, SetDebugTranslationServiceLogFile, - EnableElidedTextWarning, - DisableElidedTextWarning, TestAllLanguages }; explicit QmlDebugTranslationClient(QmlDebug::QmlDebugConnection *connection); - void changeLanguage(const QUrl &url, const QString &locale); + void changeLanguage(const QUrl &url, const QString &localeIsoCode); void changeWarningColor(const QColor &warningColor); void changeElidedTextWarningString(const QString &warningString); //is QByteArray better here? void changeElideWarning(bool elideWarning); diff --git a/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp b/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp index b9d289a0106..d1c7c9f2891 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp +++ b/src/plugins/qmlpreview/qmldebugtranslationwidget.cpp @@ -91,8 +91,9 @@ QObject *getPreviewPlugin() namespace QmlPreview { -QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent) +QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent, TestLanguageGetter languagesGetterMethod) : QWidget(parent) + , m_testLanguagesGetter(languagesGetterMethod) { auto mainLayout = new QVBoxLayout(this); @@ -124,6 +125,7 @@ QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent) layout()->addWidget(elideWarningCheckBox); connect(elideWarningCheckBox, &QCheckBox::stateChanged, [this] (int state) { m_elideWarning = (state == Qt::Checked); + }); auto controlLayout = new QHBoxLayout; @@ -232,6 +234,7 @@ void QmlDebugTranslationWidget::updateStartupProjectTranslations() void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Project *project) { + m_testLanguages.clear(); for (int i = m_selectLanguageLayout->count()-1; i >= 0; --i) { auto layoutItem = m_selectLanguageLayout->takeAt(i); delete layoutItem->widget(); @@ -244,28 +247,23 @@ void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Proje connect(multiLanguageAspect, &QmlProjectManager::QmlMultiLanguageAspect::changed, this, &QmlDebugTranslationWidget::updateStartupProjectTranslations, Qt::UniqueConnection); + auto languageLabel = new QLabel(); + languageLabel->setText(tr("Select which language should be tested:")); + m_selectLanguageLayout->addWidget(languageLabel); if (multiLanguageAspect->value()) { - m_selectLanguageLayout->addWidget(new QLabel( - tr("Current language is \'<b>%1</b>\' can be changed in the 'Translation' tab.") - .arg(multiLanguageAspect->currentLocale()))); - m_testLanguages.clear(); - m_testLanguages.append(multiLanguageAspect->currentLocale()); - } else { - m_selectLanguageLayout->addWidget(new QLabel(tr("Select which language should be tested:"))); - QString errorMessage; - for (auto language : project->availableQmlPreviewTranslations(&errorMessage)) { - auto languageCheckBox = new QCheckBox(language); - m_selectLanguageLayout->addWidget(languageCheckBox); - connect(languageCheckBox, &QCheckBox::stateChanged, [this, language] (int state) { - if (state == Qt::Checked) - m_testLanguages.append(language); - else - m_testLanguages.removeAll(language); + addLanguageCheckBoxes({multiLanguageAspect->currentLocale()}); + if (m_testLanguagesGetter) { + auto addTestLanguages = new QPushButton(tr("Add Test Languages")); + m_selectLanguageLayout->addWidget(addTestLanguages); + connect(addTestLanguages, &QPushButton::clicked, [this]() { + addLanguageCheckBoxes(m_testLanguagesGetter()); }); - languageCheckBox->setChecked(true); } - m_selectLanguageLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); + } else { + QString errorMessage; + addLanguageCheckBoxes(project->availableQmlPreviewTranslations(&errorMessage)); } + m_selectLanguageLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); } } @@ -298,14 +296,16 @@ void QmlDebugTranslationWidget::runTest() int timerCounter = 1; const auto testLanguageList = m_testLanguages; + if (m_elideWarning) + previewPlugin->changeElideWarning(true); + auto testLanguages = [previewPlugin, runControl, testLanguageList](int timerCounter, const QString &previewedFile) { - qDebug() << "testLanguages" << previewedFile; for (auto language : testLanguageList) { QTimer::singleShot(timerCounter * 1000, previewPlugin, [previewPlugin, runControl, language, previewedFile]() { if (runControl && runControl->isRunning()) { if (!previewedFile.isEmpty()) previewPlugin->setPreviewedFile(previewedFile); - previewPlugin->setLocale(language); + previewPlugin->setLocaleIsoCode(language); } }); } @@ -319,7 +319,7 @@ void QmlDebugTranslationWidget::runTest() //delete m_currentRunControl; // who deletes the runcontrol? m_currentRunControl = nullptr; if (auto previewPlugin = qobject_cast<Internal::QmlPreviewPlugin*>(getPreviewPlugin())) - previewPlugin->setLocale(m_lastUsedLanguageBeforeTest); + previewPlugin->setLocaleIsoCode(m_lastUsedLanguageBeforeTest); }); connect(runControl, &ProjectExplorer::RunControl::appendMessage, @@ -332,7 +332,7 @@ void QmlDebugTranslationWidget::runTest() if (auto runConfiguration = target->activeRunConfiguration()) { runControl->setRunConfiguration(runConfiguration); if (runControl->createMainWorker()) { - previewPlugin->setLocale(QString()); + previewPlugin->setLocaleIsoCode(QString()); runControl->initiateStart(); } } @@ -399,7 +399,7 @@ void QmlDebugTranslationWidget::appendMessage(const QString &message, Utils::Out return; } const QString serviceSeperator = ": QQmlDebugTranslationService: "; - if (!message.contains(serviceSeperator) || message.contains("DebugTranslation service - language changed")) + if (!message.contains(serviceSeperator)) return; QString locationString = message; locationString = locationString.split(serviceSeperator).first(); @@ -449,4 +449,19 @@ QString QmlDebugTranslationWidget::runButtonText(bool isRunning) return tr("Run language tests"); } +void QmlDebugTranslationWidget::addLanguageCheckBoxes(const QStringList &languages) +{ + for (auto language : languages) { + auto languageCheckBox = new QCheckBox(language); + m_selectLanguageLayout->addWidget(languageCheckBox); + connect(languageCheckBox, &QCheckBox::stateChanged, [this, language] (int state) { + if (state == Qt::Checked) + m_testLanguages.append(language); + else + m_testLanguages.removeAll(language); + }); + languageCheckBox->setChecked(true); + } +} + } // namespace QmlPreview diff --git a/src/plugins/qmlpreview/qmldebugtranslationwidget.h b/src/plugins/qmlpreview/qmldebugtranslationwidget.h index 944c7a59b93..7ea0760ac0f 100644 --- a/src/plugins/qmlpreview/qmldebugtranslationwidget.h +++ b/src/plugins/qmlpreview/qmldebugtranslationwidget.h @@ -51,11 +51,13 @@ namespace QmlPreview { class ProjectFileSelectionsWidget; + class QMLPREVIEW_EXPORT QmlDebugTranslationWidget : public QWidget { + using TestLanguageGetter = std::function<QStringList()>; Q_OBJECT public: - explicit QmlDebugTranslationWidget(QWidget *parent = nullptr); + explicit QmlDebugTranslationWidget(QWidget *parent = nullptr, TestLanguageGetter languagesGetterMethod = {}); ~QmlDebugTranslationWidget() override; void setCurrentFile(const Utils::FilePath &filepath); @@ -75,6 +77,7 @@ private: QString singleFileButtonText(const QString &filePath); QString runButtonText(bool isRunning = false); + void addLanguageCheckBoxes(const QStringList &languages); QStringList m_testLanguages; QString m_lastUsedLanguageBeforeTest; @@ -94,6 +97,7 @@ private: QString m_lastDir; QHBoxLayout *m_selectLanguageLayout; + TestLanguageGetter m_testLanguagesGetter; }; } // namespace QmlPreview diff --git a/src/plugins/qmlpreview/qmlpreviewclient.cpp b/src/plugins/qmlpreview/qmlpreviewclient.cpp index ae89d75d4aa..6580833810c 100644 --- a/src/plugins/qmlpreview/qmlpreviewclient.cpp +++ b/src/plugins/qmlpreview/qmlpreviewclient.cpp @@ -56,13 +56,6 @@ void QmlPreviewClient::zoom(float zoomFactor) sendMessage(packet.data()); } -void QmlPreviewClient::language(const QUrl &context, const QString &locale) -{ - QmlDebug::QPacket packet(dataStreamVersion()); - packet << static_cast<qint8>(Language) << context << locale; - sendMessage(packet.data()); -} - void QmlPreviewClient::announceFile(const QString &path, const QByteArray &contents) { QmlDebug::QPacket packet(dataStreamVersion()); diff --git a/src/plugins/qmlpreview/qmlpreviewclient.h b/src/plugins/qmlpreview/qmlpreviewclient.h index 4e84f6b3ee5..fdb7e3cd63e 100644 --- a/src/plugins/qmlpreview/qmlpreviewclient.h +++ b/src/plugins/qmlpreview/qmlpreviewclient.h @@ -43,8 +43,7 @@ public: Directory, ClearCache, Zoom, - Fps, - Language + Fps }; struct FpsInfo { @@ -64,7 +63,6 @@ public: void loadUrl(const QUrl &url); void rerun(); void zoom(float zoomFactor); - void language(const QUrl &context, const QString &locale); void announceFile(const QString &path, const QByteArray &contents); void announceDirectory(const QString &path, const QStringList &entries); void announceError(const QString &path); diff --git a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp index 7da4bdea13f..ca125908ad3 100644 --- a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp +++ b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.cpp @@ -36,16 +36,14 @@ namespace QmlPreview { namespace Internal { -QmlPreviewConnectionManager::~QmlPreviewConnectionManager() -{ -} - QmlPreviewConnectionManager::QmlPreviewConnectionManager(QObject *parent) : QmlDebug::QmlDebugConnectionManager(parent) { setTarget(nullptr); } +QmlPreviewConnectionManager::~QmlPreviewConnectionManager() = default; + void QmlPreviewConnectionManager::setTarget(ProjectExplorer::Target *target) { QtSupport::BaseQtVersion::populateQmlFileFinder(&m_projectFileFinder, target); @@ -117,13 +115,11 @@ void QmlPreviewConnectionManager::createDebugTranslationClient() { m_qmlDebugTranslationClient = new QmlDebugTranslationClient(connection()); connect(this, &QmlPreviewConnectionManager::language, - m_qmlDebugTranslationClient.data(), [this](const QString &locale) { - - if (m_lastLoadedUrl.isEmpty()) { - // findValidI18nDirectoryAsUrl does not work if we didn't load any file - m_initLocale = locale; - } else { - // service expects a context URL. + m_qmlDebugTranslationClient, [this](const QString &locale) { + m_lastUsedLanguage = locale; + // findValidI18nDirectoryAsUrl does not work if we didn't load any file + // service expects a context URL. + if (!m_lastLoadedUrl.isEmpty()) { // Search the parent directories of the last loaded URL for i18n files. m_qmlDebugTranslationClient->changeLanguage(findValidI18nDirectoryAsUrl(locale), locale); } @@ -159,10 +155,9 @@ void QmlPreviewConnectionManager::createPreviewClient() m_lastLoadedUrl = m_targetFileFinder.findUrl(filename); m_qmlPreviewClient->loadUrl(m_lastLoadedUrl); - if (!m_initLocale.isEmpty()) { - emit language(m_initLocale); - m_initLocale.clear(); - } + // emit language after a file was loaded and do it every time, + // because this also triggers the check for missing translations + emit language(m_lastUsedLanguage); }); connect(this, &QmlPreviewConnectionManager::rerun, @@ -171,19 +166,6 @@ void QmlPreviewConnectionManager::createPreviewClient() connect(this, &QmlPreviewConnectionManager::zoom, m_qmlPreviewClient.data(), &QmlPreviewClient::zoom); - connect(this, &QmlPreviewConnectionManager::language, - m_qmlPreviewClient.data(), [this](const QString &locale) { - - if (m_lastLoadedUrl.isEmpty()) { - // findValidI18nDirectoryAsUrl does not work if we didn't load any file - m_initLocale = locale; - } else { - // service expects a context URL. - // Search the parent directories of the last loaded URL for i18n files. - m_qmlPreviewClient->language(findValidI18nDirectoryAsUrl(locale), locale); - } - }); - connect(m_qmlPreviewClient.data(), &QmlPreviewClient::pathRequested, this, [this](const QString &path) { const bool found = m_projectFileFinder.findFileOrDirectory( diff --git a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h index 7693eda6950..c63db57343c 100644 --- a/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h +++ b/src/plugins/qmlpreview/qmlpreviewconnectionmanager.h @@ -76,10 +76,10 @@ private: QPointer<QmlDebugTranslationClient> m_qmlDebugTranslationClient; Utils::FileSystemWatcher m_fileSystemWatcher; QUrl m_lastLoadedUrl; + QString m_lastUsedLanguage; QmlPreviewFileLoader m_fileLoader = nullptr; QmlPreviewFileClassifier m_fileClassifier = nullptr; QmlPreviewFpsHandler m_fpsHandler = nullptr; - QString m_initLocale; }; } // namespace Internal diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.cpp b/src/plugins/qmlpreview/qmlpreviewplugin.cpp index ffae9a1815a..f331d96b502 100644 --- a/src/plugins/qmlpreview/qmlpreviewplugin.cpp +++ b/src/plugins/qmlpreview/qmlpreviewplugin.cpp @@ -150,8 +150,8 @@ public: QmlPreview::QmlPreviewFileClassifier m_fileClassifer = nullptr; float m_zoomFactor = -1.0; QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr; - QString m_locale; - bool elideWarning = false; + QString m_localeIsoCode; + bool m_translationElideWarning = false; QPointer<QmlDebugTranslationWidget> m_qmlDebugTranslationWidget; RunWorkerFactory localRunWorkerFactory{ @@ -163,8 +163,15 @@ public: RunWorkerFactory runWorkerFactory{ [this](RunControl *runControl) { - QmlPreviewRunner *runner = new QmlPreviewRunner(runControl, m_fileLoader, m_fileClassifer, - m_fpsHandler, m_zoomFactor); + QmlPreviewRunner *runner = new QmlPreviewRunner(QmlPreviewRunnerSetting{ + runControl, + m_fileLoader, + m_fileClassifer, + m_fpsHandler, + m_zoomFactor, + m_localeIsoCode, + m_translationElideWarning + }); connect(q, &QmlPreviewPlugin::updatePreviews, runner, &QmlPreviewRunner::loadFile); connect(q, &QmlPreviewPlugin::rerunPreviews, @@ -173,7 +180,7 @@ public: this, &QmlPreviewPluginPrivate::previewCurrentFile); connect(q, &QmlPreviewPlugin::zoomFactorChanged, runner, &QmlPreviewRunner::zoom); - connect(q, &QmlPreviewPlugin::localeChanged, + connect(q, &QmlPreviewPlugin::localeIsoCodeChanged, runner, &QmlPreviewRunner::language); connect(q, &QmlPreviewPlugin::elideWarningChanged, runner, &QmlPreviewRunner::changeElideWarning); @@ -207,7 +214,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent) &QAction::setEnabled); connect(action, &QAction::triggered, this, [this]() { if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current()) - m_locale = multiLanguageAspect->currentLocale(); + m_localeIsoCode = multiLanguageAspect->currentLocale(); ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE); }); @@ -387,30 +394,31 @@ void QmlPreviewPlugin::setFpsHandler(QmlPreviewFpsHandler fpsHandler) emit fpsHandlerChanged(d->m_fpsHandler); } -QString QmlPreviewPlugin::locale() const +QString QmlPreviewPlugin::localeIsoCode() const { - return d->m_locale; + return d->m_localeIsoCode; } -void QmlPreviewPlugin::setLocale(const QString &locale) +void QmlPreviewPlugin::setLocaleIsoCode(const QString &localeIsoCode) { if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current()) - multiLanguageAspect->setCurrentLocale(locale); - if (d->m_locale == locale) + multiLanguageAspect->setCurrentLocale(localeIsoCode); + if (d->m_localeIsoCode == localeIsoCode) return; - d->m_locale = locale; - emit localeChanged(d->m_locale); + d->m_localeIsoCode = localeIsoCode; + emit localeIsoCodeChanged(d->m_localeIsoCode); } bool QmlPreviewPlugin::elideWarning() const { - return d->elideWarning; + return d->m_translationElideWarning; } void QmlPreviewPlugin::changeElideWarning(bool elideWarning) { - d->elideWarning = elideWarning; + d->m_translationElideWarning = elideWarning; + emit elideWarningChanged(elideWarning); } void QmlPreviewPlugin::setFileLoader(QmlPreviewFileLoader fileLoader) diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.h b/src/plugins/qmlpreview/qmlpreviewplugin.h index 13146105ac9..b2455b10773 100644 --- a/src/plugins/qmlpreview/qmlpreviewplugin.h +++ b/src/plugins/qmlpreview/qmlpreviewplugin.h @@ -58,7 +58,7 @@ class QmlPreviewPlugin : public ExtensionSystem::IPlugin Q_PROPERTY(QmlPreview::QmlPreviewFpsHandler fpsHandler READ fpsHandler WRITE setFpsHandler NOTIFY fpsHandlerChanged) Q_PROPERTY(float zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged) - Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged) + Q_PROPERTY(QString localeIsoCode READ localeIsoCode WRITE setLocaleIsoCode NOTIFY localeIsoCodeChanged) Q_PROPERTY(bool elideWarning READ elideWarning WRITE changeElideWarning NOTIFY elideWarningChanged) public: @@ -84,8 +84,8 @@ public: QmlPreview::QmlPreviewFpsHandler fpsHandler() const; void setFpsHandler(QmlPreview::QmlPreviewFpsHandler fpsHandler); - QString locale() const; - void setLocale(const QString &locale); + QString localeIsoCode() const; + void setLocaleIsoCode(const QString &localeIsoCode); bool elideWarning() const; void changeElideWarning(bool elideWarning); @@ -103,7 +103,7 @@ signals: void fpsHandlerChanged(QmlPreview::QmlPreviewFpsHandler fpsHandler); void zoomFactorChanged(float zoomFactor); - void localeChanged(const QString &locale); + void localeIsoCodeChanged(const QString &localeIsoCode); void elideWarningChanged(bool elideWarning); private: diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index 518e33794fb..a1b667b78b2 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -45,17 +45,13 @@ namespace QmlPreview { static const QString QmlServerUrl = "QmlServerUrl"; -QmlPreviewRunner::QmlPreviewRunner(ProjectExplorer::RunControl *runControl, - QmlPreviewFileLoader fileLoader, - QmlPreviewFileClassifier fileClassifier, - QmlPreviewFpsHandler fpsHandler, - float initialZoom) - : RunWorker(runControl) +QmlPreviewRunner::QmlPreviewRunner(const QmlPreviewRunnerSetting &settings) + : RunWorker(settings.runControl) { setId("QmlPreviewRunner"); - m_connectionManager.setFileLoader(fileLoader); - m_connectionManager.setFileClassifier(fileClassifier); - m_connectionManager.setFpsHandler(fpsHandler); + m_connectionManager.setFileLoader(settings.fileLoader); + m_connectionManager.setFileClassifier(settings.fileClassifier); + m_connectionManager.setFpsHandler(settings.fpsHandler); connect(this, &QmlPreviewRunner::loadFile, &m_connectionManager, &Internal::QmlPreviewConnectionManager::loadFile); @@ -70,24 +66,29 @@ QmlPreviewRunner::QmlPreviewRunner(ProjectExplorer::RunControl *runControl, &m_connectionManager, &Internal::QmlPreviewConnectionManager::changeElideWarning); connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::connectionOpened, - this, [this, initialZoom]() { - if (initialZoom > 0) - emit zoom(initialZoom); + this, [this, settings]() { + if (settings.zoom > 0) + emit zoom(settings.zoom); + if (!settings.language.isEmpty()) + emit language(settings.language); + if (settings.translationElideWarning) + emit changeElideWarning(true); + emit ready(); }); connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::restart, - runControl, [this, runControl]() { - if (!runControl->isRunning()) + runControl(), [this]() { + if (!runControl()->isRunning()) return; - this->connect(runControl, &ProjectExplorer::RunControl::stopped, runControl, [runControl]() { + this->connect(runControl(), &ProjectExplorer::RunControl::stopped, [this]() { ProjectExplorer::ProjectExplorerPlugin::runRunConfiguration( - runControl->runConfiguration(), + runControl()->runConfiguration(), ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE, true); }); - runControl->initiateStop(); + runControl()->initiateStop(); }); } diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.h b/src/plugins/qmlpreview/qmlpreviewruncontrol.h index 38740b31a39..c5171e22488 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.h +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.h @@ -32,14 +32,22 @@ namespace QmlPreview { +struct QmlPreviewRunnerSetting { + ProjectExplorer::RunControl *runControl = nullptr; + QmlPreviewFileLoader fileLoader; + QmlPreviewFileClassifier fileClassifier; + QmlPreviewFpsHandler fpsHandler; + float zoom = 1.0; + QString language; + bool translationElideWarning = false; +}; + class QmlPreviewRunner : public ProjectExplorer::RunWorker { Q_OBJECT public: - QmlPreviewRunner(ProjectExplorer::RunControl *runControl, QmlPreviewFileLoader fileLoader, - QmlPreviewFileClassifier fileClassifier, QmlPreviewFpsHandler fpsHandler, - float initialZoom); + QmlPreviewRunner(const QmlPreviewRunnerSetting &settings); void setServerUrl(const QUrl &serverUrl); QUrl serverUrl() const; diff --git a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp index 12d8f317288..9aec2d6cc66 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp +++ b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.cpp @@ -91,24 +91,6 @@ void QmlPreviewClientTest::testZoom() QVERIFY(packet.atEnd()); } -void QmlPreviewClientTest::testLanguate() -{ - TestableQmlPreviewClient client; - QUrl url("file:///some/file.qml"); - QString locale("qt_QT"); - client.language(url, locale); - QCOMPARE(client.messages.count(), 1); - QmlDebug::QPacket packet(client.dataStreamVersion(), client.messages.takeFirst()); - qint8 command; - QUrl resultUrl; - QString resultLocale; - packet >> command >> resultUrl >> resultLocale; - QCOMPARE(static_cast<QmlPreviewClient::Command>(command), QmlPreviewClient::Language); - QCOMPARE(resultUrl, url); - QCOMPARE(resultLocale, locale); - QVERIFY(packet.atEnd()); -} - void QmlPreviewClientTest::testMessageReceived() { TestableQmlPreviewClient client; diff --git a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h index e5e1ad089e6..43ae0030036 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h +++ b/src/plugins/qmlpreview/tests/qmlpreviewclient_test.h @@ -36,7 +36,6 @@ private slots: void testLoadFile(); void testAnnounceFile(); void testZoom(); - void testLanguate(); void testMessageReceived(); }; diff --git a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp index 9ca2f38b08d..0e3306f15df 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp +++ b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.cpp @@ -78,21 +78,6 @@ void QmlPreviewPluginTest::testZoomFactorProperty() QCOMPARE(spy.count(), 2); } -void QmlPreviewPluginTest::testLocaleProperty() -{ - ExtensionSystem::IPlugin *plugin = getPlugin(); - QVERIFY(plugin); - - QSignalSpy spy(plugin, SIGNAL(localeChanged(QString))); - - QCOMPARE(plugin->property("locale").toString(), QString()); - plugin->setProperty("locale", "de_DE"); - QCOMPARE(plugin->property("locale").toString(), QString("de_DE")); - plugin->setProperty("locale", "qt_QT"); - QCOMPARE(plugin->property("locale").toString(), QString("qt_QT")); - QCOMPARE(spy.count(), 2); -} - void QmlPreviewPluginTest::testFpsHandlerProperty() { ExtensionSystem::IPlugin *plugin = getPlugin(); diff --git a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h index ce3cef1dfcc..8ceeb6669ca 100644 --- a/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h +++ b/src/plugins/qmlpreview/tests/qmlpreviewplugin_test.h @@ -42,7 +42,6 @@ public: private slots: void testFileLoaderProperty(); void testZoomFactorProperty(); - void testLocaleProperty(); void testFpsHandlerProperty(); }; diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 93915b03bcd..d1fbb86a153 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -3821,7 +3821,7 @@ sodipodi:nodetypes="cccccc" /> </g> <g - id="src/libs/utils/images/download_arrow"> + id="src/libs/utils/images/download"> <use style="display:inline" transform="translate(1932,132)" @@ -3837,22 +3837,10 @@ d="m 1925,578 h -2 v -8 h 2 z m -1,-0.5 4,-4 v 2 l -4,4 -4,-4 v -2 z" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccc" /> - </g> - <g - id="src/libs/utils/images/download_base"> - <use - x="0" - y="0" - xlink:href="#backgroundRect" - id="use2547" - width="100%" - height="100%" - transform="translate(1948,132)" - style="display:inline" /> <path - style="fill:none;stroke:#000000" - d="m 1934.5,579 v 2.5 h 11 V 579" - id="path2553" + style="display:inline;fill:none;stroke:#000000" + d="m 1918.5,580 v 1.5 h 11 V 580" + id="path2553-4" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" /> </g> diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index 36be18f8297..7d1d32c19b9 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -5,19 +5,58 @@ if (APPLE) string(APPEND DESTDIR "/qmldesigner") endif() -add_qtc_executable(qml2puppet +add_qtc_library(qml2puppet_static + STATIC DEPENDS - Qt5::CorePrivate Qt5::Widgets Qt5::QmlPrivate - Qt5::QuickPrivate Qt5::Network Qt5::GuiPrivate + Qt5::CorePrivate Qt5::Gui + PUBLIC_INCLUDES "${SRCDIR}/interfaces" + SOURCES_PREFIX "${SRCDIR}/interfaces" SOURCES - "${SRCDIR}/qml2puppet/qml2puppetmain.cpp" - "${SRCDIR}/qmlpuppet.qrc" - DESTINATION ${DESTDIR} + commondefines.h + nodeinstanceclientinterface.h + nodeinstanceglobal.h + nodeinstanceserverinterface.cpp nodeinstanceserverinterface.h ) -extend_qtc_executable(qml2puppet +extend_qtc_library(qml2puppet_static + PUBLIC_INCLUDES "${SRCDIR}/types" + SOURCES "${SRCDIR}/types/enumeration.h" +) + +extend_qtc_library(qml2puppet_static + PUBLIC_INCLUDES "${SRCDIR}/container" + SOURCES_PREFIX "${SRCDIR}/container" + SOURCES + addimportcontainer.cpp addimportcontainer.h + idcontainer.cpp idcontainer.h + imagecontainer.cpp imagecontainer.h + informationcontainer.cpp informationcontainer.h + instancecontainer.cpp instancecontainer.h + mockuptypecontainer.cpp mockuptypecontainer.h + propertyabstractcontainer.cpp propertyabstractcontainer.h + propertybindingcontainer.cpp propertybindingcontainer.h + propertyvaluecontainer.cpp propertyvaluecontainer.h + reparentcontainer.cpp reparentcontainer.h + sharedmemory.h +) + +extend_qtc_library(qml2puppet_static + CONDITION UNIX + SOURCES_PREFIX "${SRCDIR}/container" + SOURCES + sharedmemory_unix.cpp +) + +extend_qtc_library(qml2puppet_static + CONDITION NOT UNIX + SOURCES_PREFIX "${SRCDIR}/container" + SOURCES + sharedmemory_qt.cpp +) + +extend_qtc_library(qml2puppet_static + PUBLIC_INCLUDES "${SRCDIR}/commands" SOURCES_PREFIX "${SRCDIR}/commands" - INCLUDES "${PROJECT_SOURCE_DIR}/src/libs" SOURCES changeauxiliarycommand.cpp changeauxiliarycommand.h changebindingscommand.cpp changebindingscommand.h @@ -57,38 +96,21 @@ extend_qtc_executable(qml2puppet scenecreatedcommand.h ) -extend_qtc_executable(qml2puppet - SOURCES_PREFIX "${SRCDIR}/container" +add_qtc_executable(qml2puppet + DEPENDS + Qt5::CorePrivate Qt5::Widgets Qt5::QmlPrivate + Qt5::QuickPrivate Qt5::Network Qt5::GuiPrivate + qml2puppet_static SOURCES - addimportcontainer.cpp addimportcontainer.h - idcontainer.cpp idcontainer.h - imagecontainer.cpp imagecontainer.h - informationcontainer.cpp informationcontainer.h - instancecontainer.cpp instancecontainer.h - mockuptypecontainer.cpp mockuptypecontainer.h - propertyabstractcontainer.cpp propertyabstractcontainer.h - propertybindingcontainer.cpp propertybindingcontainer.h - propertyvaluecontainer.cpp propertyvaluecontainer.h - reparentcontainer.cpp reparentcontainer.h - sharedmemory.h + "${SRCDIR}/qml2puppet/qml2puppetmain.cpp" + "${SRCDIR}/qmlpuppet.qrc" + DESTINATION ${DESTDIR} ) extend_qtc_executable(qml2puppet - CONDITION UNIX - SOURCES_PREFIX "${SRCDIR}/container" - SOURCES - sharedmemory_unix.cpp -) -extend_qtc_executable(qml2puppet CONDITION UNIX AND (NOT APPLE) DEPENDS rt ) -extend_qtc_executable(qml2puppet - CONDITION NOT UNIX - SOURCES_PREFIX "${SRCDIR}/container" - SOURCES - sharedmemory_qt.cpp -) extend_qtc_executable(qml2puppet SOURCES_PREFIX "${SRCDIR}/instances" @@ -116,15 +138,6 @@ extend_qtc_executable(qml2puppet ) extend_qtc_executable(qml2puppet - SOURCES_PREFIX "${SRCDIR}/interfaces" - SOURCES - commondefines.h - nodeinstanceclientinterface.h - nodeinstanceglobal.h - nodeinstanceserverinterface.cpp nodeinstanceserverinterface.h -) - -extend_qtc_executable(qml2puppet SOURCES_PREFIX "${SRCDIR}/qml2puppet/iconrenderer" SOURCES iconrenderer.cpp iconrenderer.h |