|
|
@ -160,6 +160,9 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr |
|
|
|
|
|
|
|
|
|
|
|
mDocumentUI->documentTreeWidget->scrollToItem(selected); |
|
|
|
mDocumentUI->documentTreeWidget->scrollToItem(selected); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mDocumentThumbs = UBThumbnailAdaptor::load(selectedDocumentProxy()); |
|
|
|
|
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
|
|
|
|
|
|
|
|
mSelectionType = Document; |
|
|
|
mSelectionType = Document; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -268,11 +271,10 @@ void UBDocumentController::refreshDocumentThumbnailsView() |
|
|
|
if (proxy) |
|
|
|
if (proxy) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mCurrentDocument = proxy; |
|
|
|
mCurrentDocument = proxy; |
|
|
|
QList<QPixmap> thumbs = UBThumbnailAdaptor::load(proxy); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < thumbs.count(); i++) |
|
|
|
for (int i = 0; i < mDocumentThumbs.count(); i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPixmap pix = thumbs.at(i); |
|
|
|
QPixmap pix = mDocumentThumbs.at(i); |
|
|
|
QGraphicsPixmapItem *pixmapItem = new UBSceneThumbnailPixmap(pix, proxy, i); // deleted by the tree widget
|
|
|
|
QGraphicsPixmapItem *pixmapItem = new UBSceneThumbnailPixmap(pix, proxy, i); // deleted by the tree widget
|
|
|
|
|
|
|
|
|
|
|
|
if (proxy == mBoardController->activeDocument() && mBoardController->activeSceneIndex() == i) |
|
|
|
if (proxy == mBoardController->activeDocument() && mBoardController->activeSceneIndex() == i) |
|
|
@ -507,7 +509,7 @@ void UBDocumentController::openSelectedItem() |
|
|
|
|
|
|
|
|
|
|
|
if (proxy && isOKToOpenDocument(proxy)) |
|
|
|
if (proxy && isOKToOpenDocument(proxy)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mBoardController->setActiveDocumentScene(proxy, thumb->sceneIndex()); |
|
|
|
//mBoardController->setActiveDocumentScene(proxy, thumb->sceneIndex());
|
|
|
|
UBApplication::applicationController->showBoard(); |
|
|
|
UBApplication::applicationController->showBoard(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -561,6 +563,7 @@ void UBDocumentController::duplicateSelectedItem() |
|
|
|
foreach (int sceneIndex, selectedSceneIndexes) |
|
|
|
foreach (int sceneIndex, selectedSceneIndexes) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBPersistenceManager::persistenceManager()->duplicateDocumentScene(proxy, sceneIndex + offset); |
|
|
|
UBPersistenceManager::persistenceManager()->duplicateDocumentScene(proxy, sceneIndex + offset); |
|
|
|
|
|
|
|
mDocumentThumbs.insert(sceneIndex + offset, mDocumentThumbs.at(sceneIndex + offset)); |
|
|
|
offset++; |
|
|
|
offset++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -921,6 +924,7 @@ void UBDocumentController::itemClicked(QTreeWidgetItem * item, int column ) |
|
|
|
Q_UNUSED(item); |
|
|
|
Q_UNUSED(item); |
|
|
|
Q_UNUSED(column); |
|
|
|
Q_UNUSED(column); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectDocument(selectedDocumentProxy(), false); |
|
|
|
itemSelectionChanged(); |
|
|
|
itemSelectionChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1043,6 +1047,7 @@ 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); |
|
|
|
|
|
|
|
mDocumentThumbs = UBThumbnailAdaptor::load(selectedDocumentProxy()); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1057,6 +1062,7 @@ void UBDocumentController::addFileToDocument() |
|
|
|
if (document) |
|
|
|
if (document) |
|
|
|
{ |
|
|
|
{ |
|
|
|
addFileToDocument(document); |
|
|
|
addFileToDocument(document); |
|
|
|
|
|
|
|
mDocumentThumbs = UBThumbnailAdaptor::load(document); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1108,12 +1114,9 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source, |
|
|
|
|
|
|
|
|
|
|
|
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
UBMetadataDcSubsetAdaptor::persist(proxy); |
|
|
|
UBMetadataDcSubsetAdaptor::persist(proxy); |
|
|
|
|
|
|
|
mDocumentThumbs.insert(target, mDocumentThumbs.takeAt(source)); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
|
|
|
|
mDocumentUI->thumbnailWidget->hightlightItem(target); |
|
|
|
// Notify the move to anyone interested in knowing it
|
|
|
|
|
|
|
|
emit movedToIndex(target); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBApplication::boardController->setActiveDocumentScene(proxy, target); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1321,7 +1324,8 @@ void UBDocumentController::addToDocument() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int newActiveSceneIndex = selectedItems.count() == mBoardController->activeDocument()->pageCount() ? 0 : oldActiveSceneIndex + 1; |
|
|
|
int newActiveSceneIndex = selectedItems.count() == mBoardController->activeDocument()->pageCount() ? 0 : oldActiveSceneIndex + 1; |
|
|
|
mBoardController->setActiveDocumentScene(mBoardController->activeDocument(), newActiveSceneIndex); |
|
|
|
mDocumentUI->thumbnailWidget->selectItemAt(newActiveSceneIndex, false); |
|
|
|
|
|
|
|
selectDocument(mBoardController->activeDocument()); |
|
|
|
mBoardController->activeDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
mBoardController->activeDocument()->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
UBMetadataDcSubsetAdaptor::persist(mBoardController->activeDocument()); |
|
|
|
UBMetadataDcSubsetAdaptor::persist(mBoardController->activeDocument()); |
|
|
|
|
|
|
|
|
|
|
@ -1495,6 +1499,7 @@ 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); |
|
|
|
|
|
|
|
mDocumentThumbs = UBThumbnailAdaptor::load(selectedDocumentProxy()); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1605,6 +1610,13 @@ void UBDocumentController::deletePages(QList<QGraphicsItem *> itemsToDelete) |
|
|
|
UBPersistenceManager::persistenceManager()->deleteDocumentScenes(proxy, sceneIndexes); |
|
|
|
UBPersistenceManager::persistenceManager()->deleteDocumentScenes(proxy, sceneIndexes); |
|
|
|
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); |
|
|
|
UBMetadataDcSubsetAdaptor::persist(proxy); |
|
|
|
UBMetadataDcSubsetAdaptor::persist(proxy); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int offset = 0; |
|
|
|
|
|
|
|
foreach(int index, sceneIndexes) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mDocumentThumbs.removeAt(index - offset); |
|
|
|
|
|
|
|
offset++; |
|
|
|
|
|
|
|
} |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
refreshDocumentThumbnailsView(); |
|
|
|
|
|
|
|
|
|
|
|
int minIndex = proxy->pageCount() - 1; |
|
|
|
int minIndex = proxy->pageCount() - 1; |
|
|
@ -1616,3 +1628,15 @@ void UBDocumentController::deletePages(QList<QGraphicsItem *> itemsToDelete) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int UBDocumentController::getSelectedItemIndex() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QList<QGraphicsItem*> selectedItems = mDocumentUI->thumbnailWidget->selectedItems(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedItems.count() > 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBSceneThumbnailPixmap* thumb = dynamic_cast<UBSceneThumbnailPixmap*> (selectedItems.last());
|
|
|
|
|
|
|
|
return thumb->sceneIndex(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else return -1; |
|
|
|
|
|
|
|
} |