Commit 47cdb048 authored by Aleksei Kanash's avatar Aleksei Kanash

SANKORE-664:

Fixed pages shuffling.
Fixed refreshing thumbnail of new added page.
Some code refactoring and optimizations.
parent 3e2113a1
......@@ -478,6 +478,7 @@ void UBBoardController::addScene()
setActiveDocumentScene(mActiveDocument, mActiveSceneIndex + 1);
QApplication::restoreOverrideCursor();
emit newPageAdded();
}
......@@ -1233,11 +1234,11 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if(documentChange)
{
emit activeDocumentChanged();
// Notify the navigator palette that the document has changed
emit setDocOnPageNavigator(pDocumentProxy);
UBGraphicsTextItem::lastUsedTextColor = QColor();
}
// Notify the navigator palette that the document has changed
emit setDocOnPageNavigator(pDocumentProxy);
if (sceneChange)
{
......
......@@ -223,6 +223,7 @@ class UBBoardController : public QObject
void stopScript();
signals:
void newPageAdded();
void activeSceneWillBePersisted();
void activeSceneWillChange();
void activeSceneChanged();
......
......@@ -255,6 +255,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
, mDocument(parent)
, mDarkBackground(false)
, mCrossedBackground(false)
, mZoomFactor(1)
, mIsDesktopMode(false)
, mIsModified(true)
, mBackgroundObject(0)
......
......@@ -55,8 +55,8 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
setFrameShadow(QFrame::Plain);
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(addNewPage()));
connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(generateThumbnails()));
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(generateThumbnails()));
connect(UBApplication::boardController, SIGNAL(newPageAdded()), this, SLOT(addNewPage()));
connect(mScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
connect(UBApplication::boardController, SIGNAL(documentReorganized(int)), this, SLOT(onMovedToIndex(int)));
connect(UBApplication::boardController, SIGNAL(scrollToSelectedPage()), this, SLOT(onScrollToSelectedPage()));
......@@ -91,7 +91,6 @@ void UBDocumentNavigator::setDocument(UBDocumentProxy *document)
if(document)
{
mCrntDoc = document;
generateThumbnails();
}
}
......@@ -322,11 +321,11 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
}
updateSpecificThumbnail(iOldPage);
mCrntItem = pCrntItem;
}
// Then display the related page
emit changeCurrentPage();
refreshScene();
// Then display the related page
emit changeCurrentPage();
refreshScene();
}
}
bNavig = false;
......
......@@ -119,7 +119,6 @@ void UBPageNavigationWidget::setDocument(UBDocumentProxy *document)
if(mNavigator->currentDoc() != document)
{
mNavigator->setDocument(document);
UBApplication::boardController->notifyPageChanged();
}
}
......
......@@ -751,7 +751,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD
, bCanMoveUp(false)
, bCanMoveDown(false)
{
if(UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){
if(0 <= UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){
setAcceptsHoverEvents(true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
......@@ -826,7 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
bCanMoveDown = false;
UBDocumentProxy* p = proxy();
if(NULL != p && UBApplication::boardController->pageFromSceneIndex(sceneIndex()))
if(NULL != p && 0 <= UBApplication::boardController->pageFromSceneIndex(sceneIndex()))
{
int iNbPages = p->pageCount();
if(1 < iNbPages)
......@@ -842,7 +842,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
}
}
}
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<=1)
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<1)
bCanMoveUp = false;
if(bCanDelete || bCanMoveUp || bCanMoveDown)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment