Added some metadata fields

preferencesAboutTextFull
shibakaneki 13 years ago
parent d6af845cf0
commit 07414cf607
  1. 24
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  2. 4
      src/core/UBSettings.cpp
  3. 4
      src/core/UBSettings.h
  4. 55
      src/document/UBDocumentProxy.cpp
  5. 9
      src/document/UBDocumentProxy.h
  6. 81
      src/gui/UBTBDocumentEditWidget.cpp
  7. 17
      src/gui/UBTBDocumentEditWidget.h
  8. 8
      src/gui/UBTeacherBarDataMgr.cpp
  9. 21
      src/gui/UBTeacherBarDataMgr.h
  10. 6
      src/gui/UBTeacherBarWidget.cpp

@ -109,6 +109,10 @@ void UBMetadataDcSubsetAdaptor::persist(UBDocumentProxy* proxy)
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTitle,proxy->metaData(UBSettings::sessionTitle).toString()); 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::sessionTarget,proxy->metaData(UBSettings::sessionTarget).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString()); xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLicence,proxy->metaData(UBSettings::sessionLicence).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionKeywords,proxy->metaData(UBSettings::sessionKeywords).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionLevel,proxy->metaData(UBSettings::sessionLevel).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionTopic,proxy->metaData(UBSettings::sessionTopic).toString());
xmlWriter.writeTextElement(UBSettings::uniboardDocumentNamespaceUri,UBSettings::sessionAuthors,proxy->metaData(UBSettings::sessionAuthors).toString());
xmlWriter.writeEndElement(); //dc:Description xmlWriter.writeEndElement(); //dc:Description
xmlWriter.writeEndElement(); //RDF xmlWriter.writeEndElement(); //RDF
@ -224,6 +228,26 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
{ {
metadata.insert(UBSettings::sessionLicence, xml.readElementText()); metadata.insert(UBSettings::sessionLicence, xml.readElementText());
} }
else if (xml.name() == UBSettings::sessionKeywords // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionKeywords, xml.readElementText());
}
else if (xml.name() == UBSettings::sessionLevel // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionLevel, xml.readElementText());
}
else if (xml.name() == UBSettings::sessionTopic // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionTopic, xml.readElementText());
}
else if (xml.name() == UBSettings::sessionAuthors // introduced in OpenSankore 1.40.00
&& xml.namespaceUri() == UBSettings::uniboardDocumentNamespaceUri)
{
metadata.insert(UBSettings::sessionAuthors, xml.readElementText());
}
metadata.insert(UBSettings::documentVersion, docVersion); metadata.insert(UBSettings::documentVersion, docVersion);
} }

@ -39,6 +39,10 @@ QString UBSettings::documentUpdatedAt = QString("UpdatedAt");
QString UBSettings::sessionTitle = QString("sessionTitle"); QString UBSettings::sessionTitle = QString("sessionTitle");
QString UBSettings::sessionTarget = QString("sessionTarget"); QString UBSettings::sessionTarget = QString("sessionTarget");
QString UBSettings::sessionLicence = QString("sessionLicence"); QString UBSettings::sessionLicence = QString("sessionLicence");
QString UBSettings::sessionKeywords = QString("sessionAuthors");
QString UBSettings::sessionLevel = QString("sessionLevel");
QString UBSettings::sessionTopic = QString("sessionTopic");
QString UBSettings::sessionAuthors = QString("sessionAuthors");
QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:"); QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:");

@ -156,6 +156,10 @@ class UBSettings : public QObject
static QString sessionTitle; static QString sessionTitle;
static QString sessionTarget; static QString sessionTarget;
static QString sessionLicence; static QString sessionLicence;
static QString sessionKeywords;
static QString sessionLevel;
static QString sessionTopic;
static QString sessionAuthors;
static QString trashedDocumentGroupNamePrefix; static QString trashedDocumentGroupNamePrefix;

