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

preferencesAboutTextFull
shibakaneki 13 years ago
commit 72532068ac
  1. 5
      src/document/UBDocumentController.cpp
  2. 10
      src/domain/UBGraphicsTextItemDelegate.cpp
  3. 2
      src/gui/UBDockPalette.cpp
  4. 7
      src/gui/UBDocumentNavigator.cpp
  5. 2
      src/gui/UBLibPathViewer.cpp
  6. 1
      src/gui/UBResources.cpp
  7. 1
      src/gui/UBResources.h
  8. 63
      src/gui/UBThumbnailWidget.cpp
  9. 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);
} }

@ -305,10 +305,11 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
bool bEndofTheSameBlock; bool bEndofTheSameBlock;
int iBlockLen; int iBlockLen;
int iPointSize; int iPointSize;
int inewPointSize; int iNextPointSize;
int iCursorPos = startPos; int iCursorPos = startPos;
// we search continuous blocks of the text with the same PointSize and allpy new settings for them. // 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) while(iCursorPos < endPos)
{ {
bEndofTheSameBlock = false; bEndofTheSameBlock = false;
@ -326,17 +327,18 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
iBlockLen++; iBlockLen++;
cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor); cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor);
inewPointSize = cursor.charFormat().font().pointSize(); iNextPointSize = cursor.charFormat().font().pointSize();
cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor); cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor);
if ((iPointSize != inewPointSize)||(iCursorPos+iBlockLen >= endPos)) if ((iPointSize != iNextPointSize)||(iCursorPos+iBlockLen >= endPos))
bEndofTheSameBlock = true; bEndofTheSameBlock = true;
}while(!bEndofTheSameBlock); }while(!bEndofTheSameBlock);
//setting new parameners //setting new parameners
curFont.setPointSize(iPointSize + delta); int iNewPointSize = iPointSize + delta;
curFont.setPointSize( (iNewPointSize > 0)?iNewPointSize:1);
textFormat.setFont(curFont); textFormat.setFont(curFont);
cursor.mergeCharFormat(textFormat); cursor.mergeCharFormat(textFormat);

@ -697,7 +697,7 @@ void UBDockPalette::moveTabs()
void UBDockPalette::resizeTabs() void UBDockPalette::resizeTabs()
{ {
int numTabs = mTabWidgets.size(); 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() QRect UBDockPalette::getTabPaletteRect()
{ {

@ -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);

@ -284,7 +284,7 @@ void UBLibPathViewer::showBack()
if(NULL != pLastElem) if(NULL != pLastElem)
{ {
mpBackElem->setPath(pLastElem->element()->path()); mpBackElem->setPath(pLastElem->element()->path());
mpBackElem->setType(eUBLibElementType_Folder); mpBackElem->setType(pLastElem->element()->type());
mpBackElem->setName(pLastElem->element()->name()); mpBackElem->setName(pLastElem->element()->name());
} }

@ -51,7 +51,6 @@ void UBResources::init()
// Cursors // Cursors
penCursor = QCursor(Qt::CrossCursor); penCursor = QCursor(Qt::CrossCursor);
eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21); 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); markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30);
pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1); pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1);
handCursor = QCursor(Qt::OpenHandCursor); handCursor = QCursor(Qt::OpenHandCursor);

@ -37,7 +37,6 @@ class UBResources : public QObject
QCursor penCursor; QCursor penCursor;
QCursor eraserCursor; QCursor eraserCursor;
QCursor magnifierCursor;
QCursor markerCursor; QCursor markerCursor;
QCursor pointerCursor; QCursor pointerCursor;
QCursor handCursor; QCursor handCursor;

@ -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