aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmlpreview/qmlpreviewruncontrol.cpp')
-rw-r--r--src/plugins/qmlpreview/qmlpreviewruncontrol.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp
index 518e33794f..a1b667b78b 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();
});
}