diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 9ac5d13a..d3389c19 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -1086,16 +1086,36 @@ void UBPersistenceManager::persistTeacherBar(UBDocumentProxy* pDocumentProxy, in // Set the element values QDomElement teacherBarElem = teacherBarNode.toElement(); teacherBarElem.setAttribute("title", infos.title); - teacherBarElem.setAttribute("phasis", infos.phasis); - teacherBarElem.setAttribute("duration", infos.Duration); - teacherBarElem.setAttribute("equipment", infos.material); - teacherBarElem.setAttribute("activity", infos.activity); - teacherBarElem.setAttribute("action1Teacher", infos.action1Master); - teacherBarElem.setAttribute("action1Student", infos.action1Student); - teacherBarElem.setAttribute("action2Teacher", infos.action2Master); - teacherBarElem.setAttribute("action2Student", infos.action2Student); - teacherBarElem.setAttribute("action3Teacher", infos.action3Master); - teacherBarElem.setAttribute("action3Student", infos.action3Student); + teacherBarElem.setAttribute("duration", QString("%0").arg(infos.Duration)); + + QString qsAct; + for(int i=0; itext(); + // Duration + if(mpDuration1->isChecked()){ + infos.Duration = 0; + }else if(mpDuration2->isChecked()){ + infos.Duration = 1; + }else{ + infos.Duration = 2; + } + // Actions + for(int i=0; icomboValue()).arg(mActionList.at(i)->text()); + } + // Media + // TODO : Get the url of the dropped medias and store them in infos.medias + + // Links + for(int j=0; jurl()){ + infos.urls << mUrlList.at(j)->url(); + } + } + // Comments + infos.comments = mpComments->document()->toPlainText(); + UBPersistenceManager::persistenceManager()->persistTeacherBar(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex(), infos); } void UBTeacherBarWidget::loadContent() { sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex()); + // Title mpTitle->setText(nextInfos.title); + // Duration + switch(nextInfos.Duration){ + case 0: mpDuration1->setChecked(true); + break; + case 1: mpDuration2->setChecked(true); + break; + case 2: mpDuration3->setChecked(true); + break; + default: mpDuration1->setChecked(true); + break; + } + // Actions + for(int i=0; i= 2){ + UBTeacherStudentAction* pAction = new UBTeacherStudentAction(this); + pAction->setComboValue(qslAction.at(0).toInt()); + pAction->setText(qslAction.at(1)); + mActionList << pAction; + mpActions->addWidget(pAction); + } + } + // Media + // TODO : Add the media items here + + // Links + for(int j=0; jsetUrl(qsUrl); + mUrlList << pLink; + mpLinks->addWidget(pLink); + } + } + // Comments + if(NULL != mpComments){ + mpComments->document()->setPlainText(nextInfos.comments); + } } void UBTeacherBarWidget::onTitleTextChanged(const QString& text) @@ -365,12 +430,26 @@ QString UBTeacherStudentAction::comboValue() QString str; if(NULL != mpCombo){ - str = mpCombo->currentText(); + str = QString("%0").arg(mpCombo->currentIndex()); } return str; } +void UBTeacherStudentAction::setComboValue(int value) +{ + if(NULL != mpCombo){ + mpCombo->setCurrentIndex(value); + } +} + +void UBTeacherStudentAction::setText(const QString& text) +{ + if(NULL != mpText){ + mpText->document()->setPlainText(text); + } +} + // --------------------------------------------------------------------------------------------- UBTeacherBarDropMediaZone::UBTeacherBarDropMediaZone(QWidget *parent, const char *name):QWidget(parent) @@ -507,3 +586,10 @@ QString UBUrlWidget::url() return str; } + +void UBUrlWidget::setUrl(const QString &url) +{ + if(NULL != mpUrl){ + mpUrl->setText(url); + } +} diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index b29b5136..f59f64ed 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -29,6 +29,8 @@ public: ~UBTeacherStudentAction(); QString comboValue(); QString text(); + void setComboValue(int value); + void setText(const QString& text); private: QTextEdit* mpText; @@ -67,6 +69,7 @@ public: ~UBUrlWidget(); QString url(); + void setUrl(const QString& url); private: QHBoxLayout* mpLayout;