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

preferencesAboutTextFull
Didier Clerc 12 years ago
commit 712bd5238c
  1. 56
      src/board/UBBoardView.cpp
  2. 12
      src/domain/UBGraphicsMediaItem.cpp
  3. 3
      src/domain/UBGraphicsMediaItem.h
  4. 9
      src/domain/UBGraphicsTextItem.cpp
  5. 2
      src/domain/UBGraphicsTextItem.h

@ -91,7 +91,6 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent, bool
, mMultipleSelectionIsEnabled(false) , mMultipleSelectionIsEnabled(false)
, bIsControl(isControl) , bIsControl(isControl)
, bIsDesktop(isDesktop) , bIsDesktop(isDesktop)
, mRubberBandInPlayMode(false) //enables rubberband with play tool
{ {
init (); init ();
@ -535,12 +534,7 @@ Here we determines cases when items should to get mouse press event at pressing
case UBGraphicsTriangle::Type: case UBGraphicsTriangle::Type:
case UBGraphicsCompass::Type: case UBGraphicsCompass::Type:
case UBGraphicsCache::Type: case UBGraphicsCache::Type:
return true;
case UBGraphicsDelegateFrame::Type: case UBGraphicsDelegateFrame::Type:
case QGraphicsSvgItem::Type:
return true;
case DelegateButton::Type: case DelegateButton::Type:
return true; return true;
@ -989,10 +983,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if (!movingItem && !mController->cacheIsVisible()) if (!movingItem && !mController->cacheIsVisible())
mLongPressTimer.start(); mLongPressTimer.start();
if(mUBRubberBand) {
mUBRubberBand->hide();
}
handleItemMousePress(event); handleItemMousePress(event);
event->accept(); event->accept();
break; break;
@ -1006,9 +996,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
QListIterator<QGraphicsItem *> it (scene ()->items (fuzzyRect)); QListIterator<QGraphicsItem *> it (scene ()->items (fuzzyRect));
while (it.hasNext () && !foundTextItem) while (it.hasNext () && !foundTextItem)
{
foundTextItem = qgraphicsitem_cast<UBGraphicsTextItem*>(it.next ()); foundTextItem = qgraphicsitem_cast<UBGraphicsTextItem*>(it.next ());
}
if (foundTextItem) if (foundTextItem)
{ {
@ -1091,7 +1079,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
switch (currentTool) { switch (currentTool) {
case UBStylusTool::Hand : { case UBStylusTool::Hand : {
if (!mMouseButtonIsPressed && mTabletStylusIsPressed) { if (!mMouseButtonIsPressed && !mTabletStylusIsPressed) {
break; break;
} }
QPointF eventPosition = event->posF (); QPointF eventPosition = event->posF ();
@ -1109,7 +1097,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
return; return;
} }
bool rubberMove = currentTool != (UBStylusTool::Play || mRubberBandInPlayMode) bool rubberMove = (currentTool != (UBStylusTool::Play))
&& (mMouseButtonIsPressed || mTabletStylusIsPressed) && (mMouseButtonIsPressed || mTabletStylusIsPressed)
&& !movingItem; && !movingItem;
@ -1172,13 +1160,13 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
case UBStylusTool::Text : case UBStylusTool::Text :
case UBStylusTool::Capture : { case UBStylusTool::Capture : {
if (mRubberBand if (mRubberBand && (mIsCreatingTextZone || mIsCreatingSceneGrabZone)) {
&& (mIsCreatingTextZone || mIsCreatingSceneGrabZone)) {
mRubberBand->setGeometry(QRect(mMouseDownPos, event->pos()).normalized()); mRubberBand->setGeometry(QRect(mMouseDownPos, event->pos()).normalized());
event->accept(); event->accept();
} else {
QGraphicsView::mouseMoveEvent (event);
} }
else
QGraphicsView::mouseMoveEvent (event);
} break; } break;
default: default:
@ -1240,7 +1228,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{ {
if (isUBItem(movingItem) && if (isUBItem(movingItem) &&
DelegateButton::Type != movingItem->type() && DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() &&
UBGraphicsDelegateFrame::Type != movingItem->type() && UBGraphicsDelegateFrame::Type != movingItem->type() &&
UBGraphicsCache::Type != movingItem->type() && UBGraphicsCache::Type != movingItem->type() &&
QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools. QGraphicsWebView::Type != movingItem->type() && // for W3C widgets as Tools.
@ -1257,6 +1244,13 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (movingItem->isSelected()) if (movingItem->isSelected())
bReleaseIsNeed = true; bReleaseIsNeed = true;
UBGraphicsTextItem* textItem = dynamic_cast<UBGraphicsTextItem*>(movingItem);
UBGraphicsMediaItem* movieItem = dynamic_cast<UBGraphicsMediaItem*>(movingItem);
if(textItem)
textItem->setSelected(true);
else if(movieItem)
movieItem->setSelected(true);
else
movingItem->setSelected(true); movingItem->setSelected(true);
} }
@ -1266,10 +1260,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
else else
bReleaseIsNeed = true; bReleaseIsNeed = true;
if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide();
}
if (bReleaseIsNeed) if (bReleaseIsNeed)
{ {
QGraphicsView::mouseReleaseEvent (event); QGraphicsView::mouseReleaseEvent (event);
@ -1297,6 +1287,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
suspendedMousePressEvent = NULL; suspendedMousePressEvent = NULL;
} }
} }
QGraphicsView::mouseReleaseEvent (event); QGraphicsView::mouseReleaseEvent (event);
} }
else if (currentTool == UBStylusTool::Text) else if (currentTool == UBStylusTool::Text)
@ -1368,10 +1359,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
else else
bReleaseIsNeed = true; bReleaseIsNeed = true;
if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide();
}
if (bReleaseIsNeed) if (bReleaseIsNeed)
{ {
QGraphicsView::mouseReleaseEvent (event); QGraphicsView::mouseReleaseEvent (event);
@ -1399,8 +1386,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
} }
else if (currentTool == UBStylusTool::Capture) else if (currentTool == UBStylusTool::Capture)
{ {
if (mRubberBand)
mRubberBand->hide ();
if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16) if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16)
{ {
@ -1428,6 +1413,19 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
} }
} }
if (mUBRubberBand) {
mUBRubberBand->hide();
delete mUBRubberBand;
mUBRubberBand = NULL;
}
if (mRubberBand) {
mRubberBand->hide();
delete mRubberBand;
mRubberBand = NULL;
}
mMouseButtonIsPressed = false; mMouseButtonIsPressed = false;
mPendingStylusReleaseEvent = false; mPendingStylusReleaseEvent = false;
mTabletStylusIsPressed = false; mTabletStylusIsPressed = false;

