group fixes conflict merged

preferencesAboutTextFull
Ivan Ilyin 13 years ago
commit 46e6b57e83
  1. 3
      release.win7.vc9.bat
  2. 4
      src/adaptors/UBSvgSubsetAdaptor.cpp
  3. 76
      src/adaptors/UBThumbnailAdaptor.cpp
  4. 1
      src/adaptors/UBThumbnailAdaptor.h
  5. 4
      src/board/UBDrawingController.cpp
  6. 9
      src/core/UBPersistenceManager.cpp
  7. 2
      src/domain/UBGraphicsAudioItem.cpp
  8. 105
      src/domain/UBGraphicsScene.cpp
  9. 2
      src/domain/UBGraphicsVideoItem.cpp
  10. 3
      src/domain/UBW3CWidget.cpp
  11. 8
      src/gui/UBTeacherGuideWidget.cpp
  12. 9
      src/gui/UBTeacherGuideWidgetsTools.cpp
  13. 2
      src/gui/UBThumbnailWidget.cpp

@ -62,7 +62,8 @@ nmake release-install
copy %BASE_QT_TRANSLATIONS_DIRECTORY%\qt_*.qm build\win32\release\product\i18n\ copy %BASE_QT_TRANSLATIONS_DIRECTORY%\qt_*.qm build\win32\release\product\i18n\
copy resources\customizations build\win32\release\product\ mkdir build\win32\release\product\customizations
xcopy /s resources\customizations\* build\win32\release\product\customizations
del build\win32\release\product\i18n\qt_help* del build\win32\release\product\i18n\qt_help*

@ -1961,7 +1961,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::audioItemToLinkedAudio(UBGraphicsAud
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos));
} }
QString audioFileHref = audioItem->mediaFileUrl().toString(); QString audioFileHref = audioItem->mediaFileUrl().toLocalFile();
mXmlWriter.writeAttribute(nsXLink, "href", audioFileHref); mXmlWriter.writeAttribute(nsXLink, "href", audioFileHref);
mXmlWriter.writeEndElement(); mXmlWriter.writeEndElement();
} }
@ -1986,7 +1986,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::videoItemToLinkedVideo(UBGraphicsVid
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos)); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "position", QString("%1").arg(pos));
} }
QString videoFileHref = videoItem->mediaFileUrl().toString(); QString videoFileHref = videoItem->mediaFileUrl().toLocalFile();
mXmlWriter.writeAttribute(nsXLink, "href", videoFileHref); mXmlWriter.writeAttribute(nsXLink, "href", videoFileHref);
mXmlWriter.writeEndElement(); mXmlWriter.writeEndElement();
} }

