Presentation changes

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent 2806b13562
commit a672c9bf1c
  1. 2
      Sankore_3.1.pro
  2. 158
      src/board/UBBoardView.cpp
  3. 64
      src/domain/UBGraphicsItemDelegate.cpp
  4. 7
      src/domain/UBGraphicsScene.cpp
  5. 1
      src/domain/UBGraphicsScene.h

@ -374,7 +374,7 @@ macx {
linux-g++* {
CONFIG += link_prl
LIBS += -lcrypto
LIBS += -lprofiler
#LIBS += -lprofiler
LIBS += -lX11
QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp

@ -973,7 +973,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
mMouseDownPos = event->pos ();
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
if (!movingItem)
@ -981,30 +980,29 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if (event->button () == Qt::LeftButton && isInteractive())
{
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
int currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
if (!mTabletStylusIsPressed)
mMouseButtonIsPressed = true;
if (currentTool == UBStylusTool::ZoomIn)
{
switch (currentTool) {
case UBStylusTool::ZoomIn :
mController->zoomIn (mapToScene (event->pos ()));
event->accept();
}
else if (currentTool == UBStylusTool::ZoomOut)
{
break;
case UBStylusTool::ZoomOut :
mController->zoomOut (mapToScene (event->pos ()));
event->accept();
}
else if (currentTool == UBStylusTool::Hand)
{
break;
case UBStylusTool::Hand :
viewport()->setCursor(QCursor (Qt::ClosedHandCursor));
mPreviousPoint = event->posF();
event->accept();
}
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{
break;
case UBStylusTool::Selector :
case UBStylusTool::Play :
if (bIsDesktop) {
event->ignore();
return;
@ -1019,26 +1017,26 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if (!movingItem) {
// Rubberband selection implementation
if (!mUBRubberBand) {
mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
// if (!mUBRubberBand) {
// mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
// }
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
// mUBRubberBand->show();
// scene()->updateMultipleSelectionFrame();
scene()->clearSelectionFrame();
}
mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand->show();
scene()->setMultipleSelectionProcess(true);
}
else
{
if(mUBRubberBand) {
mUBRubberBand->hide();
scene()->setMultipleSelectionProcess(false);
}
}
handleItemMousePress(event);
event->accept();
}
else if (currentTool == UBStylusTool::Text)
{
break;
case UBStylusTool::Text : {
int frameWidth = UBSettings::settings ()->objectFrameWidth;
QRectF fuzzyRect (0, 0, frameWidth * 4, frameWidth * 4);
fuzzyRect.moveCenter (mapToScene (mMouseDownPos));
@ -1065,13 +1063,12 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mRubberBand->show();
mIsCreatingTextZone = true;
scene()->setMultipleSelectionProcess(true);
event->accept ();
}
}
else if (currentTool == UBStylusTool::Capture)
{
} break;
case UBStylusTool::Capture :
scene ()->deselectAllItems ();
if (!mRubberBand)
@ -1083,18 +1080,15 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
scene()->setMultipleSelectionProcess(true);
event->accept ();
}
else
{
if(UBDrawingController::drawingController()->mActiveRuler==NULL)
{
break;
default:
if(UBDrawingController::drawingController()->mActiveRuler==NULL) {
viewport()->setCursor (QCursor (Qt::BlankCursor));
}
if (scene () && !mTabletStylusIsPressed)
{
if (currentTool == UBStylusTool::Eraser)
{
if (scene () && !mTabletStylusIsPressed) {
if (currentTool == UBStylusTool::Eraser) {
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
mLongPressTimer.start();
}
@ -1114,51 +1108,65 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
}
QTime mouseMoveTime = QTime::currentTime();
if(!mIsDragInProgress && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()))
{
if(!mIsDragInProgress
&& ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())) {
qDebug() << "mouse move event canceled";
return;
}
mIsDragInProgress = true;
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
mWidgetMoved = true;
mLongPressTimer.stop();
if (isAbsurdPoint (event->pos ()))
{
if (isAbsurdPoint (event->pos ())) {
event->accept ();
return;
}
if (currentTool == UBStylusTool::Hand && (mMouseButtonIsPressed || mTabletStylusIsPressed))
{
if ((UBDrawingController::drawingController()->isDrawingTool())
&& !mMouseButtonIsPressed) {
QGraphicsView::mouseMoveEvent(event);
}
int currentTool = static_cast<int>(UBDrawingController::drawingController()->stylusTool());
switch (currentTool) {
case UBStylusTool::Hand : {
if (!mMouseButtonIsPressed && mTabletStylusIsPressed) {
break;
}
QPointF eventPosition = event->posF ();
qreal dx = eventPosition.x () - mPreviousPoint.x ();
qreal dy = eventPosition.y () - mPreviousPoint.y ();
mController->handScroll (dx, dy);
mPreviousPoint = eventPosition;
event->accept ();
}
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()) {
return;
}
} break;
case UBStylusTool::Selector :
case UBStylusTool::Play : {
if (bIsDesktop) {
event->ignore();
return;
}
if (currentTool != UBStylusTool::Play || mRubberBandInPlayMode) {
if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) {
bool rubberMove = currentTool != (UBStylusTool::Play || mRubberBandInPlayMode)
&& (mMouseButtonIsPressed || mTabletStylusIsPressed)
&& !movingItem;
if (rubberMove) {
QRect bandRect(mMouseDownPos, event->pos());
bandRect = bandRect.normalized();
if (!mUBRubberBand) {
mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
}
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand->setGeometry(bandRect);
mUBRubberBand->show();
scene()->setMultipleSelectionProcess(true);
QTime startTime = QTime::currentTime();
QTime testTime = QTime::currentTime();
@ -1203,38 +1211,28 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
<< "| =elapsed time " << startTime.msecsTo(QTime::currentTime()) << endl
<< "==================";
}
}
handleItemMouseMove(event);
}
else if ((UBDrawingController::drawingController()->isDrawingTool())
&& !mMouseButtonIsPressed)
{
QGraphicsView::mouseMoveEvent (event);
}
else if (currentTool == UBStylusTool::Text || currentTool == UBStylusTool::Capture)
{
if (mRubberBand && (mIsCreatingTextZone || mIsCreatingSceneGrabZone))
{
} break;
case UBStylusTool::Text :
case UBStylusTool::Capture : {
if (mRubberBand
&& (mIsCreatingTextZone || mIsCreatingSceneGrabZone)) {
mRubberBand->setGeometry(QRect(mMouseDownPos, event->pos()).normalized());
event->accept();
}
else
{
} else {
QGraphicsView::mouseMoveEvent (event);
}
}
else
{
if (!mTabletStylusIsPressed && scene ())
{
scene ()->inputDeviceMove (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ())), mMouseButtonIsPressed);
} break;
default:
if (!mTabletStylusIsPressed && scene()) {
scene()->inputDeviceMove(mapToScene(UBGeometryUtils::pointConstrainedInRect(event->pos(), rect()))
, mMouseButtonIsPressed);
}
event->accept ();
}
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())
mWidgetMoved = true;
qDebug() << "mouse move time" << mouseMoveTime.msecsTo(QTime::currentTime());
lastCallTime = QTime::currentTime();
}

@ -158,6 +158,8 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
, mDeleteButton(NULL)
, mDuplicateButton(NULL)
, mMenuButton(NULL)
, mZOrderUpButton(0)
, mZOrderDownButton(0)
, mMenu(0)
, mLockAction(0)
, mShowOnDisplayAction(0)
@ -243,13 +245,10 @@ void UBGraphicsItemDelegate::createControls()
void UBGraphicsItemDelegate::freeControls()
{
QGraphicsScene *controlsScene = delegated()->scene();
Q_ASSERT(controlsScene);
UB_FREE_CONTROL(mFrame, controlsScene);
UB_FREE_CONTROL(mDeleteButton, controlsScene);
UB_FREE_CONTROL(mMenuButton, controlsScene);
UB_FREE_CONTROL(mZOrderUpButton, controlsScene);
UB_FREE_CONTROL(mZOrderDownButton, controlsScene);
UB_FREE_CONTROL(mFrame, controlsScene);
freeButtons();
}
@ -263,7 +262,6 @@ bool UBGraphicsItemDelegate::controlsExist() const
;
}
UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
{
if (UBApplication::boardController)
@ -277,44 +275,35 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{
UBGraphicsScene *ubScene = castUBGraphicsScene();
switch (static_cast<int>(change)) {
if (change == QGraphicsItem::ItemSelectedHasChanged) {
bool ok;
bool selected = value.toUInt(&ok);
if (ok) {
case QGraphicsItem::ItemSelectedHasChanged : {
if (ubScene && !ubScene->multipleSelectionProcess()) {
if (selected) {
if (value.toBool()) { //selected(true)
if (!controlsExist()) {
createControls();
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
positionHandles();
ubScene->setSelectedZLevel(delegated());
}
} else {
ubScene->setOwnZlevel(delegated());
}
}
freeControls();
}
}
if ((change == QGraphicsItem::ItemSelectedHasChanged
|| change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged)
&& ubScene
&& !ubScene->multipleSelectionProcess()
&& UBApplication::boardController)
{
if (!controlsExist()) {
createControls();
}
} break;
case QGraphicsItem::ItemPositionHasChanged :
case QGraphicsItem::ItemTransformHasChanged :
case QGraphicsItem::ItemZValueHasChanged :
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
positionHandles();
}
if (change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged
|| change == QGraphicsItem::ItemZValueHasChanged)
{
UBGraphicsScene* ubScene = qobject_cast<UBGraphicsScene*>(mDelegated->scene());
if(ubScene)
if (ubScene) {
ubScene->setModified(true);
}
break;
}
return value;
}
@ -425,6 +414,10 @@ QGraphicsItem *UBGraphicsItemDelegate::delegated()
void UBGraphicsItemDelegate::positionHandles()
{
if (!controlsExist()) {
return;
}
if (mDelegated->isSelected()) {
bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control;
showHide(shownOnDisplay);
@ -644,6 +637,13 @@ void UBGraphicsItemDelegate::buildButtons()
}
void UBGraphicsItemDelegate::freeButtons()
{
//Previously deleted with the frame
// Rimplement for some specific behavior
mButtons.clear();
mDeleteButton = 0;
mMenuButton = 0;
mZOrderUpButton = 0;
mZOrderDownButton = 0;
}
void UBGraphicsItemDelegate::decorateMenu(QMenu* menu)

@ -1034,6 +1034,13 @@ UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRad
return polygonToPolygonItem(polygon);
}
void UBGraphicsScene::clearSelectionFrame()
{
if (mSelectionFrame) {
mSelectionFrame->setEnclosedItems(QList<QGraphicsItem*>());
}
}
void UBGraphicsScene::updateMultipleSelectionFrame()
{
qDebug() << "selected item count" << selectedItems().count();

@ -311,6 +311,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
void setMultipleSelectionProcess(bool pEnabled) {mMultipleSelectionProcess = pEnabled;}
bool multipleSelectionProcess() const {return mMultipleSelectionProcess;}
void clearSelectionFrame();
void updateMultipleSelectionFrame();
public slots:

Loading…
Cancel
Save