@ -53,6 +53,10 @@ void UBDocumentProxy::init()
setSessionTitle(""); setSessionTitle("");
setSessionTarget(""); setSessionTarget("");
setSessionLicence(""); setSessionLicence("");
setSessionKeywords("");
setSessionLevel("");
setSessionTopic("");
setSessionAuthor("");
} }
@ -239,6 +243,57 @@ void UBDocumentProxy::setSessionLicence(const QString & sessionLicence)
setMetaData(UBSettings::sessionLicence,QVariant(sessionLicence)); setMetaData(UBSettings::sessionLicence,QVariant(sessionLicence));
} }
void UBDocumentProxy::setSessionKeywords(const QString &kw)
{
setMetaData(UBSettings::sessionKeywords,QVariant(kw));
}
QString UBDocumentProxy::sessionKeywords()
{
if(mMetaDatas.contains(UBSettings::sessionKeywords))
return metaData(UBSettings::sessionKeywords).toString();
else
return QString();
}
void UBDocumentProxy::setSessionLevel(const QString &level)
{
setMetaData(UBSettings::sessionLevel,QVariant(level));
}
QString UBDocumentProxy::sessionLevel()
{
if(mMetaDatas.contains(UBSettings::sessionLevel))
return metaData(UBSettings::sessionLevel).toString();
else
return QString();
}
void UBDocumentProxy::setSessionTopic(const QString &topic)
{
setMetaData(UBSettings::sessionTopic,QVariant(topic));
}
QString UBDocumentProxy::sessionTopic()
{
if(mMetaDatas.contains(UBSettings::sessionTopic))
return metaData(UBSettings::sessionTopic).toString();
else
return QString();
}
void UBDocumentProxy::setSessionAuthor(const QString &authors)
{
setMetaData(UBSettings::sessionAuthors,QVariant(authors));
}
QString UBDocumentProxy::sessionAuthors()
{
if(mMetaDatas.contains(UBSettings::sessionAuthors))
return metaData(UBSettings::sessionAuthors).toString();
else
return QString();
}
bool UBDocumentProxy::isModified() const bool UBDocumentProxy::isModified() const
{ {

@ -51,6 +51,15 @@ class UBDocumentProxy : public QObject
void setSessionTarget(const QString& sessionTarget); void setSessionTarget(const QString& sessionTarget);
QString sessionLicence() const; QString sessionLicence() const;
void setSessionLicence(const QString& sessionLicence); void setSessionLicence(const QString& sessionLicence);
void setSessionKeywords(const QString& kw);
QString sessionKeywords();
void setSessionLevel(const QString& level);
QString sessionLevel();
void setSessionTopic(const QString& topic);
QString sessionTopic();
void setSessionAuthor(const QString& authors);
QString sessionAuthors();
QSize defaultDocumentSize() const; QSize defaultDocumentSize() const;
void setDefaultDocumentSize(QSize pSize); void setDefaultDocumentSize(QSize pSize);

@ -11,6 +11,14 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
, mpMetadataLabel(NULL) , mpMetadataLabel(NULL)
, mpLicenseLabel(NULL) , mpLicenseLabel(NULL)
, mpLicenseCombox(NULL) , mpLicenseCombox(NULL)
, mpKeywords(NULL)
, mpLevel(NULL)
, mpTopic(NULL)
, mpAuthor(NULL)
, mpKeywordLabel(NULL)
, mpLevelLabel(NULL)
, mpTopicLabel(NULL)
, mpAuthorLabel(NULL)
{ {
setObjectName(name); setObjectName(name);
@ -27,7 +35,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
// Title // Title
mpTitleLabel = new QLabel(tr("Session Title"), mpContainer); mpTitleLabel = new QLabel(tr("Session Title"), mpContainer);
mpTitleLabel->setAlignment(Qt::AlignLeft); mpTitleLabel->setAlignment(Qt::AlignLeft);
//mpTitleLabel->setObjectName("UBTeacherBarPreviewSubtitle"); mpTitleLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpTitleLabel, 0); mContainerLayout.addWidget(mpTitleLabel, 0);
mpTitle = new QLineEdit(mpContainer); mpTitle = new QLineEdit(mpContainer);
mpTitle->setObjectName("DockPaletteWidgetLineEdit"); mpTitle->setObjectName("DockPaletteWidgetLineEdit");
@ -36,7 +44,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
// Target // Target
mpTargetLabel = new QLabel(tr("Session Target"), mpContainer); mpTargetLabel = new QLabel(tr("Session Target"), mpContainer);
//mpTargetLabel->setObjectName("UBTeacherBarPreviewSubtitle"); mpTargetLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpTargetLabel, 0); mContainerLayout.addWidget(mpTargetLabel, 0);
mpTarget = new QTextEdit(mpContainer); mpTarget = new QTextEdit(mpContainer);
mpTarget->setObjectName("UBTeacherBarTargetBox"); mpTarget->setObjectName("UBTeacherBarTargetBox");
@ -45,15 +53,42 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
// Metadata // Metadata
mpMetadataLabel = new QLabel(tr("Metadata"), mpContainer); mpMetadataLabel = new QLabel(tr("Metadata"), mpContainer);
mpMetadataLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mpMetadataLabel->setAlignment(Qt::AlignLeft); mpMetadataLabel->setAlignment(Qt::AlignLeft);
//mpMetadataLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpMetadataLabel, 0); mContainerLayout.addWidget(mpMetadataLabel, 0);
mpKeywords = new QLineEdit(this);
mpKeywords->setObjectName("DockPaletteWidgetLineEdit");
mpLevel = new QComboBox(this);
mpLevel->setObjectName("DockPaletteWidgetComboBox");
mpTopic = new QComboBox(this);
mpTopic->setObjectName("DockPaletteWidgetComboBox");
mpAuthor = new QLineEdit(this);
mpAuthor->setObjectName("DockPaletteWidgetLineEdit");
mpKeywordLabel = new QLabel(tr("Keywords:"), this);
mpLevelLabel = new QLabel(tr("Level:"), this);
mpTopicLabel = new QLabel(tr("Topic:"), this);
mpAuthorLabel = new QLabel(tr("Author"), this);
mKeywordLayout.addWidget(mpKeywordLabel, 0);
mKeywordLayout.addWidget(mpKeywords, 1);
mLevelLayout.addWidget(mpLevelLabel, 0);
mLevelLayout.addWidget(mpLevel, 1);
mTopicLayout.addWidget(mpTopicLabel, 0);
mTopicLayout.addWidget(mpTopic, 1);
mAuthorLayout.addWidget(mpAuthorLabel, 0);
mAuthorLayout.addWidget(mpAuthor, 1);
mContainerLayout.addLayout(&mKeywordLayout, 0);
mContainerLayout.addLayout(&mLevelLayout, 0);
mContainerLayout.addLayout(&mTopicLayout, 0);
mContainerLayout.addLayout(&mAuthorLayout, 0);
mContainerLayout.addWidget(&mLicenseSeparator); mContainerLayout.addWidget(&mLicenseSeparator);
// License // License
mpLicenseLabel = new QLabel(tr("License"), mpContainer); mpLicenseLabel = new QLabel(tr("License"), mpContainer);
mpLicenseLabel->setAlignment(Qt::AlignLeft); mpLicenseLabel->setAlignment(Qt::AlignLeft);
//mpLicenseLabel->setObjectName("UBTeacherBarPreviewSubtitle"); mpLicenseLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpLicenseLabel, 0); mContainerLayout.addWidget(mpLicenseLabel, 0);
mpLicenseCombox = new QComboBox(this); mpLicenseCombox = new QComboBox(this);
mpLicenseCombox->setObjectName("DockPaletteWidgetComboBox"); mpLicenseCombox->setObjectName("DockPaletteWidgetComboBox");
@ -81,6 +116,10 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
connect(mpTitle, SIGNAL(textChanged(QString)), this, SLOT(onSessionTitleChanged())); connect(mpTitle, SIGNAL(textChanged(QString)), this, SLOT(onSessionTitleChanged()));
connect(mpTarget, SIGNAL(textChanged()), this, SLOT(onSessionTargetChanged())); connect(mpTarget, SIGNAL(textChanged()), this, SLOT(onSessionTargetChanged()));
connect(mpLicenseCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseCurrentIndexChanged(int))); connect(mpLicenseCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseCurrentIndexChanged(int)));
connect(mpKeywords, SIGNAL(textChanged(QString)), this, SLOT(onKeywordChanged(QString)));
connect(mpLevel, SIGNAL(currentIndexChanged(QString)), this, SLOT(onLevelChanged(QString)));
connect(mpTopic, SIGNAL(currentIndexChanged(QString)), this, SLOT(onTopicChanged(QString)));
connect(mpAuthor, SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString)));
} }
UBTBDocumentEditWidget::~UBTBDocumentEditWidget() UBTBDocumentEditWidget::~UBTBDocumentEditWidget()
@ -90,6 +129,14 @@ UBTBDocumentEditWidget::~UBTBDocumentEditWidget()
DELETEPTR(mpTargetLabel); DELETEPTR(mpTargetLabel);
DELETEPTR(mpTarget); DELETEPTR(mpTarget);
DELETEPTR(mpMetadataLabel); DELETEPTR(mpMetadataLabel);
DELETEPTR(mpKeywordLabel);
DELETEPTR(mpLevelLabel);
DELETEPTR(mpTopicLabel);
DELETEPTR(mpAuthorLabel);
DELETEPTR(mpKeywords);
DELETEPTR(mpLevel);
DELETEPTR(mpTopic);
DELETEPTR(mpAuthor);
DELETEPTR(mpLicenseLabel); DELETEPTR(mpLicenseLabel);
DELETEPTR(mpLicenseCombox); DELETEPTR(mpLicenseCombox);
DELETEPTR(mpPageViewButton); DELETEPTR(mpPageViewButton);
@ -128,6 +175,10 @@ void UBTBDocumentEditWidget::updateFields()
{ {
mpTitle->setText(mpDataMgr->sessionTitle()); mpTitle->setText(mpDataMgr->sessionTitle());
mpTarget->setPlainText(mpDataMgr->sessionTarget()); mpTarget->setPlainText(mpDataMgr->sessionTarget());
mpKeywords->setText(mpDataMgr->keywords());
// TODO: retrieve the level
// TODO retrieve the topic
mpAuthor->setText(mpDataMgr->authors());
} }
void UBTBDocumentEditWidget::clearFields() void UBTBDocumentEditWidget::clearFields()
@ -136,4 +187,26 @@ void UBTBDocumentEditWidget::clearFields()
mpTarget->setPlainText(""); mpTarget->setPlainText("");
} }
void UBTBDocumentEditWidget::onKeywordChanged(const QString &kw)
{
mpDataMgr->setKeywords(kw);
emit valueChanged();
}
void UBTBDocumentEditWidget::onLevelChanged(const QString &level)
{
mpDataMgr->setLevel(level);
emit valueChanged();
}
void UBTBDocumentEditWidget::onTopicChanged(const QString &topic)
{
mpDataMgr->setTopic(topic);
emit valueChanged();
}
void UBTBDocumentEditWidget::onAuthorChanged(const QString &authors)
{
mpDataMgr->setAuthors(authors);
emit valueChanged();
}

