added "tab" attribute to the MetadataType class
This commit is contained in:
parent
5b1e360139
commit
a499b508f3
5 changed files with 79 additions and 9 deletions
|
@ -5,11 +5,13 @@
|
||||||
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType id3Tag NMTOKEN #IMPLIED >
|
<!ATTLIST metadataType id3Tag NMTOKEN #IMPLIED >
|
||||||
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
||||||
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<metadataType dcName = "dc:creator"
|
<metadataType dcName = "dc:creator"
|
||||||
id3Tag = "TPE2"
|
id3Tag = "TPE2"
|
||||||
localizationKey = "creator"
|
localizationKey = "creator"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
||||||
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
|
||||||
<!ATTLIST metadataType localizationKey CDATA #REQUIRED >
|
<!ATTLIST metadataType localizationKey CDATA #REQUIRED >
|
||||||
|
<!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
|
|
||||||
<!ELEMENT metadataTypeContainer (metadataType+) >
|
<!ELEMENT metadataTypeContainer (metadataType+) >
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
<metadataType dcName = "dc:title"
|
<metadataType dcName = "dc:title"
|
||||||
id3Tag = "TIT2"
|
id3Tag = "TIT2"
|
||||||
localizationKey = "title"
|
localizationKey = "title"
|
||||||
|
tab = "main"
|
||||||
/>
|
/>
|
||||||
<metadataType dcName = "dc:creator"
|
<metadataType dcName = "dc:creator"
|
||||||
id3Tag = "TPE1"
|
id3Tag = "TPE1"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/MetadataType.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,9 +71,16 @@ class MetadataTypeContainer;
|
||||||
* <metadataType dcName = "dc:creator"
|
* <metadataType dcName = "dc:creator"
|
||||||
* id3Tag = "TPE2"
|
* id3Tag = "TPE2"
|
||||||
* localizationKey = "dc_creator"
|
* localizationKey = "dc_creator"
|
||||||
|
* tab = "main"
|
||||||
* />
|
* />
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
|
* The tab attribute (if present) must be one of "main", "music" or "talk"
|
||||||
|
* (all lowercase, case sensitive).
|
||||||
|
* This determines whether, at file upload, the metadata field appears in
|
||||||
|
* the Main, Music, or Talk tab. If the attribute is omitted, the metadata
|
||||||
|
* field will appear in none of the tabs.
|
||||||
|
*
|
||||||
* The DTD for the expected XML element looks like the following:
|
* The DTD for the expected XML element looks like the following:
|
||||||
*
|
*
|
||||||
* <pre><code>
|
* <pre><code>
|
||||||
|
@ -81,16 +88,27 @@ class MetadataTypeContainer;
|
||||||
* <!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
* <!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
|
||||||
* <!ATTLIST metadataType id3Tag NMTOKEN #IMPLIED >
|
* <!ATTLIST metadataType id3Tag NMTOKEN #IMPLIED >
|
||||||
* <!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
* <!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
|
||||||
|
* <!ATTLIST metadataType tab NMTOKEN #IMPLIED >
|
||||||
* </code></pre>
|
* </code></pre>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.4 $
|
||||||
* @see MetadataTypeContainer
|
* @see MetadataTypeContainer
|
||||||
*/
|
*/
|
||||||
class MetadataType : public Configurable
|
class MetadataType : public Configurable
|
||||||
{
|
{
|
||||||
friend class MetadataTypeContainer;
|
friend class MetadataTypeContainer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* An enumeration of all possible metadata categories.
|
||||||
|
*/
|
||||||
|
typedef enum { noTab,
|
||||||
|
mainTab,
|
||||||
|
musicTab,
|
||||||
|
talkTab } TabType;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +136,11 @@ class MetadataType : public Configurable
|
||||||
*/
|
*/
|
||||||
Ptr<Glib::ustring>::Ref localizationKey;
|
Ptr<Glib::ustring>::Ref localizationKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The localization key for this metadata type.
|
||||||
|
*/
|
||||||
|
TabType tab;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +163,8 @@ class MetadataType : public Configurable
|
||||||
MetadataType(Ptr<MetadataTypeContainer>::Ref container,
|
MetadataType(Ptr<MetadataTypeContainer>::Ref container,
|
||||||
Glib::ustring dcName,
|
Glib::ustring dcName,
|
||||||
Glib::ustring id3Tag,
|
Glib::ustring id3Tag,
|
||||||
Glib::ustring localizationKey)
|
Glib::ustring localizationKey,
|
||||||
|
TabType tab = noTab)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,6 +243,18 @@ class MetadataType : public Configurable
|
||||||
*/
|
*/
|
||||||
Ptr<const Glib::ustring>::Ref
|
Ptr<const Glib::ustring>::Ref
|
||||||
getLocalizedName(void) const throw (std::invalid_argument);
|
getLocalizedName(void) const throw (std::invalid_argument);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the tab that this metadata type should appear in,
|
||||||
|
* when an audio clip is uploaded in the Studio client.
|
||||||
|
*
|
||||||
|
* @return the name of the tab for the metadata type.
|
||||||
|
*/
|
||||||
|
TabType
|
||||||
|
getTab(void) const throw ()
|
||||||
|
{
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataType.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataType.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -65,6 +65,11 @@ static const std::string id3TagAttrName = "id3Tag";
|
||||||
*/
|
*/
|
||||||
static const std::string localizationKeyAttrName = "localizationKey";
|
static const std::string localizationKeyAttrName = "localizationKey";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the attribute of the tab name in the metadataType element
|
||||||
|
*/
|
||||||
|
static const std::string tabAttrName = "tab";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -76,8 +81,9 @@ static const std::string localizationKeyAttrName = "localizationKey";
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
MetadataType :: MetadataType(Ptr<MetadataTypeContainer>::Ref container)
|
MetadataType :: MetadataType(Ptr<MetadataTypeContainer>::Ref container)
|
||||||
throw ()
|
throw ()
|
||||||
|
: container(container),
|
||||||
|
tab(noTab)
|
||||||
{
|
{
|
||||||
this->container = container;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,10 +93,12 @@ MetadataType :: MetadataType(Ptr<MetadataTypeContainer>::Ref container)
|
||||||
MetadataType :: MetadataType(Ptr<MetadataTypeContainer>::Ref container,
|
MetadataType :: MetadataType(Ptr<MetadataTypeContainer>::Ref container,
|
||||||
Glib::ustring dcName,
|
Glib::ustring dcName,
|
||||||
Glib::ustring id3Tag,
|
Glib::ustring id3Tag,
|
||||||
Glib::ustring localizationKey)
|
Glib::ustring localizationKey,
|
||||||
|
TabType tab)
|
||||||
throw ()
|
throw ()
|
||||||
|
: container(container),
|
||||||
|
tab(tab)
|
||||||
{
|
{
|
||||||
this->container = container;
|
|
||||||
this->dcName.reset(new Glib::ustring(dcName));
|
this->dcName.reset(new Glib::ustring(dcName));
|
||||||
this->id3Tag.reset(new Glib::ustring(id3Tag));
|
this->id3Tag.reset(new Glib::ustring(id3Tag));
|
||||||
this->localizationKey.reset(new Glib::ustring(localizationKey));
|
this->localizationKey.reset(new Glib::ustring(localizationKey));
|
||||||
|
@ -128,6 +136,19 @@ MetadataType :: configure(const xmlpp::Element & element)
|
||||||
+ localizationKeyAttrName);
|
+ localizationKeyAttrName);
|
||||||
}
|
}
|
||||||
localizationKey.reset(new Glib::ustring(attribute->get_value()));
|
localizationKey.reset(new Glib::ustring(attribute->get_value()));
|
||||||
|
|
||||||
|
// get the tab, optional
|
||||||
|
tab = noTab;
|
||||||
|
if ((attribute = element.get_attribute(tabAttrName))) {
|
||||||
|
Glib::ustring tabString = attribute->get_value();
|
||||||
|
if (tabString == "main") {
|
||||||
|
tab = mainTab;
|
||||||
|
} else if (tabString == "music") {
|
||||||
|
tab = musicTab;
|
||||||
|
} else if (tabString == "talk") {
|
||||||
|
tab = talkTab;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.3 $
|
Version : $Revision: 1.4 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataTypeContainerTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/MetadataTypeContainerTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -203,6 +203,15 @@ MetadataTypeContainerTest :: firstTest(void)
|
||||||
gotException = true;
|
gotException = true;
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(gotException);
|
CPPUNIT_ASSERT(gotException);
|
||||||
|
|
||||||
|
// two simple positive checks on the tab attribute
|
||||||
|
CPPUNIT_ASSERT(container->existsByDcName("dc:title"));
|
||||||
|
metadataType = container->getByDcName("dc:title");
|
||||||
|
CPPUNIT_ASSERT(metadataType->getTab() == MetadataType::mainTab);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(container->existsByDcName("ls:buycdurl"));
|
||||||
|
metadataType = container->getByDcName("ls:buycdurl");
|
||||||
|
CPPUNIT_ASSERT(metadataType->getTab() == MetadataType::noTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue