Progressing with the medias into the new teacherbar

preferencesAboutTextFull
shibakaneki 13 years ago
parent b8e1516698
commit 628f213f1b
  1. 13
      src/gui/UBTBPageEditWidget.cpp
  2. 3
      src/gui/UBTeacherBarDataMgr.cpp
  3. 2
      src/gui/UBTeacherBarDataMgr.h
  4. 2
      src/gui/UBTeacherBarPreviewWidget.cpp

@ -179,7 +179,7 @@ void UBTBPageEditWidget::saveFields()
{ {
mpDataMgr->actions()->clear(); mpDataMgr->actions()->clear();
mpDataMgr->urls()->clear(); mpDataMgr->urls()->clear();
mpDataMgr->mediaUrls().clear(); mpDataMgr->mediaUrls()->clear();
mpDataMgr->medias()->clear(); mpDataMgr->medias()->clear();
foreach(UBTeacherStudentAction* pAct, mActions){ foreach(UBTeacherStudentAction* pAct, mActions){
@ -195,7 +195,8 @@ void UBTBPageEditWidget::saveFields()
mpDataMgr->urls()->append(link); mpDataMgr->urls()->append(link);
} }
foreach(QString url, mMediaUrls){ foreach(QString url, mMediaUrls){
mpDataMgr->mediaUrls().append(url); qDebug() << "saving media :" << url;
mpDataMgr->mediaUrls()->append(url);
} }
foreach(QWidget* pMedia, mMedias){ foreach(QWidget* pMedia, mMedias){
mpDataMgr->medias()->append(pMedia); mpDataMgr->medias()->append(pMedia);
@ -215,15 +216,17 @@ void UBTBPageEditWidget::updateFields()
mpActions->addWidget(pAction); mpActions->addWidget(pAction);
} }
// Medias // Medias
foreach(QString url, mpDataMgr->mediaUrls()){ foreach(QString url, *mpDataMgr->mediaUrls()){
if(url.isEmpty()) if(!url.isEmpty()){
continue; mMediaUrls << url;
QWidget* pWidget = mpMediaContainer->generateMediaWidget(url); QWidget* pWidget = mpMediaContainer->generateMediaWidget(url);
if(pWidget != NULL){ if(pWidget != NULL){
mMedias << pWidget; mMedias << pWidget;
mpMediaContainer->addWidget(pWidget); mpMediaContainer->addWidget(pWidget);
} }
} }
}
// Links // Links
foreach(sLink link, *mpDataMgr->urls()){ foreach(sLink link, *mpDataMgr->urls()){
UBUrlWidget* urlWidget = new UBUrlWidget(this); UBUrlWidget* urlWidget = new UBUrlWidget(this);

@ -111,8 +111,5 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
// Comments // Comments
mComments = nextInfos.comments; mComments = nextInfos.comments;
// TODO : Read the document metadata file and populate the metadata infos here
} }

@ -60,7 +60,7 @@ public:
// Medias // Medias
QVector<QWidget*>* medias(){return &mMediaList;} QVector<QWidget*>* medias(){return &mMediaList;}
void addMediaUrl(const QString& url){mMediaUrls << url;} void addMediaUrl(const QString& url){mMediaUrls << url;}
QStringList mediaUrls(){return mMediaUrls;} QStringList* mediaUrls(){return &mMediaUrls;}
// Urls // Urls
QVector<sLink>* urls(){return &mUrlList;} QVector<sLink>* urls(){return &mUrlList;}

@ -313,7 +313,7 @@ void UBTeacherBarPreviewWidget::generateActions()
void UBTeacherBarPreviewWidget::generateMedias() void UBTeacherBarPreviewWidget::generateMedias()
{ {
if(isVisible()){ if(isVisible()){
foreach(QString mediaUrl, mpDataMgr->mediaUrls()){ foreach(QString mediaUrl, *mpDataMgr->mediaUrls()){
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mediaUrl); QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(mediaUrl);
if(mimeType.contains("image")){ if(mimeType.contains("image")){
QPixmap pix = QPixmap(mediaUrl); QPixmap pix = QPixmap(mediaUrl);

Loading…
Cancel
Save