@ -29,6 +29,10 @@ private slots:
void onSessionTitleChanged(); void onSessionTitleChanged();
void onSessionTargetChanged(); void onSessionTargetChanged();
void onLicenseCurrentIndexChanged(int selection); void onLicenseCurrentIndexChanged(int selection);
void onKeywordChanged(const QString& kw);
void onLevelChanged(const QString& level);
void onTopicChanged(const QString& topic);
void onAuthorChanged(const QString& authors);
private: private:
QVBoxLayout mLayout; QVBoxLayout mLayout;
@ -41,6 +45,11 @@ private:
UBTBSeparator mTargetSeparator; UBTBSeparator mTargetSeparator;
UBTBSeparator mLicenseSeparator; UBTBSeparator mLicenseSeparator;
QHBoxLayout mKeywordLayout;
QHBoxLayout mLevelLayout;
QHBoxLayout mTopicLayout;
QHBoxLayout mAuthorLayout;
QWidget* mpContainer; QWidget* mpContainer;
QLabel* mpTitleLabel; QLabel* mpTitleLabel;
QLineEdit* mpTitle; QLineEdit* mpTitle;
@ -49,6 +58,14 @@ private:
QLabel* mpMetadataLabel; QLabel* mpMetadataLabel;
QLabel* mpLicenseLabel; QLabel* mpLicenseLabel;
QComboBox* mpLicenseCombox; QComboBox* mpLicenseCombox;
QLineEdit* mpKeywords;
QComboBox* mpLevel;
QComboBox* mpTopic;
QLineEdit* mpAuthor;
QLabel* mpKeywordLabel;
QLabel* mpLevelLabel;
QLabel* mpTopicLabel;
QLabel* mpAuthorLabel;
UBTeacherBarDataMgr* mpDataMgr; UBTeacherBarDataMgr* mpDataMgr;
}; };

