Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit ce160bf39c
  1. 2
      src/adaptors/UBImportPDF.cpp
  2. 2
      src/domain/UBGraphicsMediaItem.h
  3. 25
      src/domain/UBGraphicsMediaItemDelegate.cpp
  4. 3
      src/domain/UBGraphicsMediaItemDelegate.h

@ -80,7 +80,7 @@ bool UBImportPDF::addFileToDocument(UBDocumentProxy* pDocument, const QFile& pFi
for(int pdfPageNumber = 1; pdfPageNumber <= pdfPageCount; pdfPageNumber++) for(int pdfPageNumber = 1; pdfPageNumber <= pdfPageCount; pdfPageNumber++)
{ {
int pageIndex = documentPageCount + (pdfPageNumber - 1); int pageIndex = documentPageCount + pdfPageNumber;
UBApplication::showMessage(tr("Importing page %1 of %2").arg(pdfPageNumber).arg(pdfPageCount), true); UBApplication::showMessage(tr("Importing page %1 of %2").arg(pdfPageNumber).arg(pdfPageCount), true);
UBGraphicsScene* scene = 0; UBGraphicsScene* scene = 0;

@ -32,7 +32,7 @@ public:
class UBAudioPresentationWidget : public QWidget class UBAudioPresentationWidget : public QWidget
{ {
public: public:
UBAudioPresentationWidget::UBAudioPresentationWidget(QWidget *parent = NULL) UBAudioPresentationWidget(QWidget *parent = NULL)
:QWidget(parent) :QWidget(parent)
, mBorderSize(10) , mBorderSize(10)
, mTitleSize(10) , mTitleSize(10)

@ -36,7 +36,6 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
, mMedia(pMedia) , mMedia(pMedia)
, mToolBarShowTimer(NULL) , mToolBarShowTimer(NULL)
, m_iToolBarShowingInterval(5000) , m_iToolBarShowingInterval(5000)
, mToolBarIsShown(false)
{ {
QPalette palette; QPalette palette;
palette.setBrush ( QPalette::Light, Qt::darkGray ); palette.setBrush ( QPalette::Light, Qt::darkGray );
@ -53,18 +52,12 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
connect(mToolBarShowTimer, SIGNAL(timeout()), this, SLOT(hideToolBar())); connect(mToolBarShowTimer, SIGNAL(timeout()), this, SLOT(hideToolBar()));
mToolBarShowTimer->setInterval(m_iToolBarShowingInterval); mToolBarShowTimer->setInterval(m_iToolBarShowingInterval);
} }
if (delegated()->getMediaType() == UBGraphicsMediaItem::mediaType_Video)
{
connect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged()));
}
} }
bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event) bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
mToolBarItem->show(); mToolBarItem->show();
mToolBarIsShown = true;
if (mToolBarShowTimer) if (mToolBarShowTimer)
mToolBarShowTimer->start(); mToolBarShowTimer->start();
@ -75,14 +68,6 @@ bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *even
void UBGraphicsMediaItemDelegate::hideToolBar() void UBGraphicsMediaItemDelegate::hideToolBar()
{ {
mToolBarItem->hide(); mToolBarItem->hide();
mToolBarIsShown = false;
}
void UBGraphicsMediaItemDelegate::onZoomChanged()
{
positionHandles();
if (!mToolBarIsShown)
hideToolBar();
} }
void UBGraphicsMediaItemDelegate::buildButtons() void UBGraphicsMediaItemDelegate::buildButtons()
@ -136,18 +121,16 @@ void UBGraphicsMediaItemDelegate::positionHandles()
{ {
UBGraphicsItemDelegate::positionHandles(); UBGraphicsItemDelegate::positionHandles();
qreal AntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
UBGraphicsMediaItem *mediaItem = dynamic_cast<UBGraphicsMediaItem*>(mDelegated); UBGraphicsMediaItem *mediaItem = dynamic_cast<UBGraphicsMediaItem*>(mDelegated);
if (mediaItem) if (mediaItem)
{ {
QRectF toolBarRect = mToolBarItem->rect(); QRectF toolBarRect = mToolBarItem->rect();
if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video) if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video)
{ {
mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height());//*AntiScaleRatio); mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height());
// mToolBarItem->setScale(AntiScaleRatio); // mToolBarItem->setScale(AntiScaleRatio);
toolBarRect.setWidth(delegated()->boundingRect().width());//AntiScaleRatio); toolBarRect.setWidth(delegated()->boundingRect().width());
} }
else if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio) else if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio)
{ {
@ -156,8 +139,8 @@ void UBGraphicsMediaItemDelegate::positionHandles()
if (audioWidget) if (audioWidget)
borderSize = audioWidget->borderSize(); borderSize = audioWidget->borderSize();
mToolBarItem->setPos(borderSize,delegated()->boundingRect().height()-(mToolBarItem->rect().height() + borderSize));//*AntiScaleRatio); mToolBarItem->setPos(borderSize,delegated()->boundingRect().height()-(mToolBarItem->rect().height() + borderSize));
toolBarRect.setWidth((delegated()->boundingRect().width()-2*borderSize));///AntiScaleRatio); toolBarRect.setWidth((delegated()->boundingRect().width()-2*borderSize));
mToolBarItem->show(); mToolBarItem->show();
} }

@ -57,8 +57,6 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
void hideToolBar(); void hideToolBar();
void onZoomChanged();
protected: protected:
virtual void buildButtons(); virtual void buildButtons();
@ -73,7 +71,6 @@ class UBGraphicsMediaItemDelegate : public UBGraphicsItemDelegate
QTimer *mToolBarShowTimer; QTimer *mToolBarShowTimer;
int m_iToolBarShowingInterval; int m_iToolBarShowingInterval;
bool mToolBarIsShown;
}; };
#endif /* UBGRAPHICSMEDIAITEMDELEGATE_H_ */ #endif /* UBGRAPHICSMEDIAITEMDELEGATE_H_ */
Loading…
Cancel
Save