increased messages during document loading + optimized some calls

preferencesAboutTextFull
Clément Fauconnier 7 years ago
parent 012e838491
commit e2aef9f0aa
  1. 1
      src/adaptors/UBThumbnailAdaptor.cpp
  2. 6
      src/board/UBBoardController.cpp
  3. 1
      src/core/UBApplicationController.cpp
  4. 1
      src/core/UBPersistenceManager.cpp
  5. 1
      src/document/UBDocumentContainer.cpp
  6. 1
      src/document/UBDocumentContainer.h
  7. 3
      src/document/UBDocumentController.cpp
  8. 27
      src/gui/UBBoardThumbnailsView.cpp
  9. 4
      src/gui/UBMessageWindow.cpp
  10. 14
      src/gui/UBThumbnailWidget.cpp

@ -85,6 +85,7 @@ void UBThumbnailAdaptor::generateMissingThumbnails(UBDocumentProxy* proxy)
const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex) 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); QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", pageIndex);
QFile file(fileName); QFile file(fileName);

@ -189,6 +189,7 @@ void UBBoardController::initBackgroundGridSize()
int gridSize = (resolutionRatio * 10. * dpi) / UBGeometryUtils::inchSize; int gridSize = (resolutionRatio * 10. * dpi) / UBGeometryUtils::inchSize;
UBSettings::settings()->crossSize = gridSize; UBSettings::settings()->crossSize = gridSize;
UBSettings::settings()->defaultCrossSize = gridSize;
mActiveScene->setBackgroundGridSize(gridSize); mActiveScene->setBackgroundGridSize(gridSize);
//qDebug() << "grid size: " << gridSize; //qDebug() << "grid size: " << gridSize;
@ -228,10 +229,11 @@ void UBBoardController::setupViews()
mDisplayView->setInteractive(false); mDisplayView->setInteractive(false);
mDisplayView->setTransformationAnchor(QGraphicsView::NoAnchor); mDisplayView->setTransformationAnchor(QGraphicsView::NoAnchor);
mMessageWindow = new UBMessageWindow(mControlView); mPaletteManager = new UBBoardPaletteManager(mControlContainer, this);
mMessageWindow = new UBMessageWindow(mControlContainer);
mMessageWindow->hide(); mMessageWindow->hide();
mPaletteManager = new UBBoardPaletteManager(mControlContainer, this);
connect(this, SIGNAL(activeSceneChanged()), mPaletteManager, SLOT(activeSceneChanged())); connect(this, SIGNAL(activeSceneChanged()), mPaletteManager, SLOT(activeSceneChanged()));
} }

@ -358,6 +358,7 @@ void UBApplicationController::showBoard()
} }
} }
UBApplication::showMessage(tr("Drawing active scene and thumbnail previews"));
mMainMode = Board; mMainMode = Board;
adaptToolBar(); adaptToolBar();

@ -777,6 +777,7 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
if (pDocumentProxy->isModified()) if (pDocumentProxy->isModified())
persistDocumentMetadata(pDocumentProxy, forceImmediateSaving); persistDocumentMetadata(pDocumentProxy, forceImmediateSaving);
UBApplication::showMessage(tr("saving document thumbnail for the page %1").arg(pSceneIndex+1));
UBThumbnailAdaptor::persistScene(pDocumentProxy, pScene, pSceneIndex); UBThumbnailAdaptor::persistScene(pDocumentProxy, pScene, pSceneIndex);
if(forceImmediateSaving) if(forceImmediateSaving)
UBSvgSubsetAdaptor::persistScene(pDocumentProxy,pScene,pSceneIndex); UBSvgSubsetAdaptor::persistScene(pDocumentProxy,pScene,pSceneIndex);

@ -54,7 +54,6 @@ void UBDocumentContainer::setDocument(UBDocumentProxy* document, bool forceReloa
emit initThumbnailsRequired(this); emit initThumbnailsRequired(this);
emit documentSet(mCurrentDocument); emit documentSet(mCurrentDocument);
reloadThumbnails();
} }
} }

@ -61,7 +61,6 @@ class UBDocumentContainer : public QObject
void insertThumbPage(int index); void insertThumbPage(int index);
private: private:
UBDocumentProxy* mCurrentDocument; UBDocumentProxy* mCurrentDocument;
QList<const QPixmap*> mDocumentThumbs; QList<const QPixmap*> mDocumentThumbs;

