qmlproject: rename lastUsedLanguage -> currentLocale

removed the connection from plugin to
QmlMultiLanguageAspect::setCurrentLocale
but calling it directly in QmlPreviewPlugin::setLocale

Does not matter which method is called it will change the right
thing only once because it is checking if it already have the
set locale.

Change-Id: I6cb4b115788adc103481dcda45e3214a0cd73401
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Tim Jenssen
2020-07-20 20:45:08 +02:00
parent 03307d8cb4
commit bde420f7b7
5 changed files with 24 additions and 21 deletions

View File

@@ -193,7 +193,10 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
action->setEnabled(SessionManager::startupProject() != nullptr);
connect(SessionManager::instance(), &SessionManager::startupProjectChanged, action,
&QAction::setEnabled);
connect(action, &QAction::triggered, this, []() {
connect(action, &QAction::triggered, this, [this]() {
if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current())
m_locale = multiLanguageAspect->currentLocale();
ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE);
});
menu->addAction(Core::ActionManager::registerAction(action, "QmlPreview.Internal"),
@@ -334,6 +337,8 @@ QString QmlPreviewPlugin::locale() const
void QmlPreviewPlugin::setLocale(const QString &locale)
{
if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current())
multiLanguageAspect->setCurrentLocale(locale);
if (d->m_locale == locale)
return;