Your ROOT_URL in app.ini is http://git.osmesh.ru/ but you are visiting https://git.osmesh.ru/MOS/OpenBoard/commit/dbc0f592d0107ec37a53a7cc246c253e0c928dca?style=split&whitespace=show-all You should set ROOT_URL correctly, otherwise the web may not work correctly.

images are stored on disk when downloaded on the board

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent cf9d3850ab
commit dbc0f592d0
  1. 33
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 38
      src/board/UBBoardController.cpp

@ -1863,14 +1863,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::pixmapItemToLinkedImage(UBGraphicsPi
QString path = mDocumentPath + "/" + fileName; QString path = mDocumentPath + "/" + fileName;
if (!QFile::exists(path))
{
QDir dir;
dir.mkdir(mDocumentPath + "/" + UBPersistenceManager::imageDirectory);
pixmapItem->pixmap().toImage().save(path, "PNG");
}
mXmlWriter.writeAttribute(nsXLink, "href", fileName); mXmlWriter.writeAttribute(nsXLink, "href", fileName);
graphicsItemToSvg(pixmapItem); graphicsItemToSvg(pixmapItem);
@ -1910,25 +1902,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::svgItemToLinkedSvg(UBGraphicsSvgItem
mXmlWriter.writeStartElement("image"); mXmlWriter.writeStartElement("image");
QString fileName = UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".svg";
QString path = mDocumentPath + "/" + fileName;
if (!QFile::exists(path))
{
QDir dir;
dir.mkdir(mDocumentPath + "/" + UBPersistenceManager::imageDirectory);
QFile file(path);
if (!file.open(QIODevice::WriteOnly))
{
qWarning() << "cannot open file for writing embeded svg content " << path;
return;
}
file.write(svgItem->fileData());
}
mXmlWriter.writeAttribute(nsXLink, "href", fileName); mXmlWriter.writeAttribute(nsXLink, "href", fileName);
graphicsItemToSvg(svgItem); graphicsItemToSvg(svgItem);
@ -1984,6 +1957,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::pdfItemToLinkedPDF(UBGraphicsPDFItem
} }
file.write(pdfItem->fileData()); file.write(pdfItem->fileData());
file.close();
} }
mXmlWriter.writeAttribute(nsXLink, "href", fileName + "#page=" + QString::number(pdfItem->pageNumber())); mXmlWriter.writeAttribute(nsXLink, "href", fileName + "#page=" + QString::number(pdfItem->pageNumber()));
@ -2344,11 +2318,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::graphicsWidgetToSvg(UBGraphicsWidget
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "frozen", xmlTrue); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "frozen", xmlTrue);
} }
// QString snapshotPath = mDocumentPath + "/" + UBPersistenceManager::widgetDirectory + "/" + uuid + ".png";
// item->takeSnapshot().save(snapshotPath, "PNG");
mXmlWriter.writeStartElement(nsXHtml, "iframe"); mXmlWriter.writeStartElement(nsXHtml, "iframe");
mXmlWriter.writeAttribute("style", "border: none"); mXmlWriter.writeAttribute("style", "border: none");

@ -1105,6 +1105,21 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl
UBGraphicsPixmapItem* pixItem = mActiveScene->addPixmap(pix, NULL, pPos, 1.); UBGraphicsPixmapItem* pixItem = mActiveScene->addPixmap(pix, NULL, pPos, 1.);
pixItem->setSourceUrl(sourceUrl); pixItem->setSourceUrl(sourceUrl);
QString documentPath = UBApplication::boardController->selectedDocument()->persistencePath();
QString fileName = UBPersistenceManager::imageDirectory + "/" + pixItem->uuid().toString() + ".png";
QString path = documentPath + "/" + fileName;
if (!QFile::exists(path))
{
QDir dir;
dir.mkdir(documentPath + "/" + UBPersistenceManager::imageDirectory);
pixItem->pixmap().toImage().save(path, "PNG");
}
if (isBackground) if (isBackground)
{ {
mActiveScene->setAsBackgroundObject(pixItem, true); mActiveScene->setAsBackgroundObject(pixItem, true);
@ -1123,6 +1138,29 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl
qDebug() << "accepting mime type" << mimeType << "as vecto image"; qDebug() << "accepting mime type" << mimeType << "as vecto image";
UBGraphicsSvgItem* svgItem = mActiveScene->addSvg(sourceUrl, pPos, pData); UBGraphicsSvgItem* svgItem = mActiveScene->addSvg(sourceUrl, pPos, pData);
QString documentPath = UBApplication::boardController->selectedDocument()->persistencePath();
QString fileName = UBPersistenceManager::imageDirectory + "/" + svgItem->uuid().toString() + ".svg";
QString path = documentPath + "/" + fileName;
if (!QFile::exists(path))
{
QDir dir;
dir.mkdir(documentPath + "/" + UBPersistenceManager::imageDirectory);
QFile file(path);
if (!file.open(QIODevice::WriteOnly))
{
qWarning() << "cannot open file for writing embeded svg content " << path;
return;
}
file.write(svgItem->fileData());
file.close();
}
svgItem->setSourceUrl(sourceUrl); svgItem->setSourceUrl(sourceUrl);
if (isBackground) if (isBackground)

Loading…
Cancel
Save