@ -168,6 +168,7 @@ void UBDocumentController::selectDocument(UBDocumentProxy* proxy, bool setAsCurr
if (selected) if (selected)
{ {
setDocument(proxy); setDocument(proxy);
reloadThumbnails();
selected->setSelected(true); selected->setSelected(true);
@ -267,7 +268,7 @@ void UBDocumentController::itemSelectionChanged()
{ {
updateCurrentSelection(); updateCurrentSelection();
reloadThumbnails(); emit documentThumbnailsUpdated(this);
if (multipleSelection()) if (multipleSelection())
mSelectionType = Multiple; mSelectionType = Multiple;

@ -115,6 +115,8 @@ void UBBoardThumbnailsView::removeThumbnail(int i)
UBDraggableThumbnailView* UBBoardThumbnailsView::createThumbnail(UBDocumentContainer* source, 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); UBGraphicsScene* pageScene = UBPersistenceManager::persistenceManager()->loadDocumentScene(source->selectedDocument(), i);
UBThumbnailView* pageView = new UBThumbnailView(pageScene); UBThumbnailView* pageView = new UBThumbnailView(pageScene);
@ -200,20 +202,23 @@ void UBBoardThumbnailsView::resizeEvent(QResizeEvent *event)
void UBBoardThumbnailsView::mousePressEvent(QMouseEvent *event) void UBBoardThumbnailsView::mousePressEvent(QMouseEvent *event)
{ {
mLongPressTimer.start(); QGraphicsView::mousePressEvent(event);
mLastPressedMousePos = event->pos();
UBDraggableThumbnailView* item = dynamic_cast<UBDraggableThumbnailView*>(itemAt(event->pos()));
if (item) if (!event->isAccepted())
{ {
UBApplication::boardController->persistViewPositionOnCurrentScene(); mLongPressTimer.start();
UBApplication::boardController->persistCurrentScene(); mLastPressedMousePos = event->pos();
UBApplication::boardController->setActiveDocumentScene(item->sceneIndex());
UBApplication::boardController->centerOn(UBApplication::boardController->activeScene()->lastCenter());
}
QGraphicsView::mousePressEvent(event); UBDraggableThumbnailView* item = dynamic_cast<UBDraggableThumbnailView*>(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) void UBBoardThumbnailsView::mouseMoveEvent(QMouseEvent *event)

@ -42,7 +42,7 @@ UBMessageWindow::UBMessageWindow(QWidget *parent)
mLabel = new QLabel(parent); mLabel = new QLabel(parent);
mLabel->setStyleSheet(QString("QLabel { color: white; background-color: transparent; border: none; font-family: Arial; font-size: 14px }")); 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); mLayout->setContentsMargins(radius() + 15, 4, radius() + 15, 4);
@ -79,7 +79,7 @@ void UBMessageWindow::showMessage(const QString& message, bool showSpinningWheel
{ {
mSpinningWheel->hide(); mSpinningWheel->hide();
mSpinningWheel->stopAnimation(); mSpinningWheel->stopAnimation();
mTimer.start(200, this); mTimer.start(50, this);
} }
adjustSizeAndPosition(); adjustSizeAndPosition();

@ -898,17 +898,27 @@ void UBDraggableThumbnail::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (triggered(p.y())) if (triggered(p.y()))
{ {
if(deletable() && getIcon("close")->triggered(p.x())) if(deletable() && getIcon("close")->triggered(p.x()))
{
event->accept();
deletePage(); deletePage();
}
else if(getIcon("duplicate")->triggered(p.x())) else if(getIcon("duplicate")->triggered(p.x()))
{
event->accept();
duplicatePage(); duplicatePage();
}
/* /*
else if(movableUp() && getIcon("moveUp")->triggered(p.x())) else if(movableUp() && getIcon("moveUp")->triggered(p.x()))
moveUpPage(); moveUpPage();
else if (movableDown() && getIcon("moveDown")->triggered(p.x())) else if (movableDown() && getIcon("moveDown")->triggered(p.x()))
moveDownPage();*/ moveDownPage();*/
}
event->accept(); event->ignore();
}
else
{
event->ignore();
}
} }
void UBDraggableThumbnail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void UBDraggableThumbnail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)

Loading…
Cancel
Save