Merge remote-tracking branch 'origin/4.14' into master

Change-Id: Ie53b4c2516d80a653d51bc6b666040c586ce44ab
This commit is contained in:
Eike Ziller
2020-10-08 12:04:06 +02:00
78 changed files with 1397 additions and 494 deletions

View File

@@ -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);

View File

@@ -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));
}
}

View File

@@ -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

View File

@@ -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()

View File

@@ -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);

View File

@@ -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()

View File

@@ -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;

View File

@@ -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()});

View File

@@ -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

View File

@@ -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;

View File

@@ -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();
const DesignerMcuManager &mcuManager = DesignerMcuManager::instance();
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 (mcuManager.isMCUProject()) {
const QSet<QString> blockTypes = mcuManager.bannedItems();
if (blockTypes.contains(entry.typeName()))
if (blockTypes.contains(QString::fromUtf8(entry.typeName())))
valid = false;
}

View File

@@ -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();

View File

@@ -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 QmlDesigner::DesignerMcuManager &mcuManager = QmlDesigner::DesignerMcuManager::instance();
const QByteArray fontPrefix = {"font"};
const QList<QByteArray> nonMcuFontProperties = {"wordSpacing", "letterSpacing", "hintingPreference",
"kerning", "preferShaping", "capitalization",
"strikeout", "underline", "styleName"};
if (mcuManager.isMCUProject()) {
const QSet<QString> nonMcuProperties = mcuManager.bannedProperties();
const auto mcuAllowedItemProperties = mcuManager.allowedItemProperties();
const auto mcuBannedComplexProperties = mcuManager.bannedComplexProperties();
const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"};
const QList<QByteArray> list = name().split('.');
const QByteArray pureName = list.constFirst();
const QString pureNameStr = QString::fromUtf8(pureName);
const QList<QByteArray> list = name().split('.');
const QByteArray pureName = list.constFirst();
const QByteArray ending = list.constLast();
const QString endingStr = QString::fromUtf8(ending);
QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
->documentManager()
.currentDesignDocument();
//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 (designDocument && designDocument->isQtForMCUsProject()) {
if (pureName == fontPrefix) {
if (nonMcuFontProperties.contains(list.constLast()))
return false;
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;

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -928,6 +928,8 @@ Project {
"settingspage.ui",
"shortcutmanager.cpp",
"shortcutmanager.h",
"designermcumanager.cpp",
"designermcumanager.h",
]
}
}

View File

@@ -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"));

View File

@@ -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)

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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());

View File

@@ -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);

View File

@@ -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(

View File

@@ -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

View File

@@ -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)

View File

@@ -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:

View File

@@ -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();
});
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -36,7 +36,6 @@ private slots:
void testLoadFile();
void testAnnounceFile();
void testZoom();
void testLanguate();
void testMessageReceived();
};

View File

@@ -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();

View File

@@ -42,7 +42,6 @@ public:
private slots:
void testFileLoaderProperty();
void testZoomFactorProperty();
void testLocaleProperty();
void testFpsHandlerProperty();
};