@ -121,6 +121,18 @@ UBGraphicsMediaItem::~UBGraphicsMediaItem()
} }
void UBGraphicsMediaItem::setSelected(bool selected)
{
if(selected){
Delegate()->createControls();
if (mediaType_Audio == mMediaType)
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::ResizingHorizontally);
else
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
}
UBGraphicsProxyWidget::setSelected(selected);
}
QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
if ((change == QGraphicsItem::ItemEnabledChange) if ((change == QGraphicsItem::ItemEnabledChange)

@ -91,6 +91,9 @@ public:
virtual void setSourceUrl(const QUrl &pSourceUrl); virtual void setSourceUrl(const QUrl &pSourceUrl);
void setSelected(bool selected);
public slots: public slots:
void toggleMute(); void toggleMute();

@ -77,6 +77,15 @@ UBGraphicsTextItem::~UBGraphicsTextItem()
{ {
} }
void UBGraphicsTextItem::setSelected(bool selected)
{
if(selected){
Delegate()->createControls();
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
}
QGraphicsTextItem::setSelected(selected);
}
QVariant UBGraphicsTextItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsTextItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
QVariant newValue = value; QVariant newValue = value;

@ -92,6 +92,8 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual void setUuid(const QUuid &pUuid); virtual void setUuid(const QUuid &pUuid);
void setHtml(const QString &text); void setHtml(const QString &text);
void setSelected(bool selected);
signals: signals:
void textUndoCommandAdded(UBGraphicsTextItem *textItem); void textUndoCommandAdded(UBGraphicsTextItem *textItem);

Loading…
Cancel
Save