@ -1555,7 +1555,7 @@ void UBDocumentTreeView::dropEvent(QDropEvent *event)
Q_ASSERT ( QFileInfo ( thumbTmp ) . exists ( ) ) ;
Q_ASSERT ( QFileInfo ( thumbTmp ) . exists ( ) ) ;
Q_ASSERT ( QFileInfo ( thumbTo ) . exists ( ) ) ;
Q_ASSERT ( QFileInfo ( thumbTo ) . exists ( ) ) ;
const QPixmap * pix = new QPixmap ( thumbTmp ) ;
auto pix = std : : make_shared < QPixmap > ( thumbTmp ) ;
UBDocumentController * ctrl = UBApplication : : documentController ;
UBDocumentController * ctrl = UBApplication : : documentController ;
ctrl - > addPixmapAt ( pix , toIndex ) ;
ctrl - > addPixmapAt ( pix , toIndex ) ;
}
}
@ -2238,7 +2238,6 @@ void UBDocumentController::sortDocuments(int kind, int order)
}
}
}
}
void UBDocumentController : : onSortOrderChanged ( bool order )
void UBDocumentController : : onSortOrderChanged ( bool order )
{
{
int kindIndex = mDocumentUI - > sortKind - > currentIndex ( ) ;
int kindIndex = mDocumentUI - > sortKind - > currentIndex ( ) ;
@ -2297,9 +2296,6 @@ void UBDocumentController::show()
{
{
selectDocument ( mBoardController - > selectedDocument ( ) ) ;
selectDocument ( mBoardController - > selectedDocument ( ) ) ;
//to be sure thumbnails will be up-to-date
reloadThumbnails ( ) ;
updateActions ( ) ;
updateActions ( ) ;
if ( ! mToolsPalette )
if ( ! mToolsPalette )
@ -3061,6 +3057,11 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source,
}
}
}
}
void UBDocumentController : : updateThumbnailPixmap ( int index , const QPixmap & newThumbnail )
{
mDocumentUI - > thumbnailWidget - > updateThumbnailPixmap ( index , newThumbnail ) ;
}
void UBDocumentController : : thumbnailViewResized ( )
void UBDocumentController : : thumbnailViewResized ( )
{
{
@ -3182,7 +3183,7 @@ void UBDocumentController::addToDocument()
UBMetadataDcSubsetAdaptor : : persist ( mBoardController - > selectedDocument ( ) ) ;
UBMetadataDcSubsetAdaptor : : persist ( mBoardController - > selectedDocument ( ) ) ;
mBoardController - > reloadThumbnails ( ) ;
mBoardController - > reloadThumbnails ( ) ;
emit UBApplication : : b oardController- > documentThumbnailsUpdated ( this ) ;
emit mB oardController- > documentThumbnailsUpdated ( this ) ;
UBApplication : : applicationController - > showBoard ( ) ;
UBApplication : : applicationController - > showBoard ( ) ;
mBoardController - > setActiveDocumentScene ( newActiveSceneIndex ) ;
mBoardController - > setActiveDocumentScene ( newActiveSceneIndex ) ;
@ -3583,7 +3584,7 @@ void UBDocumentController::deletePages(QList<QGraphicsItem *> itemsToDelete)
}
}
}
}
UBDocumentContainer : : deletePages ( sceneIndexes ) ;
UBDocumentContainer : : deletePages ( sceneIndexes ) ;
emit UBApplication : : b oardController- > documentThumbnailsUpdated ( this ) ;
emit mB oardController- > documentThumbnailsUpdated ( this ) ;
proxy - > setMetaData ( UBSettings : : documentUpdatedAt , UBStringUtils : : toUtcIsoDateTime ( QDateTime : : currentDateTime ( ) ) ) ;
proxy - > setMetaData ( UBSettings : : documentUpdatedAt , UBStringUtils : : toUtcIsoDateTime ( QDateTime : : currentDateTime ( ) ) ) ;
UBMetadataDcSubsetAdaptor : : persist ( proxy ) ;
UBMetadataDcSubsetAdaptor : : persist ( proxy ) ;
@ -3724,7 +3725,7 @@ bool UBDocumentController::firstAndOnlySceneSelected() const
return false ;
return false ;
}
}
void UBDocumentController : : refreshDocumentThumbnailsView ( UBDocumentContainer * )
void UBDocumentController : : refreshDocumentThumbnailsView ( UBDocumentContainer * source )
{
{
UBDocumentTreeModel * docModel = UBPersistenceManager : : persistenceManager ( ) - > mDocumentTreeStructureModel ;
UBDocumentTreeModel * docModel = UBPersistenceManager : : persistenceManager ( ) - > mDocumentTreeStructureModel ;
UBDocumentProxy * currentDocumentProxy = selectedDocument ( ) ;
UBDocumentProxy * currentDocumentProxy = selectedDocument ( ) ;
@ -3740,11 +3741,9 @@ void UBDocumentController:: refreshDocumentThumbnailsView(UBDocumentContainer*)
return ;
return ;
}
}
QList < const QPixmap * > thumbs ;
if ( currentDocumentProxy )
if ( currentDocumentProxy )
{
{
UBThumbnailAdaptor : : load ( currentDocumentProxy , thumbs ) ;
UBThumbnailAdaptor : : load ( currentDocumentProxy , documen tT humbs( ) ) ;
}
}
QApplication : : setOverrideCursor ( QCursor ( Qt : : WaitCursor ) ) ;
QApplication : : setOverrideCursor ( QCursor ( Qt : : WaitCursor ) ) ;
@ -3760,7 +3759,9 @@ void UBDocumentController:: refreshDocumentThumbnailsView(UBDocumentContainer*)
{
{
for ( int i = 0 ; i < currentDocumentProxy - > pageCount ( ) ; i + + )
for ( int i = 0 ; i < currentDocumentProxy - > pageCount ( ) ; i + + )
{
{
const QPixmap * pix = thumbs . at ( i ) ;
UBApplication : : showMessage ( tr ( " Refreshing Document Thumbnails View (%1/%2) " ) . arg ( i + 1 ) . arg ( source - > selectedDocument ( ) - > pageCount ( ) ) ) ;
auto pix = documentThumbs ( ) . at ( i ) ;
QGraphicsPixmapItem * pixmapItem = new UBSceneThumbnailPixmap ( * pix , currentDocumentProxy , i ) ; // deleted by the tree widget
QGraphicsPixmapItem * pixmapItem = new UBSceneThumbnailPixmap ( * pix , currentDocumentProxy , i ) ; // deleted by the tree widget
if ( currentDocumentProxy = = mBoardController - > selectedDocument ( ) & & mBoardController - > activeSceneIndex ( ) = = i )
if ( currentDocumentProxy = = mBoardController - > selectedDocument ( ) & & mBoardController - > activeSceneIndex ( ) = = i )
@ -3792,9 +3793,9 @@ void UBDocumentController:: refreshDocumentThumbnailsView(UBDocumentContainer*)
if ( selection )
if ( selection )
{
{
disconnect ( mDocumentUI - > thumbnailWidget - > scene ( ) , SIGNAL ( selectionChanged ( ) ) , this , SLOT ( pageSelectionChanged ( ) ) ) ;
disconnect ( mDocumentUI - > thumbnailWidget - > scene ( ) , SIGNAL ( selectionChanged ( ) ) , this , SLOT ( pageSelectionChanged ( ) ) ) ;
UBSceneThumbnailPixmap * currentScene = dynamic_cast < UBSceneThumbnailPixmap * > ( selection ) ;
UBSceneThumbnailPixmap * currentSceneThumbnailPixmap = dynamic_cast < UBSceneThumbnailPixmap * > ( selection ) ;
if ( currentScene )
if ( currentSceneThumbnailPixmap )
mDocumentUI - > thumbnailWidget - > hightlightItem ( currentScene - > sceneIndex ( ) ) ;
mDocumentUI - > thumbnailWidget - > hightlightItem ( currentSceneThumbnailPixmap - > sceneIndex ( ) ) ;
connect ( mDocumentUI - > thumbnailWidget - > scene ( ) , SIGNAL ( selectionChanged ( ) ) , this , SLOT ( pageSelectionChanged ( ) ) ) ;
connect ( mDocumentUI - > thumbnailWidget - > scene ( ) , SIGNAL ( selectionChanged ( ) ) , this , SLOT ( pageSelectionChanged ( ) ) ) ;
}
}