persisted session parameters

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent ea81899384
commit e3b51cc19e
  1. 21
      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

@ -105,6 +105,11 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy)
// introduced in UB 4.4
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(); //RDF
@ -204,7 +209,21 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
metadata.insert(UBSettings::documentUpdatedAt, xml.readElementText());
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);
}

@ -36,6 +36,9 @@ QString UBSettings::documentSize = QString("Size");
QString UBSettings::documentIdentifer = QString("ID");
QString UBSettings::documentVersion = QString("Version");
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:");

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

@ -49,6 +49,10 @@ void UBDocumentProxy::init()
setUuid(QUuid::createUuid());
setDefaultDocumentSize(UBSettings::settings()->defaultDocumentSize);
setSessionTitle("");
setSessionTarget("");
setSessionLicence("");
}
@ -196,6 +200,46 @@ void UBDocumentProxy::setUuid(const QUuid& 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
{
return mIsModified;

@ -45,6 +45,12 @@ class UBDocumentProxy : public QObject
QString name() 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;
void setDefaultDocumentSize(QSize pSize);

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

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

Loading…
Cancel
Save