Merge branch 'develop' into shiba-dev

preferencesAboutTextFull
shibakaneki 12 years ago
commit 69fec641b2
  1. 2
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 6
      src/board/UBBoardController.cpp
  3. 14
      src/board/UBFeaturesController.cpp
  4. 3
      src/core/UBPersistenceManager.cpp
  5. 199
      src/domain/UBGraphicsDelegateFrame.cpp
  6. 3
      src/domain/UBGraphicsDelegateFrame.h
  7. 6
      src/domain/UBGraphicsGroupContainerItem.cpp
  8. 2
      src/domain/UBGraphicsGroupContainerItem.h
  9. 3
      src/domain/UBGraphicsItemDelegate.cpp
  10. 4
      src/domain/UBGraphicsItemGroupUndoCommand.cpp
  11. 66
      src/domain/UBGraphicsItemUndoCommand.cpp
  12. 6
      src/domain/UBGraphicsItemUndoCommand.h
  13. 18
      src/domain/UBGraphicsScene.cpp
  14. 2
      src/domain/UBGraphicsScene.h
  15. 2
      src/domain/UBGraphicsStrokesGroup.cpp
  16. 6
      src/domain/UBGraphicsTextItem.cpp
  17. 11
      src/domain/UBItem.cpp
  18. 4
      src/domain/UBItem.h
  19. 6
      src/gui/UBTeacherGuideWidget.cpp
  20. 4
      src/web/UBWebController.cpp

