From c4b5e2a54dfae8ee89ee17450b12753c0accc311 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 2 Feb 2012 15:28:49 +0100 Subject: [PATCH 1/7] removed unused cursor --- src/gui/UBResources.cpp | 3 +-- src/gui/UBResources.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/UBResources.cpp b/src/gui/UBResources.cpp index be2e7dcc..f1eb64ab 100644 --- a/src/gui/UBResources.cpp +++ b/src/gui/UBResources.cpp @@ -51,7 +51,6 @@ void UBResources::init() // Cursors penCursor = QCursor(Qt::CrossCursor); eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21); - magnifierCursor = QCursor(QPixmap(":/images/cursors/magnifier.png"), 9, 9); markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30); pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1); handCursor = QCursor(Qt::OpenHandCursor); @@ -60,5 +59,5 @@ void UBResources::init() arrowCursor = QCursor(Qt::ArrowCursor); textCursor = QCursor(Qt::ArrowCursor); rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16); - drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); + drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); } diff --git a/src/gui/UBResources.h b/src/gui/UBResources.h index fd32fa6d..bae4eee6 100644 --- a/src/gui/UBResources.h +++ b/src/gui/UBResources.h @@ -37,7 +37,6 @@ class UBResources : public QObject QCursor penCursor; QCursor eraserCursor; - QCursor magnifierCursor; QCursor markerCursor; QCursor pointerCursor; QCursor handCursor; From 9df0997b31fa234fbf088cd808d5f6121562ff99 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 2 Feb 2012 17:44:57 +0200 Subject: [PATCH 2/7] Fix for SANKORE-495 --- src/gui/UBDockPalette.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 82f28d76..b168663f 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -697,7 +697,7 @@ void UBDockPalette::moveTabs() void UBDockPalette::resizeTabs() { int numTabs = mTabWidgets.size(); - mTabPalette->resize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); + mTabPalette->setFixedSize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); } QRect UBDockPalette::getTabPaletteRect() { From d05325330cf58957a3f5c936d2f66c232ee81636 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 2 Feb 2012 18:04:18 +0200 Subject: [PATCH 3/7] Fix to SANKORE-408. --- src/domain/UBGraphicsTextItemDelegate.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index c430d84d..55eed451 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -309,6 +309,7 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta) int iCursorPos = startPos; // we search continuous blocks of the text with the same PointSize and allpy new settings for them. + cursor.setPosition (startPos, QTextCursor::MoveAnchor); while(iCursorPos < endPos) { bEndofTheSameBlock = false; From f2ee1360350098c8d8de9abe66d9728598708c19 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 2 Feb 2012 18:14:22 +0200 Subject: [PATCH 4/7] Addition to SANKORE-408. --- src/domain/UBGraphicsTextItemDelegate.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index 55eed451..ea031cf1 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -305,7 +305,7 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta) bool bEndofTheSameBlock; int iBlockLen; int iPointSize; - int inewPointSize; + int iNextPointSize; int iCursorPos = startPos; // we search continuous blocks of the text with the same PointSize and allpy new settings for them. @@ -327,17 +327,18 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta) iBlockLen++; cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor); - inewPointSize = cursor.charFormat().font().pointSize(); + iNextPointSize = cursor.charFormat().font().pointSize(); cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor); - if ((iPointSize != inewPointSize)||(iCursorPos+iBlockLen >= endPos)) + if ((iPointSize != iNextPointSize)||(iCursorPos+iBlockLen >= endPos)) bEndofTheSameBlock = true; }while(!bEndofTheSameBlock); //setting new parameners - curFont.setPointSize(iPointSize + delta); + int iNewPointSize = iPointSize + delta; + curFont.setPointSize( (iNewPointSize > 0)?iNewPointSize:1); textFormat.setFont(curFont); cursor.mergeCharFormat(textFormat); From a2ee87b010cf4e6439d82529f3c265709ca6d5a6 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Thu, 2 Feb 2012 19:09:48 +0200 Subject: [PATCH 5/7] Fix for SANKORE-496 --- src/gui/UBLibPathViewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/UBLibPathViewer.cpp b/src/gui/UBLibPathViewer.cpp index 2dff5098..ca79f7c0 100644 --- a/src/gui/UBLibPathViewer.cpp +++ b/src/gui/UBLibPathViewer.cpp @@ -284,7 +284,7 @@ void UBLibPathViewer::showBack() if(NULL != pLastElem) { mpBackElem->setPath(pLastElem->element()->path()); - mpBackElem->setType(eUBLibElementType_Folder); + mpBackElem->setType(pLastElem->element()->type()); mpBackElem->setName(pLastElem->element()->name()); } From ead5cff1b28802cf858558e2be35cd1e3d1895eb Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Fri, 3 Feb 2012 18:57:04 +0300 Subject: [PATCH 6/7] enhancements for document navigator --- src/gui/UBDocumentNavigator.cpp | 6 +--- src/gui/UBThumbnailWidget.cpp | 63 ++++++++------------------------- src/gui/UBThumbnailWidget.h | 2 -- 3 files changed, 16 insertions(+), 55 deletions(-) diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 4efea020..74c1d67f 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -391,17 +391,13 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event) 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 emit changeCurrentPage(); refreshScene(); } bNavig = false; } + QGraphicsView::mousePressEvent(event); } /** diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index e589300b..c7821ab9 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -740,25 +740,21 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event) { - // INFO: This implementation should work but this method is not called on a mousePressEvent, why? - // PLEASE DO NOT REMOVE THIS METHOD! We should reactivate this code when we will fix - // the mousePressEvent-not-called issue! - -// QPointF p = event->pos(); - -// // 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) -// { -// deletePage(); -// } -// if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) -// { -// moveUpPage(); -// } -// if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) -// { -// moveDownPage(); -// } + QPointF p = event->pos(); + + // 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) + { + deletePage(); + } + if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) + { + moveUpPage(); + } + if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) + { + moveDownPage(); + } event->accept(); } @@ -809,32 +805,3 @@ void UBSceneThumbnailNavigPixmap::moveDownPage() { 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; -} diff --git a/src/gui/UBThumbnailWidget.h b/src/gui/UBThumbnailWidget.h index f3f25d6a..ed47869b 100644 --- a/src/gui/UBThumbnailWidget.h +++ b/src/gui/UBThumbnailWidget.h @@ -292,7 +292,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap public: UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex); ~UBSceneThumbnailNavigPixmap(); - void notifyClick(QPointF clickedScenePos); protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *event); @@ -305,7 +304,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap void deletePage(); void moveUpPage(); void moveDownPage(); - QPointF clickedPos(QPointF clickedScenePos); bool bButtonsVisible; bool bCanDelete; From 5761ddb0ead859d60e5c3fa1bbde4c22f32e73d8 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Fri, 3 Feb 2012 19:24:02 +0300 Subject: [PATCH 7/7] Fixed selection issues in document navigator. --- src/document/UBDocumentController.cpp | 5 ++--- src/gui/UBDocumentNavigator.cpp | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 9d1f8d42..5aafded1 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1150,11 +1150,10 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source, UBMetadataDcSubsetAdaptor::persist(proxy); 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 emit movedToIndex(target); + + UBApplication::boardController->setActiveDocumentScene(proxy, target); } diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 74c1d67f..0f6b6eff 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -444,7 +444,8 @@ void UBDocumentNavigator::onMovedToIndex(int index) UBSceneThumbnailNavigPixmap* pItem = dynamic_cast(mThumbnails.at(index)); if(NULL != pItem) { - mCrntItem = pItem; + if(mCrntItem) mCrntItem->setSelected(false);//deselecting previous one + mCrntItem = pItem; mCrntItem->setSelected(true); centerOn(mCrntItem); }