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() ...@@ -478,6 +478,7 @@ void UBBoardController::addScene()
setActiveDocumentScene(mActiveDocument, mActiveSceneIndex + 1); setActiveDocumentScene(mActiveDocument, mActiveSceneIndex + 1);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
emit newPageAdded();
} }
...@@ -1233,11 +1234,11 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -1233,11 +1234,11 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if(documentChange) if(documentChange)
{ {
emit activeDocumentChanged(); emit activeDocumentChanged();
// Notify the navigator palette that the document has changed
emit setDocOnPageNavigator(pDocumentProxy);
UBGraphicsTextItem::lastUsedTextColor = QColor(); UBGraphicsTextItem::lastUsedTextColor = QColor();
} }
// Notify the navigator palette that the document has changed
emit setDocOnPageNavigator(pDocumentProxy);
if (sceneChange) if (sceneChange)
{ {
......
...@@ -223,6 +223,7 @@ class UBBoardController : public QObject ...@@ -223,6 +223,7 @@ class UBBoardController : public QObject
void stopScript(); void stopScript();
signals: signals:
void newPageAdded();
void activeSceneWillBePersisted(); void activeSceneWillBePersisted();
void activeSceneWillChange(); void activeSceneWillChange();
void activeSceneChanged(); void activeSceneChanged();
......
...@@ -255,6 +255,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) ...@@ -255,6 +255,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
, mDocument(parent) , mDocument(parent)
, mDarkBackground(false) , mDarkBackground(false)
, mCrossedBackground(false) , mCrossedBackground(false)
, mZoomFactor(1)
, mIsDesktopMode(false) , mIsDesktopMode(false)
, mIsModified(true) , mIsModified(true)
, mBackgroundObject(0) , mBackgroundObject(0)
......
...@@ -55,8 +55,8 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra ...@@ -55,8 +55,8 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra
setFrameShadow(QFrame::Plain); setFrameShadow(QFrame::Plain);
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(addNewPage())); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(generateThumbnails()));
connect(UBApplication::boardController, SIGNAL(setDocOnPageNavigator(UBDocumentProxy*)), this, SLOT(generateThumbnails())); connect(UBApplication::boardController, SIGNAL(newPageAdded()), this, SLOT(addNewPage()));
connect(mScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(mScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
connect(UBApplication::boardController, SIGNAL(documentReorganized(int)), this, SLOT(onMovedToIndex(int))); connect(UBApplication::boardController, SIGNAL(documentReorganized(int)), this, SLOT(onMovedToIndex(int)));
connect(UBApplication::boardController, SIGNAL(scrollToSelectedPage()), this, SLOT(onScrollToSelectedPage())); connect(UBApplication::boardController, SIGNAL(scrollToSelectedPage()), this, SLOT(onScrollToSelectedPage()));
...@@ -91,7 +91,6 @@ void UBDocumentNavigator::setDocument(UBDocumentProxy *document) ...@@ -91,7 +91,6 @@ void UBDocumentNavigator::setDocument(UBDocumentProxy *document)
if(document) if(document)
{ {
mCrntDoc = document; mCrntDoc = document;
generateThumbnails();
} }
} }
...@@ -322,12 +321,12 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event) ...@@ -322,12 +321,12 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
} }
updateSpecificThumbnail(iOldPage); updateSpecificThumbnail(iOldPage);
mCrntItem = pCrntItem; mCrntItem = pCrntItem;
}
// Then display the related page // Then display the related page
emit changeCurrentPage(); emit changeCurrentPage();
refreshScene(); refreshScene();
} }
}
bNavig = false; bNavig = false;
} }
......
...@@ -119,7 +119,6 @@ void UBPageNavigationWidget::setDocument(UBDocumentProxy *document) ...@@ -119,7 +119,6 @@ void UBPageNavigationWidget::setDocument(UBDocumentProxy *document)
if(mNavigator->currentDoc() != document) if(mNavigator->currentDoc() != document)
{ {
mNavigator->setDocument(document); mNavigator->setDocument(document);
UBApplication::boardController->notifyPageChanged();
} }
} }
......
...@@ -751,7 +751,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD ...@@ -751,7 +751,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD
, bCanMoveUp(false) , bCanMoveUp(false)
, bCanMoveDown(false) , bCanMoveDown(false)
{ {
if(UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){ if(0 <= UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);
setFlag(QGraphicsItem::ItemIsSelectable, true); setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
...@@ -826,7 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() ...@@ -826,7 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
bCanMoveDown = false; bCanMoveDown = false;
UBDocumentProxy* p = proxy(); UBDocumentProxy* p = proxy();
if(NULL != p && UBApplication::boardController->pageFromSceneIndex(sceneIndex())) if(NULL != p && 0 <= UBApplication::boardController->pageFromSceneIndex(sceneIndex()))
{ {
int iNbPages = p->pageCount(); int iNbPages = p->pageCount();
if(1 < iNbPages) if(1 < iNbPages)
...@@ -842,7 +842,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState() ...@@ -842,7 +842,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
} }
} }
} }
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<=1) if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<1)
bCanMoveUp = false; bCanMoveUp = false;
if(bCanDelete || bCanMoveUp || bCanMoveDown) 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