@ -33,18 +33,14 @@
#include "core/memcheck.h" #include "core/memcheck.h"
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy) void UBThumbnailAdaptor::generateMissingThumbnails(UBDocumentProxy* proxy)
{ {
QList<QPixmap> thumbnails;
if (!proxy || proxy->persistencePath().isEmpty())
return thumbnails;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
int existingPageCount = proxy->pageCount(); int existingPageCount = proxy->pageCount();
QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount); for (int iPageNo = 0; iPageNo < existingPageCount; ++iPageNo)
{
QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", iPageNo);
QFile thumbFile(thumbFileName); QFile thumbFile(thumbFileName);
if (!thumbFile.exists()) if (!thumbFile.exists())
@ -53,9 +49,7 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
int thumbCount = 0; int thumbCount = 0;
for(int i = 0 ; i < existingPageCount; i++) UBGraphicsScene* scene = UBSvgSubsetAdaptor::loadScene(proxy, iPageNo);
{
UBGraphicsScene* scene = UBSvgSubsetAdaptor::loadScene(proxy, i);
if (scene) if (scene)
{ {
@ -64,24 +58,25 @@ QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
if (displayMessage && thumbCount == 1) if (displayMessage && thumbCount == 1)
UBApplication::showMessage(tr("Generating preview thumbnails ...")); UBApplication::showMessage(tr("Generating preview thumbnails ..."));
persistScene(proxy->persistencePath(), scene, i); persistScene(proxy->persistencePath(), scene, iPageNo);
}
else{
if(i==0){
// we are working a document without zero page but on a system that enable it
// we have to create an empty zero scene
scene = new UBGraphicsScene(proxy);
UBSvgSubsetAdaptor::persistScene(proxy,scene,0);
persistScene(proxy->persistencePath(),scene,i);
thumbCount++;
}
}
} }
if (displayMessage && thumbCount > 0) if (displayMessage && thumbCount > 0)
UBApplication::showMessage(tr("%1 thumbnails generated ...").arg(thumbCount)); UBApplication::showMessage(tr("%1 thumbnails generated ...").arg(thumbCount));
} }
}
}
QList<QPixmap> UBThumbnailAdaptor::load(UBDocumentProxy* proxy)
{
QList<QPixmap> thumbnails;
if (!proxy || proxy->persistencePath().isEmpty())
return thumbnails;
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
generateMissingThumbnails(proxy);
//end compatibility with older format //end compatibility with older format
@ -113,39 +108,10 @@ QPixmap UBThumbnailAdaptor::load(UBDocumentProxy* proxy, int index)
{ {
int existingPageCount = proxy->pageCount(); int existingPageCount = proxy->pageCount();
if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index >= existingPageCount) if (!proxy || proxy->persistencePath().size() == 0 || index < 0 || index > existingPageCount)
return QPixmap(); return QPixmap();
//compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails //compatibility with older formats (<= 4.0.b.2.0) : generate missing thumbnails
generateMissingThumbnails(proxy);
QString thumbFileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", existingPageCount);
QFile thumbFile(thumbFileName);
if (!thumbFile.exists())
{
bool displayMessage = (existingPageCount > 5);
int thumbCount = 0;
for(int i = 0 ; i < existingPageCount; i++)
{
UBGraphicsScene* scene = UBSvgSubsetAdaptor::loadScene(proxy, i);
if (scene)
{
thumbCount++;
if (displayMessage && thumbCount == 1)
UBApplication::showMessage(tr("Generating preview thumbnails ..."));
persistScene(proxy->persistencePath(), scene, i);
}
}
if (displayMessage && thumbCount > 0)
UBApplication::showMessage(tr("%1 thumbnails generated ...").arg(thumbCount));
}
//end compatibility with older format //end compatibility with older format
QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index); QString fileName = proxy->persistencePath() + UBFileSystemUtils::digitFileFormat("/page%1.thumbnail.jpg", index);

@ -29,6 +29,7 @@ private: UBThumbnailAdaptor() {}
public: public:
static void persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified = false); static void persistScene(const QString& pDocPath, UBGraphicsScene* pScene, int pageIndex, bool overrideModified = false);
static void generateMissingThumbnails(UBDocumentProxy* proxy);
static QList<QPixmap> load(UBDocumentProxy* proxy); static QList<QPixmap> load(UBDocumentProxy* proxy);
static QPixmap load(UBDocumentProxy* proxy, int index); static QPixmap load(UBDocumentProxy* proxy, int index);

@ -45,7 +45,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
, mActiveRuler(NULL) , mActiveRuler(NULL)
, mStylusTool((UBStylusTool::Enum)-1) , mStylusTool((UBStylusTool::Enum)-1)
, mLatestDrawingTool((UBStylusTool::Enum)-1) , mLatestDrawingTool((UBStylusTool::Enum)-1)
, mDrawingMode(/*DRAWING_MODE*/eDrawingMode_Vector) , mDrawingMode(DRAWING_MODE)
{ {
connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged())); connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged()));
@ -114,7 +114,7 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication::mainWindow->actionPen->setChecked(true); UBApplication::mainWindow->actionPen->setChecked(true);
else if (mStylusTool == UBStylusTool::Eraser){ else if (mStylusTool == UBStylusTool::Eraser){
UBApplication::mainWindow->actionEraser->setChecked(true); UBApplication::mainWindow->actionEraser->setChecked(true);
//mDrawingMode = eDrawingMode_Artistic; mDrawingMode = eDrawingMode_Artistic;
} }
else if (mStylusTool == UBStylusTool::Marker) else if (mStylusTool == UBStylusTool::Marker)
UBApplication::mainWindow->actionMarker->setChecked(true); UBApplication::mainWindow->actionMarker->setChecked(true);

@ -848,7 +848,12 @@ QString UBPersistenceManager::teacherGuideAbsoluteObjectPath(UBDocumentProxy* pD
QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath) QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath)
{ {
QFileInfo fi(pPath.replace("file://","")); QString path = pPath;
//windows
path.replace("file:///","");
//others
path.replace("file://","");
QFileInfo fi(path);
QString uuid = QUuid::createUuid(); QString uuid = QUuid::createUuid();
if (!fi.exists() || !pDocumentProxy) if (!fi.exists() || !pDocumentProxy)
@ -862,7 +867,7 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy*
QDir dir; QDir dir;
dir.mkdir(pDocumentProxy->persistencePath() + "/" + UBPersistenceManager::teacherGuideDirectory); dir.mkdir(pDocumentProxy->persistencePath() + "/" + UBPersistenceManager::teacherGuideDirectory);
QFile source(pPath); QFile source(path);
source.copy(destPath); source.copy(destPath);
} }

@ -96,6 +96,8 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem()); UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem());
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), copy, SLOT(activeSceneChanged()));
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);

