Merge branch 'OEFUniboard' of github.com:stayonshadow/PrivateBoard into OEFUniboard

preferencesAboutTextFull
Didier Clerc 11 years ago
commit 30e51f5a88
  1. 15
      src/board/UBBoardController.cpp
  2. 2
      src/board/UBBoardController.h
  3. 3
      src/core/UBMimeData.cpp
  4. 12
      src/domain/UBGraphicsGroupContainerItem.cpp
  5. 5
      src/domain/UBGraphicsItemDelegate.cpp
  6. 3
      src/domain/UBGraphicsProxyWidget.cpp
  7. 5
      src/domain/UBGraphicsScene.cpp
  8. 18
      src/domain/UBSelectionFrame.cpp

@ -543,7 +543,7 @@ void UBBoardController::duplicateScene()
duplicateScene(mActiveSceneIndex); duplicateScene(mActiveSceneIndex);
} }
UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync) UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
{ {
if (!item) if (!item)
return NULL; return NULL;
@ -602,12 +602,9 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync)
if (mitem) if (mitem)
{ {
sourceUrl = mitem->mediaFileUrl(); sourceUrl = mitem->mediaFileUrl();
if (bAsync)
{
downloadURL(sourceUrl, srcFile, itemPos, QSize(itemSize.width(), itemSize.height()), false, false); downloadURL(sourceUrl, srcFile, itemPos, QSize(itemSize.width(), itemSize.height()), false, false);
return NULL; // async operation return NULL; // async operation
} }
}
}break; }break;
case UBMimeType::VectorImage: case UBMimeType::VectorImage:
@ -643,8 +640,8 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item, bool bAsync)
mActiveScene->setURStackEnable(false); mActiveScene->setURStackEnable(false);
foreach(QGraphicsItem* pIt, children){ foreach(QGraphicsItem* pIt, children){
UBItem* pItem = dynamic_cast<UBItem*>(pIt); UBItem* pItem = dynamic_cast<UBItem*>(pIt);
if(pItem){ // we diong sync duplication of all childs. if(pItem){
QGraphicsItem * itemToGroup = dynamic_cast<QGraphicsItem *>(duplicateItem(pItem, false)); QGraphicsItem * itemToGroup = dynamic_cast<QGraphicsItem *>(duplicateItem(pItem));
if (itemToGroup) if (itemToGroup)
duplicatedItems.append(itemToGroup); duplicatedItems.append(itemToGroup);
} }
@ -2220,11 +2217,7 @@ void UBBoardController::copy()
UBItem* ubItem = dynamic_cast<UBItem*>(gi); UBItem* ubItem = dynamic_cast<UBItem*>(gi);
if (ubItem && !mActiveScene->tools().contains(gi)) if (ubItem && !mActiveScene->tools().contains(gi))
{ selected << ubItem;
UBItem *itemCopy = ubItem->deepCopy();
if (itemCopy)
selected << itemCopy;
}
} }
if (selected.size() > 0) if (selected.size() > 0)

@ -168,7 +168,7 @@ class UBBoardController : public UBDocumentContainer
void moveSceneToIndex(int source, int target); void moveSceneToIndex(int source, int target);
void duplicateScene(int index); void duplicateScene(int index);
UBGraphicsItem *duplicateItem(UBItem *item, bool bAsync = true); UBGraphicsItem *duplicateItem(UBItem *item);
void deleteScene(int index); void deleteScene(int index);
bool cacheIsVisible() {return mCacheWidgetIsEnabled;} bool cacheIsVisible() {return mCacheWidgetIsEnabled;}

@ -61,6 +61,5 @@ UBMimeDataGraphicsItem::UBMimeDataGraphicsItem(QList<UBItem*> pItems)
UBMimeDataGraphicsItem::~UBMimeDataGraphicsItem() UBMimeDataGraphicsItem::~UBMimeDataGraphicsItem()
{ {
foreach(UBItem* item, mItems) // Explanation: selected items are owned by the scene and handled by this class
delete item;
} }

@ -183,16 +183,6 @@ void UBGraphicsGroupContainerItem::paint(QPainter *painter, const QStyleOptionGr
Q_UNUSED(painter); Q_UNUSED(painter);
Q_UNUSED(option); Q_UNUSED(option);
// we would not use paint smth for the moment
// if (option->state & QStyle::State_Selected) {
// painter->setBrush(Qt::NoBrush);
// QPen tmpPen;
// qreal tmpPenWidth = 1.0;
// tmpPen.setWidth(tmpPenWidth);
// tmpPen.setColor(Qt::lightGray);
// painter->setPen(tmpPen);
// painter->drawRect(itemsBoundingRect.adjusted(tmpPenWidth / 2, tmpPenWidth / 2, -tmpPenWidth / 2, -tmpPenWidth / 2));
// }
Delegate()->postpaint(painter, option, widget); Delegate()->postpaint(painter, option, widget);
} }
@ -211,8 +201,6 @@ UBGraphicsGroupContainerItem *UBGraphicsGroupContainerItem::deepCopy() const
copyItemParameters(copy); copyItemParameters(copy);
// copy->resize(this->size());
return copy; return copy;
} }

