diff --git a/livesupport/modules/core/include/LiveSupport/Core/SearchCriteria.h b/livesupport/modules/core/include/LiveSupport/Core/SearchCriteria.h
index c58fe19af..2261ca346 100644
--- a/livesupport/modules/core/include/LiveSupport/Core/SearchCriteria.h
+++ b/livesupport/modules/core/include/LiveSupport/Core/SearchCriteria.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/core/include/LiveSupport/Core/SearchCriteria.h,v $
------------------------------------------------------------------------------*/
@@ -69,7 +69,7 @@ namespace Core {
* Its fields are:
*
* - type - values in (audioClip | playlist | all); the default is
- * audioClip
+ * all
* - operator - values in (and | or); the default is and
* - condition1 : { key : string, comparison: string, value : string }
* - a search condition, where key is one of the
@@ -177,7 +177,7 @@ class SearchCriteria
* @param type one of "audioClip" (default), "playlist" or "all"
* @param logicalOperator either "and" (default) or "or"
*/
- SearchCriteria(const std::string & type = "audioClip",
+ SearchCriteria(const std::string & type = "all",
const std::string & logicalOperator = "and")
throw(std::invalid_argument)
: limit(0), offset(0)
diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h
index a55646217..e959858f5 100644
--- a/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h
+++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h
@@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Author : $Author: maroy $
- Version : $Revision: 1.2 $
+ Author : $Author: fgerlits $
+ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ComboBoxText.h,v $
------------------------------------------------------------------------------*/
@@ -63,8 +63,8 @@ using namespace LiveSupport::Core;
/**
* A combo box holding text entries.
*
- * @author $Author: maroy $
- * @version $Revision: 1.2 $
+ * @author $Author: fgerlits $
+ * @version $Revision: 1.3 $
*/
class ComboBoxText : public Gtk::ComboBoxText
{
@@ -240,6 +240,11 @@ class ComboBoxText : public Gtk::ComboBoxText
virtual GtkType
child_type_vfunc() const throw ();
+ /**
+ * A signal object to notify people that the selection has changed.
+ */
+ sigc::signal signalSelectionChangedObject;
+
public:
/**
@@ -293,6 +298,20 @@ class ComboBoxText : public Gtk::ComboBoxText
void
set_active_text(const Glib::ustring & text) throw ();
+ /**
+ * Accessor for the selectionChanged signal.
+ * This signal is emitted by onMenuItemSelected() when the active
+ * text of the ComboBoxText has changed.
+ * It has the same function as Gtk::ComboBoxText::signal_changed().
+ *
+ * TODO: it would be nicer to override signal_changed();
+ * need to figure out how.
+ *
+ * @return the signal object (a protected member of this class)
+ */
+ sigc::signal
+ signalSelectionChanged(void) throw ();
+
};
diff --git a/livesupport/modules/widgets/src/AdvancedSearchItem.cxx b/livesupport/modules/widgets/src/AdvancedSearchItem.cxx
index ab3b60d76..0a3a3e057 100644
--- a/livesupport/modules/widgets/src/AdvancedSearchItem.cxx
+++ b/livesupport/modules/widgets/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/modules/widgets/src/Attic/AdvancedSearchItem.cxx,v $
------------------------------------------------------------------------------*/
@@ -178,11 +178,17 @@ AdvancedSearchItem :: readMetadataTypes(void)
metadataTypes.reset(new MapVector);
metadataTypes->push_back(std::make_pair(
- *getResourceUstring("titleMetadataDisplay"),
- *getResourceUstring("titleMetadataSearchKey") ));
+ *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") ));
diff --git a/livesupport/modules/widgets/src/ComboBoxText.cxx b/livesupport/modules/widgets/src/ComboBoxText.cxx
index b96ccf1b9..24e081b77 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.4 $
+ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ComboBoxText.cxx,v $
------------------------------------------------------------------------------*/
@@ -393,6 +393,7 @@ ComboBoxText :: onMenuItemSelected(void) throw ()
Gtk::MenuItem * item = menu->get_active();
Gtk::Label * selected = (Gtk::Label*) item->get_child();
set_active_text(selected->get_text());
+ signalSelectionChanged().emit();
}
@@ -448,3 +449,13 @@ ComboBoxText :: set_active_text(const Glib::ustring & text) throw ()
label->set_text(text);
}
+
+/*------------------------------------------------------------------------------
+ * Accessor for the selectionChanged signal.
+ *----------------------------------------------------------------------------*/
+sigc::signal
+ComboBoxText :: signalSelectionChanged(void) throw ()
+{
+ return signalSelectionChangedObject;
+}
+
diff --git a/livesupport/products/gLiveSupport/etc/Makefile.in b/livesupport/products/gLiveSupport/etc/Makefile.in
index fc1d54eac..e4840183c 100644
--- a/livesupport/products/gLiveSupport/etc/Makefile.in
+++ b/livesupport/products/gLiveSupport/etc/Makefile.in
@@ -21,7 +21,7 @@
#
#
# Author : $Author: fgerlits $
-# Version : $Revision: 1.31 $
+# Version : $Revision: 1.32 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
#
# @configure_input@
@@ -191,6 +191,7 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
${TMP_DIR}/SchedulerWindow.o \
${TMP_DIR}/SchedulePlaylistWindow.o \
${TMP_DIR}/SearchWindow.o \
+ ${TMP_DIR}/BrowseEntry.o \
${TMP_DIR}/BrowseItem.o
G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \
diff --git a/livesupport/products/gLiveSupport/src/BrowseEntry.cxx b/livesupport/products/gLiveSupport/src/BrowseEntry.cxx
index dd7bf6594..c603209a6 100644
--- a/livesupport/products/gLiveSupport/src/BrowseEntry.cxx
+++ b/livesupport/products/gLiveSupport/src/BrowseEntry.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/BrowseEntry.cxx,v $
------------------------------------------------------------------------------*/
@@ -35,13 +35,12 @@
#include
-#include "LiveSupport/Widgets/BrowseItem.h"
-
#include "BrowseEntry.h"
using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
+using namespace LiveSupport::GLiveSupport;
/* =================================================== local data structures */
@@ -57,71 +56,37 @@ using namespace LiveSupport::Widgets;
/*------------------------------------------------------------------------------
* Constructor.
*----------------------------------------------------------------------------*/
-BrowseEntry :: BrowseEntry(Ptr::Ref bundle)
- throw ()
+BrowseEntry :: BrowseEntry(
+ Ptr::Ref gLiveSupport,
+ Ptr::Ref bundle)
+ throw ()
: LocalizedObject(bundle)
{
- BrowseItem * searchOptionsBox = Gtk::manage(new
- BrowseItem(true, getBundle()) );
- pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
-
- searchOptionsBox->signal_add_new().connect(sigc::mem_fun(*this,
- &BrowseEntry::onAddNewCondition ));
-}
-
-
-/*------------------------------------------------------------------------------
- * Add a new search condition entrys item.
- *----------------------------------------------------------------------------*/
-void
-BrowseEntry :: onAddNewCondition(void) throw ()
-{
- BrowseItem * searchOptionsBox = Gtk::manage(new
- BrowseItem(false, getBundle()) );
- pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
-
- searchOptionsBox->signal_add_new().connect(sigc::mem_fun(*this,
- &BrowseEntry::onAddNewCondition ));
- searchOptionsBox->show_all_children();
- searchOptionsBox->show();
-}
-
-
-/*------------------------------------------------------------------------------
- * Return the current state of the search fields.
- *----------------------------------------------------------------------------*/
-Ptr::Ref
-BrowseEntry :: getSearchCriteria(void) throw ()
-{
- Ptr::Ref criteria(new SearchCriteria("all", "and"));
-
- Gtk::Box_Helpers::BoxList children = this->children();
- Gtk::Box_Helpers::BoxList::type_base::iterator it;
+ browseItemOne = Gtk::manage(new BrowseItem(
+ gLiveSupport,
+ *getResourceUstring("genreMetadataDisplay"),
+ bundle ));
+ browseItemTwo = Gtk::manage(new BrowseItem(
+ gLiveSupport,
+ *getResourceUstring("creatorMetadataDisplay"),
+ bundle ));
+ browseItemThree = Gtk::manage(new BrowseItem(
+ gLiveSupport,
+ *getResourceUstring("albumMetadataDisplay"),
+ bundle ));
- for (it = children.begin(); it != children.end(); ++it) {
- BrowseItem * child = dynamic_cast(
- it->get_widget() );
- criteria->addCondition(child->getSearchCondition());
- }
- return criteria;
-}
-
-
-/*------------------------------------------------------------------------------
- * Connect a callback to the "enter key pressed" event.
- *----------------------------------------------------------------------------*/
-void
-BrowseEntry :: connectCallback(const sigc::slot & callback)
- throw ()
-{
- Gtk::Box_Helpers::BoxList children = this->children();
- Gtk::Box_Helpers::BoxList::type_base::iterator it;
-
- for (it = children.begin(); it != children.end(); ++it) {
- BrowseItem * child = dynamic_cast(
- it->get_widget() );
- child->signal_activate().connect(callback);
- }
+ browseItemOne->signalSelectionChanged().connect(
+ sigc::bind(
+ sigc::mem_fun(*browseItemTwo, &BrowseItem::onParentChangedShow),
+ browseItemOne ));
+ browseItemTwo->signalSelectionChanged().connect(
+ sigc::bind(
+ sigc::mem_fun(*browseItemThree, &BrowseItem::onParentChangedShow),
+ browseItemTwo ));
+
+ pack_start(*browseItemOne, Gtk::PACK_EXPAND_WIDGET, 5);
+ pack_start(*browseItemTwo, Gtk::PACK_EXPAND_WIDGET, 5);
+ pack_start(*browseItemThree, Gtk::PACK_EXPAND_WIDGET, 5);
}
diff --git a/livesupport/products/gLiveSupport/src/BrowseEntry.h b/livesupport/products/gLiveSupport/src/BrowseEntry.h
index 065871f27..36fada061 100644
--- a/livesupport/products/gLiveSupport/src/BrowseEntry.h
+++ b/livesupport/products/gLiveSupport/src/BrowseEntry.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/BrowseEntry.h,v $
------------------------------------------------------------------------------*/
@@ -45,6 +45,8 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Core/SearchCriteria.h"
+#include "BrowseItem.h"
+#include "GLiveSupport.h"
namespace LiveSupport {
@@ -61,13 +63,13 @@ using namespace LiveSupport::Core;
/* =============================================================== data types */
/**
- * A Gtk::VBox with one or more search input fields in it.
+ * A Gtk::HBox with one or more search input fields in it.
*
* @author $Author: fgerlits $
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
-class BrowseEntry : public Gtk::VBox,
- public LocalizedObject
+class BrowseEntry : public Gtk::HBox,
+ public LocalizedObject
{
private:
@@ -76,13 +78,31 @@ class BrowseEntry : public Gtk::VBox,
*/
BrowseEntry(void) throw ();
+ /**
+ * The first BrowseItem entry field.
+ */
+ BrowseItem * browseItemOne;
+
+ /**
+ * The second BrowseItem entry field.
+ */
+ BrowseItem * browseItemTwo;
+
+ /**
+ * The third BrowseItem entry field.
+ */
+ BrowseItem * browseItemThree;
+
+
public:
/**
* Constructor with localization parameter.
*/
- BrowseEntry(Ptr::Ref bundle)
- throw ();
+ BrowseEntry(
+ Ptr::Ref gLiveSupport,
+ Ptr::Ref bundle)
+ throw ();
/**
* A virtual destructor.
@@ -92,12 +112,6 @@ class BrowseEntry : public Gtk::VBox,
{
}
- /**
- * Add a new search condition entry item.
- */
- void
- onAddNewCondition(void) throw ();
-
/**
* Return the current state of the search fields.
*
@@ -105,15 +119,23 @@ class BrowseEntry : public Gtk::VBox,
* which contains the data entered by the user
*/
Ptr::Ref
- getSearchCriteria(void) throw ();
+ getSearchCriteria(void) throw ()
+ {
+ return browseItemThree->getSearchCriteria();
+ }
+
/**
- * Connect a callback to the "enter key pressed" event.
+ * The signal raised when either the combo box or the tree view
+ * selection has changed.
*
- * @param callback the function to execute when enter is pressed.
+ * @return the signalSelectionChanged() of the last browse item
*/
- void
- connectCallback(const sigc::slot & callback) throw ();
+ sigc::signal
+ signalSelectionChanged(void) throw ()
+ {
+ return browseItemThree->signalSelectionChanged();
+ }
};
diff --git a/livesupport/products/gLiveSupport/src/BrowseItem.cxx b/livesupport/products/gLiveSupport/src/BrowseItem.cxx
index 1961a236d..33b2ed22d 100644
--- a/livesupport/products/gLiveSupport/src/BrowseItem.cxx
+++ b/livesupport/products/gLiveSupport/src/BrowseItem.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/BrowseItem.cxx,v $
------------------------------------------------------------------------------*/
@@ -60,13 +60,11 @@ using namespace LiveSupport::GLiveSupport;
*----------------------------------------------------------------------------*/
BrowseItem :: BrowseItem(
Ptr::Ref gLiveSupport,
- Ptr::Ref metadata,
- Ptr::Ref parentCriteria,
+ const Glib::ustring & metadata,
Ptr::Ref bundle)
throw ()
: LocalizedObject(bundle),
- gLiveSupport(gLiveSupport),
- parentCriteria(parentCriteria)
+ gLiveSupport(gLiveSupport)
{
try {
if (!metadataTypes) {
@@ -80,6 +78,8 @@ BrowseItem :: BrowseItem(
std::exit(1);
}
+ parentCriteria.reset(new SearchCriteria);
+
Ptr::Ref wf = WidgetFactory::getInstance();
metadataEntry = Gtk::manage(wf->createComboBoxText());
@@ -87,28 +87,32 @@ BrowseItem :: BrowseItem(
for (it = metadataTypes->begin(); it != metadataTypes->end(); ++it) {
metadataEntry->append_text(it->first);
}
- metadataEntry->set_active_text(*metadata);
- if (metadataEntry->get_active_text() != *metadata) {
+ metadataEntry->set_active_text(metadata);
+ if (metadataEntry->get_active_text() != metadata) {
metadataEntry->set_active_text(metadataTypes->front().first);
}
- pack_start(*metadataEntry, Gtk::PACK_EXPAND_WIDGET, 5);
+ metadataEntry->signalSelectionChanged().connect(sigc::mem_fun(*this,
+ &BrowseItem::onShow ));
+ pack_start(*metadataEntry, Gtk::PACK_SHRINK, 5);
treeModel = Gtk::ListStore::create(modelColumns);
metadataValues = Gtk::manage(wf->createTreeView(treeModel));
metadataValues->appendColumn("", modelColumns.column);
metadataValues->set_headers_visible(false);
- pack_start(*metadataValues, Gtk::PACK_EXPAND_WIDGET, 5);
+ metadataValues->signal_cursor_changed().connect(sigc::mem_fun(*this,
+ &BrowseItem::emitSignalSelectionChanged ));
+ pack_start(*metadataValues, Gtk::PACK_SHRINK, 5);
- reset();
+ onShow();
}
/*------------------------------------------------------------------------------
- * Return the current state of the search fields.
+ * Return the search criteria selected by the user.
*----------------------------------------------------------------------------*/
-Ptr::Ref
-BrowseItem :: getSearchCondition(void) throw (std::invalid_argument)
+Ptr::Ref
+BrowseItem :: getSearchCriteria(void) throw (std::invalid_argument)
{
std::string metadataName = metadataEntry->get_active_text();
std::string metadataKey;
@@ -134,18 +138,23 @@ BrowseItem :: getSearchCondition(void) throw (std::invalid_argument)
if (refSelection) {
Gtk::TreeModel::iterator iter = refSelection->get_selected();
if (iter) {
+ found = true;
metadataValue = (*iter)[modelColumns.column];
}
}
if (!found) {
- metadataValue = *getResourceUstring("allStringForBrowse");
- } // may throw std::invalid_argument
+ return parentCriteria; // should never happen, but für alle Fälle
+ }
- Ptr::Ref
- condition(new SearchCriteria::SearchConditionType(
- metadataKey, "=", metadataValue ));
- return condition;
+ if (metadataValue == allString) {
+ return parentCriteria;
+
+ } else {
+ Ptr::Ref criteria(new SearchCriteria(*parentCriteria));
+ criteria->addCondition(metadataKey, "=", metadataValue);
+ return criteria;
+ }
}
@@ -159,11 +168,17 @@ BrowseItem :: readMetadataTypes(void)
metadataTypes.reset(new MapVector);
metadataTypes->push_back(std::make_pair(
- *getResourceUstring("titleMetadataDisplay"),
- *getResourceUstring("titleMetadataSearchKey") ));
+ *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") ));
@@ -201,7 +216,7 @@ BrowseItem :: readOperatorTypes(void)
* Fill in the column with the possible values.
*----------------------------------------------------------------------------*/
void
-BrowseItem :: reset(void) throw ()
+BrowseItem :: onShow(void) throw ()
{
std::string metadataName = metadataEntry->get_active_text();
Ptr::Ref metadataKey(new Glib::ustring);
@@ -224,11 +239,12 @@ BrowseItem :: reset(void) throw ()
int rowNumber = 1;
Gtk::TreeModel::Row row = *treeModel->append();
try {
- row[modelColumns.column] = *getResourceUstring("allStringForBrowse");
+ allString = *getResourceUstring("allStringForBrowse");
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
+ row[modelColumns.column] = allString;
row[modelColumns.rowNumberColumn] = rowNumber++;
metadataValues->get_selection()->select(*row);
@@ -240,5 +256,7 @@ BrowseItem :: reset(void) throw ()
row[modelColumns.column] = *valuesIt;
row[modelColumns.rowNumberColumn] = rowNumber++;
}
+
+ emitSignalSelectionChanged();
}
diff --git a/livesupport/products/gLiveSupport/src/BrowseItem.h b/livesupport/products/gLiveSupport/src/BrowseItem.h
index dc60305a8..2840e39b1 100644
--- a/livesupport/products/gLiveSupport/src/BrowseItem.h
+++ b/livesupport/products/gLiveSupport/src/BrowseItem.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/BrowseItem.h,v $
------------------------------------------------------------------------------*/
@@ -72,8 +72,15 @@ using namespace LiveSupport::Widgets;
/**
* A single browse input field.
*
+ * It consists of a Widgets::ComboBoxText and a Widgets::ZebraTreeView
+ * (without header). It stores a "parent search criteria", and shows all
+ * possible metadata values of the type selected in the ComboBoxText which
+ * match this condition. The parent search criteria should be conjunction
+ * of all search conditions selected in BrowseItem objects to the left of
+ * this one.
+ *
* @author $Author: fgerlits $
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
class BrowseItem : public Gtk::VBox,
public LocalizedObject
@@ -112,7 +119,7 @@ class BrowseItem : public Gtk::VBox,
* Lists one clip per row.
*
* @author $Author: fgerlits $
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
class ModelColumns : public ZebraTreeModelColumnRecord
{
@@ -141,6 +148,12 @@ class BrowseItem : public Gtk::VBox,
*/
Glib::RefPtr treeModel;
+ /**
+ * This is pretty lame, but we store the localized version of the
+ * "--- all ---" string here.
+ */
+ Glib::ustring allString;
+
/**
* The GLiveSupport object, holding the state of the application.
*/
@@ -174,6 +187,23 @@ class BrowseItem : public Gtk::VBox,
void
readOperatorTypes(void) throw (std::invalid_argument);
+ /**
+ * Emit the "selection changed" signal.
+ */
+ void
+ emitSignalSelectionChanged(void) throw ()
+ {
+ signalSelectionChanged().emit();
+ }
+
+
+ protected:
+
+ /**
+ * A signal object to notify people that the selection has changed.
+ */
+ sigc::signal signalSelectionChangedObject;
+
public:
@@ -186,8 +216,7 @@ class BrowseItem : public Gtk::VBox,
*/
BrowseItem(
Ptr::Ref gLiveSupport,
- Ptr::Ref metadata,
- Ptr::Ref parentCriteria,
+ const Glib::ustring & metadata,
Ptr::Ref bundle)
throw ();
@@ -200,20 +229,50 @@ class BrowseItem : public Gtk::VBox,
}
/**
- * Return the current state of the search fields.
+ * Return the search criteria selected by the user.
+ * This is the parent criteria (assumed to have operator "and")
+ * with the search condition showing the current selection added
+ * (if any).
*
* @return a new LiveSupport::Storage::SearchCriteria instance,
* which contains the data entered by the user
*/
- Ptr::Ref
- getSearchCondition(void) throw (std::invalid_argument);
+ Ptr::Ref
+ getSearchCriteria(void) throw (std::invalid_argument);
/**
* Fill in the column with the possible values (limited by the
* parent criteria), and set the selection to "all".
*/
void
- reset(void) throw ();
+ onShow(void) throw ();
+
+ /**
+ * The signal handler for refreshing the treeview of metadata values,
+ * if we also need to change the parent criteria. Same as onShow(),
+ * plus changing the parent criteria.
+ *
+ * @param criteria the new parent search criteria
+ */
+ void
+ onParentChangedShow(BrowseItem * leftNeighbor)
+ throw ()
+ {
+ parentCriteria = leftNeighbor->getSearchCriteria();
+ onShow();
+ }
+
+ /**
+ * The signal raised when either the combo box or the tree view
+ * selection has changed.
+ *
+ * @return the signal object (a protected member of this class)
+ */
+ sigc::signal
+ signalSelectionChanged(void) throw ()
+ {
+ return signalSelectionChangedObject;
+ }
};
diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.cxx b/livesupport/products/gLiveSupport/src/SearchWindow.cxx
index b94a4ec5a..17aca1bb6 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.7 $
+ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $
------------------------------------------------------------------------------*/
@@ -202,27 +202,19 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
Gtk::VBox*
SearchWindow :: constructBrowseView(void) throw ()
{
- Ptr::Ref wf = WidgetFactory::getInstance();
-
-// FIXME
-Ptr::Ref metadata(new Glib::ustring("Title"));
-Ptr::Ref criteria(new SearchCriteria);
-
- // set up the selection panel
-// FIXME
- BrowseItem * browsePanel = Gtk::manage(new BrowseItem(
- gLiveSupport,
- metadata,
- criteria,
- getBundle() ));
+ // set up the browse input fields
+ browseEntry = Gtk::manage(new BrowseEntry(gLiveSupport, getBundle()));
+
+ browseEntry->signalSelectionChanged().connect(sigc::mem_fun(
+ *this, &SearchWindow::onBrowse ));
// set up the search results display
ZebraTreeView * searchResults = constructSearchResults();
// make a new box and pack the main components into it
Gtk::VBox * view = Gtk::manage(new Gtk::VBox);
- view->pack_start(*browsePanel, Gtk::PACK_EXPAND_WIDGET, 5);
- view->pack_start(*searchResults, Gtk::PACK_EXPAND_WIDGET, 5);
+ view->pack_start(*browseEntry, Gtk::PACK_EXPAND_WIDGET, 5);
+ view->pack_start(*searchResults, Gtk::PACK_EXPAND_WIDGET, 5);
return view;
}
@@ -284,6 +276,16 @@ SearchWindow :: onAdvancedSearch(void) throw ()
}
+/*------------------------------------------------------------------------------
+ * Event handler for changed selection in the Browse view.
+ *----------------------------------------------------------------------------*/
+void
+SearchWindow :: onBrowse(void) throw ()
+{
+ onSearch(browseEntry->getSearchCriteria());
+}
+
+
/*------------------------------------------------------------------------------
* Do the searching.
*----------------------------------------------------------------------------*/
diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.h b/livesupport/products/gLiveSupport/src/SearchWindow.h
index da5b21532..10a637b32 100644
--- a/livesupport/products/gLiveSupport/src/SearchWindow.h
+++ b/livesupport/products/gLiveSupport/src/SearchWindow.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.h,v $
------------------------------------------------------------------------------*/
@@ -52,8 +52,8 @@
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
#include "LiveSupport/Widgets/AdvancedSearchEntry.h"
#include "GLiveSupport.h"
-//FIXME
-#include "BrowseItem.h"
+#include "BrowseEntry.h"
+
namespace LiveSupport {
namespace GLiveSupport {
@@ -73,7 +73,7 @@ using namespace LiveSupport::Widgets;
* The Search/Browse window.
*
* @author $Author: fgerlits $
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
class SearchWindow : public WhiteWindow, public LocalizedObject
{
@@ -92,8 +92,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
/**
* The box containing the browse input fields.
*/
-// FIXME
- BrowseItem * browseEntry;
+ BrowseEntry * browseEntry;
/**
* Construct the simple search view.
@@ -144,6 +143,12 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
void
onAdvancedSearch(void) throw ();
+ /**
+ * Event handler for changed selection in the Browse view.
+ */
+ void
+ onBrowse(void) throw ();
+
/**
* Do the searching.
*/
@@ -155,7 +160,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
* Lists one clip per row.
*
* @author $Author: fgerlits $
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
class ModelColumns : public ZebraTreeModelColumnRecord
{
diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt
index 6756fb568..0504fe9e4 100644
--- a/livesupport/products/gLiveSupport/var/hu.txt
+++ b/livesupport/products/gLiveSupport/var/hu.txt
@@ -145,10 +145,14 @@ hu:table
creatorColumnLabel:string { "Előadó" }
lengthColumnLabel:string { "Hossz" }
- titleMetadataDisplay:string { "Cím" }
- titleMetadataSearchKey:string { "dc:title" }
+ genreMetadataDisplay:string { "Műfaj" }
+ genreMetadataSearchKey:string { "dc:type" }
creatorMetadataDisplay:string { "Előadó" }
creatorMetadataSearchKey:string { "dc:creator" }
+ albumMetadataDisplay:string { "Lemez" }
+ albumMetadataSearchKey:string { "dc:source" }
+ titleMetadataDisplay:string { "Cím" }
+ titleMetadataSearchKey:string { "dc:title" }
lengthMetadataDisplay:string { "Hossz" }
lengthMetadataSearchKey:string { "dcterms:extent" }
diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt
index 82142ef81..a557669ab 100644
--- a/livesupport/products/gLiveSupport/var/root.txt
+++ b/livesupport/products/gLiveSupport/var/root.txt
@@ -147,10 +147,14 @@ root:table
creatorColumnLabel:string { "Creator" }
lengthColumnLabel:string { "Length" }
- titleMetadataDisplay:string { "Title" }
- titleMetadataSearchKey:string { "dc:title" }
+ genreMetadataDisplay:string { "Genre" }
+ genreMetadataSearchKey:string { "dc:type" }
creatorMetadataDisplay:string { "Creator" }
creatorMetadataSearchKey:string { "dc:creator" }
+ albumMetadataDisplay:string { "Album" }
+ albumMetadataSearchKey:string { "dc:source" }
+ titleMetadataDisplay:string { "Title" }
+ titleMetadataSearchKey:string { "dc:title" }
lengthMetadataDisplay:string { "Length" }
lengthMetadataSearchKey:string { "dcterms:extent" }