@ -313,6 +313,7 @@ void UBGraphicsScene::selectionChangedProcessing()
+ QString::number(selectedItems().first()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f')); + QString::number(selectedItems().first()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f'));
} }
} }
void UBGraphicsScene::updateGroupButtonState() void UBGraphicsScene::updateGroupButtonState()
{ {
QAction *groupAction = UBApplication::mainWindow->actionGroupItems; QAction *groupAction = UBApplication::mainWindow->actionGroupItems;
@ -337,9 +338,6 @@ void UBGraphicsScene::updateGroupButtonState()
} }
} }
// MARK: -
// MARK: Mouse/Tablet events handling
bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pressure) bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pressure)
{ {
//mMesure1Ms = 0; //mMesure1Ms = 0;
@ -509,7 +507,6 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
return accepted; return accepted;
} }
bool UBGraphicsScene::inputDeviceRelease() bool UBGraphicsScene::inputDeviceRelease()
{ {
/* /*
@ -608,8 +605,6 @@ bool UBGraphicsScene::inputDeviceRelease()
return accepted; return accepted;
} }
// MARK: -
void UBGraphicsScene::drawEraser(const QPointF &pPoint, bool isFirstDraw) void UBGraphicsScene::drawEraser(const QPointF &pPoint, bool isFirstDraw)
{ {
qreal eraserWidth = UBSettings::settings()->currentEraserWidth(); qreal eraserWidth = UBSettings::settings()->currentEraserWidth();
@ -685,7 +680,6 @@ void UBGraphicsScene::moveTo(const QPointF &pPoint)
mDrawWithCompass = false; mDrawWithCompass = false;
} }
void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth, bool bLineStyle) void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth, bool bLineStyle)
{ {
if (mPreviousWidth == -1.0) if (mPreviousWidth == -1.0)
@ -737,11 +731,8 @@ void UBGraphicsScene::drawLineTo(const QPointF &pEndPoint, const qreal &pWidth,
} }
} }
void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
{ {
// QList<QGraphicsItem*> itemList;
const QLineF line(mPreviousPoint, pEndPoint); const QLineF line(mPreviousPoint, pEndPoint);
const QPolygonF eraserPolygon = UBGeometryUtils::lineToPolygon(line, pWidth); const QPolygonF eraserPolygon = UBGeometryUtils::lineToPolygon(line, pWidth);
@ -778,7 +769,6 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
} }
} }
} }
}else{ }else{
QSet<QGraphicsItem*> toBeAddedItems; QSet<QGraphicsItem*> toBeAddedItems;
QSet<QGraphicsItem*> toBeRemovedItems; QSet<QGraphicsItem*> toBeRemovedItems;
@ -788,23 +778,19 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
if (mShouldUseOMP) if (mShouldUseOMP)
{ {
// #pragma omp parallel for #pragma omp parallel for
for (int i = 0; i < collidItemsSize; i++) for (int i = 0; i < collidItemsSize; i++)
{ {
UBGraphicsPolygonItem *collidingPolygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(collidItems.at(i)); UBGraphicsPolygonItem *collidingPolygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*>(collidItems.at(i));
if (NULL != collidingPolygonItem) if (NULL != collidingPolygonItem)
{ {
collidingPolygonItem->setColor(QColor(Qt::green));
UBGraphicsStrokesGroup* pGroup = collidingPolygonItem->strokesGroup(); UBGraphicsStrokesGroup* pGroup = collidingPolygonItem->strokesGroup();
if(eraserInnerRect.contains(collidingPolygonItem->boundingRect())) if(eraserInnerRect.contains(collidingPolygonItem->boundingRect()))
{ {
// #pragma omp critical #pragma omp critical
qDebug() << "case 1";
// Put the entire polygon into the remove list // Put the entire polygon into the remove list
collidingPolygonItem->setColor(QColor(Qt::blue));
toBeRemovedItems << collidingPolygonItem; toBeRemovedItems << collidingPolygonItem;
} }
else else
@ -816,43 +802,50 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
collidingPath.addPolygon(collidingPolygon); collidingPath.addPolygon(collidingPolygon);
// Then we substract the eraser path to the polygon and we simplify it // Then we substract the eraser path to the polygon and we simplify it
QPainterPath croppedPath = collidingPath.subtracted(eraserPath); /**/
QTransform polyTransform = collidingPolygonItem->sceneTransform().inverted();
QPointF mTrPrevPoint = polyTransform.map(mPreviousPoint);
QPointF mTrEndPoint = polyTransform.map(pEndPoint);
const QLineF trLine(mTrPrevPoint, mTrEndPoint);
const QPolygonF trEraserPolygon = UBGeometryUtils::lineToPolygon(trLine, pWidth);
QPainterPath trEraser;
trEraser.addPolygon(trEraserPolygon);
QPainterPath croppedPath = collidingPath.subtracted(trEraser);
/**/
// Original
//QPainterPath croppedPath = collidingPath.subtracted(eraserPath);
QPainterPath croppedPathSimplified = croppedPath.simplified(); QPainterPath croppedPathSimplified = croppedPath.simplified();
/*if (croppedPath == collidingPath) /*if (croppedPath == collidingPath)
{ {
// NOOP // NOOP
qDebug() << "case 2";
toBeRemovedItems << collidingPolygonItem; toBeRemovedItems << collidingPolygonItem;
} }
else */if (croppedPathSimplified.isEmpty()) else */if (croppedPathSimplified.isEmpty())
{ {
// #pragma omp critical #pragma omp critical
qDebug() << "case 3";
// Put the entire polygon into the remove list if the eraser removes all its visible content // Put the entire polygon into the remove list if the eraser removes all its visible content
collidingPolygonItem->setColor(QColor(Qt::blue));
toBeRemovedItems << collidingPolygonItem; toBeRemovedItems << collidingPolygonItem;
} }
else else
{ {
//qDebug() << "case 4";
// Then we convert the remaining path to a list of polygons that will be converted in // Then we convert the remaining path to a list of polygons that will be converted in
// UBGraphicsPolygonItems and added to the scene // UBGraphicsPolygonItems and added to the scene
foreach(const QPolygonF &pol, croppedPathSimplified.toFillPolygons()) foreach(const QPolygonF &pol, croppedPathSimplified.toFillPolygons())
{ {
UBGraphicsPolygonItem* croppedPolygonItem = collidingPolygonItem->deepCopy(pol); UBGraphicsPolygonItem* croppedPolygonItem = collidingPolygonItem->deepCopy(pol);
croppedPolygonItem->setColor(QColor(Qt::black)); #pragma omp critical
// #pragma omp critical
if(NULL != pGroup){ if(NULL != pGroup){
croppedPolygonItem->setStrokesGroup(pGroup); croppedPolygonItem->setStrokesGroup(pGroup);
// croppedPolygonItem->setTransform(pGroup->sceneTransform().inverted());
} }
// Add this new polygon to the 'added' list // Add this new polygon to the 'added' list
toBeAddedItems << croppedPolygonItem; toBeAddedItems << croppedPolygonItem;
} }
// #pragma omp critical #pragma omp critical
// Remove the original polygonitem because it has been replaced by many smaller polygons // Remove the original polygonitem because it has been replaced by many smaller polygons
collidingPolygonItem->setColor(QColor(Qt::blue));
toBeRemovedItems << collidingPolygonItem; toBeRemovedItems << collidingPolygonItem;
} }
} }
@ -925,30 +918,14 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
mRemovedItems += toBeRemovedItems; mRemovedItems += toBeRemovedItems;
} }
// bool hack = false;
// UBGraphicsStrokesGroup* pG = new UBGraphicsStrokesGroup();
if(eDrawingMode_Vector == DRAWING_MODE){ if(eDrawingMode_Vector == DRAWING_MODE){
foreach(QGraphicsItem* item, toBeAddedItems){ foreach(QGraphicsItem* item, toBeAddedItems){
UBGraphicsPolygonItem* poly = dynamic_cast<UBGraphicsPolygonItem*>(item); UBGraphicsPolygonItem* poly = dynamic_cast<UBGraphicsPolygonItem*>(item);
if(NULL != poly && NULL != poly->strokesGroup()){ if(NULL != poly && NULL != poly->strokesGroup()){
// if(!hack){ poly->setTransform(poly->strokesGroup()->transform());
// itemList = poly->strokesGroup()->childItems(); poly->strokesGroup()->addToGroup(poly);
// removeItem(poly->strokesGroup());
// foreach(QGraphicsItem* it, itemList){
// pG->addToGroup(it);
// }
// hack = true;
// }
qreal dx = -poly->strokesGroup()->sceneTransform().inverted().dx();
qreal dy = -poly->strokesGroup()->sceneTransform().inverted().dy();
//poly->setTransform(QTransform().translate(20, 0));
poly->setTransform(QTransform().translate(dx, dy));
poly->strokesGroup()/*pG*/->addToGroup(poly);
} }
} }
//addItem(pG);
}else{ }else{
addItems(toBeAddedItems); addItems(toBeAddedItems);
mAddedItems += toBeAddedItems; mAddedItems += toBeAddedItems;
@ -958,7 +935,6 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
mPreviousPoint = pEndPoint; mPreviousPoint = pEndPoint;
} }
void UBGraphicsScene::drawArcTo(const QPointF& pCenterPoint, qreal pSpanAngle) void UBGraphicsScene::drawArcTo(const QPointF& pCenterPoint, qreal pSpanAngle)
{ {
mDrawWithCompass = true; mDrawWithCompass = true;
@ -1070,7 +1046,6 @@ void UBGraphicsScene::recolorAllItems()
} }
} }
UBGraphicsPolygonItem* UBGraphicsScene::lineToPolygonItem(const QLineF &pLine, const qreal &pWidth) UBGraphicsPolygonItem* UBGraphicsScene::lineToPolygonItem(const QLineF &pLine, const qreal &pWidth)
{ {
UBGraphicsPolygonItem *polygonItem = new UBGraphicsPolygonItem(pLine, pWidth); UBGraphicsPolygonItem *polygonItem = new UBGraphicsPolygonItem(pLine, pWidth);
@ -1080,7 +1055,6 @@ UBGraphicsPolygonItem* UBGraphicsScene::lineToPolygonItem(const QLineF &pLine, c
return polygonItem; return polygonItem;
} }
void UBGraphicsScene::initPolygonItem(UBGraphicsPolygonItem* polygonItem) void UBGraphicsScene::initPolygonItem(UBGraphicsPolygonItem* polygonItem)
{ {
QColor colorOnDarkBG; QColor colorOnDarkBG;
@ -1112,7 +1086,6 @@ void UBGraphicsScene::initPolygonItem(UBGraphicsPolygonItem* polygonItem)
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
} }
UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRadius, qreal pSpanAngle, qreal pWidth) UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRadius, qreal pSpanAngle, qreal pWidth)
{ {
QPolygonF polygon = UBGeometryUtils::arcToPolygon(pStartRadius, pSpanAngle, pWidth); QPolygonF polygon = UBGeometryUtils::arcToPolygon(pStartRadius, pSpanAngle, pWidth);
@ -1120,7 +1093,6 @@ UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRad
return polygonToPolygonItem(polygon); return polygonToPolygonItem(polygon);
} }
UBGraphicsPolygonItem* UBGraphicsScene::polygonToPolygonItem(const QPolygonF pPolygon) UBGraphicsPolygonItem* UBGraphicsScene::polygonToPolygonItem(const QPolygonF pPolygon)
{ {
UBGraphicsPolygonItem *polygonItem = new UBGraphicsPolygonItem(pPolygon); UBGraphicsPolygonItem *polygonItem = new UBGraphicsPolygonItem(pPolygon);
@ -1130,14 +1102,12 @@ UBGraphicsPolygonItem* UBGraphicsScene::polygonToPolygonItem(const QPolygonF pPo
return polygonItem; return polygonItem;
} }
void UBGraphicsScene::hideEraser() void UBGraphicsScene::hideEraser()
{ {
if (mEraser) if (mEraser)
mEraser->hide(); mEraser->hide();
} }
void UBGraphicsScene::leaveEvent(QEvent * event) void UBGraphicsScene::leaveEvent(QEvent * event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
@ -1212,13 +1182,11 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const
return copy; return copy;
} }
UBItem* UBGraphicsScene::deepCopy() const UBItem* UBGraphicsScene::deepCopy() const
{ {
return sceneDeepCopy(); return sceneDeepCopy();
} }
void UBGraphicsScene::clearItemsAndAnnotations() void UBGraphicsScene::clearItemsAndAnnotations()
{ {
deselectAllItems(); deselectAllItems();
@ -1250,7 +1218,6 @@ void UBGraphicsScene::clearItemsAndAnnotations()
setDocumentUpdated(); setDocumentUpdated();
} }
void UBGraphicsScene::clearItems() void UBGraphicsScene::clearItems()
{ {
deselectAllItems(); deselectAllItems();
@ -1288,7 +1255,6 @@ void UBGraphicsScene::clearItems()
setDocumentUpdated(); setDocumentUpdated();
} }
void UBGraphicsScene::clearAnnotations() void UBGraphicsScene::clearAnnotations()
{ {
QSet<QGraphicsItem*> emptyList; QSet<QGraphicsItem*> emptyList;
@ -1319,7 +1285,6 @@ void UBGraphicsScene::clearAnnotations()
setDocumentUpdated(); setDocumentUpdated();
} }
UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const QPointF& pPos, qreal pScaleFactor, bool pUseAnimation) UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const QPointF& pPos, qreal pScaleFactor, bool pUseAnimation)
{ {
UBGraphicsPixmapItem* pixmapItem = new UBGraphicsPixmapItem(); UBGraphicsPixmapItem* pixmapItem = new UBGraphicsPixmapItem();
@ -1359,7 +1324,6 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q
return pixmapItem; return pixmapItem;
} }
void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem) void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
{ {
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
@ -1368,7 +1332,6 @@ void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
} }
} }
UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool shouldPlayAsap, const QPointF& pPos) UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool shouldPlayAsap, const QPointF& pPos)
{ {
UBGraphicsVideoItem* videoItem = new UBGraphicsVideoItem(pVideoFileUrl); UBGraphicsVideoItem* videoItem = new UBGraphicsVideoItem(pVideoFileUrl);
@ -1431,7 +1394,6 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s
return audioItem; return audioItem;
} }
UBGraphicsWidgetItem* UBGraphicsScene::addWidget(const QUrl& pWidgetUrl, const QPointF& pPos) UBGraphicsWidgetItem* UBGraphicsScene::addWidget(const QUrl& pWidgetUrl, const QPointF& pPos)
{ {
int widgetType = UBAbstractWidget::widgetType(pWidgetUrl); int widgetType = UBAbstractWidget::widgetType(pWidgetUrl);
@ -1451,7 +1413,6 @@ UBGraphicsWidgetItem* UBGraphicsScene::addWidget(const QUrl& pWidgetUrl, const Q
} }
} }
UBGraphicsAppleWidgetItem* UBGraphicsScene::addAppleWidget(const QUrl& pWidgetUrl, const QPointF& pPos) UBGraphicsAppleWidgetItem* UBGraphicsScene::addAppleWidget(const QUrl& pWidgetUrl, const QPointF& pPos)
{ {
UBGraphicsAppleWidgetItem *appleWidget = new UBGraphicsAppleWidgetItem(pWidgetUrl); UBGraphicsAppleWidgetItem *appleWidget = new UBGraphicsAppleWidgetItem(pWidgetUrl);
@ -1461,7 +1422,6 @@ UBGraphicsAppleWidgetItem* UBGraphicsScene::addAppleWidget(const QUrl& pWidgetUr
return appleWidget; return appleWidget;
} }
UBGraphicsW3CWidgetItem* UBGraphicsScene::addW3CWidget(const QUrl& pWidgetUrl, const QPointF& pPos, int widgetType) UBGraphicsW3CWidgetItem* UBGraphicsScene::addW3CWidget(const QUrl& pWidgetUrl, const QPointF& pPos, int widgetType)
{ {
UBGraphicsW3CWidgetItem *w3CWidget = new UBGraphicsW3CWidgetItem(pWidgetUrl, 0, widgetType); UBGraphicsW3CWidgetItem *w3CWidget = new UBGraphicsW3CWidgetItem(pWidgetUrl, 0, widgetType);
@ -1502,7 +1462,6 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
} }
} }
UBGraphicsW3CWidgetItem* UBGraphicsScene::addOEmbed(const QUrl& pContentUrl, const QPointF& pPos) UBGraphicsW3CWidgetItem* UBGraphicsScene::addOEmbed(const QUrl& pContentUrl, const QPointF& pPos)
{ {
QStringList widgetPaths = UBPersistenceManager::persistenceManager()->allWidgets(UBSettings::settings()->applicationApplicationsLibraryDirectory()); QStringList widgetPaths = UBPersistenceManager::persistenceManager()->allWidgets(UBSettings::settings()->applicationApplicationsLibraryDirectory());
@ -1588,7 +1547,6 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint
return svgItem; return svgItem;
} }
UBGraphicsTextItem* UBGraphicsScene::addText(const QString& pString, const QPointF& pTopLeft) UBGraphicsTextItem* UBGraphicsScene::addText(const QString& pString, const QPointF& pTopLeft)
{ {
return addTextWithFont(pString, pTopLeft, UBSettings::settings()->fontPixelSize() return addTextWithFont(pString, pTopLeft, UBSettings::settings()->fontPixelSize()
@ -1680,6 +1638,7 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con
return textItem; return textItem;
} }
UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const QPointF& pTopLeft) UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const QPointF& pTopLeft)
{ {
UBGraphicsTextItem *textItem = new UBGraphicsTextItem(); UBGraphicsTextItem *textItem = new UBGraphicsTextItem();
@ -1743,7 +1702,6 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item)
mFastAccessItems.removeAll(item); mFastAccessItems.removeAll(item);
} }
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items) void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)
{ {
setModified(true); setModified(true);
@ -1757,7 +1715,6 @@ void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items)
mFastAccessItems.removeAll(item); mFastAccessItems.removeAll(item);
} }
void UBGraphicsScene::deselectAllItems() void UBGraphicsScene::deselectAllItems()
{ {
foreach(QGraphicsItem *gi, selectedItems ()) foreach(QGraphicsItem *gi, selectedItems ())
@ -1803,7 +1760,6 @@ QGraphicsItem* UBGraphicsScene::setAsBackgroundObject(QGraphicsItem* item, bool
return item; return item;
} }
QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio) QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio)
{ {
@ -1843,7 +1799,6 @@ QRectF UBGraphicsScene::normalizedSceneRect(qreal ratio)
return normalizedRect; return normalizedRect;
} }
void UBGraphicsScene::setDocument(UBDocumentProxy* pDocument) void UBGraphicsScene::setDocument(UBDocumentProxy* pDocument)
{ {
if (pDocument != mDocument) if (pDocument != mDocument)
@ -1858,7 +1813,6 @@ void UBGraphicsScene::setDocument(UBDocumentProxy* pDocument)
} }
} }
QGraphicsItem* UBGraphicsScene::scaleToFitDocumentSize(QGraphicsItem* item, bool center, int margin, bool expand) QGraphicsItem* UBGraphicsScene::scaleToFitDocumentSize(QGraphicsItem* item, bool center, int margin, bool expand)
{ {
int maxWidth = mNominalSize.width() - (margin * 2); int maxWidth = mNominalSize.width() - (margin * 2);
@ -1897,7 +1851,6 @@ void UBGraphicsScene::addRuler(QPointF center)
setModified(true); setModified(true);
} }
void UBGraphicsScene::addProtractor(QPointF center) void UBGraphicsScene::addProtractor(QPointF center)
{ {
// Protractor // Protractor
@ -2089,7 +2042,6 @@ void UBGraphicsScene::addMask(const QPointF &center)
setModified(true); setModified(true);
} }
void UBGraphicsScene::setRenderingQuality(UBItem::RenderingQuality pRenderingQuality) void UBGraphicsScene::setRenderingQuality(UBItem::RenderingQuality pRenderingQuality)
{ {
QListIterator<QGraphicsItem*> itItems(mFastAccessItems); QListIterator<QGraphicsItem*> itItems(mFastAccessItems);
@ -2107,7 +2059,6 @@ void UBGraphicsScene::setRenderingQuality(UBItem::RenderingQuality pRenderingQua
} }
} }
QList<QUrl> UBGraphicsScene::relativeDependencies() const QList<QUrl> UBGraphicsScene::relativeDependencies() const
{ {
QList<QUrl> relativePathes; QList<QUrl> relativePathes;
@ -2127,7 +2078,6 @@ QList<QUrl> UBGraphicsScene::relativeDependencies() const
return relativePathes; return relativePathes;
} }
QSize UBGraphicsScene::nominalSize() QSize UBGraphicsScene::nominalSize()
{ {
if (mDocument && !mNominalSize.isValid()) if (mDocument && !mNominalSize.isValid())
@ -2138,7 +2088,6 @@ QSize UBGraphicsScene::nominalSize()
return mNominalSize; return mNominalSize;
} }
void UBGraphicsScene::setNominalSize(const QSize& pSize) void UBGraphicsScene::setNominalSize(const QSize& pSize)
{ {
if (nominalSize() != pSize) if (nominalSize() != pSize)
@ -2152,7 +2101,6 @@ void UBGraphicsScene::setNominalSize(const QSize& pSize)
} }
} }
void UBGraphicsScene::setNominalSize(int pWidth, int pHeight) void UBGraphicsScene::setNominalSize(int pWidth, int pHeight)
{ {
setNominalSize(QSize(pWidth, pHeight)); setNominalSize(QSize(pWidth, pHeight));
@ -2162,6 +2110,7 @@ void UBGraphicsScene::setSelectedZLevel(QGraphicsItem * item)
{ {
item->setZValue(mZLayerController->generateZLevel(itemLayerType::SelectedItem)); item->setZValue(mZLayerController->generateZLevel(itemLayerType::SelectedItem));
} }
void UBGraphicsScene::setOwnZlevel(QGraphicsItem *item) void UBGraphicsScene::setOwnZlevel(QGraphicsItem *item)
{ {
item->setZValue(item->data(UBGraphicsItemData::ItemOwnZValue).toReal()); item->setZValue(item->data(UBGraphicsItemData::ItemOwnZValue).toReal());
@ -2184,7 +2133,6 @@ QGraphicsItem* UBGraphicsScene::rootItem(QGraphicsItem* item) const
return root; return root;
} }
void UBGraphicsScene::drawItems (QPainter * painter, int numItems, void UBGraphicsScene::drawItems (QPainter * painter, int numItems,
QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget) QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget)
{ {
@ -2359,13 +2307,13 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
QGraphicsScene::keyReleaseEvent(keyEvent); QGraphicsScene::keyReleaseEvent(keyEvent);
} }
void UBGraphicsScene::setDocumentUpdated() void UBGraphicsScene::setDocumentUpdated()
{ {
if (document()) if (document())
document()->setMetaData(UBSettings::documentUpdatedAt document()->setMetaData(UBSettings::documentUpdatedAt
, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); , UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
} }
void UBGraphicsScene::createEraiser() void UBGraphicsScene::createEraiser()
{ {
mEraser = new QGraphicsEllipseItem(); // mem : owned and destroyed by the scene mEraser = new QGraphicsEllipseItem(); // mem : owned and destroyed by the scene
@ -2379,6 +2327,7 @@ void UBGraphicsScene::createEraiser()
addItem(mEraser); addItem(mEraser);
} }
void UBGraphicsScene::createPointer() void UBGraphicsScene::createPointer()
{ {
mPointer = new QGraphicsEllipseItem(); // mem : owned and destroyed by the scene mPointer = new QGraphicsEllipseItem(); // mem : owned and destroyed by the scene

@ -69,6 +69,8 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem()); UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem());
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), copy, SLOT(activeSceneChanged()));
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);

