Merge branch 'Bett-2012' of github.com:Sankore/Sankore-3.1 into Bett-2012

preferencesAboutTextFull
shibakaneki 13 years ago
commit 81e493ecce
  1. 23
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  2. 3
      src/core/UBSettings.cpp
  3. 3
      src/core/UBSettings.h
  4. 44
      src/document/UBDocumentProxy.cpp
  5. 6
      src/document/UBDocumentProxy.h
  6. 39
      src/gui/UBTeacherBarDataMgr.cpp
  7. 5
      src/gui/UBTeacherBarDataMgr.h

@ -97,7 +97,7 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy)
// introduced in UB 4.2 // introduced in UB 4.2
xmlWriter.writeTextElement(nsDc, "identifier", proxy->metaData(UBSettings::documentIdentifer).toString()); xmlWriter.writeTextElement(nsDc, "identifier", proxy->metaData(UBSettings::documentIdentifer).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "version", UBSettings::currentFileVersion); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "version", UBSettings::currentFileVersion);
QString width = QString::number(proxy->defaultDocumentSize().width()); QString width = QString::number(proxy->defaultDocumentSize().width());
QString height = QString::number(proxy->defaultDocumentSize().height()); QString height = QString::number(proxy->defaultDocumentSize().height());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "size", QString("%1x%2").arg(width).arg(height)); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "size", QString("%1x%2").arg(width).arg(height));
@ -105,6 +105,11 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy)
// introduced in UB 4.4 // introduced in UB 4.4
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "updated-at", proxy->metaData(UBSettings::documentUpdatedAt).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri, "updated-at", proxy->metaData(UBSettings::documentUpdatedAt).toString());
// introduced in OpenSankore 1.40.00
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTitle,proxy->metaData(UBSettings::sessionTitle).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTarget,proxy->metaData(UBSettings::sessionTarget).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString());
xmlWriter.writeEndElement(); //dc:Description xmlWriter.writeEndElement(); //dc:Description
xmlWriter.writeEndElement(); //RDF xmlWriter.writeEndElement(); //RDF
@ -204,7 +209,21 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
metadata.insert(UBSettings::documentUpdatedAt, xml.readElementText()); metadata.insert(UBSettings::documentUpdatedAt, xml.readElementText());
updatedAtFound = true; updatedAtFound = true;
} }
else if (xml.name() == UBSettings::sessionTitle // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionTitle, xml.readElementText());
}
else if (xml.name() == UBSettings::sessionTarget // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionTarget, xml.readElementText());
}
else if (xml.name() == UBSettings::sessionLicence // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionLicence, xml.readElementText());
}
metadata.insert(UBSettings::documentVersion, docVersion); metadata.insert(UBSettings::documentVersion, docVersion);
} }

@ -36,6 +36,9 @@ QString UBSettings::documentSize = QString("Size");
QString UBSettings::documentIdentifer = QString("ID"); QString UBSettings::documentIdentifer = QString("ID");
QString UBSettings::documentVersion = QString("Version"); QString UBSettings::documentVersion = QString("Version");
QString UBSettings::documentUpdatedAt = QString("UpdatedAt"); QString UBSettings::documentUpdatedAt = QString("UpdatedAt");
QString UBSettings::sessionTitle = QString("sessionTitle");
QString UBSettings::sessionTarget = QString("sessionTarget");
QString UBSettings::sessionLicence = QString("sessionLicence");
QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:"); QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:");

@ -153,6 +153,9 @@ class UBSettings : public QObject
static QString documentIdentifer; static QString documentIdentifer;
static QString documentVersion; static QString documentVersion;
static QString documentUpdatedAt; static QString documentUpdatedAt;
static QString sessionTitle;
static QString sessionTarget;
static QString sessionLicence;
static QString trashedDocumentGroupNamePrefix; static QString trashedDocumentGroupNamePrefix;

