Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit d72ae38b7f
  1. 18
      src/adaptors/UBImportImage.cpp
  2. 63
      src/adaptors/UBImportPDF.cpp
  3. 3
      src/adaptors/UBThumbnailAdaptor.cpp

@ -74,24 +74,6 @@ QString UBImportImage::importFileFilter()
return filter;
}
/*
bool UBImportImage::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile)
{
int res = UBDocumentManager::documentManager()->addImageAsPageToDocument(QStringList(QFileInfo(pFile).absoluteFilePath()), pDocument);
if (res == 0)
{
UBApplication::showMessage(tr("Image import failed."));
return false;
}
else
{
UBApplication::showMessage(tr("Image import successful."));
return true;
}
}
*/
QList<UBGraphicsItem*> UBImportImage::import(const QUuid& uuid, const QString& filePath)
{
QList<UBGraphicsItem*> result;

@ -91,66 +91,3 @@ const QString& UBImportPDF::folderToCopy()
{
return UBPersistenceManager::objectDirectory;
}
/*
bool UBImportPDF::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFile)
{
QString documentName = QFileInfo(pFile.fileName()).completeBaseName();
QUuid uuid = QUuid::createUuid();
QString filepath = UBPersistenceManager::persistenceManager()->addPdfFileToDocument(pDocument, pFile.fileName(), uuid);
PDFRenderer *pdfRenderer = PDFRenderer::rendererForUuid(uuid, pDocument->persistencePath() + "/" + filepath, true); // renderer is automatically deleted when not used anymore
if (!pdfRenderer->isValid())
{
UBApplication::showMessage(tr("PDF import failed."));
return false;
}
pdfRenderer->setDPI(this->dpi);
int documentPageCount = pDocument->pageCount();
if (documentPageCount == 1 && UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocument, 0)->isEmpty())
{
documentPageCount = 0;
}
int pdfPageCount = pdfRenderer->pageCount();
for(int pdfPageNumber = 1; pdfPageNumber <= pdfPageCount; pdfPageNumber++)
{
int pageIndex = documentPageCount + pdfPageNumber;
UBApplication::showMessage(tr("Importing page %1 of %2").arg(pdfPageNumber).arg(pdfPageCount), true);
UBGraphicsScene* scene = 0;
if (pageIndex == 0)
{
scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocument, pageIndex);
}
else
{
scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(pDocument, pageIndex);
}
scene->setBackground(false, false);
UBGraphicsPDFItem *pdfItem = new UBGraphicsPDFItem(pdfRenderer, pdfPageNumber); // deleted by the scene
scene->addItem(pdfItem);
pdfItem->setPos(-pdfItem->boundingRect().width() / 2, -pdfItem->boundingRect().height() / 2);
scene->setAsBackgroundObject(pdfItem, false, false);
scene->setNominalSize(pdfItem->boundingRect().width(), pdfItem->boundingRect().height());
UBPersistenceManager::persistenceManager()->persistDocumentScene(pDocument, scene, pageIndex);
}
UBApplication::showMessage(tr("PDF import successful."));
return true;
}
*/

@ -117,9 +117,6 @@ void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& lis
void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, int pageIndex, bool overrideModified)
{
qDebug() << "Persist scene on path " << proxy->persistencePath() << ", index " << pageIndex;
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex);
QFile thumbFile(fileName);

Loading…
Cancel
Save