From 628f213f1b0a4d9cb5d8d5c3a49b6c386e6b1726 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Wed, 25 Jan 2012 16:02:10 +0100 Subject: [PATCH] Progressing with the medias into the new teacherbar --- src/gui/UBTBPageEditWidget.cpp | 21 ++++++++++++--------- src/gui/UBTeacherBarDataMgr.cpp | 3 --- src/gui/UBTeacherBarDataMgr.h | 2 +- src/gui/UBTeacherBarPreviewWidget.cpp | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/UBTBPageEditWidget.cpp b/src/gui/UBTBPageEditWidget.cpp index 4173aba1..39f6716c 100644 --- a/src/gui/UBTBPageEditWidget.cpp +++ b/src/gui/UBTBPageEditWidget.cpp @@ -179,7 +179,7 @@ void UBTBPageEditWidget::saveFields() { mpDataMgr->actions()->clear(); mpDataMgr->urls()->clear(); - mpDataMgr->mediaUrls().clear(); + mpDataMgr->mediaUrls()->clear(); mpDataMgr->medias()->clear(); foreach(UBTeacherStudentAction* pAct, mActions){ @@ -195,7 +195,8 @@ void UBTBPageEditWidget::saveFields() mpDataMgr->urls()->append(link); } foreach(QString url, mMediaUrls){ - mpDataMgr->mediaUrls().append(url); + qDebug() << "saving media :" << url; + mpDataMgr->mediaUrls()->append(url); } foreach(QWidget* pMedia, mMedias){ mpDataMgr->medias()->append(pMedia); @@ -215,15 +216,17 @@ void UBTBPageEditWidget::updateFields() mpActions->addWidget(pAction); } // Medias - foreach(QString url, mpDataMgr->mediaUrls()){ - if(url.isEmpty()) - continue; - QWidget* pWidget = mpMediaContainer->generateMediaWidget(url); - if(pWidget != NULL){ - mMedias << pWidget; - mpMediaContainer->addWidget(pWidget); + foreach(QString url, *mpDataMgr->mediaUrls()){ + if(!url.isEmpty()){ + mMediaUrls << url; + QWidget* pWidget = mpMediaContainer->generateMediaWidget(url); + if(pWidget != NULL){ + mMedias << pWidget; + mpMediaContainer->addWidget(pWidget); + } } } + // Links foreach(sLink link, *mpDataMgr->urls()){ UBUrlWidget* urlWidget = new UBUrlWidget(this); diff --git a/src/gui/UBTeacherBarDataMgr.cpp b/src/gui/UBTeacherBarDataMgr.cpp index 28cbcb24..b612aa57 100644 --- a/src/gui/UBTeacherBarDataMgr.cpp +++ b/src/gui/UBTeacherBarDataMgr.cpp @@ -111,8 +111,5 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged) // Comments mComments = nextInfos.comments; - - // TODO : Read the document metadata file and populate the metadata infos here - } diff --git a/src/gui/UBTeacherBarDataMgr.h b/src/gui/UBTeacherBarDataMgr.h index 73c28cc1..3158dab6 100644 --- a/src/gui/UBTeacherBarDataMgr.h +++ b/src/gui/UBTeacherBarDataMgr.h @@ -60,7 +60,7 @@ public: // Medias QVector* medias(){return &mMediaList;} void addMediaUrl(const QString& url){mMediaUrls << url;} - QStringList mediaUrls(){return mMediaUrls;} + QStringList* mediaUrls(){return &mMediaUrls;} // Urls QVector* urls(){return &mUrlList;} diff --git a/src/gui/UBTeacherBarPreviewWidget.cpp b/src/gui/UBTeacherBarPreviewWidget.cpp index 9b7b136f..1779ddcf 100644 --- a/src/gui/UBTeacherBarPreviewWidget.cpp +++ b/src/gui/UBTeacherBarPreviewWidget.cpp @@ -313,7 +313,7 @@ void UBTeacherBarPreviewWidget::generateActions() void UBTeacherBarPreviewWidget::generateMedias() { if(isVisible()){ - foreach(QString mediaUrl, mpDataMgr->mediaUrls()){ + foreach(QString mediaUrl, *mpDataMgr->mediaUrls()){ QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mediaUrl); if(mimeType.contains("image")){ QPixmap pix = QPixmap(mediaUrl);