Document mode: title page selection

preferencesAboutTextFull
Anatoly Mihalchenko 12 years ago
parent b8f006d1ca
commit c33a10579a
  1. 8
      src/document/UBDocumentContainer.cpp
  2. 2
      src/document/UBDocumentContainer.h
  3. 11
      src/document/UBDocumentController.cpp
  4. 17
      src/gui/UBThumbnailWidget.cpp

@ -52,12 +52,18 @@ void UBDocumentContainer::duplicatePages(QList<int>& pageIndexes)
emit documentThumbnailsUpdated(this); emit documentThumbnailsUpdated(this);
} }
void UBDocumentContainer::movePageToIndex(int source, int target) bool UBDocumentContainer::movePageToIndex(int source, int target)
{ {
if (source==0)
{
// Title page - cant be moved
return false;
}
UBPersistenceManager::persistenceManager()->moveSceneToIndex(mCurrentDocument, source, target); UBPersistenceManager::persistenceManager()->moveSceneToIndex(mCurrentDocument, source, target);
deleteThumbPage(source); deleteThumbPage(source);
insertThumbPage(target); insertThumbPage(target);
emit documentThumbnailsUpdated(this); emit documentThumbnailsUpdated(this);
return true;
} }
void UBDocumentContainer::deletePages(QList<int>& pageIndexes) void UBDocumentContainer::deletePages(QList<int>& pageIndexes)

@ -37,7 +37,7 @@ class UBDocumentContainer : public QObject
static int sceneIndexFromPage(int sceneIndex); static int sceneIndexFromPage(int sceneIndex);
void duplicatePages(QList<int>& pageIndexes); void duplicatePages(QList<int>& pageIndexes);
void movePageToIndex(int source, int target); bool movePageToIndex(int source, int target);
void deletePages(QList<int>& pageIndexes); void deletePages(QList<int>& pageIndexes);
void addPage(int index); void addPage(int index);
void updatePage(int index); void updatePage(int index);

@ -1032,12 +1032,13 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source, int target) void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source, int target)
{ {
UBDocumentContainer::movePageToIndex(source, target); if (UBDocumentContainer::movePageToIndex(source, target))
{
proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); proxy->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(proxy); UBMetadataDcSubsetAdaptor::persist(proxy);
mDocumentUI->thumbnailWidget->hightlightItem(target); mDocumentUI->thumbnailWidget->hightlightItem(target);
}
} }

@ -210,13 +210,18 @@ void UBThumbnailWidget::mousePressEvent(QMouseEvent *event)
mMousePressPos = event->pos(); mMousePressPos = event->pos();
UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(itemAt(mMousePressPos)); UBSceneThumbnailPixmap* sceneItem = dynamic_cast<UBSceneThumbnailPixmap*>(itemAt(mMousePressPos));
if(sceneItem){ if(sceneItem==NULL)
int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex()); {
if(pageIndex == 0){ event->ignore();
event->ignore(); return;
return;
}
} }
//if(sceneItem){
// int pageIndex = UBDocumentContainer::pageFromSceneIndex(sceneItem->sceneIndex());
// if(pageIndex == 0){
// event->ignore();
// return;
// }
//}
mMousePressScenePos = mapToScene(mMousePressPos); mMousePressScenePos = mapToScene(mMousePressPos);
QGraphicsItem* underlyingItem = itemAt(mMousePressPos); QGraphicsItem* underlyingItem = itemAt(mMousePressPos);

Loading…
Cancel
Save