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. 5
      src/document/UBDocumentController.cpp
  4. 13
      src/gui/UBThumbnailWidget.cpp

@ -52,12 +52,18 @@ void UBDocumentContainer::duplicatePages(QList<int>& pageIndexes)
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);
deleteThumbPage(source);
insertThumbPage(target);
emit documentThumbnailsUpdated(this);
return true;
}
void UBDocumentContainer::deletePages(QList<int>& pageIndexes)

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

@ -1032,13 +1032,14 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
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()));
UBMetadataDcSubsetAdaptor::persist(proxy);
mDocumentUI->thumbnailWidget->hightlightItem(target);
}
}
void UBDocumentController::thumbnailViewResized()

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

Loading…
Cancel
Save