26 connect(
this, &QQmlPreviewServiceImpl::load, &m_handler, &QQmlPreviewHandler::loadUrl);
27 connect(
this, &QQmlPreviewServiceImpl::drop, &m_handler, &QQmlPreviewHandler::dropCU);
28 connect(
this, &QQmlPreviewServiceImpl::rerun, &m_handler, &QQmlPreviewHandler::rerun);
29 connect(
this, &QQmlPreviewServiceImpl::zoom, &m_handler, &QQmlPreviewHandler::zoom);
30 connect(&m_handler, &QQmlPreviewHandler::error,
this, &QQmlPreviewServiceImpl::forwardError,
31 Qt::DirectConnection);
32 connect(&m_handler, &QQmlPreviewHandler::fps,
this, &QQmlPreviewServiceImpl::forwardFps,
33 Qt::DirectConnection);
42 QQmlDebugPacket packet(data);
50 packet >> path >> contents;
52 const QUrl url = path.startsWith(QLatin1Char(
':'))
53 ? QUrl(QLatin1String(
"qrc") + path)
54 : QUrl::fromLocalFile(path);
57 emit file(path, contents);
62 if (m_currentUrl.isEmpty() && path.endsWith(
".qml")) {
64 emit load(m_currentUrl);
71 packet >> path >> entries;
72 emit directory(path, entries);
100 emit zoom(
static_cast<qreal>(factor));
104 forwardError(QString::fromLatin1(
"Invalid command: %1").arg(command));
125 if (state == Enabled) {
126 m_loader.reset(
new QQmlPreviewFileLoader(
this));
127 connect(
this, &QQmlPreviewServiceImpl::load,
128 m_loader.data(), &QQmlPreviewFileLoader::whitelist, Qt::DirectConnection);
129 QV4::ExecutionEngine::setPreviewing(
true);
130 m_fileEngine.reset(
new QQmlPreviewFileEngineHandler(m_loader.data()));
132 QV4::ExecutionEngine::setPreviewing(
false);
133 m_fileEngine.reset();