@ -49,6 +49,10 @@ void UBDocumentProxy::init()
setUuid(QUuid::createUuid()); setUuid(QUuid::createUuid());
setDefaultDocumentSize(UBSettings::settings()->defaultDocumentSize); setDefaultDocumentSize(UBSettings::settings()->defaultDocumentSize);
setSessionTitle("");
setSessionTarget("");
setSessionLicence("");
} }
@ -196,6 +200,46 @@ void UBDocumentProxy::setUuid(const QUuid& uuid)
UBSettings::uniboardDocumentNamespaceUri + "/" + UBStringUtils::toCanonicalUuid(uuid)); UBSettings::uniboardDocumentNamespaceUri + "/" + UBStringUtils::toCanonicalUuid(uuid));
} }
QString UBDocumentProxy::sessionTitle() const
{
if(mMetaDatas.contains(UBSettings::sessionTitle))
return metaData(UBSettings::sessionTitle).toString();
else
return QString();
}
void UBDocumentProxy::setSessionTitle(const QString & sessionTitle)
{
setMetaData(UBSettings::sessionTitle,QVariant(sessionTitle));
}
QString UBDocumentProxy::sessionTarget() const
{
if(mMetaDatas.contains(UBSettings::sessionTarget))
return metaData(UBSettings::sessionTarget).toString();
else
return QString();
}
void UBDocumentProxy::setSessionTarget(const QString & sessionTarget)
{
setMetaData(UBSettings::sessionTarget,QVariant(sessionTarget));
}
QString UBDocumentProxy::sessionLicence() const
{
if(mMetaDatas.contains(UBSettings::sessionLicence))
return metaData(UBSettings::sessionLicence).toString();
else
return QString();
}
void UBDocumentProxy::setSessionLicence(const QString & sessionLicence)
{
setMetaData(UBSettings::sessionLicence,QVariant(sessionLicence));
}
bool UBDocumentProxy::isModified() const bool UBDocumentProxy::isModified() const
{ {
return mIsModified; return mIsModified;

@ -45,6 +45,12 @@ class UBDocumentProxy : public QObject
QString name() const; QString name() const;
QString groupName() const; QString groupName() const;
QString sessionTitle() const;
void setSessionTitle(const QString& sessionTitle);
QString sessionTarget() const;
void setSessionTarget(const QString& sessionTarget);
QString sessionLicence() const;
void setSessionLicence(const QString& sessionLicence);
QSize defaultDocumentSize() const; QSize defaultDocumentSize() const;
void setDefaultDocumentSize(QSize pSize); void setDefaultDocumentSize(QSize pSize);

@ -1,9 +1,14 @@
#include "UBTeacherBarDataMgr.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBPersistenceManager.h" #include "core/UBPersistenceManager.h"
#include "board/UBBoardController.h" #include "board/UBBoardController.h"
#include "customWidgets/UBGlobals.h" #include "customWidgets/UBGlobals.h"
#include "UBTeacherBarDataMgr.h" #include "adaptors/UBMetadataDcSubsetAdaptor.h"
UBTeacherBarDataMgr::UBTeacherBarDataMgr() UBTeacherBarDataMgr::UBTeacherBarDataMgr()
{ {
@ -47,30 +52,32 @@ void UBTeacherBarDataMgr::saveContent()
// Comments // Comments
infos.comments = mComments; infos.comments = mComments;
UBPersistenceManager::persistenceManager()->persistTeacherBar(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex(), infos); UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument();
if(documentProxy){
UBPersistenceManager::persistenceManager()->persistTeacherBar(documentProxy, UBApplication::boardController->activeSceneIndex(), infos);
// TODO: Store the document metadata somewhere documentProxy->setSessionTitle(mSessionTitle);
// Session Title documentProxy->setSessionTarget(mSessionTarget);
//... = mSessionTitle; documentProxy->setSessionLicence(mSessionLicence);
// Session Target
//... = mSessionTarget;
UBMetadataDcSubsetAdaptor::persist(documentProxy);
}
} }
void UBTeacherBarDataMgr::loadContent(bool docChanged) void UBTeacherBarDataMgr::loadContent(bool docChanged)
{ {
clearLists(); clearLists();
UBDocumentProxy* documentProxy = UBApplication::boardController->activeDocument();
sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(UBApplication::boardController->activeDocument(), UBApplication::boardController->activeSceneIndex()); sTeacherBarInfos nextInfos = UBPersistenceManager::persistenceManager()->getTeacherBarInfos(documentProxy, UBApplication::boardController->activeSceneIndex());
if(true/*docChanged*/){
if(docChanged){ mSessionTitle = documentProxy->sessionTitle();
// TODO: Read these information from the metadata file mSessionTarget = documentProxy->sessionTarget();
mSessionLicence = documentProxy->sessionLicence();
// Session Title
//mSessionTitle = ...;
// Session Target
//mSessionTarget = ...;
} }
// Page Title // Page Title
mPageTitle = nextInfos.title; mPageTitle = nextInfos.title;
// Actions // Actions

@ -46,6 +46,10 @@ public:
void setSessionTarget(const QString& target){mSessionTarget = target;} void setSessionTarget(const QString& target){mSessionTarget = target;}
QString sessionTarget(){return mSessionTarget;} QString sessionTarget(){return mSessionTarget;}
// Licence
void setSessionLicence(const QString& licence){mSessionLicence = licence;}
QString sessionLicence(){return mSessionLicence;}
// Page Title // Page Title
void setPageTitle(const QString& title){mPageTitle = title;} void setPageTitle(const QString& title){mPageTitle = title;}
QString pageTitle(){return mPageTitle;} QString pageTitle(){return mPageTitle;}
@ -73,6 +77,7 @@ public:
private: private:
QString mSessionTitle; QString mSessionTitle;
QString mSessionTarget; QString mSessionTarget;
QString mSessionLicence;
QString mPageTitle; QString mPageTitle;
QString mComments; QString mComments;

Loading…
Cancel
Save