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. 9
      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)
{
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);

@ -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()));
}

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

@ -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);

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

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

@ -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;

@ -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,6 +202,10 @@ void UBBoardThumbnailsView::resizeEvent(QResizeEvent *event)
void UBBoardThumbnailsView::mousePressEvent(QMouseEvent *event)
{
QGraphicsView::mousePressEvent(event);
if (!event->isAccepted())
{
mLongPressTimer.start();
mLastPressedMousePos = event->pos();
@ -212,8 +218,7 @@ void UBBoardThumbnailsView::mousePressEvent(QMouseEvent *event)
UBApplication::boardController->setActiveDocumentScene(item->sceneIndex());
UBApplication::boardController->centerOn(UBApplication::boardController->activeScene()->lastCenter());
}
QGraphicsView::mousePressEvent(event);
}
}
void UBBoardThumbnailsView::mouseMoveEvent(QMouseEvent *event)

@ -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();

@ -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)

Loading…
Cancel
Save