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,10 +117,21 @@ 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.
*/
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<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
@ -310,8 +354,7 @@ class ComboBoxText : public Gtk::ComboBoxText
* @return the signal object (a protected member of this class)
*/
sigc::signal<void>
signalSelectionChanged(void) throw ();
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
@ -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<WidgetFactory>::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<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
@ -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<CornerImages>::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<Gtk::TreeModel> 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<Glib::ustring>::Ref message) throw ();
createMessageWindow(Ptr<Glib::ustring>::Ref message) throw ();
};

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"
@ -283,7 +284,7 @@ static const std::string schedulerWindowTitleImageName
* Return the singleton instance to WidgetFactory
*----------------------------------------------------------------------------*/
Ptr<WidgetFactory>::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<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
*----------------------------------------------------------------------------*/
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<Gdk::Pixbuf> passiveImage;
Glib::RefPtr<Gdk::Pixbuf> 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<Gdk::Pixbuf> rawImage;
@ -533,7 +564,7 @@ WidgetFactory :: createImage(ImageType imageName) throw ()
*----------------------------------------------------------------------------*/
ZebraTreeView *
WidgetFactory :: createTreeView(Glib::RefPtr<Gtk::TreeModel> treeModel)
throw ()
throw ()
{
return new ZebraTreeView(treeModel);
}
@ -544,7 +575,7 @@ WidgetFactory :: createTreeView(Glib::RefPtr<Gtk::TreeModel> treeModel)
*----------------------------------------------------------------------------*/
WhiteWindow *
WidgetFactory :: createMessageWindow(Ptr<Glib::ustring>::Ref message)
throw ()
throw ()
{
return new MessageWindow(message);
}

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)
throw ()
: LocalizedObject(bundle)
AdvancedSearchEntry :: AdvancedSearchEntry(
Ptr<MetadataTypeContainer>::Ref metadataTypes,
Ptr<ResourceBundle>::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<ResourceBundle>::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<SearchCriteria>::Ref
AdvancedSearchEntry :: getSearchCriteria(void) throw ()
AdvancedSearchEntry :: getSearchCriteria(void) throw ()
{
Ptr<SearchCriteria>::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<void> & callback)
throw ()
AdvancedSearchEntry :: connectCallback(const sigc::slot<void> & callback)
throw ()
{
Gtk::Box_Helpers::BoxList children = this->children();
Gtk::Box_Helpers::BoxList::type_base::iterator it;

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,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<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,
Ptr<ResourceBundle>::Ref bundle)
throw ()
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);
}
std::string value = valueEntry->get_text();
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,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<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,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<ResourceBundle>::Ref bundle)
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.
*/
@ -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<Glib::ustring>::Ref message) throw ();
displayMessageWindow(Ptr<Glib::ustring>::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<SessionId>::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<SchedulerClientInterface>::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<StorageClientInterface>::Ref
getStorage(void) throw ()
getStorage(void) throw ()
{
return storage;
}
@ -410,11 +417,22 @@ class GLiveSupport : public LocalizedConfigurable,
* @return the map of supported languages.
*/
Ptr<const LanguageMap>::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<MetadataTypeContainer>::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<Playable>::Ref playable)
throw (XmlRpcException);
throw (XmlRpcException);
/**
* Play a Playable object using the output audio player.

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,9 +166,11 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
Ptr<WidgetFactory>::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(

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" }
}
}