Commit cf662842 authored by Aleksei Kanash's avatar Aleksei Kanash

Improved switching between documents. Removed useless calls, some logic changes.

parent f849bea3
...@@ -452,6 +452,7 @@ void UBBoardController::addScene() ...@@ -452,6 +452,7 @@ void UBBoardController::addScene()
setActiveDocumentScene(mActiveDocument, mActiveSceneIndex + 1); setActiveDocumentScene(mActiveDocument, mActiveSceneIndex + 1);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
emit newPageAdded();
} }
...@@ -1179,11 +1180,11 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -1179,11 +1180,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)
{ {
......
...@@ -215,6 +215,7 @@ class UBBoardController : public QObject ...@@ -215,6 +215,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();
......
...@@ -55,10 +55,11 @@ UBDocumentNavigator::UBDocumentNavigator(QWidget *parent, const char *name):QGra ...@@ -55,10 +55,11 @@ 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()));
} }
/** /**
...@@ -150,10 +151,11 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage) ...@@ -150,10 +151,11 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
if(UBApplication::boardController) if(UBApplication::boardController)
{ {
UBApplication::boardController->persistCurrentScene(); UBApplication::boardController->persistCurrentScene();
}else
{
UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage);
} }
UBThumbnailAdaptor::persistScene(mCrntDoc->persistencePath(), pScene, iPage);
// Load it // Load it
QPixmap pix = UBThumbnailAdaptor::load(mCrntDoc, iPage); QPixmap pix = UBThumbnailAdaptor::load(mCrntDoc, iPage);
UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, iPage); UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(pix, mCrntDoc, iPage);
......
...@@ -115,7 +115,6 @@ void UBPageNavigationWidget::setDocument(UBDocumentProxy *document) ...@@ -115,7 +115,6 @@ void UBPageNavigationWidget::setDocument(UBDocumentProxy *document)
if(mNavigator->currentDoc() != document) if(mNavigator->currentDoc() != document)
{ {
mNavigator->setDocument(document); mNavigator->setDocument(document);
UBApplication::boardController->notifyPageChanged();
} }
} }
......
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