@ -247,6 +247,8 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
{ {
QString url = pUrl; QString url = pUrl;
// if the file name start with file:// it has be removed because QFileInfo doesn't support this form // if the file name start with file:// it has be removed because QFileInfo doesn't support this form
//
url = url.replace("file:///","");
url = url.replace("file://",""); url = url.replace("file://","");
QString name = pName; QString name = pName;
@ -304,6 +306,7 @@ QString UBW3CWidget::createNPAPIWrapperInDir(const QString& pUrl, const QDir& pD
if (fi.exists()){ if (fi.exists()){
QString target = widgetLibraryPath + "/" + fi.fileName(); QString target = widgetLibraryPath + "/" + fi.fileName();
QString source = pUrl; QString source = pUrl;
source.replace("file:///","");
source.replace("file://",""); source.replace("file://","");
QFile::copy(source, target); QFile::copy(source, target);
} }

@ -533,7 +533,13 @@ void UBTeacherGuidePresentationWidget::showData(QVector<tUBGEElementNode*> data)
newWidgetItem->setText(0,element->attributes.value("title")); newWidgetItem->setText(0,element->attributes.value("title"));
newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_MEDIA); newWidgetItem->setData(0,tUBTGTreeWidgetItemRole_HasAnAction,tUBTGActionAssociateOnClickItem_MEDIA);
newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11))); newWidgetItem->setData(0,Qt::FontRole, QVariant(QFont(QApplication::font().family(),11)));
newWidgetItem->setData(0, TG_USER_ROLE_MIME_TYPE, UBApplication::boardController->activeDocument()->persistencePath()+ "/" + element->attributes.value("relativePath")); QString mimeTypeString;
#ifdef Q_WS_WIN
mimeTypeString = QUrl::fromLocalFile(UBApplication::boardController->activeDocument()->persistencePath()+ "/" + element->attributes.value("relativePath")).toString();
#else
mimeTypeString = UBApplication::boardController->activeDocument()->persistencePath()+ "/" + element->attributes.value("relativePath");
#endif
newWidgetItem->setData(0, TG_USER_ROLE_MIME_TYPE, mimeTypeString);
newWidgetItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable); newWidgetItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
mpRootWidgetItem->addChild(newWidgetItem); mpRootWidgetItem->addChild(newWidgetItem);

