diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index b0b6a141..3d87e123 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -85,6 +85,7 @@ void UBThumbnailAdaptor::generateMissingThumbnails(UBDocumentProxy* proxy) const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex) { + UBApplication::showMessage(tr("loading thumbnail of page %1").arg(pageIndex + 1)); QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex); QFile file(fileName); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index e5ce8e36..ffa576ec 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -189,6 +189,7 @@ void UBBoardController::initBackgroundGridSize() int gridSize = (resolutionRatio * 10. * dpi) / UBGeometryUtils::inchSize; UBSettings::settings()->crossSize = gridSize; + UBSettings::settings()->defaultCrossSize = gridSize; mActiveScene->setBackgroundGridSize(gridSize); //qDebug() << "grid size: " << gridSize; @@ -228,10 +229,11 @@ void UBBoardController::setupViews() mDisplayView->setInteractive(false); mDisplayView->setTransformationAnchor(QGraphicsView::NoAnchor); - mMessageWindow = new UBMessageWindow(mControlView); + mPaletteManager = new UBBoardPaletteManager(mControlContainer, this); + + mMessageWindow = new UBMessageWindow(mControlContainer); mMessageWindow->hide(); - mPaletteManager = new UBBoardPaletteManager(mControlContainer, this); connect(this, SIGNAL(activeSceneChanged()), mPaletteManager, SLOT(activeSceneChanged())); } diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index d8bdc89f..4e062425 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -358,6 +358,7 @@ void UBApplicationController::showBoard() } } + UBApplication::showMessage(tr("Drawing active scene and thumbnail previews")); mMainMode = Board; adaptToolBar(); diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index f0791119..a28cb35f 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -777,6 +777,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, if (pDocumentProxy->isModified()) persistDocumentMetadata(pDocumentProxy, forceImmediateSaving); + UBApplication::showMessage(tr("saving document thumbnail for the page %1").arg(pSceneIndex+1)); UBThumbnailAdaptor::persistScene(pDocumentProxy, pScene, pSceneIndex); if(forceImmediateSaving) UBSvgSubsetAdaptor::persistScene(pDocumentProxy,pScene,pSceneIndex); diff --git a/src/document/UBDocumentContainer.cpp b/src/document/UBDocumentContainer.cpp index 9bc9601c..2d30f607 100644 --- a/src/document/UBDocumentContainer.cpp +++ b/src/document/UBDocumentContainer.cpp @@ -54,7 +54,6 @@ void UBDocumentContainer::setDocument(UBDocumentProxy* document, bool forceReloa emit initThumbnailsRequired(this); emit documentSet(mCurrentDocument); - reloadThumbnails(); } } diff --git a/src/document/UBDocumentContainer.h b/src/document/UBDocumentContainer.h index 8ee9b5c0..f47e08ea 100644 --- a/src/document/UBDocumentContainer.h +++ b/src/document/UBDocumentContainer.h @@ -61,7 +61,6 @@ class UBDocumentContainer : public QObject void insertThumbPage(int index); - private: UBDocumentProxy* mCurrentDocument; QList mDocumentThumbs; diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 04d53136..7c6b3406 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -168,6 +168,7 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr if (selected) { setDocument(proxy); + reloadThumbnails(); selected->setSelected(true); @@ -267,7 +268,7 @@ void UBDocumentController::itemSelectionChanged() { updateCurrentSelection(); - reloadThumbnails(); + emit documentThumbnailsUpdated(this); if (multipleSelection()) mSelectionType = Multiple; diff --git a/src/gui/UBBoardThumbnailsView.cpp b/src/gui/UBBoardThumbnailsView.cpp index f2ccafd7..c7fa4b9b 100644 --- a/src/gui/UBBoardThumbnailsView.cpp +++ b/src/gui/UBBoardThumbnailsView.cpp @@ -115,6 +115,8 @@ void UBBoardThumbnailsView::removeThumbnail(int i) UBDraggableThumbnailView* UBBoardThumbnailsView::createThumbnail(UBDocumentContainer* source, int i) { + UBApplication::showMessage(tr("Loading document scene (%1/%2)").arg(i+1).arg(source->selectedDocument()->pageCount())); + UBGraphicsScene* pageScene = UBPersistenceManager::persistenceManager()->loadDocumentScene(source->selectedDocument(), i); UBThumbnailView* pageView = new UBThumbnailView(pageScene); @@ -200,20 +202,23 @@ void UBBoardThumbnailsView::resizeEvent(QResizeEvent *event) void UBBoardThumbnailsView::mousePressEvent(QMouseEvent *event) { - mLongPressTimer.start(); - mLastPressedMousePos = event->pos(); - - UBDraggableThumbnailView* item = dynamic_cast(itemAt(event->pos())); + QGraphicsView::mousePressEvent(event); - if (item) + if (!event->isAccepted()) { - UBApplication::boardController->persistViewPositionOnCurrentScene(); - UBApplication::boardController->persistCurrentScene(); - UBApplication::boardController->setActiveDocumentScene(item->sceneIndex()); - UBApplication::boardController->centerOn(UBApplication::boardController->activeScene()->lastCenter()); - } + mLongPressTimer.start(); + mLastPressedMousePos = event->pos(); - QGraphicsView::mousePressEvent(event); + UBDraggableThumbnailView* item = dynamic_cast(itemAt(event->pos())); + + if (item) + { + UBApplication::boardController->persistViewPositionOnCurrentScene(); + UBApplication::boardController->persistCurrentScene(); + UBApplication::boardController->setActiveDocumentScene(item->sceneIndex()); + UBApplication::boardController->centerOn(UBApplication::boardController->activeScene()->lastCenter()); + } + } } void UBBoardThumbnailsView::mouseMoveEvent(QMouseEvent *event) diff --git a/src/gui/UBMessageWindow.cpp b/src/gui/UBMessageWindow.cpp index 1d499a98..14adbbb6 100644 --- a/src/gui/UBMessageWindow.cpp +++ b/src/gui/UBMessageWindow.cpp @@ -42,7 +42,7 @@ UBMessageWindow::UBMessageWindow(QWidget *parent) mLabel = new QLabel(parent); mLabel->setStyleSheet(QString("QLabel { color: white; background-color: transparent; border: none; font-family: Arial; font-size: 14px }")); - mOriginalAlpha = mBackgroundBrush.color().alpha(); + mOriginalAlpha = 255; mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4); @@ -79,7 +79,7 @@ void UBMessageWindow::showMessage(const QString& message, bool showSpinningWheel { mSpinningWheel->hide(); mSpinningWheel->stopAnimation(); - mTimer.start(200, this); + mTimer.start(50, this); } adjustSizeAndPosition(); diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index 788c7f6d..5d6acbaf 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -898,17 +898,27 @@ void UBDraggableThumbnail::mousePressEvent(QGraphicsSceneMouseEvent *event) if (triggered(p.y())) { if(deletable() && getIcon("close")->triggered(p.x())) + { + event->accept(); deletePage(); + } else if(getIcon("duplicate")->triggered(p.x())) + { + event->accept(); duplicatePage(); + } /* else if(movableUp() && getIcon("moveUp")->triggered(p.x())) moveUpPage(); else if (movableDown() && getIcon("moveDown")->triggered(p.x())) moveDownPage();*/ - } - event->accept(); + event->ignore(); + } + else + { + event->ignore(); + } } void UBDraggableThumbnail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)