From 1232807ad10de92eb1808a19b26974f132b43920 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 23 Aug 2012 12:33:26 +0200 Subject: [PATCH 1/7] fixed issue with dnd on mac from teacher guide to board --- src/board/UBBoardController.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index a1fbd435..2474e755 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -957,6 +957,9 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri // In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is // why we will check if an ; exists and take the first part (the standard allows this kind of mimetype) + if(mimeType.isEmpty()) + mimeType = UBFileSystemUtils::mimeTypeFromFileName(sourceUrl.toString()); + int position=mimeType.indexOf(";"); if(position != -1) mimeType=mimeType.left(position); @@ -977,9 +980,18 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri qDebug() << "accepting mime type" << mimeType << "as raster image"; - QImage img; - img.loadFromData(pData); - QPixmap pix = QPixmap::fromImage(img); + + QPixmap pix; + if(pData.length() == 0){ + pix.load(sourceUrl.toString()); + } + else{ + QImage img; + img.loadFromData(pData); + pix = QPixmap::fromImage(img); + } + + UBGraphicsPixmapItem* pixItem = mActiveScene->addPixmap(pix, NULL, pPos, 1.); pixItem->setSourceUrl(sourceUrl); From 572bb698797ac526cd128152be5514a0fa28a6c0 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 23 Aug 2012 13:59:25 +0200 Subject: [PATCH 2/7] fixed issue on dnd of media and audio to the board --- src/board/UBBoardController.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 2474e755..1fe4b154 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -913,7 +913,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const else if (sUrl.startsWith("file://") || sUrl.startsWith("/")) { QString fileName = url.toLocalFile(); - + QUrl formedUrl = sUrl.startsWith("file://") ? sUrl : QUrl::fromLocalFile(sUrl); QString contentType = UBFileSystemUtils::mimeTypeFromFileName(fileName); bool shouldLoadFileData = @@ -926,7 +926,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const if (shouldLoadFileData) file.open(QIODevice::ReadOnly); - downloadFinished(true, url, contentType, file.readAll(), pPos, pSize, isBackground, internalData); + downloadFinished(true, formedUrl, contentType, file.readAll(), pPos, pSize, isBackground, internalData); if (shouldLoadFileData) file.close(); @@ -955,6 +955,8 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri { QString mimeType = pContentTypeHeader; + qDebug() << sourceUrl.toString(); + // In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is // why we will check if an ; exists and take the first part (the standard allows this kind of mimetype) if(mimeType.isEmpty()) @@ -1948,7 +1950,7 @@ UBGraphicsMediaItem* UBBoardController::addVideo(const QUrl& pSourceUrl, bool st QString destFile; bool b = UBPersistenceManager::persistenceManager()->addFileToDocument(selectedDocument(), - pSourceUrl.toLocalFile(), + pSourceUrl.toLocalFile(), UBPersistenceManager::videoDirectory, uuid, destFile); From 5d0464ea80bf601dcd34adca3c38dc5e94daa7ab Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 23 Aug 2012 14:13:45 +0200 Subject: [PATCH 3/7] fixed issue of widget that doesn't follow the scroll area on the presentation widget --- src/board/UBBoardController.cpp | 6 +----- src/gui/UBTeacherGuideWidget.cpp | 12 ++++++++++++ src/gui/UBTeacherGuideWidget.h | 6 ++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 1fe4b154..2ef4cedf 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -955,8 +955,6 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri { QString mimeType = pContentTypeHeader; - qDebug() << sourceUrl.toString(); - // In some cases "image/jpeg;charset=" is retourned by the drag-n-drop. That is // why we will check if an ; exists and take the first part (the standard allows this kind of mimetype) if(mimeType.isEmpty()) @@ -985,7 +983,7 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri QPixmap pix; if(pData.length() == 0){ - pix.load(sourceUrl.toString()); + pix.load(sourceUrl.toLocalFile()); } else{ QImage img; @@ -993,8 +991,6 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QStri pix = QPixmap::fromImage(img); } - - UBGraphicsPixmapItem* pixItem = mActiveScene->addPixmap(pix, NULL, pPos, 1.); pixItem->setSourceUrl(sourceUrl); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 5322919a..666c64e0 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -468,6 +468,10 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpTreeWidget->setIconSize(QSize(24,24)); connect(mpTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(onAddItemClicked(QTreeWidgetItem*,int))); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); +#ifdef Q_WS_MAC + // on mac and with the custom qt the widget on the tree are not automatically relocated when using the vertical scrollbar. To relocate them we link the valueChange signal of the vertical scrollbar witht a local signal to trig a change and a repaint of the tree widget + connect(mpTreeWidget->verticalScrollBar(),SIGNAL(valueChanged(int)),this,SLOT(onSliderMoved(int))); +#endif } UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() @@ -484,6 +488,14 @@ UBTeacherGuidePresentationWidget::~UBTeacherGuidePresentationWidget() DELETEPTR(mpLayout); } +#ifdef Q_WS_MAC +void UBTeacherGuidePresentationWidget::onSliderMoved(int size) +{ + Q_UNUSED(size); + mpMediaSwitchItem->setExpanded(true); +} +#endif + bool UBTeacherGuidePresentationWidget::eventFilter(QObject* object, QEvent* event) { Q_UNUSED(object); diff --git a/src/gui/UBTeacherGuideWidget.h b/src/gui/UBTeacherGuideWidget.h index 775728e5..1d165f13 100644 --- a/src/gui/UBTeacherGuideWidget.h +++ b/src/gui/UBTeacherGuideWidget.h @@ -114,6 +114,12 @@ private: QTreeWidgetItem* mpRootWidgetItem; QTreeWidgetItem* mpMediaSwitchItem; + +#ifdef Q_WS_MACX +private slots: + void onSliderMoved(int size); +#endif + }; /*************************************************************************** From 0e9f7166d2b8426e8ad2139f59c3fad283e89e42 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 23 Aug 2012 20:11:23 +0200 Subject: [PATCH 4/7] 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); From f7896e143e8c16b59bce3477bd509e9b4e83ceed Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 24 Aug 2012 10:20:26 +0200 Subject: [PATCH 5/7] fixed issue with flash on mac --- resources/sankore.qrc | 1 + src/core/UBPersistenceManager.cpp | 28 ++++++++++++++++ src/core/UBPersistenceManager.h | 1 + src/gui/UBTeacherGuideWidget.cpp | 5 +-- src/gui/UBTeacherGuideWidgetsTools.cpp | 45 ++++++++++++++++++++------ src/gui/UBTeacherGuideWidgetsTools.h | 4 +-- 6 files changed, 70 insertions(+), 14 deletions(-) diff --git a/resources/sankore.qrc b/resources/sankore.qrc index 9941c519..425c21c5 100644 --- a/resources/sankore.qrc +++ b/resources/sankore.qrc @@ -364,5 +364,6 @@ images/teacherGuide/w3c_24x24.svg images/teacherGuide/pencil.svg images/duplicateDisabled.svg + images/teacherGuide/flash_24x24.svg diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 954af5b5..2c025a7c 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -878,6 +878,34 @@ QString UBPersistenceManager::addObjectToTeacherGuideDirectory(UBDocumentProxy* return destPath; } +QString UBPersistenceManager::addWidgetToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath) +{ + QString path = UBFileSystemUtils::removeLocalFilePrefix(pPath); + QFileInfo fi(path); + Q_ASSERT(fi.isDir()); + + int lastIndex = path.lastIndexOf("."); + QString extension(""); + if(lastIndex != -1) + extension = path.right(path.length() - lastIndex); + + QString uuid = QUuid::createUuid(); + + if (!fi.exists() || !pDocumentProxy) + return ""; + + QString directoryName = UBPersistenceManager::teacherGuideDirectory + "/" + uuid + extension; + QString destPath = pDocumentProxy->persistencePath() + "/" + directoryName; + + if (!QDir(destPath).exists()){ + QDir dir; + dir.mkdir(pDocumentProxy->persistencePath() + "/" + UBPersistenceManager::teacherGuideDirectory); + UBFileSystemUtils::copyDir(path,destPath); + } + + return destPath; +} + bool UBPersistenceManager::addFileToDocument(UBDocumentProxy* pDocumentProxy, QString path, const QString& subdir, diff --git a/src/core/UBPersistenceManager.h b/src/core/UBPersistenceManager.h index 9ea21db3..79624b18 100644 --- a/src/core/UBPersistenceManager.h +++ b/src/core/UBPersistenceManager.h @@ -83,6 +83,7 @@ class UBPersistenceManager : public QObject QString teacherGuideAbsoluteObjectPath(UBDocumentProxy* pDocumentProxy); QString addObjectToTeacherGuideDirectory(UBDocumentProxy* proxy, QString pPath); + QString addWidgetToTeacherGuideDirectory(UBDocumentProxy* pDocumentProxy, QString pPath); virtual void addDirectoryContentToDocument(const QString& documentRootFolder, UBDocumentProxy* pDocument); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index 666c64e0..d7fd3493 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -565,7 +565,7 @@ void UBTeacherGuidePresentationWidget::showData( QVector data } else if (element->name == "media") { createMediaButtonItem(); - QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem( mpMediaSwitchItem); + QTreeWidgetItem* newWidgetItem = new QTreeWidgetItem(mpMediaSwitchItem); newWidgetItem->setIcon(0, QIcon( ":images/teacherGuide/" + element->attributes.value("mediaType") + "_24x24.svg")); newWidgetItem->setText(0, element->attributes.value("title")); newWidgetItem->setData(0, tUBTGTreeWidgetItemRole_HasAnAction, tUBTGActionAssociateOnClickItem_MEDIA); @@ -582,7 +582,8 @@ void UBTeacherGuidePresentationWidget::showData( QVector data QTreeWidgetItem* mediaItem = new QTreeWidgetItem(newWidgetItem); mediaItem->setData(0, tUBTGTreeWidgetItemRole_HasAnAction, tUBTGActionAssociateOnClickItem_NONE); - UBTGMediaWidget* mediaWidget = new UBTGMediaWidget(element->attributes.value("relativePath"), newWidgetItem); + qDebug() << element->attributes.value("mediaType"); + UBTGMediaWidget* mediaWidget = new UBTGMediaWidget(element->attributes.value("relativePath"), newWidgetItem,0,element->attributes.value("mediaType").contains("flash")); newWidgetItem->setExpanded(false); mpTreeWidget->setItemWidget(mediaItem, 0, mediaWidget); } diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index 71334fbb..d9c88efd 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -304,7 +304,7 @@ UBTGMediaWidget::UBTGMediaWidget(QTreeWidgetItem* widget, QWidget* parent,const setMinimumHeight(250); } -UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWidget* parent,const char* name): QStackedWidget(parent) +UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWidget* parent,bool forceFlashMediaType,const char* name): QStackedWidget(parent) , mpTreeWidgetItem(widget) , mpDropMeWidget(NULL) , mpWorkWidget(NULL) @@ -320,7 +320,7 @@ UBTGMediaWidget::UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget, QWi setObjectName(name); mMediaPath = UBApplication::boardController->selectedDocument()->persistencePath()+ "/" + mediaPath; setAcceptDrops(false); - createWorkWidget(); + createWorkWidget(forceFlashMediaType); setFixedHeight(200); } @@ -343,8 +343,7 @@ void UBTGMediaWidget::initializeWithDom(QDomElement element) mIsInitializationMode = true; setAcceptDrops(false); mMediaPath = UBApplication::boardController->selectedDocument()->persistencePath() + "/" + element.attribute("relativePath"); - qDebug() << mMediaPath; - createWorkWidget(); + createWorkWidget(element.attribute("mediaType").contains("flash")); setFixedHeight(200); mpTitle->setInitialText(element.attribute("title")); mIsInitializationMode = false; @@ -369,8 +368,12 @@ void UBTGMediaWidget::hideEvent(QHideEvent* event) void UBTGMediaWidget::showEvent(QShowEvent* event) { QWidget::showEvent(event); - if(mpWebView) - mpWebView->load(QUrl(mMediaPath + "/index.htm")); + if(mpWebView){ + QString indexPath = mMediaPath+"/index.htm"; + if(!QFile::exists(indexPath)) + indexPath += "l"; + mpWebView->load(QUrl::fromLocalFile(indexPath)); + } } tUBGEElementNode* UBTGMediaWidget::saveData() @@ -392,7 +395,7 @@ void UBTGMediaWidget::dragEnterEvent(QDragEnterEvent *event) event->accept(); } -void UBTGMediaWidget::createWorkWidget() +void UBTGMediaWidget::createWorkWidget(bool forceFlashMediaType) { QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mMediaPath); bool setMedia = true; @@ -419,12 +422,32 @@ void UBTGMediaWidget::createWorkWidget() mpMediaLabelWidget->setPixmap(pixmap); mpMediaLabelWidget->setScaledContents(true); } - else if(mimeType.contains("application")){ + else if(mimeType.contains("widget") && !forceFlashMediaType){ mMediaType = "w3c"; + if(!(mIsPresentationMode || mIsInitializationMode)){ + mMediaPath = UBPersistenceManager::persistenceManager()->addWidgetToTeacherGuideDirectory(proxyDocument, mMediaPath); + } + mpWebView = new UBDraggableWeb(mMediaPath); + mpWebView->setAcceptDrops(false); + mpWebView->settings()->setAttribute(QWebSettings::JavaEnabled, true); + mpWebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + mpWebView->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true); + mpWebView->settings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true); + mpWebView->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); + mpWebView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); + mpWebView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); + QString indexPath = mMediaPath+"/index.htm"; + if(!QFile::exists(indexPath)) + indexPath += "l"; + mpWebView->load(QUrl::fromLocalFile(indexPath)); + } + else if(mimeType.contains("x-shockwave-flash") || forceFlashMediaType){ + mMediaType = "flash"; if(!(mIsPresentationMode || mIsInitializationMode)){ QDir baseW3CDirectory(UBPersistenceManager::persistenceManager()->teacherGuideAbsoluteObjectPath(proxyDocument)); mMediaPath = UBGraphicsW3CWidgetItem::createNPAPIWrapperInDir(mMediaPath,baseW3CDirectory,mimeType,QSize(100,100),QUuid::createUuid()); } + qDebug() << mMediaPath; mpWebView = new UBDraggableWeb(mMediaPath); mpWebView->setAcceptDrops(false); mpWebView->settings()->setAttribute(QWebSettings::JavaEnabled, true); @@ -434,8 +457,10 @@ void UBTGMediaWidget::createWorkWidget() mpWebView->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true); mpWebView->settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true); mpWebView->settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true); - - mpWebView->load(QUrl(mMediaPath+"/index.htm")); + QString indexPath = mMediaPath+"/index.htm"; + if(!QFile::exists(indexPath)) + indexPath += "l"; + mpWebView->load(QUrl::fromLocalFile(indexPath)); } else{ qDebug() << "createWorkWidget mime type not handled" << mimeType; diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index 43e726e3..e4ee8c53 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -137,7 +137,7 @@ class UBTGMediaWidget : public QStackedWidget , public iUBTGSaveData Q_OBJECT public: UBTGMediaWidget(QTreeWidgetItem* widget = 0, QWidget* parent = 0, const char* name = "UBTGMediaWidget"); - UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget = 0, QWidget* parent = 0, const char* name = "UBTGMediaWidget"); + UBTGMediaWidget(QString mediaPath, QTreeWidgetItem* widget = 0, QWidget* parent = 0, bool forceFlashMediaType = false, const char *name = "UBTGMediaWidget"); ~UBTGMediaWidget(); tUBGEElementNode* saveData(); void initializeWithDom(QDomElement element); @@ -152,7 +152,7 @@ protected: private: void parseMimeData(const QMimeData* pMimeData); - void createWorkWidget(); + void createWorkWidget(bool forceFlashMediaType = false); void updateSize(); QTreeWidgetItem* mpTreeWidgetItem; From fd7b50d0df0af37eb21015637f350b59a9869d67 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 24 Aug 2012 10:31:37 +0200 Subject: [PATCH 6/7] dnd from the title of media --- src/gui/UBTeacherGuideWidget.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index d7fd3493..7de10dbf 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -457,7 +457,6 @@ UBTeacherGuidePresentationWidget::UBTeacherGuidePresentationWidget(QWidget *pare mpLayout->addWidget(mpTreeWidget); mpRootWidgetItem = mpTreeWidget->invisibleRootItem(); - mpTreeWidget->setSelectionMode(QAbstractItemView::NoSelection); mpTreeWidget->setDragEnabled(true); mpTreeWidget->setRootIsDecorated(false); mpTreeWidget->setIndentation(0); From 18b7f8b12d0fa4cbde0165f9580fe4b7860c4d32 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 24 Aug 2012 11:30:33 +0200 Subject: [PATCH 7/7] duplicated style because doesn't work (workaround) --- resources/style.qss | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/style.qss b/resources/style.qss index a754c544..e53e0ee6 100644 --- a/resources/style.qss +++ b/resources/style.qss @@ -14,6 +14,15 @@ QWidget#UBFeaturesCentralWidget border: 2px solid #999999; } +QTextEdit, +QLineEdit, +QComboBox#DockPaletteWidgetComboBox QAbstractItemView +{ + selection-background-color: lightgreen; + selection-color: black; +} + + QWidget#mAdditionalDataContainer { border-radius: 10px;