@ -230,11 +230,14 @@ void UBTGAdaptableText::bottomMargin(int newValue)
* class UBTGDraggableWeb * * class UBTGDraggableWeb *
***************************************************************************/ ***************************************************************************/
UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView(parent) UBDraggableWeb::UBDraggableWeb(QString& relativePath, QWidget* parent): QWebView(parent)
, mRelativePath(relativePath)
, mDragStartPosition(QPoint(-1,-1)) , mDragStartPosition(QPoint(-1,-1))
, mDragStarted(false) , mDragStarted(false)
{ {
if(!relativePath.startsWith("file://"))
mRelativePath = QUrl::fromLocalFile(relativePath).toString();
else
mRelativePath = relativePath;
//NOOP //NOOP
} }
@ -499,7 +502,11 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event)
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData(); QMimeData *mimeData = new QMimeData();
QList<QUrl> urlList; QList<QUrl> urlList;
#ifdef Q_WS_WIN
urlList << QUrl::fromLocalFile(mMediaPath);
#else
urlList << QUrl(mMediaPath); urlList << QUrl(mMediaPath);
#endif
mimeData->setUrls(urlList); mimeData->setUrls(urlList);
drag->setMimeData(mimeData); drag->setMimeData(mimeData);

@ -842,7 +842,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
} }
} }
} }
if(UBSettings::settings()->teacherGuidePageZeroActivated and sceneIndex()<=1) if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<=1)
bCanMoveUp = false; bCanMoveUp = false;
if(bCanDelete || bCanMoveUp || bCanMoveDown) if(bCanDelete || bCanMoveUp || bCanMoveDown)

Loading…
Cancel
Save