forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user