improved thumbnails reloading (fixes somes cases and is more respectful of reponsibility)

preferencesAboutTextFull
Clément Fauconnier 3 years ago
parent 88129a048b
commit 836f0f2705
  1. 2
      src/core/UBDocumentManager.cpp
  2. 18
      src/document/UBDocumentController.cpp

@ -286,8 +286,6 @@ int UBDocumentManager::addFilesToDocument(UBDocumentProxy* document, QStringList
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(document, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(document, pageIndex);
importAdaptor->placeImportedItemToScene(scene, page); importAdaptor->placeImportedItemToScene(scene, page);
UBPersistenceManager::persistenceManager()->persistDocumentScene(document, scene, pageIndex); UBPersistenceManager::persistenceManager()->persistDocumentScene(document, scene, pageIndex);
if (UBApplication::documentController->selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->insertThumbPage(pageIndex);
} }
UBPersistenceManager::persistenceManager()->persistDocumentMetadata(document); UBPersistenceManager::persistenceManager()->persistDocumentMetadata(document);

@ -2393,8 +2393,11 @@ void UBDocumentController::duplicateSelectedItem()
int sceneCount = selectedSceneIndexes.count(); int sceneCount = selectedSceneIndexes.count();
showMessage(tr("duplicated %1 page","duplicated %1 pages",sceneCount).arg(sceneCount), false); showMessage(tr("duplicated %1 page","duplicated %1 pages",sceneCount).arg(sceneCount), false);
mBoardController->setActiveDocumentScene(selectedThumbnail); if (selectedDocument() == mBoardController->selectedDocument())
mBoardController->reloadThumbnails(); {
mBoardController->setActiveDocumentScene(selectedThumbnail);
mBoardController->reloadThumbnails();
}
} }
} }
else else
@ -2999,6 +3002,8 @@ void UBDocumentController::addFolderOfImages()
document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(document); UBMetadataDcSubsetAdaptor::persist(document);
reloadThumbnails(); reloadThumbnails();
if (selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->reloadThumbnails();
} }
} }
} }
@ -3012,11 +3017,6 @@ void UBDocumentController::addFileToDocument()
if (document) if (document)
{ {
addFileToDocument(document); addFileToDocument(document);
reloadThumbnails();
if (UBApplication::boardController->selectedDocument() == selectedDocument())
{
UBApplication::boardController->reloadThumbnails();
}
} }
} }
@ -3050,6 +3050,8 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(document); UBMetadataDcSubsetAdaptor::persist(document);
reloadThumbnails(); reloadThumbnails();
if (selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->reloadThumbnails();
} }
else else
{ {
@ -3328,6 +3330,8 @@ void UBDocumentController::addImages()
document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(document); UBMetadataDcSubsetAdaptor::persist(document);
reloadThumbnails(); reloadThumbnails();
if (selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->reloadThumbnails();
} }
} }
} }

Loading…
Cancel
Save