From b447369b8f563fcc648ef49fc4f8a5dc0c388c0f Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Wed, 30 Nov 2011 14:03:04 +0100 Subject: [PATCH] Resolved an issue related to the teacherbar --- src/core/UBPersistenceManager.cpp | 4 +++- src/gui/UBTeacherBarWidget.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 8c2f3f95..5a845e0a 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -1072,7 +1072,8 @@ void UBPersistenceManager::persistTeacherBar(UBDocumentProxy* pDocumentProxy, in if(f.open(QIODevice::WriteOnly)) { QDomElement rootElem = domDoc.documentElement(); - QDomNode teacherBarNode = domDoc.namedItem("teacherBar"); + QDomNode teacherBarNode = rootElem.namedItem("teacherBar"); + if(teacherBarNode.isNull()) { // Create the element @@ -1120,6 +1121,7 @@ sTeacherBarInfos UBPersistenceManager::getTeacherBarInfos(UBDocumentProxy* pDocu QDomDocument domDoc; if(domDoc.setContent(f.readAll())) { + qDebug() << domDoc.toString(); QDomElement rootElem = domDoc.documentElement(); QDomNode teacherBarNode = rootElem.namedItem("teacherBar"); diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index dd73b4c3..66547219 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -1,4 +1,4 @@ -#include "UBTeacherBarWidget.h" + #include "UBTeacherBarWidget.h" #include "core/UBApplication.h" #include "core/UBPersistenceManager.h" @@ -259,6 +259,7 @@ void UBTeacherBarWidget::saveContent() { sTeacherBarInfos infos; infos.title = mpTitle->text(); + qDebug() << "Title read: " << infos.title; infos.phasis = mpPhasis->currentIndex(); infos.Duration = mpDuration->currentIndex(); infos.material = mpEquipment->text(); @@ -276,6 +277,7 @@ void UBTeacherBarWidget::loadContent() { sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex()); mpTitle->setText(nextInfos.title); + qDebug() << "Title loaded: " << nextInfos.title << ", Title set: " << mpTitle->text(); mpPhasis->setCurrentIndex(nextInfos.phasis); mpDuration->setCurrentIndex(nextInfos.Duration); mpEquipment->setText(nextInfos.material);