26 connect(
this, &QQmlPreviewServiceImpl::load, &m_handler, &QQmlPreviewHandler::load);
27 connect(
this, &QQmlPreviewServiceImpl::drop, &m_handler, &QQmlPreviewHandler::dropCU);
29 connect(
this, &QQmlPreviewServiceImpl::zoom, &m_handler, &QQmlPreviewHandler::zoom);
30 connect(
this, &QQmlPreviewServiceImpl::animationSpeed,
31 &m_handler, &QQmlPreviewHandler::setAnimationSpeed);
32 connect(
this, &QQmlPreviewServiceImpl::settingsChanged,
33 &m_handler, &QQmlPreviewHandler::configure);
34 connect(&m_handler, &QQmlPreviewHandler::error,
this, &QQmlPreviewServiceImpl::forwardError,
35 Qt::DirectConnection);
37 Qt::DirectConnection);
38 connect(&m_handler, &QQmlPreviewHandler::confirmation,
39 this, &QQmlPreviewServiceImpl::forwardConfirmation, Qt::DirectConnection);
48 QQmlDebugPacket packet(data);
56 packet >> path >> contents;
58 const QUrl url = path.startsWith(QLatin1Char(
':'))
59 ? QUrl(QLatin1String(
"qrc") + path)
60 : QUrl::fromLocalFile(path);
63 emit file(path, contents);
68 if (m_currentUrl.isEmpty() && path.endsWith(
".qml")) {
70 emit load(m_currentUrl);
77 packet >> path >> entries;
78 emit directory(path, entries);
106 emit zoom(
static_cast<qreal>(factor));
109 case AnimationSpeed: {
112 emit animationSpeed(qreal(factor));
115 case Configuration: {
116 bool enableInPlaceUpdates;
117 packet >> enableInPlaceUpdates;
118 QQmlPreviewHandler::Settings options;
119 options.enableInPlaceUpdates = enableInPlaceUpdates;
120 emit settingsChanged(options);
124 forwardError(QString::fromLatin1(
"Invalid command: %1").arg(command));
145 if (state == Enabled) {
146 m_loader.reset(
new QQmlPreviewFileLoader(
this));
147 connect(
this, &QQmlPreviewServiceImpl::load,
148 m_loader.data(), &QQmlPreviewFileLoader::whitelist, Qt::DirectConnection);
149 QV4::ExecutionEngine::setPreviewing(
true);
150 m_fileEngine.reset(
new QQmlPreviewFileEngineHandler(m_loader.data()));
152 QV4::ExecutionEngine::setPreviewing(
false);
153 m_fileEngine.reset();