From 0e9f7166d2b8426e8ad2139f59c3fad283e89e42 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 23 Aug 2012 20:11:23 +0200 Subject: [PATCH] fixed issue with flash and removed {} --- plugins/cffadaptor/src/UBCFFAdaptor.cpp | 18 ++++++++---------- src/board/UBBoardController.cpp | 2 +- src/domain/UBGraphicsWidgetItem.cpp | 6 +++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/cffadaptor/src/UBCFFAdaptor.cpp b/plugins/cffadaptor/src/UBCFFAdaptor.cpp index a0ea3216..68ec3ff9 100644 --- a/plugins/cffadaptor/src/UBCFFAdaptor.cpp +++ b/plugins/cffadaptor/src/UBCFFAdaptor.cpp @@ -919,7 +919,7 @@ bool UBCFFAdaptor::UBToCFFConverter::ibwAddLine(int x1, int y1, int x2, int y2, QDomElement svgBackgroundCrossPart = doc.createElementNS(svgIWBNS,svgIWBNSPrefix + ":line"); QDomElement iwbBackgroundCrossPart = doc.createElementNS(iwbNS,iwbNsPrefix + ":" + tElement); - QString sUUID = QUuid::createUuid().toString().remove("{").remove("}"); + QString sUUID = QUuid::createUuid().toString(); svgBackgroundCrossPart.setTagName(tIWBLine); @@ -1061,7 +1061,7 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle QString sSrcFileName = sourcePath + "/" + srcPath ; QString fileExtention = getExtentionFromFileName(sSrcFileName); QString sDstContentFolder = getDstContentFolderName(ubzElement.tagName()); - QString sDstFileName(QString(QUuid::createUuid().toString()+"."+convertExtention(fileExtention)).remove("{").remove("}")); + QString sDstFileName(QString(QUuid::createUuid().toString()+"."+convertExtention(fileExtention))); if (itIsSupportedFormat(fileExtention)) // format is supported and we can copy src. files without changing. @@ -1268,7 +1268,7 @@ bool UBCFFAdaptor::UBToCFFConverter::setCFFAttribute(const QString &attributeNam QString id = tl.at(tl.count()-1); // if element already have an ID, we use it. Else we create new id for element. if (QString() == id) - id = QUuid::createUuid().toString().remove("{").remove("}"); + id = QUuid::createUuid().toString(); svgElement.setAttribute(aID, id); iwbElement.setAttribute(aRef, id); @@ -1382,11 +1382,9 @@ bool UBCFFAdaptor::UBToCFFConverter::createBackground(const QDomElement &element if (0 <= mViewbox.topLeft().y()) bckRect.topLeft().setY(0); -// QString backgroundImagePath = createBackgroundImage(element, QSize(bckRect.width(), bckRect.height())); -// if (QString() != backgroundImagePath) if (QRect() != bckRect) { - QString sElementID = QUuid::createUuid().toString().remove("{").remove("}"); + QString sElementID = QUuid::createUuid().toString(); bool darkBackground = (avTrue == element.attribute(aDarkBackground)); svgBackgroundElementPart.setAttribute(aFill, darkBackground ? "black" : "white"); @@ -1635,7 +1633,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZAudio(const QDomElement &element, Q //we must create image-containers for audio files int audioImageDimention = qMin(svgElementPart.attribute(aWidth).toInt(), svgElementPart.attribute(aHeight).toInt()); QString srcAudioImageFile(sAudioElementImage); - QString elementId = QString(QUuid::createUuid().toString()).remove("{").remove("}"); + QString elementId = QString(QUuid::createUuid().toString()); QString sDstAudioImageFileName = elementId+"."+fePng; QString dstAudioImageFilePath = destinationPath+"/"+cfImages+"/"+sDstAudioImageFileName; QString dstAudioImageRelativePath = cfImages+"/"+sDstAudioImageFileName; @@ -1793,7 +1791,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZPolygon(const QDomElement &element, if (0 < iwbElementPart.attributes().count()) { - QString id = QUuid::createUuid().toString().remove("{").remove("}"); + QString id = QUuid::createUuid().toString(); svgElementPart.setAttribute(aID, id); iwbElementPart.setAttribute(aRef, id); @@ -1826,7 +1824,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZPolyline(const QDomElement &element if (0 < iwbElementPart.attributes().count()) { - QString id = QUuid::createUuid().toString().remove("{").remove("}"); + QString id = QUuid::createUuid().toString(); svgElementPart.setAttribute(aID, id); iwbElementPart.setAttribute(aRef, id); @@ -1858,7 +1856,7 @@ bool UBCFFAdaptor::UBToCFFConverter::parseUBZLine(const QDomElement &element, QM if (0 < iwbElementPart.attributes().count()) { - QString id = QUuid::createUuid().toString().remove("{").remove("}"); + QString id = QUuid::createUuid().toString(); svgElementPart.setAttribute(aID, id); iwbElementPart.setAttribute(aRef, id); diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 5015e90a..332ea3b0 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1230,7 +1230,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri if (widgetUrl.length() > 0) { UBGraphicsWidgetItem *widgetItem = mActiveScene->addW3CWidget(QUrl::fromLocalFile(widgetUrl), pPos); - + widgetItem->setUuid(QUuid::createUuid()); widgetItem->setSourceUrl(sourceUrl); UBDrawingController::drawingController()->setStylusTool(UBStylusTool::Selector); diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp index 0f056860..f85074f8 100644 --- a/src/domain/UBGraphicsWidgetItem.cpp +++ b/src/domain/UBGraphicsWidgetItem.cpp @@ -114,7 +114,8 @@ void UBGraphicsWidgetItem::initialize() connect(page(), SIGNAL(linkClicked(const QUrl&)), this, SLOT(onLinkClicked(const QUrl&))); } -void UBGraphicsWidgetItem::onLinkClicked(const QUrl& url){ +void UBGraphicsWidgetItem::onLinkClicked(const QUrl& url) +{ UBApplication::webController->loadUrl(url); } @@ -846,6 +847,9 @@ UBGraphicsW3CWidgetItem::UBGraphicsW3CWidgetItem(const QUrl& pWidgetUrl, QGraphi /* is it a valid local file ? */ QFile f(mMainHtmlUrl.toLocalFile()); + qDebug() << mMainHtmlFileName; + qDebug() << mMainHtmlUrl.toLocalFile(); + if(!f.exists()) mMainHtmlUrl = QUrl(mMainHtmlFileName);