@ -120,14 +120,17 @@ void DelegateButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void DelegateButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void DelegateButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
painter->save();
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
QGraphicsSvgItem::paint(painter, option, widget); QGraphicsSvgItem::paint(painter, option, widget);
painter->restore();
if (mIsPressed && mShowProgressIndicator) { if (mIsPressed && mShowProgressIndicator) {
QPen pen; QPen pen;
pen.setBrush(Qt::white); pen.setBrush(Qt::white);
pen.setWidth(3); pen.setWidth(3);
painter->save(); painter->save();
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
painter->setPen(pen); painter->setPen(pen);
int spanAngle = qMin(mPressProgres, UBSettings::longClickInterval) * 360 / UBSettings::longClickInterval; int spanAngle = qMin(mPressProgres, UBSettings::longClickInterval) * 360 / UBSettings::longClickInterval;

@ -49,8 +49,11 @@ UBGraphicsProxyWidget::~UBGraphicsProxyWidget()
void UBGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void UBGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
painter->save();
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
QGraphicsProxyWidget::paint(painter,option,widget); QGraphicsProxyWidget::paint(painter,option,widget);
Delegate()->postpaint(painter, option, widget); Delegate()->postpaint(painter, option, widget);
painter->restore();
} }
QVariant UBGraphicsProxyWidget::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsProxyWidget::itemChange(GraphicsItemChange change, const QVariant &value)

@ -319,8 +319,6 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
mShouldUseOMP = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5; mShouldUseOMP = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5;
#endif #endif
// setItemIndexMethod(QGraphicsScene::BspTreeIndex);
setUuid(QUuid::createUuid()); setUuid(QUuid::createUuid());
setDocument(parent); setDocument(parent);
createEraiser(); createEraiser();
@ -1070,9 +1068,6 @@ void UBGraphicsScene::notifyZChanged(QGraphicsItem *item, qreal zValue)
void UBGraphicsScene::updateSelectionFrame() void UBGraphicsScene::updateSelectionFrame()
{ {
qDebug() << "selected item count" << selectedItems().count(); qDebug() << "selected item count" << selectedItems().count();
// if (!mMultipleSelectionProcess) {
// return;
// }
if (!mSelectionFrame) { if (!mSelectionFrame) {
mSelectionFrame = new UBSelectionFrame(); mSelectionFrame = new UBSelectionFrame();

@ -133,12 +133,6 @@ void UBSelectionFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
} else { } else {
mOperationMode = om_moving; mOperationMode = om_moving;
} }
// foreach (UBGraphicsItemDelegate *curDelegate, mEnclosedtems) {
// qDebug() << "TransformBefore" << curDelegate->delegated()->transform();
// }
// QGraphicsRectItem::mousePressEvent(event);
} }
void UBSelectionFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBSelectionFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
@ -191,9 +185,6 @@ void UBSelectionFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
item->update(); item->update();
item->setTransform(ownTransform, false); item->setTransform(ownTransform, false);
// int resultAngle = (int)mRotationAngle % 360;
// setCursorFromAngle(QString::number(resultAngle));
qDebug() << "curAngle" << mRotationAngle; qDebug() << "curAngle" << mRotationAngle;
} break; } break;
@ -219,11 +210,6 @@ void UBSelectionFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent */*event*/)
} }
mOperationMode = om_idle; mOperationMode = om_idle;
// foreach (UBGraphicsItemDelegate *curDelegate, mEnclosedtems) {
// qDebug() << "TransformBefore" << curDelegate->delegated()->transform();
// }
// QGraphicsRectItem::mouseReleaseEvent(event);
} }
void UBSelectionFrame::onZoomChanged(qreal pZoom) void UBSelectionFrame::onZoomChanged(qreal pZoom)
@ -232,11 +218,7 @@ void UBSelectionFrame::onZoomChanged(qreal pZoom)
qDebug() << "Board current zoom" << UBApplication::boardController->currentZoom(); qDebug() << "Board current zoom" << UBApplication::boardController->currentZoom();
qDebug() << "UBApplication::boardController->systemScaleFactor()" << UBApplication::boardController->systemScaleFactor(); qDebug() << "UBApplication::boardController->systemScaleFactor()" << UBApplication::boardController->systemScaleFactor();
mAntiscaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * pZoom); mAntiscaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * pZoom);
// updateScale();
// QTransform tr;
// tr.scale(mAntiscaleRatio, mAntiscaleRatio);
// this->setTransform(tr);
} }
void UBSelectionFrame::remove() void UBSelectionFrame::remove()

Loading…
Cancel
Save