Revert "workaround to adress badly attached thumbnail views (no more time to investigate on it...) + prevent overwriting scenes"

This reverts commit 0fd15f62a4.
preferencesAboutTextFull
Clément Fauconnier 7 years ago
parent 407e454897
commit ce2f4259c5
  1. 14
      src/board/UBBoardController.cpp
  2. 2
      src/document/UBDocumentContainer.cpp
  3. 1
      src/document/UBDocumentContainer.h
  4. 17
      src/gui/UBBoardThumbnailsView.cpp
  5. 1
      src/gui/UBBoardThumbnailsView.h

@ -1536,11 +1536,11 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
ClearUndoStack();
persistCurrentScene(); //previous scene
mActiveScene = targetScene;
mActiveSceneIndex = index;
persistCurrentScene();
setDocument(pDocumentProxy, forceReload);
updateSystemScaleFactor();
@ -1556,8 +1556,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
adjustDisplayViews();
persistCurrentScene(); //new scene
UBSettings::settings()->setDarkBackground(mActiveScene->isDarkBackground());
UBSettings::settings()->setPageBackground(mActiveScene->pageBackground());
@ -1569,18 +1567,10 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
updateBackgroundActionsState(mActiveScene->isDarkBackground(), mActiveScene->pageBackground());
if(documentChange)
{
UBGraphicsTextItem::lastUsedTextColor = QColor();
emit initThumbnailsRequired(this);
}
if (sceneChange)
{
emit activeSceneChanged();
//should not be necessary, but if not called, sometimes, some views are not "connected" the first time the document is loaded
//this is a workaround to adress unexpectedly badly attached thumbnail views (no more time to investigate on it...)
emit reloadThumbnailRequired(this, mActiveSceneIndex);
}
}

@ -92,7 +92,7 @@ void UBDocumentContainer::deletePages(QList<int>& pageIndexes)
offset++;
}
emit documentThumbnailsUpdated(this);
}
void UBDocumentContainer::addPage(int index)

@ -80,7 +80,6 @@ class UBDocumentContainer : public QObject
void addThumbnailRequired(UBDocumentContainer* source, int index);
void removeThumbnailRequired(int index);
void moveThumbnailRequired(int from, int to);
void reloadThumbnailRequired(UBDocumentContainer* source, int index);
void documentThumbnailsUpdated(UBDocumentContainer* source);
};

@ -78,7 +78,6 @@ UBBoardThumbnailsView::UBBoardThumbnailsView(QWidget *parent, const char *name)
connect(UBApplication::boardController, SIGNAL(addThumbnailRequired(UBDocumentContainer*, int)), this, SLOT(addThumbnail(UBDocumentContainer*, int)), Qt::UniqueConnection);
connect(UBApplication::boardController, SIGNAL(moveThumbnailRequired(int, int)), this, SLOT(moveThumbnail(int, int)), Qt::UniqueConnection);
connect(this, SIGNAL(moveThumbnailRequired(int, int)), this, SLOT(moveThumbnail(int, int)), Qt::UniqueConnection);
connect(UBApplication::boardController, SIGNAL(reloadThumbnailRequired(UBDocumentContainer*, int)), this, SLOT(reloadThumbnail(UBDocumentContainer*, int)), Qt::UniqueConnection);
connect(UBApplication::boardController, SIGNAL(removeThumbnailRequired(int)), this, SLOT(removeThumbnail(int)), Qt::UniqueConnection);
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressTimeout()), Qt::UniqueConnection);
@ -95,13 +94,6 @@ void UBBoardThumbnailsView::moveThumbnail(int from, int to)
updateThumbnailsPos();
}
void UBBoardThumbnailsView::reloadThumbnail(UBDocumentContainer* source, int index)
{
removeThumbnail(index);
addThumbnail(source, index);
}
void UBBoardThumbnailsView::removeThumbnail(int i)
{
UBDraggableThumbnailView* item = mThumbnails.at(i);
@ -135,12 +127,7 @@ void UBBoardThumbnailsView::addThumbnail(UBDocumentContainer* source, int i)
void UBBoardThumbnailsView::clearThumbnails()
{
for(int i = 0; i < mThumbnails.size(); i++)
{
scene()->removeItem(mThumbnails.at(i)->pageNumber());
scene()->removeItem(mThumbnails.at(i));
mThumbnails.at(i)->deleteLater();
}
qDeleteAll(mThumbnails);
mThumbnails.clear();
}
@ -224,7 +211,7 @@ void UBBoardThumbnailsView::mousePressAndHoldEvent(QPoint pos)
drag->setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2));
drag->exec();
}
}
}
void UBBoardThumbnailsView::mouseReleaseEvent(QMouseEvent *event)

@ -50,7 +50,6 @@ public slots:
void clearThumbnails();
void initThumbnails(UBDocumentContainer* source);
void addThumbnail(UBDocumentContainer* source, int i);
void reloadThumbnail(UBDocumentContainer* source, int i);
void moveThumbnail(int from, int to);
void removeThumbnail(int i);

Loading…
Cancel
Save