|
|
|
@ -91,92 +91,34 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex) |
|
|
|
|
return pix; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& list) |
|
|
|
|
{ |
|
|
|
|
generateMissingThumbnails(proxy); |
|
|
|
|
|
|
|
|
|
foreach(const QPixmap* pm, list) |
|
|
|
|
delete pm; |
|
|
|
|
list.clear(); |
|
|
|
|
for(int i=0; i<proxy->pageCount(); i++) |
|
|
|
|
list.append(get(proxy, i)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy) |
|
|
|
|
void UBThumbnailAdaptor::updateDocumentToHandleZeroPage(UBDocumentProxy* proxy) |
|
|
|
|
{ |
|
|
|
|
QList<QPixmap> thumbnails; |
|
|
|
|
|
|
|
|
|
qDebug() << "Loadinf thumbnails for " << proxy->name(); |
|
|
|
|
|
|
|
|
|
if (!proxy || proxy->persistencePath().isEmpty()) |
|
|
|
|
return thumbnails; |
|
|
|
|
|
|
|
|
|
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
|
|
|
|
|
generateMissingThumbnails(proxy); |
|
|
|
|
|
|
|
|
|
//end compatibility with older format
|
|
|
|
|
|
|
|
|
|
bool moreToProcess = true; |
|
|
|
|
int pageCount = UBApplication::boardController->sceneIndexFromPage(0); |
|
|
|
|
|
|
|
|
|
while (moreToProcess) { |
|
|
|
|
pageCount++; |
|
|
|
|
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageCount); |
|
|
|
|
|
|
|
|
|
if(UBSettings::settings()->teacherGuidePageZeroActivated->get().toBool()){ |
|
|
|
|
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.svg", 0); |
|
|
|
|
QFile file(fileName); |
|
|
|
|
if (file.exists()) { |
|
|
|
|
QPixmap pix; |
|
|
|
|
//Warning. Works only with modified Qt
|
|
|
|
|
#ifdef Q_WS_X11 |
|
|
|
|
//pix.load(fileName, 0, Qt::AutoColor);
|
|
|
|
|
pix.load(fileName, 0); |
|
|
|
|
#else |
|
|
|
|
pix.load(fileName, 0, Qt::AutoColor, false); |
|
|
|
|
#endif |
|
|
|
|
thumbnails.append(pix); |
|
|
|
|
} else { |
|
|
|
|
moreToProcess = false; |
|
|
|
|
qDebug() << fileName; |
|
|
|
|
if(!file.exists()){ |
|
|
|
|
UBPersistenceManager::persistenceManager()->persistDocumentScene(proxy,new UBGraphicsScene(proxy),0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return thumbnails; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index) |
|
|
|
|
void UBThumbnailAdaptor::load(UBDocumentProxy* proxy, QList<const QPixmap*>& list) |
|
|
|
|
{ |
|
|
|
|
qDebug() << "Loadinf thumbnails for " << proxy->name(); |
|
|
|
|
|
|
|
|
|
int existingPageCount = proxy->pageCount(); |
|
|
|
|
|
|
|
|
|
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index > existingPageCount) |
|
|
|
|
return QPixmap(); |
|
|
|
|
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
|
|
|
|
|
updateDocumentToHandleZeroPage(proxy); |
|
|
|
|
generateMissingThumbnails(proxy); |
|
|
|
|
|
|
|
|
|
//end compatibility with older format
|
|
|
|
|
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index); |
|
|
|
|
|
|
|
|
|
QFile file(fileName); |
|
|
|
|
if (file.exists()) |
|
|
|
|
{ |
|
|
|
|
QPixmap pix; |
|
|
|
|
//Warning. Works only with modified Qt
|
|
|
|
|
#ifdef Q_WS_X11 |
|
|
|
|
pix.load(fileName, 0, Qt::AutoColor); |
|
|
|
|
#else |
|
|
|
|
pix.load(fileName, 0, Qt::AutoColor, false); |
|
|
|
|
#endif |
|
|
|
|
return pix; |
|
|
|
|
} |
|
|
|
|
return QPixmap(); |
|
|
|
|
foreach(const QPixmap* pm, list) |
|
|
|
|
delete pm; |
|
|
|
|
list.clear(); |
|
|
|
|
for(int i=0; i<proxy->pageCount(); i++) |
|
|
|
|
list.append(get(proxy, i)); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
void UBThumbnailAdaptor::persistScene(UBDocumentProxy* proxy, UBGraphicsScene* pScene, int pageIndex, bool overrideModified) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
qDebug() << "Persiste scene on path " << proxy->persistencePath() << ", index " << pageIndex; |
|
|
|
|
qDebug() << "Persist scene on path " << proxy->persistencePath() << ", index " << pageIndex; |
|
|
|
|
|
|
|
|
|
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex); |
|
|
|
|
|
|
|
|
|