@ -59,6 +59,10 @@ void UBTeacherBarDataMgr::saveContent()
documentProxy->setSessionTitle(mSessionTitle); documentProxy->setSessionTitle(mSessionTitle);
documentProxy->setSessionTarget(mSessionTarget); documentProxy->setSessionTarget(mSessionTarget);
documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence)); documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence));
documentProxy->setSessionKeywords(mAuthors);
documentProxy->setSessionLevel(mLevel);
documentProxy->setSessionTopic(mTopic);
documentProxy->setSessionAuthor(mAuthors);
UBMetadataDcSubsetAdaptor::persist(documentProxy); UBMetadataDcSubsetAdaptor::persist(documentProxy);
} }
@ -76,6 +80,10 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
mSessionTitle = documentProxy->sessionTitle(); mSessionTitle = documentProxy->sessionTitle();
mSessionTarget = documentProxy->sessionTarget(); mSessionTarget = documentProxy->sessionTarget();
mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt(); mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt();
mKeywords = documentProxy->sessionKeywords();
mLevel = documentProxy->sessionLevel();
mTopic = documentProxy->sessionTopic();
mAuthors = documentProxy->sessionAuthors();
} }
// Page Title // Page Title

@ -99,6 +99,23 @@ public:
void setComments(const QString& c){mComments = c;} void setComments(const QString& c){mComments = c;}
QString comments(){return mComments;} QString comments(){return mComments;}
// Keywords
void setKeywords(const QString& kw){mKeywords = kw;}
QString keywords(){return mKeywords;}
// Level
void setLevel(const QString& level){mLevel = level;}
QString level(){return mLevel;}
// Topic
void setTopic(const QString& topic){mTopic = topic;}
QString topic(){return mTopic;}
// Authors
void setAuthors(const QString& authors){mAuthors = authors;}
QString authors(){return mAuthors;}
// Others // Others
void clearLists(); void clearLists();
void saveContent(); void saveContent();
@ -110,6 +127,10 @@ private:
eLicense mSessionLicence; eLicense mSessionLicence;
QString mPageTitle; QString mPageTitle;
QString mComments; QString mComments;
QString mKeywords;
QString mLevel;
QString mTopic;
QString mAuthors;
QVector<sAction> mActionList; QVector<sAction> mActionList;
QVector<sLink> mUrlList; QVector<sLink> mUrlList;

@ -143,7 +143,11 @@ bool UBTeacherBarWidget::isEmpty()
mData.urls()->empty() && mData.urls()->empty() &&
mData.actions()->empty() && mData.actions()->empty() &&
mData.medias()->empty() && mData.medias()->empty() &&
mData.comments() == ""; mData.comments() == "" &&
mData.authors() == "" &&
mData.keywords() == "" &&
mData.level() == "" &&
mData.topic() == "";
} }
void UBTeacherBarWidget::onShowEditMode() void UBTeacherBarWidget::onShowEditMode()

Loading…
Cancel
Save