25 connect(
this, &QQmlPreviewServiceImpl::load, &m_handler, &QQmlPreviewHandler::loadUrl);
26 connect(
this, &QQmlPreviewServiceImpl::drop, &m_handler, &QQmlPreviewHandler::dropCU);
27 connect(
this, &QQmlPreviewServiceImpl::rerun, &m_handler, &QQmlPreviewHandler::rerun);
28 connect(
this, &QQmlPreviewServiceImpl::zoom, &m_handler, &QQmlPreviewHandler::zoom);
29 connect(&m_handler, &QQmlPreviewHandler::error,
this, &QQmlPreviewServiceImpl::forwardError,
30 Qt::DirectConnection);
31 connect(&m_handler, &QQmlPreviewHandler::fps,
this, &QQmlPreviewServiceImpl::forwardFps,
32 Qt::DirectConnection);
41 QQmlDebugPacket packet(data);
49 packet >> path >> contents;
51 const QUrl url = path.startsWith(QLatin1Char(
':'))
52 ? QUrl(QLatin1String(
"qrc") + path)
53 : QUrl::fromLocalFile(path);
56 emit file(path, contents);
61 if (m_currentUrl.isEmpty() && path.endsWith(
".qml")) {
63 emit load(m_currentUrl);
70 packet >> path >> entries;
71 emit directory(path, entries);
99 emit zoom(
static_cast<qreal>(factor));
103 forwardError(QString::fromLatin1(
"Invalid command: %1").arg(command));
124 if (state == Enabled) {
125 m_loader.reset(
new QQmlPreviewFileLoader(
this));
126 connect(
this, &QQmlPreviewServiceImpl::load,
127 m_loader.data(), &QQmlPreviewFileLoader::whitelist, Qt::DirectConnection);
128 QV4::ExecutionEngine::setPreviewing(
true);
129 m_fileEngine.reset(
new QQmlPreviewFileEngineHandler(m_loader.data()));
131 QV4::ExecutionEngine::setPreviewing(
false);
132 m_fileEngine.reset();