diff --git a/livesupport/modules/widgets/etc/Makefile.in b/livesupport/modules/widgets/etc/Makefile.in index 99c401b50..91a0cd6c0 100644 --- a/livesupport/modules/widgets/etc/Makefile.in +++ b/livesupport/modules/widgets/etc/Makefile.in @@ -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 \ diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h index e959858f5..ff24c5f59 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h @@ -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 +#include + #include #include #include @@ -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,10 +117,21 @@ class ComboBoxText : public Gtk::ComboBoxText */ Glib::RefPtr rightImage; + /** + * A map type for storing { text, key } pairs. + */ + typedef std::map::Ref> + KeyMapType; + + /** + * A map containing { text, key } pairs. + */ + KeyMapType keyMap; + /** * Default constructor. */ - ComboBoxText(void) throw () + ComboBoxText(void) throw () { } @@ -131,7 +145,7 @@ class ComboBoxText : public Gtk::ComboBoxText void onMenuPosition(int & x, int & y, - bool & pushIn) throw (); + bool & pushIn) throw (); /** * Event handler for the combo box being clicked. @@ -140,13 +154,13 @@ class ComboBoxText : public Gtk::ComboBoxText * @return true if the the event was handled, false otherwise. */ bool - onBoxClicked(GdkEventButton * event) throw (); + onBoxClicked(GdkEventButton * event) throw (); /** * Event handler for the menu item selected. */ void - onMenuItemSelected(void) throw (); + onMenuItemSelected(void) throw (); protected: @@ -158,7 +172,7 @@ class ComboBoxText : public Gtk::ComboBoxText */ virtual void on_size_request(Gtk::Requisition* requisition) - throw (); + throw (); /** * Handle the size allocate event. @@ -167,31 +181,31 @@ class ComboBoxText : public Gtk::ComboBoxText */ virtual void on_size_allocate(Gtk::Allocation& allocation) - throw (); + throw (); /** * Handle the map event. */ virtual void - on_map() throw (); + on_map() throw (); /** * Handle the unmap event. */ virtual void - on_unmap() throw (); + on_unmap() throw (); /** * Handle the realize event. */ virtual void - on_realize() throw (); + on_realize() throw (); /** * Handle the unrealize event. */ virtual void - on_unrealize() throw (); + on_unrealize() throw (); /** * Handle the expose event. @@ -200,7 +214,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @return true if something was drawn (?) */ virtual bool - on_expose_event(GdkEventExpose* event) throw (); + on_expose_event(GdkEventExpose* event) throw (); /** * Execute a function on all children of this container. @@ -214,7 +228,7 @@ class ComboBoxText : public Gtk::ComboBoxText forall_vfunc(gboolean includeInternals, GtkCallback callback, gpointer callbackData) - throw (); + throw (); /** * Handle the add event. @@ -222,7 +236,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @param child the child being added to the widget. */ virtual void - on_add(Gtk::Widget* child) throw (); + on_add(Gtk::Widget* child) throw (); /** * Handle the remove event. @@ -230,7 +244,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @param child the child to remove from the widget. */ virtual void - on_remove(Gtk::Widget* child) throw (); + on_remove(Gtk::Widget* child) throw (); /** * Tell what kind of children this container accepts. @@ -238,7 +252,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @return the type of children this container accepts. */ virtual GtkType - child_type_vfunc() const throw (); + child_type_vfunc() const throw (); /** * A signal object to notify people that the selection has changed. @@ -262,7 +276,7 @@ class ComboBoxText : public Gtk::ComboBoxText * A virtual destructor. */ virtual - ~ComboBoxText(void) throw (); + ~ComboBoxText(void) throw (); /** * Append a new text entry to the combo box menu. @@ -270,7 +284,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @param text the text entry to append. */ void - append_text(const Glib::ustring &text) throw (); + append_text(const Glib::ustring &text) throw (); /** * Return the active text. @@ -278,7 +292,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @return the active text of the combo box. */ Glib::ustring - get_active_text(void) const throw (); + get_active_text(void) const throw (); /** * Insert a new text entry at a given position. @@ -288,7 +302,7 @@ class ComboBoxText : public Gtk::ComboBoxText */ void insert_text(int position, - const Glib::ustring & text) throw (); + const Glib::ustring & text) throw (); /** * Set the active text. @@ -296,8 +310,38 @@ class ComboBoxText : public Gtk::ComboBoxText * @param text the text to select as active. */ void - set_active_text(const Glib::ustring & text) throw (); - + 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::Ref text, + Ptr::Ref key) + throw (); + + /** + * Get the key corresponding to the selected item. + * + * @return the key corresponding to the currently active (selected) + * text + */ + Ptr::Ref + getActiveKey(void) throw (std::logic_error); + /** * Accessor for the selectionChanged signal. * This signal is emitted by onMenuItemSelected() when the active @@ -310,8 +354,7 @@ class ComboBoxText : public Gtk::ComboBoxText * @return the signal object (a protected member of this class) */ sigc::signal - signalSelectionChanged(void) throw (); - + signalSelectionChanged(void) throw (); }; diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/MetadataComboBoxText.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/MetadataComboBoxText.h new file mode 100644 index 000000000..605ccd0bd --- /dev/null +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/MetadataComboBoxText.h @@ -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 leftImage, + Glib::RefPtr centerImage, + Glib::RefPtr rightImage, + Ptr::Ref metadataTypes) + throw (); + + /** + * A virtual destructor. + */ + virtual + ~MetadataComboBoxText(void) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Widgets +} // namespace LiveSupport + +#endif // LiveSupport_Widgets_MetadataComboBoxText_h + diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/OperatorComboBoxText.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/OperatorComboBoxText.h new file mode 100644 index 000000000..6743e5bde --- /dev/null +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/OperatorComboBoxText.h @@ -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 leftImage, + Glib::RefPtr centerImage, + Glib::RefPtr rightImage, + Ptr::Ref bundle) + throw (); + + /** + * A virtual destructor. + */ + virtual + ~OperatorComboBoxText(void) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Widgets +} // namespace LiveSupport + +#endif // LiveSupport_Widgets_OperatorComboBoxText_h + diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 41e3ef2d7..477482489 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h @@ -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 #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; * * * @author $Author: fgerlits $ - * @version $Revision: 1.21 $ + * @version $Revision: 1.22 $ */ class WidgetFactory : virtual public Configurable @@ -186,7 +189,7 @@ class WidgetFactory : /** * The default constructor. */ - WidgetFactory(void) throw () + WidgetFactory(void) throw () { } @@ -207,7 +210,7 @@ class WidgetFactory : * A virtual destructor, as this class has virtual functions. */ virtual - ~WidgetFactory(void) throw () + ~WidgetFactory(void) throw () { } @@ -218,7 +221,7 @@ class WidgetFactory : * @return the name of the expected XML configuration element. */ static const std::string - getConfigElementName(void) throw () + getConfigElementName(void) throw () { return configElementNameStr; } @@ -229,7 +232,7 @@ class WidgetFactory : * @return the singleton instance of this object. */ static Ptr::Ref - getInstance() throw (); + getInstance() throw (); /** * Configure the object based on the XML element supplied. @@ -268,18 +271,44 @@ class WidgetFactory : * @return a button of the requested type, or 0 */ ImageButton * - createButton(ImageButtonType type) throw (); + 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. * * @return a combo box, that holds text entries. */ ComboBoxText * - createComboBoxText(void) throw (); + 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::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::Ref bundle) + throw (); + /** * Create and return a blue singular container. * It is the reponsibility of the caller to dispose of the created @@ -288,7 +317,7 @@ class WidgetFactory : * @return a blue singular container. */ BlueBin * - createBlueBin(void) throw (); + createBlueBin(void) throw (); /** * Create and return a dark blue singular container. @@ -298,7 +327,7 @@ class WidgetFactory : * @return a dark blue singular container. */ BlueBin * - createDarkBlueBin(void) throw (); + createDarkBlueBin(void) throw (); /** * Create and return a singular container holding a text entry. @@ -308,7 +337,7 @@ class WidgetFactory : * @return a singular container holding a text entry. */ EntryBin * - createEntryBin(void) throw (); + createEntryBin(void) throw (); /** * Return the images for the white window. @@ -316,7 +345,7 @@ class WidgetFactory : * @return the corner images for the white window. */ Ptr::Ref - getWhiteWindowCorners(void) throw () + getWhiteWindowCorners(void) throw () { return whiteWindowImages; } @@ -329,7 +358,7 @@ class WidgetFactory : * @return the container holding the requested image. */ Gtk::Image * - createImage(ImageType imageName) throw (); + createImage(ImageType imageName) throw (); /** * Create and return a ZebraTreeView instance. @@ -340,7 +369,7 @@ class WidgetFactory : */ ZebraTreeView * createTreeView(Glib::RefPtr treeModel) - throw (); + throw (); /** * Create a window with a single line of text, and an OK button. @@ -351,7 +380,7 @@ class WidgetFactory : * @param message the message to include in the window. */ WhiteWindow * - createMessageWindow(Ptr::Ref message) throw (); + createMessageWindow(Ptr::Ref message) throw (); }; diff --git a/livesupport/modules/widgets/src/ComboBoxText.cxx b/livesupport/modules/widgets/src/ComboBoxText.cxx index 24e081b77..bede2c056 100644 --- a/livesupport/modules/widgets/src/ComboBoxText.cxx +++ b/livesupport/modules/widgets/src/ComboBoxText.cxx @@ -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::Ref text, + Ptr::Ref key) throw () +{ + append_text(*text); + keyMap[*text] = key; +} + + +/*------------------------------------------------------------------------------ + * Get the key corresponding to the selected item. + *----------------------------------------------------------------------------*/ +Ptr::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. *----------------------------------------------------------------------------*/ diff --git a/livesupport/modules/widgets/src/MetadataComboBoxText.cxx b/livesupport/modules/widgets/src/MetadataComboBoxText.cxx new file mode 100644 index 000000000..e1b969edb --- /dev/null +++ b/livesupport/modules/widgets/src/MetadataComboBoxText.cxx @@ -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 leftImage, + Glib::RefPtr centerImage, + Glib::RefPtr rightImage, + Ptr::Ref metadataTypes) + throw () + : ComboBoxText(leftImage, centerImage, rightImage) +{ + MetadataTypeContainer::Vector::const_iterator it; + for (it = metadataTypes->begin(); it != metadataTypes->end(); ++it) { + Ptr::Ref metadata = *it; + appendPair(metadata->getLocalizedName(), metadata->getDcName()); + } + set_active(0); // select the first item +} + + +/*------------------------------------------------------------------------------ + * Destructor. + *----------------------------------------------------------------------------*/ +MetadataComboBoxText :: ~MetadataComboBoxText(void) throw () +{ +} + diff --git a/livesupport/modules/widgets/src/OperatorComboBoxText.cxx b/livesupport/modules/widgets/src/OperatorComboBoxText.cxx new file mode 100644 index 000000000..4e006da70 --- /dev/null +++ b/livesupport/modules/widgets/src/OperatorComboBoxText.cxx @@ -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 leftImage, + Glib::RefPtr centerImage, + Glib::RefPtr rightImage, + Ptr::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 () +{ +} + diff --git a/livesupport/modules/widgets/src/WidgetFactory.cxx b/livesupport/modules/widgets/src/WidgetFactory.cxx index 65bb6b2fa..1a87d7be7 100644 --- a/livesupport/modules/widgets/src/WidgetFactory.cxx +++ b/livesupport/modules/widgets/src/WidgetFactory.cxx @@ -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 #include #include "LiveSupport/Widgets/Colors.h" @@ -283,7 +284,7 @@ static const std::string schedulerWindowTitleImageName * Return the singleton instance to WidgetFactory *----------------------------------------------------------------------------*/ Ptr::Ref -WidgetFactory :: getInstance(void) throw () +WidgetFactory :: getInstance(void) throw () { if (!singleton.get()) { singleton.reset(new WidgetFactory()); @@ -355,7 +356,7 @@ WidgetFactory :: loadImage(const std::string imageName) *----------------------------------------------------------------------------*/ Button * WidgetFactory :: createButton(const Glib::ustring & label, - ButtonType type) throw () + ButtonType type) throw () { switch (type) { case pushButton: @@ -374,7 +375,7 @@ WidgetFactory :: createButton(const Glib::ustring & label, * Create a combo box *----------------------------------------------------------------------------*/ ComboBoxText * -WidgetFactory :: createComboBoxText(void) throw () +WidgetFactory :: createComboBoxText(void) throw () { return new ComboBoxText(comboBoxLeftImage, comboBoxCenterImage, @@ -382,11 +383,41 @@ WidgetFactory :: createComboBoxText(void) throw () } +/*------------------------------------------------------------------------------ + * Create a metadata combo box + *----------------------------------------------------------------------------*/ +MetadataComboBoxText * +WidgetFactory :: createMetadataComboBoxText( + Ptr::Ref metadataTypes) + throw () +{ + return new MetadataComboBoxText(comboBoxLeftImage, + comboBoxCenterImage, + comboBoxRightImage, + metadataTypes); +} + + +/*------------------------------------------------------------------------------ + * Create a comparison operator combo box + *----------------------------------------------------------------------------*/ +OperatorComboBoxText * +WidgetFactory :: createOperatorComboBoxText( + Ptr::Ref bundle) + throw () +{ + return new OperatorComboBoxText(comboBoxLeftImage, + comboBoxCenterImage, + comboBoxRightImage, + bundle); +} + + /*------------------------------------------------------------------------------ * Create a blue bin *----------------------------------------------------------------------------*/ BlueBin * -WidgetFactory :: createBlueBin(void) throw () +WidgetFactory :: createBlueBin(void) throw () { return new BlueBin(Colors::LightBlue, blueBinImages); } @@ -396,7 +427,7 @@ WidgetFactory :: createBlueBin(void) throw () * Create a dark blue bin *----------------------------------------------------------------------------*/ BlueBin * -WidgetFactory :: createDarkBlueBin(void) throw () +WidgetFactory :: createDarkBlueBin(void) throw () { return new BlueBin(Colors::MasterPanelCenterBlue, darkBlueBinImages); } @@ -406,7 +437,7 @@ WidgetFactory :: createDarkBlueBin(void) throw () * Create an entry bin *----------------------------------------------------------------------------*/ EntryBin * -WidgetFactory :: createEntryBin(void) throw () +WidgetFactory :: createEntryBin(void) throw () { return new EntryBin(Colors::LightBlue, entryBinImages); } @@ -416,7 +447,7 @@ WidgetFactory :: createEntryBin(void) throw () * Create a stock button *----------------------------------------------------------------------------*/ ImageButton * -WidgetFactory :: createButton(ImageButtonType type) throw () +WidgetFactory :: createButton(ImageButtonType type) throw () { Glib::RefPtr passiveImage; Glib::RefPtr rollImage; @@ -489,7 +520,7 @@ WidgetFactory :: createButton(ImageButtonType type) throw () * Create a resize image *----------------------------------------------------------------------------*/ Gtk::Image * -WidgetFactory :: createImage(ImageType imageName) throw () +WidgetFactory :: createImage(ImageType imageName) throw () { Glib::RefPtr rawImage; @@ -533,7 +564,7 @@ WidgetFactory :: createImage(ImageType imageName) throw () *----------------------------------------------------------------------------*/ ZebraTreeView * WidgetFactory :: createTreeView(Glib::RefPtr treeModel) - throw () + throw () { return new ZebraTreeView(treeModel); } @@ -544,7 +575,7 @@ WidgetFactory :: createTreeView(Glib::RefPtr treeModel) *----------------------------------------------------------------------------*/ WhiteWindow * WidgetFactory :: createMessageWindow(Ptr::Ref message) - throw () + throw () { return new MessageWindow(message); } diff --git a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml index 6b225559d..c74c46db0 100644 --- a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml +++ b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml @@ -8,7 +8,8 @@ storageClientFactory, schedulerClientFactory, outputPlayer, - cuePlayer) > + cuePlayer, + metadataTypeContainer) > @@ -84,7 +85,14 @@ + + + + + + ]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml.template b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml.template index 951a9499b..86c06c55c 100644 --- a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml.template +++ b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml.template @@ -8,7 +8,8 @@ storageClientFactory, schedulerClientFactory, outputPlayer, - cuePlayer) > + cuePlayer, + metadataTypeContainer) > @@ -84,7 +85,14 @@ + + + + + + ]> + + + + + + + + + + + + + + + + + + + + + + + + + localizationKey = "orchestra_or_band" + /> + + + + + + + + + + + + + + diff --git a/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.cxx b/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.cxx index fb7736e4f..5595d22f8 100644 --- a/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.cxx +++ b/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.cxx @@ -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::Ref bundle) - throw () - : LocalizedObject(bundle) +AdvancedSearchEntry :: AdvancedSearchEntry( + Ptr::Ref metadataTypes, + Ptr::Ref bundle) + throw () + : 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, @@ -74,10 +79,12 @@ AdvancedSearchEntry :: AdvancedSearchEntry(Ptr::Ref bundle) * Add a new search condition entrys item. *----------------------------------------------------------------------------*/ void -AdvancedSearchEntry :: onAddNewCondition(void) throw () +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, @@ -91,7 +98,7 @@ AdvancedSearchEntry :: onAddNewCondition(void) throw () * Return the current state of the search fields. *----------------------------------------------------------------------------*/ Ptr::Ref -AdvancedSearchEntry :: getSearchCriteria(void) throw () +AdvancedSearchEntry :: getSearchCriteria(void) throw () { Ptr::Ref criteria(new SearchCriteria("all", "and")); @@ -112,8 +119,8 @@ AdvancedSearchEntry :: getSearchCriteria(void) throw () * Connect a callback to the "enter key pressed" event. *----------------------------------------------------------------------------*/ void -AdvancedSearchEntry :: connectCallback(const sigc::slot & callback) - throw () +AdvancedSearchEntry :: connectCallback(const sigc::slot & callback) + throw () { Gtk::Box_Helpers::BoxList children = this->children(); Gtk::Box_Helpers::BoxList::type_base::iterator it; diff --git a/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.h b/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.h index 9242fdf17..4c7ef4d57 100644 --- a/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.h +++ b/livesupport/products/gLiveSupport/src/AdvancedSearchEntry.h @@ -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,24 +65,28 @@ 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, +class AdvancedSearchEntry : public Gtk::VBox, public LocalizedObject { private: /** - * Default constructor. + * A container holding all known metadata types. */ - AdvancedSearchEntry(void) throw (); - + Ptr::Ref metadataTypes; + + public: /** - * Constructor with localization parameter. + * Constructor. + * + * @param metadataTypes container holding all known metadata types */ - AdvancedSearchEntry(Ptr::Ref bundle) + AdvancedSearchEntry(Ptr::Ref metadataTypes, + Ptr::Ref bundle) throw (); /** diff --git a/livesupport/products/gLiveSupport/src/AdvancedSearchItem.cxx b/livesupport/products/gLiveSupport/src/AdvancedSearchItem.cxx index abc1a82da..9a09ed0d3 100644 --- a/livesupport/products/gLiveSupport/src/AdvancedSearchItem.cxx +++ b/livesupport/products/gLiveSupport/src/AdvancedSearchItem.cxx @@ -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, - Ptr::Ref bundle) - throw () +AdvancedSearchItem :: AdvancedSearchItem( + bool isFirst, + Ptr::Ref metadataTypes, + Ptr::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::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::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); - } - - std::string value = valueEntry->get_text(); + Ptr::Ref metadataKey = metadataEntry->getActiveKey(); + Ptr::Ref operatorKey = operatorEntry->getActiveKey(); + std::string value = valueEntry->get_text(); Ptr::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") )); -} - diff --git a/livesupport/products/gLiveSupport/src/AdvancedSearchItem.h b/livesupport/products/gLiveSupport/src/AdvancedSearchItem.h index c5431b8ed..452cdfc39 100644 --- a/livesupport/products/gLiveSupport/src/AdvancedSearchItem.h +++ b/livesupport/products/gLiveSupport/src/AdvancedSearchItem.h @@ -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,9 +73,9 @@ 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, +class AdvancedSearchItem : public Gtk::HBox, public LocalizedObject { private: @@ -85,25 +87,15 @@ class AdvancedSearchItem : public Gtk::HBox, typedef std::vector > MapVector; - /** - * The list of possible metadata field names. - */ - Ptr::Ref metadataTypes; - - /** - * The list of possible comparison operators. - */ - Ptr::Ref operatorTypes; - /** * The metadata field. */ - ComboBoxText * metadataEntry; + MetadataComboBoxText * metadataEntry; /** * The operator field. */ - ComboBoxText * operatorEntry; + OperatorComboBoxText * operatorEntry; /** * The "search for this value" field. @@ -120,41 +112,19 @@ 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 isFirst true if this is the first search condition + * (so it does not need a Close button) + * @param metadataTypes container holding all known metadata types */ - AdvancedSearchItem(bool isFirst, - Ptr::Ref bundle) + AdvancedSearchItem(bool isFirst, + Ptr::Ref metadataTypes, + Ptr::Ref bundle) throw (); /** diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index 10f6d04dc..c9b9439de 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -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::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::Ref locale) { changeLocale(*locale); + metadataTypeContainer->setBundle(getBundle()); + if (masterPanel.get()) { masterPanel->changeLanguage(getBundle()); } diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index ba37d2ce4..f043dc1f8 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -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::Ref supportedLanguages; + /** + * The container for all the possible metadata types. + */ + Ptr::Ref metadataTypeContainer; + /** * The master panel window. */ @@ -227,13 +233,13 @@ class GLiveSupport : public LocalizedConfigurable, * Store the contents of the Scratchpad as a user preference. */ void - storeScratchpadContents(void) throw (); + storeScratchpadContents(void) throw (); /** * Load the contents of the Scratchpad as a user preference. */ void - loadScratchpadContents(void) throw (); + loadScratchpadContents(void) throw (); /** * Release the resources used by the output audio player. @@ -256,7 +262,7 @@ class GLiveSupport : public LocalizedConfigurable, /** * Constructor. */ - GLiveSupport(void) throw () + GLiveSupport(void) throw () : outputPlayerIsPaused(false), cuePlayerIsPaused(false) { @@ -267,7 +273,7 @@ class GLiveSupport : public LocalizedConfigurable, * Virtual destructor. */ virtual - ~GLiveSupport(void) throw () + ~GLiveSupport(void) throw () { if (outputPlayer.get()) { outputPlayer->deInitialize(); @@ -284,7 +290,7 @@ class GLiveSupport : public LocalizedConfigurable, * @return the name of the expected XML configuration element. */ static const std::string - getConfigElementName(void) throw () + getConfigElementName(void) throw () { return configElementNameStr; } @@ -313,7 +319,7 @@ class GLiveSupport : public LocalizedConfigurable, * false otherwise */ bool - checkConfiguration(void) throw (); + checkConfiguration(void) throw (); /** * Display a message window. @@ -322,14 +328,15 @@ class GLiveSupport : public LocalizedConfigurable, * @param message the message to display */ void - displayMessageWindow(Ptr::Ref message) throw (); + displayMessageWindow(Ptr::Ref message) + throw (); /** * Show the main window, and run the application. * This call will only return after the main window has been closed. */ void - show(void) throw (); + show(void) throw (); /** * Change the language of the application. @@ -356,7 +363,7 @@ class GLiveSupport : public LocalizedConfigurable, */ bool login(const std::string & login, - const std::string & password) throw (); + const std::string & password) throw (); /** * Return the session id for the user. @@ -368,7 +375,7 @@ class GLiveSupport : public LocalizedConfigurable, * @see #login */ Ptr::Ref - getSessionId(void) const throw () + getSessionId(void) const throw () { return sessionId; } @@ -380,7 +387,7 @@ class GLiveSupport : public LocalizedConfigurable, * @see #logout */ void - logout(void) throw (); + logout(void) throw (); /** * Accessor function to the scheduler client held by this object. @@ -388,7 +395,7 @@ class GLiveSupport : public LocalizedConfigurable, * @return the scheduler client held by this object. */ Ptr::Ref - getScheduler(void) throw () + getScheduler(void) throw () { return scheduler; } @@ -399,7 +406,7 @@ class GLiveSupport : public LocalizedConfigurable, * @return the storage client held by this object. */ Ptr::Ref - getStorage(void) throw () + getStorage(void) throw () { return storage; } @@ -410,11 +417,22 @@ class GLiveSupport : public LocalizedConfigurable, * @return the map of supported languages. */ Ptr::Ref - getSupportedLanguages(void) const throw () + getSupportedLanguages(void) const throw () { return supportedLanguages; } + /** + * Return a container with all supported metadata types. + * + * @return the metadata type container + */ + Ptr::Ref + getMetadataTypeContainer(void) const throw () + { + return metadataTypeContainer; + } + /** * Show the UI components that are visible when no one is logged in. */ @@ -593,7 +611,7 @@ class GLiveSupport : public LocalizedConfigurable, */ virtual void deletePlayable(Ptr::Ref playable) - throw (XmlRpcException); + throw (XmlRpcException); /** * Play a Playable object using the output audio player. diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.cxx b/livesupport/products/gLiveSupport/src/SearchWindow.cxx index 0926e9c98..ae89bab42 100644 --- a/livesupport/products/gLiveSupport/src/SearchWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SearchWindow.cxx @@ -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,9 +166,11 @@ SearchWindow :: constructAdvancedSearchView(void) throw () Ptr::Ref wf = WidgetFactory::getInstance(); // the three main components of the window - advancedSearchEntry = Gtk::manage(new AdvancedSearchEntry(getBundle())); - Gtk::Box * searchButtonBox = Gtk::manage(new Gtk::HButtonBox( - Gtk::BUTTONBOX_END )); + advancedSearchEntry = Gtk::manage(new AdvancedSearchEntry( + gLiveSupport->getMetadataTypeContainer(), + getBundle() )); + Gtk::Box * searchButtonBox = Gtk::manage(new Gtk::HButtonBox( + Gtk::BUTTONBOX_END )); // set up the callback function for the entry field advancedSearchEntry->connectCallback(sigc::mem_fun( diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index fdf292935..cfc866d8e 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -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" } + } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index 884af8c44..ad4a52252 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -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" } + } }