|
|
@ -750,6 +750,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD |
|
|
|
, bCanDelete(false) |
|
|
|
, bCanDelete(false) |
|
|
|
, bCanMoveUp(false) |
|
|
|
, bCanMoveUp(false) |
|
|
|
, bCanMoveDown(false) |
|
|
|
, bCanMoveDown(false) |
|
|
|
|
|
|
|
, bCanDuplicate(false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(0 <= UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){ |
|
|
|
if(0 <= UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){ |
|
|
|
setAcceptsHoverEvents(true); |
|
|
|
setAcceptsHoverEvents(true); |
|
|
@ -788,14 +789,18 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra |
|
|
|
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/close.svg")); |
|
|
|
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/close.svg")); |
|
|
|
else |
|
|
|
else |
|
|
|
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/closeDisabled.svg")); |
|
|
|
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/closeDisabled.svg")); |
|
|
|
|
|
|
|
if(bCanDuplicate) |
|
|
|
|
|
|
|
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/duplicate.svg")); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/duplicateDisabled.svg")); |
|
|
|
if(bCanMoveUp) |
|
|
|
if(bCanMoveUp) |
|
|
|
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUp.svg")); |
|
|
|
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUp.svg")); |
|
|
|
else |
|
|
|
else |
|
|
|
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUpDisabled.svg")); |
|
|
|
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUpDisabled.svg")); |
|
|
|
if(bCanMoveDown) |
|
|
|
if(bCanMoveDown) |
|
|
|
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menu.svg")); |
|
|
|
painter->drawPixmap(3*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menu.svg")); |
|
|
|
else |
|
|
|
else |
|
|
|
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menuDisabled.svg")); |
|
|
|
painter->drawPixmap(3*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menuDisabled.svg")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -805,17 +810,14 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even |
|
|
|
|
|
|
|
|
|
|
|
// Here we check the position of the click and verify if it has to trig an action or not.
|
|
|
|
// 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(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) |
|
|
|
{ |
|
|
|
|
|
|
|
deletePage(); |
|
|
|
deletePage(); |
|
|
|
} |
|
|
|
if(bCanDuplicate && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) |
|
|
|
if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) |
|
|
|
duplicatePage(); |
|
|
|
{ |
|
|
|
if(bCanMoveUp && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 3*BUTTONSIZE + 2*BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) |
|
|
|
moveUpPage(); |
|
|
|
moveUpPage(); |
|
|
|
} |
|
|
|
if(bCanMoveDown && p.x() >= 3*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 4*BUTTONSIZE + 3*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) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
moveDownPage(); |
|
|
|
moveDownPage(); |
|
|
|
} |
|
|
|
|
|
|
|
event->accept(); |
|
|
|
event->accept(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -824,6 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() |
|
|
|
bCanDelete = false; |
|
|
|
bCanDelete = false; |
|
|
|
bCanMoveUp = false; |
|
|
|
bCanMoveUp = false; |
|
|
|
bCanMoveDown = false; |
|
|
|
bCanMoveDown = false; |
|
|
|
|
|
|
|
bCanDuplicate = true; |
|
|
|
|
|
|
|
|
|
|
|
UBDocumentProxy* p = proxy(); |
|
|
|
UBDocumentProxy* p = proxy(); |
|
|
|
if(NULL != p && 0 <= UBApplication::boardController->pageFromSceneIndex(sceneIndex())) |
|
|
|
if(NULL != p && 0 <= UBApplication::boardController->pageFromSceneIndex(sceneIndex())) |
|
|
@ -842,13 +845,19 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<1) |
|
|
|
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<=1) |
|
|
|
bCanMoveUp = false; |
|
|
|
bCanMoveUp = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex() == 0){ |
|
|
|
|
|
|
|
bCanDelete = false; |
|
|
|
|
|
|
|
bCanDuplicate = false; |
|
|
|
|
|
|
|
bCanMoveUp = false; |
|
|
|
|
|
|
|
bCanMoveDown = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(bCanDelete || bCanMoveUp || bCanMoveDown) |
|
|
|
if(bCanDelete || bCanMoveUp || bCanMoveDown) |
|
|
|
{ |
|
|
|
|
|
|
|
bButtonsVisible = true; |
|
|
|
bButtonsVisible = true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBSceneThumbnailNavigPixmap::deletePage() |
|
|
|
void UBSceneThumbnailNavigPixmap::deletePage() |
|
|
@ -859,6 +868,14 @@ void UBSceneThumbnailNavigPixmap::deletePage() |
|
|
|
UBApplication::documentController->deletePages(itemsToDelete); |
|
|
|
UBApplication::documentController->deletePages(itemsToDelete); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBSceneThumbnailNavigPixmap::duplicatePage() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QList<int> itemsToDelete; |
|
|
|
|
|
|
|
itemsToDelete << sceneIndex(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBApplication::documentController->duplicateScenes(proxy(),itemsToDelete); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBSceneThumbnailNavigPixmap::moveUpPage() |
|
|
|
void UBSceneThumbnailNavigPixmap::moveUpPage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1); |
|
|
|
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1); |
|
|
|