Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Aleksei Kanash 13 years ago
commit 02f9aec527
  1. 5
      src/document/UBDocumentController.cpp
  2. 7
      src/gui/UBDocumentNavigator.cpp
  3. 63
      src/gui/UBThumbnailWidget.cpp
  4. 2
      src/gui/UBThumbnailWidget.h

@ -1150,11 +1150,10 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source,
UBMetadataDcSubsetAdaptor::persist(proxy); UBMetadataDcSubsetAdaptor::persist(proxy);
refreshDocumentThumbnailsView(); refreshDocumentThumbnailsView();
// NOTE [Didier]: I think that selecting the thumbnail is not the role of the documentController
mDocumentUI->thumbnailWidget->selectItemAt(target);
// Notify the move to anyone interested in knowing it // Notify the move to anyone interested in knowing it
emit movedToIndex(target); emit movedToIndex(target);
UBApplication::boardController->setActiveDocumentScene(proxy, target);
} }

@ -391,17 +391,13 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
mCrntItem = pCrntItem; mCrntItem = pCrntItem;
} }
// HACK: for an unknown reason, the mousePressEvent of the item is not
// called when a click occurs on it. So I created this method in
// order to handle the click.
mCrntItem->notifyClick(mapToScene(event->pos()));
// Then display the related page // Then display the related page
emit changeCurrentPage(); emit changeCurrentPage();
refreshScene(); refreshScene();
} }
bNavig = false; bNavig = false;
} }
QGraphicsView::mousePressEvent(event);
} }
/** /**
@ -448,6 +444,7 @@ void UBDocumentNavigator::onMovedToIndex(int index)
UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index)); UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index));
if(NULL != pItem) if(NULL != pItem)
{ {
if(mCrntItem) mCrntItem->setSelected(false);//deselecting previous one
mCrntItem = pItem; mCrntItem = pItem;
mCrntItem->setSelected(true); mCrntItem->setSelected(true);
centerOn(mCrntItem); centerOn(mCrntItem);

@ -740,25 +740,21 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra
void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
// INFO: This implementation should work but this method is not called on a mousePressEvent, why? QPointF p = event->pos();
// PLEASE DO NOT REMOVE THIS METHOD! We should reactivate this code when we will fix
// the mousePressEvent-not-called issue! // Here we check the position of the click and verify if it has to trig an action or not.
if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// QPointF p = event->pos(); {
deletePage();
// // Here we check the position of the click and verify if it has to trig an action or not. }
// if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
// { {
// deletePage(); moveUpPage();
// } }
// if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// { {
// moveUpPage(); moveDownPage();
// } }
// if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// moveDownPage();
// }
event->accept(); event->accept();
} }
@ -809,32 +805,3 @@ void UBSceneThumbnailNavigPixmap::moveDownPage()
{ {
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() + 1); UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() + 1);
} }
void UBSceneThumbnailNavigPixmap::notifyClick(QPointF clickedScenePos)
{
QPointF p = clickedPos(clickedScenePos);
// Here we check the position of the click and verify if it has to trig an action or not.
if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
deletePage();
}
if(bCanMoveUp && p.x() >= (BUTTONSIZE + BUTTONSPACING)/2 && p.x() <= BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
moveUpPage();
}
if(bCanMoveDown && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= BUTTONSIZE + BUTTONSPACING + BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
moveDownPage();
}
}
QPointF UBSceneThumbnailNavigPixmap::clickedPos(QPointF clickedScenePos)
{
QPointF p;
p.setX(clickedScenePos.x() - scenePos().x());
p.setY(clickedScenePos.y() - scenePos().y());
return p;
}

@ -292,7 +292,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
public: public:
UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex); UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex);
~UBSceneThumbnailNavigPixmap(); ~UBSceneThumbnailNavigPixmap();
void notifyClick(QPointF clickedScenePos);
protected: protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
@ -305,7 +304,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
void deletePage(); void deletePage();
void moveUpPage(); void moveUpPage();
void moveDownPage(); void moveDownPage();
QPointF clickedPos(QPointF clickedScenePos);
bool bButtonsVisible; bool bButtonsVisible;
bool bCanDelete; bool bCanDelete;

Loading…
Cancel
Save