@ -1084,7 +1084,7 @@ QGraphicsItem *UBSvgSubsetAdaptor::UBSvgSubsetReader::readElementFromGroup()
{
QGraphicsItem *result = 0;
result = mScene->itemByUuid(QUuid(mXmlReader.attributes().value(aId).toString()));
result = mScene->itemForUuid(QUuid(mXmlReader.attributes().value(aId).toString()));
mXmlReader.skipCurrentElement();
mXmlReader.readNext();

@ -645,7 +645,7 @@ void UBBoardController::duplicateItem(UBItem *item)
{
mActiveScene->addItem(gitem);
gitem->setPos(itemPos);
mLastCreatedItem = gitem;
mLastCreatedItem = gitem;
gitem->setSelected(true);
}
return;
@ -1132,7 +1132,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
"",
sourceUrl.toString(),
UBPersistenceManager::videoDirectory,
uuid,
destFile,
@ -1175,7 +1175,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri
QString destFile;
bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(),
"",
sourceUrl.toString(),
UBPersistenceManager::audioDirectory,
uuid,
destFile,

@ -144,7 +144,7 @@ void UBFeaturesComputingThread::compute(const QList<QPair<QUrl, UBFeature> > &pS
void UBFeaturesComputingThread::run()
{
forever {
qDebug() << "Custom thread started execution";
// qDebug() << "Custom thread started execution";
mMutex.lock();
QList<QPair<QUrl, UBFeature> > searchData = mScanningData;
@ -158,17 +158,17 @@ void UBFeaturesComputingThread::run()
break;
}
QTime curTime = QTime::currentTime();
// QTime curTime = QTime::currentTime();
int fsCnt = featuresCountAll(searchData);
int msecsto = curTime.msecsTo(QTime::currentTime());
qDebug() << "time on evaluation" << msecsto;
// int msecsto = curTime.msecsTo(QTime::currentTime());
// qDebug() << "time on evaluation" << msecsto;
emit maxFilesCountEvaluated(fsCnt);
emit scanStarted();
curTime = QTime::currentTime();
// curTime = QTime::currentTime();
scanAll(searchData, favoriteSet);
qDebug() << "Time on finishing" << curTime.msecsTo(QTime::currentTime());
// qDebug() << "Time on finishing" << curTime.msecsTo(QTime::currentTime());
emit scanFinished();
mMutex.lock();
@ -183,7 +183,7 @@ void UBFeaturesComputingThread::run()
UBFeaturesComputingThread::~UBFeaturesComputingThread()
{
qDebug() << "thread destructor catched";
// qDebug() << "thread destructor catched";
mMutex.lock();
abort = true;

@ -913,6 +913,7 @@ bool UBPersistenceManager::addFileToDocument(UBDocumentProxy* pDocumentProxy,
QString& destinationPath,
QByteArray* data)
{
Q_ASSERT(path.length());
QFileInfo fi(path);
if (!pDocumentProxy || objectUuid.isNull())
@ -920,6 +921,8 @@ bool UBPersistenceManager::addFileToDocument(UBDocumentProxy* pDocumentProxy,
if (data == NULL && !fi.exists())
return false;
qDebug() << fi.suffix();
QString fileName = subdir + "/" + objectUuid.toString() + "." + fi.suffix();
destinationPath = pDocumentProxy->persistencePath() + "/" + fileName;

@ -286,18 +286,111 @@ bool UBGraphicsDelegateFrame::canResizeBottomRight(qreal width, qreal height, qr
return res;
}
QPointF UBGraphicsDelegateFrame::getFixedPointFromPos()
{
QPointF fixedPoint;
if (!moving() && !rotating())
{
if (resizingTop())
{
if (mMirrorX && mMirrorY)
{
if ((0 < mAngle) && (mAngle < 90))
fixedPoint = delegated()->sceneBoundingRect().topLeft();
else
fixedPoint = delegated()->sceneBoundingRect().topRight();
}
else
{
if ((0 < mAngle) && (mAngle <= 90))
fixedPoint = delegated()->sceneBoundingRect().bottomRight();
else
fixedPoint = delegated()->sceneBoundingRect().bottomLeft();
}
}
else if (resizingLeft())
{
if (mMirrorX && mMirrorY)
{
if ((0 < mAngle) && (mAngle < 90))
fixedPoint = delegated()->sceneBoundingRect().bottomLeft();
else
fixedPoint = delegated()->sceneBoundingRect().topLeft();
}
else
{
if ((0 < mAngle) && (mAngle <= 90))
fixedPoint = delegated()->sceneBoundingRect().topRight();
else
fixedPoint = delegated()->sceneBoundingRect().bottomRight();
}
}
}
return fixedPoint;
}
QSizeF UBGraphicsDelegateFrame::getResizeVector(qreal moveX, qreal moveY)
{
qreal dPosX = 0;
qreal dPosY = 0;
if (resizingTop())
{
if (mMirrorX && mMirrorY)
dPosY = moveY;
else
dPosY = -moveY;
}
else if (resizingLeft())
{
if (mMirrorX && mMirrorY)
dPosX = moveX;
else
dPosX = -moveX;
}
else if (resizingRight())
dPosX = (mMirrorX) ? -moveX : moveX;
else if (resizingBottom())
dPosY = mMirrorY ? -moveY : moveY;
return QSizeF(dPosX, dPosY);
}
void UBGraphicsDelegateFrame::resizeDelegate(qreal moveX, qreal moveY)
{
QPointF fixedPoint = getFixedPointFromPos();
UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(delegated());
if (resizableItem)
{
QSizeF originalSize = delegated()->boundingRect().size();
resizableItem->resize(originalSize + getResizeVector(moveX, moveY));
if (resizingTop() || resizingLeft() || ((mMirrorX || mMirrorY) && resizingBottomRight()))
{
delegated()->setPos(delegated()->pos()-getFixedPointFromPos()+fixedPoint);
}
}
}
void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (None == mCurrentTool)
return;
QLineF move(mStartingPoint, event->scenePos());
QLineF move;
if(rotating() || moving() || mOperationMode == Scaling)
move = QLineF(mStartingPoint, event->scenePos());
else
move = QLineF(event->lastScenePos(), event->scenePos());
qreal moveX = move.length() * cos((move.angle() - mAngle) * PI / 180);
qreal moveY = -move.length() * sin((move.angle() - mAngle) * PI / 180);
qreal width = delegated()->boundingRect().width() * mTotalScaleX;
qreal height = delegated()->boundingRect().height() * mTotalScaleY;
if(mOperationMode == Scaling)
if(!rotating())
{
mTranslateX = moveX;
// Perform the resize
@ -398,44 +491,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
}
}
else if (mOperationMode == Resizing || mOperationMode == ResizingHorizontally)
{
mTranslateX = moveX;
UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(delegated());
if (resizableItem)
{
QLineF mousePosDelta(delegated()->mapFromScene(event->lastScenePos())
, delegated()->mapFromScene(event->scenePos()));
QSizeF incVector(0, 0);
if (resizingBottomRight())
{
incVector = QSizeF(mousePosDelta.dx(), mousePosDelta.dy());
}
else if (resizingRight())
{
incVector = QSizeF(mousePosDelta.dx(), 0);
}
else if (resizingBottom())
{
incVector = QSizeF(0, mousePosDelta.dy());
}
else if (resizingLeft())
{
incVector = QSizeF(- mousePosDelta.dx(), 0);
}
else if (resizingTop())
{
incVector = QSizeF(0, - mousePosDelta.dy());
}
QSizeF newSize = resizableItem->size() + incVector;
resizableItem->resize(newSize);
}
}
if (rotating())
{
mTranslateX = 0;
@ -483,49 +539,56 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
// we just detects coordinates of corner before and after scaling and then moves object at diff between them.
if (resizingBottomRight() && mMirrorX)
{
mTranslateX += mInitialTransform.map(delegated()->boundingRect().bottomRight()).x() - tr.map(delegated()->boundingRect().bottomRight()).x();
else
mTranslateX += mInitialTransform.map(delegated()->boundingRect().topLeft()).x() - tr.map(delegated()->boundingRect().topLeft()).x();
if (resizingBottomRight() && mMirrorY)
mTranslateY += mInitialTransform.map(delegated()->boundingRect().bottomRight()).y() - tr.map(delegated()->boundingRect().bottomRight()).y();
}
else
{
mTranslateX += mInitialTransform.map(delegated()->boundingRect().topLeft()).x() - tr.map(delegated()->boundingRect().topLeft()).x();
mTranslateY += mInitialTransform.map(delegated()->boundingRect().topLeft()).y() - tr.map(delegated()->boundingRect().topLeft()).y();
}
}
else if (resizingTop() || resizingLeft())
{
QPointF bottomRight = tr.map(delegated()->boundingRect().bottomRight());
QPointF fixedPoint = mInitialTransform.map(delegated()->boundingRect().bottomRight());
mTranslateX += fixedPoint.x() - bottomRight.x();
mTranslateY += fixedPoint.y() - bottomRight.y();
}
// Update the transform
if (mOperationMode == Scaling || moving() || rotating())
{
tr = buildTransform();
delegated()->setTransform(tr);
}
else if (resizingTop() || resizingLeft())
else if (mOperationMode == Resizing)
{
if (mOperationMode == Scaling)
if (!moving() && !rotating())
{
QPointF bottomRight = tr.map(delegated()->boundingRect().bottomRight());
QPointF fixedPoint = mInitialTransform.map(delegated()->boundingRect().bottomRight());
mTranslateX += fixedPoint.x() - bottomRight.x();
mTranslateY += fixedPoint.y() - bottomRight.y();
}
else
{
QLineF vector;
if (resizingLeft())
if (resizingBottomRight())
{
QPointF topRight1 = mInitialTransform.map(QPointF(delegated()->boundingRect().width() - moveX, 0));
QPointF topRight2 = mInitialTransform.map(QPointF(delegated()->boundingRect().width(), 0));
vector.setPoints(topRight1, topRight2);
if (mMirrorX && mMirrorY)
mCurrentTool = ResizeTop;
else
mCurrentTool = ResizeBottom;
resizeDelegate(moveX, moveY);
if (mMirrorX && mMirrorY)
mCurrentTool = ResizeLeft;
else
mCurrentTool = ResizeRight;
resizeDelegate(moveX, moveY);
mCurrentTool = ResizeBottomRight;
}
else
{
QPointF bottomLeft1 = mInitialTransform.map(QPointF(0, delegated()->boundingRect().height() - moveY));
QPointF bottomLeft2 = mInitialTransform.map(QPointF(0, delegated()->boundingRect().height()));
vector.setPoints(bottomLeft1, bottomLeft2);
}
mTranslateX = vector.dx();
mTranslateY = vector.dy();
resizeDelegate(moveX, moveY);
}
tr = buildTransform();
}
delegated()->setTransform(tr);
event->accept();
}

@ -37,6 +37,9 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
QPainterPath shape() const;
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
QPointF getFixedPointFromPos();
QSizeF getResizeVector(qreal moveX, qreal moveY);
void resizeDelegate(qreal moveX, qreal moveY);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

@ -123,6 +123,8 @@ void UBGraphicsGroupContainerItem::removeFromGroup(QGraphicsItem *item)
pRemoveFromGroup(item);
item->setFlags(ItemIsSelectable | ItemIsFocusable);
}
void UBGraphicsGroupContainerItem::deselectCurrentItem()
@ -211,7 +213,7 @@ void UBGraphicsGroupContainerItem::setUuid(const QUuid &pUuid)
setData(UBGraphicsItemData::ItemUuid, QVariant(pUuid)); //store item uuid inside the QGraphicsItem to fast operations with Items on the scene
}
void UBGraphicsGroupContainerItem::destroy() {
void UBGraphicsGroupContainerItem::destroy(bool canUndo) {
foreach (QGraphicsItem *item, childItems()) {
pRemoveFromGroup(item);
@ -219,7 +221,7 @@ void UBGraphicsGroupContainerItem::destroy() {
item->setFlag(QGraphicsItem::ItemIsFocusable, true);
}
remove();
remove(canUndo);
}
void UBGraphicsGroupContainerItem::clearSource()

@ -34,7 +34,7 @@ public:
}
virtual void setUuid(const QUuid &pUuid);
void destroy();
void destroy(bool canUndo = true);
virtual void clearSource();

@ -166,7 +166,8 @@ void UBGraphicsItemDelegate::init()
UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
{
disconnect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged()));
if (UBApplication::boardController)
disconnect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged()));
// do not release mMimeData.
// the mMimeData is owned by QDrag since the setMimeData call as specified in the documentation
}

