added metadata types to Advanced Search

This commit is contained in:
fgerlits 2005-05-25 23:02:36 +00:00
parent 12657e5aa7
commit 70c3d52357
20 changed files with 1048 additions and 259 deletions

View file

@ -21,7 +21,7 @@
#
#
# Author : $Author: fgerlits $
# Version : $Revision: 1.16 $
# Version : $Revision: 1.17 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/etc/Makefile.in,v $
#
# @configure_input@
@ -115,6 +115,8 @@ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \
${TMP_DIR}/CornerImages.o \
${TMP_DIR}/ButtonImages.o \
${TMP_DIR}/ComboBoxText.o \
${TMP_DIR}/MetadataComboBoxText.o \
${TMP_DIR}/OperatorComboBoxText.o \
${TMP_DIR}/Notebook.o \
${TMP_DIR}/WidgetFactory.o \
${TMP_DIR}/ZebraTreeView.o \

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h,v $
------------------------------------------------------------------------------*/
@ -40,6 +40,9 @@
#include "configure.h"
#endif
#include <map>
#include <exception>
#include <gtkmm/label.h>
#include <gtkmm/menu.h>
#include <gtkmm/comboboxtext.h>
@ -64,7 +67,7 @@ using namespace LiveSupport::Core;
* A combo box holding text entries.
*
* @author $Author: fgerlits $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class ComboBoxText : public Gtk::ComboBoxText
{
@ -114,6 +117,17 @@ class ComboBoxText : public Gtk::ComboBoxText
*/
Glib::RefPtr<Gdk::Pixbuf> rightImage;
/**
* A map type for storing { text, key } pairs.
*/
typedef std::map<const Glib::ustring, Ptr<const Glib::ustring>::Ref>
KeyMapType;
/**
* A map containing { text, key } pairs.
*/
KeyMapType keyMap;
/**
* Default constructor.
*/
@ -298,6 +312,36 @@ class ComboBoxText : public Gtk::ComboBoxText
void
set_active_text(const Glib::ustring & text) throw ();
/**
* Set the active text.
*
* @param index the number of the menu item to select as active.
*/
void
set_active(int index) throw ();
/**
* Add a new entry, together with an (invisible) key.
*
* @param text the text to be displayed
* @param key the key corresponding to this text
* @see getActiveKey()
*/
void
appendPair(Ptr<const Glib::ustring>::Ref text,
Ptr<const Glib::ustring>::Ref key)
throw ();
/**
* Get the key corresponding to the selected item.
*
* @return the key corresponding to the currently active (selected)
* text
*/
Ptr<const Glib::ustring>::Ref
getActiveKey(void) throw (std::logic_error);
/**
* Accessor for the selectionChanged signal.
* This signal is emitted by onMenuItemSelected() when the active
@ -311,7 +355,6 @@ class ComboBoxText : public Gtk::ComboBoxText
*/
sigc::signal<void>
signalSelectionChanged(void) throw ();
};

View file

