fixed some path issue on windows

preferencesAboutTextFull
unknown 13 years ago
parent f943726b20
commit b253ed5774
  1. 9
      src/core/UBPersistenceManager.cpp
  2. 7
      src/domain/UBW3CWidget.cpp
  3. 8
      src/gui/UBTeacherGuideWidget.cpp
  4. 6
      src/gui/UBTeacherGuideWidgetsTools.cpp
  5. 2
      src/gui/UBThumbnailWidget.cpp

@ -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);
} }

@ -247,7 +247,9 @@ 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;
QFileInfo fi(url); QFileInfo fi(url);
@ -304,7 +306,8 @@ 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);

@ -372,7 +372,7 @@ tUBGEElementNode* UBTGMediaWidget::saveData()
tUBGEElementNode* result = new tUBGEElementNode(); tUBGEElementNode* result = new tUBGEElementNode();
QString relativePath = mMediaPath; QString relativePath = mMediaPath;
relativePath = relativePath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/",""); relativePath = relativePath.replace(UBApplication::boardController->activeDocument()->persistencePath()+"/","");
result->name = "media"; result->name = "media";
result->attributes.insert("title",mpTitle->text()); result->attributes.insert("title",mpTitle->text());
result->attributes.insert("relativePath",relativePath); result->attributes.insert("relativePath",relativePath);
result->attributes.insert("mediaType",mMediaType); result->attributes.insert("mediaType",mMediaType);
@ -499,7 +499,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