@ -22,7 +22,7 @@ UBGraphicsItemGroupUndoCommand::~UBGraphicsItemGroupUndoCommand()
void UBGraphicsItemGroupUndoCommand::undo()
{
mGroup->destroy();
mGroup->destroy(false);
foreach(QGraphicsItem *item, mItems) {
item->setSelected(true);
}
@ -41,7 +41,7 @@ void UBGraphicsItemGroupUndoCommand::redo()
QList<QGraphicsItem*> childItems = item->childItems();
UBGraphicsGroupContainerItem *currentGroup = dynamic_cast<UBGraphicsGroupContainerItem*>(item);
if (currentGroup) {
currentGroup->destroy();
currentGroup->destroy(false);
}
foreach (QGraphicsItem *chItem, childItems) {
mGroup->addToGroup(chItem);

@ -27,10 +27,11 @@
#include "domain/UBGraphicsGroupContainerItem.h"
UBGraphicsItemUndoCommand::UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems,
const QSet<QGraphicsItem*>& pAddedItems)
const QSet<QGraphicsItem*>& pAddedItems, const GroupDataTable &groupsMap)
: mScene(pScene)
, mRemovedItems(pRemovedItems - pAddedItems)
, mAddedItems(pAddedItems - pRemovedItems)
, mRemovedItems(pRemovedItems - pAddedItems)
, mAddedItems(pAddedItems - pRemovedItems)
, mExcludedFromGroup(groupsMap)
{
mFirstRedo = true;
@ -110,6 +111,36 @@ void UBGraphicsItemUndoCommand::undo()
}
}
QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup);
UBGraphicsGroupContainerItem *nextGroup = 0;
UBGraphicsGroupContainerItem *previousGroupItem;
bool groupChanged = false;
while (curMapElement.hasNext()) {
curMapElement.next();
groupChanged = previousGroupItem != curMapElement.key();
//trying to find the group on the scene;
if (!nextGroup || groupChanged) {
UBGraphicsGroupContainerItem *groupCandidate = curMapElement.key();
if (groupCandidate) {
nextGroup = groupCandidate;
if(!mScene->items().contains(nextGroup)) {
mScene->addItem(nextGroup);
}
nextGroup->setVisible(true);
}
}
QGraphicsItem *groupedItem = mScene->itemForUuid(curMapElement.value());
if (groupedItem) {
nextGroup->addToGroup(groupedItem);
}
previousGroupItem = curMapElement.key();
UBGraphicsItem::Delegate(nextGroup)->update();
}
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
mScene->update(mScene->sceneRect());
@ -125,6 +156,35 @@ void UBGraphicsItemUndoCommand::redo()
return;
}
QMapIterator<UBGraphicsGroupContainerItem*, QUuid> curMapElement(mExcludedFromGroup);
UBGraphicsGroupContainerItem *nextGroup = 0;
UBGraphicsGroupContainerItem *previousGroupItem;
bool groupChanged = false;
while (curMapElement.hasNext()) {
curMapElement.next();
groupChanged = previousGroupItem != curMapElement.key();
//trying to find the group on the scene;
if (!nextGroup || groupChanged) {
UBGraphicsGroupContainerItem *groupCandidate = curMapElement.key();
if (groupCandidate) {
nextGroup = groupCandidate;
}
}
QGraphicsItem *groupedItem = mScene->itemForUuid(curMapElement.value());
if (groupedItem) {
if (nextGroup->childItems().count() == 1) {
nextGroup->destroy(false);
break;
}
nextGroup->removeFromGroup(groupedItem);
}
previousGroupItem = curMapElement.key();
UBGraphicsItem::Delegate(nextGroup)->update();
}
QSetIterator<QGraphicsItem*> itRemoved(mRemovedItems);
while (itRemoved.hasNext())
{

@ -18,6 +18,7 @@
#include <QtGui>
#include "UBAbstractUndoCommand.h"
#include "UBGraphicsGroupContainerItem.h"
class UBGraphicsScene;
@ -26,8 +27,10 @@ class UBGraphicsScene;
class UBGraphicsItemUndoCommand : public UBAbstractUndoCommand
{
public:
typedef QMultiMap<UBGraphicsGroupContainerItem*, QUuid> GroupDataTable;
UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, const QSet<QGraphicsItem*>& pRemovedItems,
const QSet<QGraphicsItem*>& pAddedItems);
const QSet<QGraphicsItem*>& pAddedItems, const GroupDataTable &groupsMap = GroupDataTable());
UBGraphicsItemUndoCommand(UBGraphicsScene* pScene, QGraphicsItem* pRemovedItem,
QGraphicsItem* pAddedItem);
@ -47,6 +50,7 @@ class UBGraphicsItemUndoCommand : public UBAbstractUndoCommand
UBGraphicsScene* mScene;
QSet<QGraphicsItem*> mRemovedItems;
QSet<QGraphicsItem*> mAddedItems;
GroupDataTable mExcludedFromGroup;
bool mFirstRedo;
};