@ -0,0 +1,97 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/MetadataComboBoxText.h,v $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_MetadataComboBoxText_h
#define LiveSupport_Widgets_MetadataComboBoxText_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A combo box holding all possible metadata type entries.
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
*/
class MetadataComboBoxText : public ComboBoxText
{
public:
/**
* Constructor.
*
*/
MetadataComboBoxText(Glib::RefPtr<Gdk::Pixbuf> leftImage,
Glib::RefPtr<Gdk::Pixbuf> centerImage,
Glib::RefPtr<Gdk::Pixbuf> rightImage,
Ptr<MetadataTypeContainer>::Ref metadataTypes)
throw ();
/**
* A virtual destructor.
*/
virtual
~MetadataComboBoxText(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_MetadataComboBoxText_h

View file

@ -0,0 +1,98 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/OperatorComboBoxText.h,v $
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_OperatorComboBoxText_h
#define LiveSupport_Widgets_OperatorComboBoxText_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A combo box holding all possible search operator entries.
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
*/
class OperatorComboBoxText : public ComboBoxText,
public LocalizedObject
{
public:
/**
* Constructor.
*
*/
OperatorComboBoxText(Glib::RefPtr<Gdk::Pixbuf> leftImage,
Glib::RefPtr<Gdk::Pixbuf> centerImage,
Glib::RefPtr<Gdk::Pixbuf> rightImage,
Ptr<ResourceBundle>::Ref bundle)
throw ();
/**
* A virtual destructor.
*/
virtual
~OperatorComboBoxText(void) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_OperatorComboBoxText_h

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.21 $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
------------------------------------------------------------------------------*/
@ -44,12 +44,15 @@
#include <gtkmm/image.h>
#include "LiveSupport/Core/Configurable.h"
#include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Widgets/CornerImages.h"
#include "LiveSupport/Widgets/ButtonImages.h"
#include "LiveSupport/Widgets/Button.h"
#include "LiveSupport/Widgets/ImageButton.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
#include "LiveSupport/Widgets/MetadataComboBoxText.h"
#include "LiveSupport/Widgets/OperatorComboBoxText.h"
#include "LiveSupport/Widgets/BlueBin.h"
#include "LiveSupport/Widgets/EntryBin.h"
@ -89,7 +92,7 @@ class ZebraTreeView;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.21 $
* @version $Revision: 1.22 $
*/
class WidgetFactory :
virtual public Configurable
@ -271,7 +274,7 @@ class WidgetFactory :
createButton(ImageButtonType type) throw ();
/**
* Create a combo box, that holds text entries.
* Create a combo box that holds text entries.
* It is the reponsibility of the caller to dispose of the created
* object properly.
*
@ -280,6 +283,32 @@ class WidgetFactory :
ComboBoxText *
createComboBoxText(void) throw ();
/**
* Create a metadata combo box that holds metadata types.
* It is the reponsibility of the caller to dispose of the created
* object properly.
*
* @param metadataTypes a container of metadata types to display.
* @return a combo box, that holds metadata types.
*/
MetadataComboBoxText *
createMetadataComboBoxText(
Ptr<MetadataTypeContainer>::Ref metadataTypes)
throw ();
/**
* Create a combo box that holds comparison operators.
* It is the reponsibility of the caller to dispose of the created
* object properly.
*
* @param bundle a localization bundle.
* @return a combo box, that holds comparison operators.
*/
OperatorComboBoxText *
createOperatorComboBoxText(
Ptr<ResourceBundle>::Ref bundle)
throw ();
/**
* Create and return a blue singular container.
* It is the reponsibility of the caller to dispose of the created

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ComboBoxText.cxx,v $
------------------------------------------------------------------------------*/
@ -450,6 +450,44 @@ ComboBoxText :: set_active_text(const Glib::ustring & text) throw ()
}
/*------------------------------------------------------------------------------
* Set the first item in the combo box to be the active text.
*----------------------------------------------------------------------------*/
void
ComboBoxText :: set_active(int index) throw ()
{
menu->set_active(index);
onMenuItemSelected();
}
/*------------------------------------------------------------------------------
* Add a new entry, together with an (invisible) key.
*----------------------------------------------------------------------------*/
void
ComboBoxText :: appendPair(Ptr<const Glib::ustring>::Ref text,
Ptr<const Glib::ustring>::Ref key) throw ()
{
append_text(*text);
keyMap[*text] = key;
}
/*------------------------------------------------------------------------------
* Get the key corresponding to the selected item.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
ComboBoxText :: getActiveKey(void) throw (std::logic_error)
{
KeyMapType::const_iterator it = keyMap.find(get_active_text());
if (it != keyMap.end()) {
return it->second;
} else {
throw std::logic_error("no active key found in OperatorComboBoxText");
}
}
/*------------------------------------------------------------------------------
* Accessor for the selectionChanged signal.
*----------------------------------------------------------------------------*/

View file

@ -0,0 +1,79 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/MetadataComboBoxText.cxx,v $
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/MetadataComboBoxText.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
MetadataComboBoxText :: MetadataComboBoxText(
Glib::RefPtr<Gdk::Pixbuf> leftImage,
Glib::RefPtr<Gdk::Pixbuf> centerImage,
Glib::RefPtr<Gdk::Pixbuf> rightImage,
Ptr<MetadataTypeContainer>::Ref metadataTypes)
throw ()
: ComboBoxText(leftImage, centerImage, rightImage)
{
MetadataTypeContainer::Vector::const_iterator it;
for (it = metadataTypes->begin(); it != metadataTypes->end(); ++it) {
Ptr<const MetadataType>::Ref metadata = *it;
appendPair(metadata->getLocalizedName(), metadata->getDcName());
}
set_active(0); // select the first item
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
MetadataComboBoxText :: ~MetadataComboBoxText(void) throw ()
{
}

View file

@ -0,0 +1,85 @@
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/OperatorComboBoxText.cxx,v $
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/OperatorComboBoxText.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
OperatorComboBoxText :: OperatorComboBoxText(
Glib::RefPtr<Gdk::Pixbuf> leftImage,
Glib::RefPtr<Gdk::Pixbuf> centerImage,
Glib::RefPtr<Gdk::Pixbuf> rightImage,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: ComboBoxText(leftImage, centerImage, rightImage),
LocalizedObject(bundle)
{
appendPair(getResourceUstring("partialOperatorDisplay"),
getResourceUstring("partialOperatorSearchKey"));
appendPair(getResourceUstring("prefixOperatorDisplay"),
getResourceUstring("prefixOperatorSearchKey"));
appendPair(getResourceUstring("=OperatorDisplay"),
getResourceUstring("=OperatorSearchKey"));
appendPair(getResourceUstring("<=OperatorDisplay"),
getResourceUstring("<=OperatorSearchKey"));
appendPair(getResourceUstring(">=OperatorDisplay"),
getResourceUstring(">=OperatorSearchKey"));
set_active(0); // select the first item
}
/*------------------------------------------------------------------------------
* Destructor.
*----------------------------------------------------------------------------*/
OperatorComboBoxText :: ~OperatorComboBoxText(void) throw ()
{
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.23 $
Version : $Revision: 1.24 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
------------------------------------------------------------------------------*/
@ -33,6 +33,7 @@
#include "configure.h"
#endif
#include <unicode/resbund.h>
#include <gtkmm/entry.h>
#include "LiveSupport/Widgets/Colors.h"
@ -382,6 +383,36 @@ WidgetFactory :: createComboBoxText(void) throw ()
}
/*------------------------------------------------------------------------------
* Create a metadata combo box
*----------------------------------------------------------------------------*/
MetadataComboBoxText *
WidgetFactory :: createMetadataComboBoxText(
Ptr<MetadataTypeContainer>::Ref metadataTypes)
throw ()
{
return new MetadataComboBoxText(comboBoxLeftImage,
comboBoxCenterImage,
comboBoxRightImage,
metadataTypes);
}
/*------------------------------------------------------------------------------
* Create a comparison operator combo box
*----------------------------------------------------------------------------*/
OperatorComboBoxText *
WidgetFactory :: createOperatorComboBoxText(
Ptr<ResourceBundle>::Ref bundle)
throw ()
{
return new OperatorComboBoxText(comboBoxLeftImage,
comboBoxCenterImage,
comboBoxRightImage,
bundle);
}
/*------------------------------------------------------------------------------
* Create a blue bin
*----------------------------------------------------------------------------*/

View file

@ -8,7 +8,8 @@
storageClientFactory,
schedulerClientFactory,
outputPlayer,
cuePlayer) >
cuePlayer,
metadataTypeContainer) >
<!ELEMENT resourceBundle EMPTY >
<!ATTLIST resourceBundle path CDATA #REQUIRED >
@ -84,7 +85,14 @@
<!ATTLIST helixPlayer audioStreamTimeout NMTOKEN #IMPLIED >
<!ATTLIST helixPlayer fadeLookAheatTime NMTOKEN #IMPLIED >
<!ELEMENT metadataTypeContainer (metadataType+) >
<!ELEMENT metadataType EMPTY >
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
]>
<gLiveSupport>
<resourceBundle path = "./tmp/gLiveSupport"
locale = "en"
@ -134,5 +142,146 @@
</audioPlayer>
</cuePlayer>
<metadataTypeContainer>
<metadataType dcName = "dc:title"
id3Tag = "Title"
localizationKey = "title"
/>
<metadataType dcName = "dc:creator"
id3Tag = "Artist"
localizationKey = "creator"
/>
<metadataType dcName = "dc:source"
id3Tag = "Album"
localizationKey = "album"
/>
<metadataType dcName = "ls:year"
id3Tag = "Year"
localizationKey = "year"
/>
<metadataType dcName = "dc:type"
id3Tag = "Genre"
localizationKey = "genre"
/>
<metadataType dcName = "dc:description"
id3Tag = "Comment"
localizationKey = "description"
/>
<metadataType dcName = "dc:format"
localizationKey = "format"
/>
<metadataType dcName = "ls:bpm"
id3Tag = "BPM"
localizationKey = "bpm"
/>
<metadataType dcName = "ls:rating"
id3Tag = "Rating"
localizationKey = "rating"
/>
<metadataType dcName = "dcterms:extent"
localizationKey = "length"
/>
<metadataType dcName = "ls:encoded_by"
id3Tag = "Encoded by"
localizationKey = "encoded_by"
/>
<metadataType dcName = "ls:track_num"
id3Tag = "Track"
localizationKey = "track_number"
/>
<metadataType dcName = "ls:disc_num"
id3Tag = "Disk"
localizationKey = "disc_number"
/>
<metadataType dcName = "ls:mood"
id3Tag = "Mood"
localizationKey = "mood"
/>
<metadataType dcName = "dc:publisher"
id3Tag = "Label"
localizationKey = "publishing_label"
/>
<metadataType dcName = "ls:composer"
id3Tag = "Composer"
localizationKey = "composer"
/>
<metadataType dcName = "ls:bitrate"
id3Tag = "Bitrate"
localizationKey = "bitrate"
/>
<metadataType dcName = "ls:channels"
id3Tag = "Channels"
localizationKey = "channels"
/> <!-- one of "", "Mono", "Stereo" or "5.1" -->
<metadataType dcName = "ls:samplerate"
id3Tag = "Samplerate"
localizationKey = "sample_rate"
/>
<metadataType dcName = "ls:encoder"
id3Tag = "Encoder"
localizationKey = "encoding_software"
/>
<metadataType dcName = "ls:crc"
id3Tag = "CRC"
localizationKey = "checksum"
/>
<metadataType dcName = "ls:lyrics"
id3Tag = "Lyrics"
localizationKey = "lyrics"
/>
<metadataType dcName = "ls:orchestra"
id3Tag = "Orchestra or band"
localizationKey = "orchestra_or_band"
/>
<metadataType dcName = "ls:conductor"
id3Tag = "Conductor"
localizationKey = "conductor"
/>
<metadataType dcName = "ls:lyricist"
id3Tag = "Lyricist"
localizationKey = "lyricist"
/>
<metadataType dcName = "ls:originallyricist"
id3Tag = "Original lyricist"
localizationKey = "original_lyricist"
/>
<metadataType dcName = "ls:radiostationname"
id3Tag = "Radio station name"
localizationKey = "radio_station_name"
/>
<metadataType dcName = "ls:audiofileinfourl"
id3Tag = "Audio file information web page"
localizationKey = "audio_file_info_url"
/>
<metadataType dcName = "ls:artisturl"
id3Tag = "Artist web page"
localizationKey = "artist_url"
/>
<metadataType dcName = "ls:audiosourceurl"
id3Tag = "Audio source web page"
localizationKey = "audio_source_url"
/>
<metadataType dcName = "ls:buycdurl"
id3Tag = "Buy CD web page"
localizationKey = "buy_cd_url"
/>
<metadataType dcName = "ls:isrcnumber"
id3Tag = "ISRC number"
localizationKey = "isrc_number"
/>
<metadataType dcName = "ls:catalognumber"
id3Tag = "Catalog"
localizationKey = "catalog_number"
/>
<metadataType dcName = "ls:originalartist"
id3Tag = "Original Artist"
localizationKey = "original_artist"
/>
<metadataType dcName = "dc:rights"
id3Tag = "Copyright"
localizationKey = "copyright"
/>
<!-- TODO: finish; the above are only the Main and Music tabs -->
</metadataTypeContainer>
</gLiveSupport>

View file

@ -8,7 +8,8 @@
storageClientFactory,
schedulerClientFactory,
outputPlayer,
cuePlayer) >
cuePlayer,
metadataTypeContainer) >
<!ELEMENT resourceBundle EMPTY >
<!ATTLIST resourceBundle path CDATA #REQUIRED >
@ -84,7 +85,14 @@
<!ATTLIST helixPlayer audioStreamTimeout NMTOKEN #IMPLIED >
<!ATTLIST helixPlayer fadeLookAheatTime NMTOKEN #IMPLIED >
<!ELEMENT metadataTypeContainer (metadataType+) >
<!ELEMENT metadataType EMPTY >
<!ATTLIST metadataType dcName NMTOKEN #REQUIRED >
<!ATTLIST metadataType id3Tag CDATA #IMPLIED >
<!ATTLIST metadataType localizationKey NMTOKEN #REQUIRED >
]>
<gLiveSupport>
<resourceBundle path = "ls_install_dir/var/gLiveSupport"
locale = "en"
@ -134,5 +142,142 @@
</audioPlayer>
</cuePlayer>
<metadataTypeContainer>
<metadataType dcName = "dc:title"
id3Tag = "Title"
localizationKey = "title"
/>
<metadataType dcName = "dc:creator"
id3Tag = "Artist"
localizationKey = "creator"
/>
<metadataType dcName = "dc:type"
id3Tag = "Genre"
localizationKey = "genre"
/>
<metadataType dcName = "dc:format"
localizationKey = "file_format"
/>
<metadataType dcName = "dcterms:extent"
localizationKey = "length"
/>
<metadataType dcName = "dc:source"
id3Tag = "Album"
localizationKey = "album"
/>
<metadataType dcName = "ls:year"
id3Tag = "Year"
localizationKey = "year"
/>
<metadataType dcName = "ls:bpm"
id3Tag = "BPM"
localizationKey = "bpm"
/>
<metadataType dcName = "ls:rating"
id3Tag = "Rating"
localizationKey = "rating"
/>
<metadataType dcName = "ls:encoded_by"
id3Tag = "Encoded by"
localizationKey = "encoded_by"
/>
<metadataType dcName = "ls:track_num"
id3Tag = "Track"
localizationKey = "track_number"
/>
<metadataType dcName = "ls:disc_num"
id3Tag = "Disk"
localizationKey = "disc_number"
/>
<metadataType dcName = "ls:mood"
id3Tag = "Mood"
localizationKey = "mood"
/>
<metadataType dcName = "dc:publisher"
id3Tag = "Label"
localizationKey = "publishing_label"
/>
<metadataType dcName = "ls:composer"
id3Tag = "Composer"
localizationKey = "composer"
/>
<metadataType dcName = "ls:bitrate"
id3Tag = "Bitrate"
localizationKey = "bitrate"
/>
<metadataType dcName = "ls:channels"
id3Tag = "Channels"
localizationKey = "channels"
/> <!-- one of "", "Mono", "Stereo" or "5.1" -->
<metadataType dcName = "ls:samplerate"
id3Tag = "Samplerate"
localizationKey = "sample_rate"
/>
<metadataType dcName = "ls:encoder"
id3Tag = "Encoder"
localizationKey = "encoding_software"
/>
<metadataType dcName = "ls:crc"
id3Tag = "CRC"
localizationKey = "checksum"
/>
<metadataType dcName = "ls:lyrics"
id3Tag = "Lyrics"
localizationKey = "lyrics"
/>
<metadataType dcName = "ls:orchestra"
id3Tag = "Orchestra or band" <!-- ??? -->
localizationKey = "orchestra_or_band"
/>
<metadataType dcName = "ls:conductor"
id3Tag = "Conductor"
localizationKey = "conductor"
/>
<metadataType dcName = "ls:lyricist"
id3Tag = "Lyricist"
localizationKey = "lyricist"
/>
<metadataType dcName = "ls:originallyricist"
id3Tag = "Original lyricist"
localizationKey = "original_lyricist"
/>
<metadataType dcName = "ls:radiostationname"
id3Tag = "Radio station name"
localizationKey = "radio_station_name"
/>
<metadataType dcName = "ls:audiofileinfourl"
id3Tag = "Audio file information web page"
localizationKey = "audio_file_info_url"
/>
<metadataType dcName = "ls:artisturl"
id3Tag = "Artist web page"
localizationKey = "artist_url"
/>
<metadataType dcName = "ls:audiosourceurl"
id3Tag = "Audio source web page"
localizationKey = "audio_source_url"
/>
<metadataType dcName = "ls:buycdurl"
id3Tag = "Buy CD web page"
localizationKey = "buy_cd_url"
/>
<metadataType dcName = "ls:isrcnumber"
id3Tag = "ISRC number"
localizationKey = "isrc_number"
/>
<metadataType dcName = "ls:catalognumber"
id3Tag = "Catalog"
localizationKey = "catalog_number"
/>
<metadataType dcName = "ls:originalartist"
id3Tag = "Original Artist"
localizationKey = "original_artist"
/>
<metadataType dcName = "dc:rights"
id3Tag = "Copyright"
localizationKey = "copyright"
/>
<!-- TODO: finish; the above are only the Main and Music tabs -->
</metadataTypeContainer>
</gLiveSupport>

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.cxx,v $
------------------------------------------------------------------------------*/
@ -57,12 +57,17 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
AdvancedSearchEntry :: AdvancedSearchEntry(Ptr<ResourceBundle>::Ref bundle)
AdvancedSearchEntry :: AdvancedSearchEntry(
Ptr<MetadataTypeContainer>::Ref metadataTypes,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle)
: LocalizedObject(bundle),
metadataTypes(metadataTypes)
{
AdvancedSearchItem * searchOptionsBox = Gtk::manage(new
AdvancedSearchItem(true, getBundle()) );
AdvancedSearchItem(true,
metadataTypes,
getBundle() ));
pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
searchOptionsBox->signal_add_new().connect(sigc::mem_fun(*this,
@ -77,7 +82,9 @@ void
AdvancedSearchEntry :: onAddNewCondition(void) throw ()
{
AdvancedSearchItem * searchOptionsBox = Gtk::manage(new
AdvancedSearchItem(false, getBundle()) );
AdvancedSearchItem(false,
metadataTypes,
getBundle() ));
pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
searchOptionsBox->signal_add_new().connect(sigc::mem_fun(*this,

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.h,v $
------------------------------------------------------------------------------*/
@ -44,6 +44,7 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Core/SearchCriteria.h"
@ -64,7 +65,7 @@ using namespace LiveSupport::Core;
* A Gtk::VBox with one or more search input fields in it.
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class AdvancedSearchEntry : public Gtk::VBox,
public LocalizedObject
@ -72,16 +73,20 @@ class AdvancedSearchEntry : public Gtk::VBox,
private:
/**
* Default constructor.
* A container holding all known metadata types.
*/
AdvancedSearchEntry(void) throw ();
Ptr<MetadataTypeContainer>::Ref metadataTypes;
public:
/**
* Constructor with localization parameter.
* Constructor.
*
* @param metadataTypes container holding all known metadata types
*/
AdvancedSearchEntry(Ptr<ResourceBundle>::Ref bundle)
AdvancedSearchEntry(Ptr<MetadataTypeContainer>::Ref metadataTypes,
Ptr<ResourceBundle>::Ref bundle)
throw ();
/**

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/AdvancedSearchItem.cxx,v $
------------------------------------------------------------------------------*/
@ -58,23 +58,13 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
AdvancedSearchItem :: AdvancedSearchItem(bool isFirst,
AdvancedSearchItem :: AdvancedSearchItem(
bool isFirst,
Ptr<MetadataTypeContainer>::Ref metadataTypes,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle)
{
try {
if (!metadataTypes) {
readMetadataTypes();
}
if (!operatorTypes) {
readOperatorTypes();
}
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
Gtk::Label * searchByLabel;
@ -89,19 +79,10 @@ AdvancedSearchItem :: AdvancedSearchItem(bool isFirst,
pack_start(*searchByLabel, Gtk::PACK_SHRINK, 5);
metadataEntry = Gtk::manage(wf->createComboBoxText());
MapVector::const_iterator it;
for (it = metadataTypes->begin(); it != metadataTypes->end(); ++it) {
metadataEntry->append_text(it->first);
}
metadataEntry->set_active_text(metadataTypes->front().first);
metadataEntry = Gtk::manage(wf->createMetadataComboBoxText(metadataTypes));
pack_start(*metadataEntry, Gtk::PACK_EXPAND_WIDGET, 5);
operatorEntry = Gtk::manage(wf->createComboBoxText());
for (it = operatorTypes->begin(); it != operatorTypes->end(); ++it) {
operatorEntry->append_text(it->first);
}
operatorEntry->set_active_text(operatorTypes->front().first);
operatorEntry = Gtk::manage(wf->createOperatorComboBoxText(bundle));
pack_start(*operatorEntry, Gtk::PACK_EXPAND_WIDGET, 5);
valueEntry = Gtk::manage(wf->createEntryBin());
@ -125,100 +106,15 @@ AdvancedSearchItem :: AdvancedSearchItem(bool isFirst,
Ptr<SearchCriteria::SearchConditionType>::Ref
AdvancedSearchItem :: getSearchCondition(void) throw ()
{
std::string metadataName = metadataEntry->get_active_text();
std::string metadataKey;
bool found = false;
MapVector::const_iterator it;
for (it = metadataTypes->begin(); it != metadataTypes->end(); ++it) {
if (it->first == metadataName) {
found = true;
metadataKey = it->second;
break;
}
}
if (!found) {
std::cerr << "unknown metadata type: " << metadataName
<< std::endl << "(this should never happen)" << std::endl;
std::exit(1);
}
std::string operatorName = operatorEntry->get_active_text();
std::string operatorKey;
found = false;
for (it = operatorTypes->begin(); it != operatorTypes->end(); ++it) {
if (it->first == operatorName) {
found = true;
operatorKey = it->second;
break;
}
}
if (!found) {
std::cerr << "unknown comparison operator: " << operatorName
<< std::endl << "(this should never happen)" << std::endl;
std::exit(1);
}
Ptr<const Glib::ustring>::Ref metadataKey = metadataEntry->getActiveKey();
Ptr<const Glib::ustring>::Ref operatorKey = operatorEntry->getActiveKey();
std::string value = valueEntry->get_text();
Ptr<SearchCriteria::SearchConditionType>::Ref
condition(new SearchCriteria::SearchConditionType(metadataKey,
operatorKey,
value) );
condition(new SearchCriteria::SearchConditionType(*metadataKey,
*operatorKey,
value));
return condition;
}
/*------------------------------------------------------------------------------
* Read the localized metadata field names.
*----------------------------------------------------------------------------*/
void
AdvancedSearchItem :: readMetadataTypes(void)
throw (std::invalid_argument)
{
metadataTypes.reset(new MapVector);
metadataTypes->push_back(std::make_pair(
*getResourceUstring("genreMetadataDisplay"),
*getResourceUstring("genreMetadataSearchKey") ));
metadataTypes->push_back(std::make_pair(
*getResourceUstring("creatorMetadataDisplay"),
*getResourceUstring("creatorMetadataSearchKey") ));
metadataTypes->push_back(std::make_pair(
*getResourceUstring("albumMetadataDisplay"),
*getResourceUstring("albumMetadataSearchKey") ));
metadataTypes->push_back(std::make_pair(
*getResourceUstring("titleMetadataDisplay"),
*getResourceUstring("titleMetadataSearchKey") ));
metadataTypes->push_back(std::make_pair(
*getResourceUstring("lengthMetadataDisplay"),
*getResourceUstring("lengthMetadataSearchKey") ));
}
/*------------------------------------------------------------------------------
* Read the localized comparison operator names.
*----------------------------------------------------------------------------*/
void
AdvancedSearchItem :: readOperatorTypes(void)
throw (std::invalid_argument)
{
operatorTypes.reset(new MapVector);
operatorTypes->push_back(std::make_pair(
*getResourceUstring("partialOperatorDisplay"),
*getResourceUstring("partialOperatorSearchKey") ));
operatorTypes->push_back(std::make_pair(
*getResourceUstring("prefixOperatorDisplay"),
*getResourceUstring("prefixOperatorSearchKey") ));
operatorTypes->push_back(std::make_pair(
*getResourceUstring("=OperatorDisplay"),
*getResourceUstring("=OperatorSearchKey") ));
operatorTypes->push_back(std::make_pair(
*getResourceUstring("<=OperatorDisplay"),
*getResourceUstring("<=OperatorSearchKey") ));
operatorTypes->push_back(std::make_pair(
*getResourceUstring(">=OperatorDisplay"),
*getResourceUstring(">=OperatorSearchKey") ));
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/AdvancedSearchItem.h,v $
------------------------------------------------------------------------------*/
@ -47,8 +47,10 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Core/SearchCriteria.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
#include "LiveSupport/Widgets/MetadataComboBoxText.h"
#include "LiveSupport/Widgets/OperatorComboBoxText.h"
#include "LiveSupport/Widgets/EntryBin.h"
#include "LiveSupport/Widgets/ImageButton.h"
@ -71,7 +73,7 @@ using namespace LiveSupport::Widgets;
* A single search input field.
*
* @author $Author: fgerlits $
* @version $Revision: 1.1 $
* @version $Revision: 1.2 $
*/
class AdvancedSearchItem : public Gtk::HBox,
public LocalizedObject
@ -85,25 +87,15 @@ class AdvancedSearchItem : public Gtk::HBox,
typedef std::vector<std::pair<Glib::ustring, Glib::ustring> >
MapVector;
/**
* The list of possible metadata field names.
*/
Ptr<MapVector>::Ref metadataTypes;
/**
* The list of possible comparison operators.
*/
Ptr<MapVector>::Ref operatorTypes;
/**
* The metadata field.
*/
ComboBoxText * metadataEntry;
MetadataComboBoxText * metadataEntry;
/**
* The operator field.
*/
ComboBoxText * operatorEntry;
OperatorComboBoxText * operatorEntry;
/**
* The "search for this value" field.
@ -120,40 +112,18 @@ class AdvancedSearchItem : public Gtk::HBox,
*/
ImageButton * closeButton;
/**
* Default constructor.
*/
AdvancedSearchItem(void) throw ();
/**
* Read the localized metadata field names.
*
* @exception std::invalid_argument if some keys are not found in
* the resource bundle
*/
void
readMetadataTypes(void) throw (std::invalid_argument);
/**
* Read the localized comparison operator names.
*
* @exception std::invalid_argument if some keys are not found in
* the resource bundle
*/
void
readOperatorTypes(void) throw (std::invalid_argument);
public:
/**
* Constructor with localization parameter.
* Constructor.
*
* @param isFirst true if this is the first search condition
* (so it does not need a Close button)
* @param bundle the resource bundle for localization
* @param metadataTypes container holding all known metadata types
*/
AdvancedSearchItem(bool isFirst,
Ptr<MetadataTypeContainer>::Ref metadataTypes,
Ptr<ResourceBundle>::Ref bundle)
throw ();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.44 $
Version : $Revision: 1.45 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/
@ -239,6 +239,21 @@ GLiveSupport :: configure(const xmlpp::Element & element)
cuePlayer = apf->getAudioPlayer();
cuePlayer->initialize();
// configure the MetadataTypeContainer
nodes = element.get_children(MetadataTypeContainer::getConfigElementName());
if (nodes.size() < 1) {
throw std::invalid_argument("no metadataTypeContainer element");
}
Ptr<ResourceBundle>::Ref metadataBundle;
try {
metadataBundle = getBundle("metadataTypes");
} catch (std::invalid_argument &e) {
throw std::invalid_argument(e.what());
}
metadataTypeContainer.reset(new MetadataTypeContainer(metadataBundle));
metadataTypeContainer->configure(
*((const xmlpp::Element*) *(nodes.begin())) );
}
@ -376,6 +391,8 @@ GLiveSupport :: changeLanguage(Ptr<const std::string>::Ref locale)
{
changeLocale(*locale);
metadataTypeContainer->setBundle(getBundle());
if (masterPanel.get()) {
masterPanel->changeLanguage(getBundle());
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.35 $
Version : $Revision: 1.36 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
------------------------------------------------------------------------------*/
@ -48,6 +48,7 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedConfigurable.h"
#include "LiveSupport/Core/MetadataTypeContainer.h"
#include "LiveSupport/Authentication/AuthenticationClientInterface.h"
#include "LiveSupport/Storage/StorageClientInterface.h"
#include "LiveSupport/SchedulerClient/SchedulerClientInterface.h"
@ -101,7 +102,7 @@ class MasterPanelWindow;
* respective documentation.
*
* @author $Author: fgerlits $
* @version $Revision: 1.35 $
* @version $Revision: 1.36 $
* @see LocalizedObject#getBundle(const xmlpp::Element &)
* @see AuthenticationClientFactory
* @see StorageClientFactory
@ -174,6 +175,11 @@ class GLiveSupport : public LocalizedConfigurable,
*/
Ptr<LanguageMap>::Ref supportedLanguages;
/**
* The container for all the possible metadata types.
*/
Ptr<MetadataTypeContainer>::Ref metadataTypeContainer;
/**
* The master panel window.
*/
@ -322,7 +328,8 @@ class GLiveSupport : public LocalizedConfigurable,
* @param message the message to display
*/
void
displayMessageWindow(Ptr<Glib::ustring>::Ref message) throw ();
displayMessageWindow(Ptr<Glib::ustring>::Ref message)
throw ();
/**
* Show the main window, and run the application.
@ -415,6 +422,17 @@ class GLiveSupport : public LocalizedConfigurable,
return supportedLanguages;
}
/**
* Return a container with all supported metadata types.
*
* @return the metadata type container
*/
Ptr<MetadataTypeContainer>::Ref
getMetadataTypeContainer(void) const throw ()
{
return metadataTypeContainer;
}
/**
* Show the UI components that are visible when no one is logged in.
*/

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.15 $
Version : $Revision: 1.16 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -166,7 +166,9 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
// the three main components of the window
advancedSearchEntry = Gtk::manage(new AdvancedSearchEntry(getBundle()));
advancedSearchEntry = Gtk::manage(new AdvancedSearchEntry(
gLiveSupport->getMetadataTypeContainer(),
getBundle() ));
Gtk::Box * searchButtonBox = Gtk::manage(new Gtk::HButtonBox(
Gtk::BUTTONBOX_END ));

View file

@ -189,5 +189,44 @@ hu:table
cuePlayerLabel:string { "Belehallgatni" }
}
metadataTypes:table
{
title:string { "Title" }
creator:string { "Creator" }
album:string { "Album" }
year:string { "Year" }
genre:string { "Genre" }
description:string { "Description" }
format:string { "Format" }
length:string { "Length" }
bpm:string { "BPM" }
rating:string { "Rating" }
encoded_by:string { "Encoded by" }
track_number:string { "Track number" }
disc_number:string { "Disc number" }
mood:string { "Mood" }
publishing_label:string { "Publishing label" }
composer:string { "Composer" }
bitrate:string { "Bitrate" }
channels:string { "Channels" }
sample_rate:string { "Sample rate" }
encoding_software:string { "Encoding software" }
checksum:string { "Checksum" }
lyrics:string { "Lyrics" }
orchestra_or_band:string { "Orchestra or band" }
conductor:string { "Conductor" }
lyricist:string { "Lyricist" }
original_lyricist:string { "Original lyricist" }
radio_station_name:string { "Radio station name" }
audio_file_info_url:string { "File info web page" }
artist_url:string { "Artist web page" }
audio_source_url:string { "Source web page" }
buy_cd_url:string { "Buy CD web page" }
isrc_number:string { "ISRC number" }
catalog_number:string { "Catalog number" }
original_artist:string { "Original artist" }
copyright:string { "Copyright" }
}
}

View file

@ -191,5 +191,44 @@ root:table
cuePlayerLabel:string { "Preview" }
}
metadataTypes:table
{
title:string { "Title" }
creator:string { "Creator" }
album:string { "Album" }
year:string { "Year" }
genre:string { "Genre" }
description:string { "Description" }
format:string { "Format" }
length:string { "Length" }
bpm:string { "BPM" }
rating:string { "Rating" }
encoded_by:string { "Encoded by" }
track_number:string { "Track number" }
disc_number:string { "Disc number" }
mood:string { "Mood" }
publishing_label:string { "Publishing label" }
composer:string { "Composer" }
bitrate:string { "Bitrate" }
channels:string { "Channels" }
sample_rate:string { "Sample rate" }
encoding_software:string { "Encoding software" }
checksum:string { "Checksum" }
lyrics:string { "Lyrics" }
orchestra_or_band:string { "Orchestra or band" }
conductor:string { "Conductor" }
lyricist:string { "Lyricist" }
original_lyricist:string { "Original lyricist" }
radio_station_name:string { "Radio station name" }
audio_file_info_url:string { "File info web page" }
artist_url:string { "Artist web page" }
audio_source_url:string { "Source web page" }
buy_cd_url:string { "Buy CD web page" }
isrc_number:string { "ISRC number" }
catalog_number:string { "Catalog number" }
original_artist:string { "Original artist" }
copyright:string { "Copyright" }
}
}