@ -1067,6 +1067,7 @@ UBItem* UBGraphicsScene::deepCopy() const
void UBGraphicsScene::clearContent(clearCase pCase)
{
QSet<QGraphicsItem*> removedItems;
UBGraphicsItemUndoCommand::GroupDataTable groupsMap;
switch (pCase) {
case clearBackground :
@ -1106,8 +1107,14 @@ void UBGraphicsScene::clearContent(clearCase pCase)
if(shouldDelete) {
if (itemGroup) {
itemGroup->removeFromGroup(item);
groupsMap.insert(itemGroup, UBGraphicsItem::getOwnUuid(item));
if (itemGroup->childItems().count() == 1) {
itemGroup->destroy();
groupsMap.insert(itemGroup, UBGraphicsItem::getOwnUuid(itemGroup->childItems().first()));
QGraphicsItem *lastItem = itemGroup->childItems().first();
bool isSelected = itemGroup->isSelected();
itemGroup->destroy(false);
lastItem->setSelected(isSelected);
}
itemGroup->Delegate()->update();
}
@ -1123,7 +1130,8 @@ void UBGraphicsScene::clearContent(clearCase pCase)
update(sceneRect());
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, QSet<QGraphicsItem*>());
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, QSet<QGraphicsItem*>(), groupsMap);
UBApplication::undoStack->push(uc);
}
@ -1442,6 +1450,7 @@ UBGraphicsTextItem* UBGraphicsScene::textForObjectName(const QString& pString, c
textItem->setObjectName(objectName);
QSizeF size = textItem->size();
textItem->setPos(QPointF(-size.width()/2.0,-size.height()/2.0));
textItem->setData(UBGraphicsItemData::ItemEditable,QVariant(false));
}
textItem->setPlainText(pString);
@ -1571,8 +1580,9 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)
{
foreach(QGraphicsItem* item, items)
foreach(QGraphicsItem* item, items) {
UBCoreGraphicsScene::removeItem(item);
}
mItemCount -= items.size();
@ -1665,7 +1675,7 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio)
return normalizedRect;
}
QGraphicsItem *UBGraphicsScene::itemByUuid(QUuid uuid)
QGraphicsItem *UBGraphicsScene::itemForUuid(QUuid uuid)
{
QGraphicsItem *result = 0;

@ -174,7 +174,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QRectF normalizedSceneRect(qreal ratio = -1.0);
QGraphicsItem *itemByUuid(QUuid uuid);
QGraphicsItem *itemForUuid(QUuid uuid);
void moveTo(const QPointF& pPoint);
void drawLineTo(const QPointF& pEndPoint, const qreal& pWidth, bool bLineStyle);

@ -5,7 +5,7 @@
#include "core/memcheck.h"
UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent)
:UBGraphicsItem(), QGraphicsItemGroup(parent)
:QGraphicsItemGroup(parent), UBGraphicsItem()
{
setDelegate(new UBGraphicsItemDelegate(this, 0, true, true, false));
Delegate()->init();

@ -30,9 +30,9 @@
QColor UBGraphicsTextItem::lastUsedTextColor;
UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
: UBGraphicsItem()
, QGraphicsTextItem(parent)
UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
QGraphicsTextItem(parent)
, UBGraphicsItem()
, mMultiClickState(0)
, mLastMousePressTime(QTime::currentTime())
{

@ -66,12 +66,17 @@ bool UBGraphicsItem::isRotatable(QGraphicsItem *item)
return item->data(UBGraphicsItemData::ItemRotatable).toBool();
}
void UBGraphicsItem::remove()
QUuid UBGraphicsItem::getOwnUuid(QGraphicsItem *item)
{
if (Delegate())
Delegate()->remove(this);
QString idCandidate = item->data(UBGraphicsItemData::ItemUuid).toString();
return idCandidate == QUuid().toString() ? QUuid() : QUuid(idCandidate);
}
void UBGraphicsItem::remove(bool canUndo)
{
if (Delegate())
Delegate()->remove(canUndo);
}
UBGraphicsItemDelegate *UBGraphicsItem::Delegate(QGraphicsItem *pItem)
{

@ -104,11 +104,11 @@ public:
static void assignZValue(QGraphicsItem*, qreal value);
static bool isRotatable(QGraphicsItem *item);
static bool isFlippable(QGraphicsItem *item);
static QUuid getOwnUuid(QGraphicsItem *item);
static UBGraphicsItemDelegate *Delegate(QGraphicsItem *pItem);
void remove();
void remove(bool canUndo = true);
virtual void clearSource(){}

@ -163,7 +163,8 @@ UBTeacherGuideEditionWidget::~UBTeacherGuideEditionWidget()
void UBTeacherGuideEditionWidget::onSliderMoved(int size)
{
Q_UNUSED(size);
mpAddAMediaItem->setExpanded(true);
if(mpAddAMediaItem)
mpAddAMediaItem->setExpanded(true);
}
#endif
void UBTeacherGuideEditionWidget::showEvent(QShowEvent* event)
@ -491,7 +492,8 @@ UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget()
void UBTeacherGuidePresentationWidget::onSliderMoved(int size)
{
Q_UNUSED(size);
mpMediaSwitchItem->setExpanded(true);
if(mpMediaSwitchItem)
mpMediaSwitchItem->setExpanded(true);
}
#endif

@ -733,8 +733,8 @@ bool UBWebController::isEduMedia(const QUrl& pUrl)
void UBWebController::loadUrl(const QUrl& url)
{
bool webBrowserAlreadyInstanciated = dynamic_cast<WBBrowserWindow*>(mStackedWidget->widget(WebBrowser)) != NULL;
UBApplication::applicationController->showInternet();
bool webBrowserAlreadyInstanciated = dynamic_cast<WBBrowserWindow*>(mStackedWidget->widget(WebBrowser)) != NULL;
UBApplication::applicationController->showInternet();
if (UBSettings::settings()->webUseExternalBrowser->get().toBool())
{
QDesktopServices::openUrl(url);

Loading…
Cancel
Save