added browse tab to the Search window
This commit is contained in:
parent
4749cd5c81
commit
afb16ee5dd
13 changed files with 270 additions and 154 deletions
|
@ -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:
|
||||
* <ul>
|
||||
* <li>type - values in (audioClip | playlist | all); the default is
|
||||
* <i>audioClip</i></li>
|
||||
* <i>all</i></li>
|
||||
* <li>operator - values in (and | or); the default is <i>and</i></li>
|
||||
* <li>condition1 : { key : string, comparison: string, value : string }
|
||||
* - a search condition, where <i>key</i> 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)
|
||||
|
|
|
@ -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<void> 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<void>
|
||||
signalSelectionChanged(void) throw ();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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") ));
|
||||
|
|
|
@ -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<void>
|
||||
ComboBoxText :: signalSelectionChanged(void) throw ()
|
||||
{
|
||||
return signalSelectionChangedObject;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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 <iostream>
|
||||
|
||||
#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<ResourceBundle>::Ref bundle)
|
||||
BrowseEntry :: BrowseEntry(
|
||||
Ptr<LiveSupport::GLiveSupport::GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ()
|
||||
: LocalizedObject(bundle)
|
||||
{
|
||||
BrowseItem * searchOptionsBox = Gtk::manage(new
|
||||
BrowseItem(true, getBundle()) );
|
||||
pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
|
||||
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 ));
|
||||
|
||||
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<SearchCriteria>::Ref
|
||||
BrowseEntry :: getSearchCriteria(void) throw ()
|
||||
{
|
||||
Ptr<SearchCriteria>::Ref criteria(new SearchCriteria("all", "and"));
|
||||
|
||||
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<BrowseItem *>(
|
||||
it->get_widget() );
|
||||
criteria->addCondition(child->getSearchCondition());
|
||||
}
|
||||
|
||||
return criteria;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Connect a callback to the "enter key pressed" event.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
BrowseEntry :: connectCallback(const sigc::slot<void> & 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<BrowseItem *>(
|
||||
it->get_widget() );
|
||||
child->signal_activate().connect(callback);
|
||||
}
|
||||
|
||||
browseItemOne->signalSelectionChanged().connect(
|
||||
sigc::bind<BrowseItem*>(
|
||||
sigc::mem_fun(*browseItemTwo, &BrowseItem::onParentChangedShow),
|
||||
browseItemOne ));
|
||||
browseItemTwo->signalSelectionChanged().connect(
|
||||
sigc::bind<BrowseItem*>(
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,12 +63,12 @@ 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,
|
||||
class BrowseEntry : public Gtk::HBox,
|
||||
public LocalizedObject
|
||||
{
|
||||
private:
|
||||
|
@ -76,12 +78,30 @@ 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<ResourceBundle>::Ref bundle)
|
||||
BrowseEntry(
|
||||
Ptr<LiveSupport::GLiveSupport::GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
|
@ -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<SearchCriteria>::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<void> & callback) throw ();
|
||||
sigc::signal<void>
|
||||
signalSelectionChanged(void) throw ()
|
||||
{
|
||||
return browseItemThree->signalSelectionChanged();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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<LiveSupport::GLiveSupport::GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<Glib::ustring>::Ref metadata,
|
||||
Ptr<SearchCriteria>::Ref parentCriteria,
|
||||
const Glib::ustring & metadata,
|
||||
Ptr<ResourceBundle>::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<WidgetFactory>::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<SearchCriteria::SearchConditionType>::Ref
|
||||
BrowseItem :: getSearchCondition(void) throw (std::invalid_argument)
|
||||
Ptr<SearchCriteria>::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<SearchCriteria::SearchConditionType>::Ref
|
||||
condition(new SearchCriteria::SearchConditionType(
|
||||
metadataKey, "=", metadataValue ));
|
||||
return condition;
|
||||
if (metadataValue == allString) {
|
||||
return parentCriteria;
|
||||
|
||||
} else {
|
||||
Ptr<SearchCriteria>::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<Glib::ustring>::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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Gtk::ListStore> 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<void> signalSelectionChangedObject;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -186,8 +216,7 @@ class BrowseItem : public Gtk::VBox,
|
|||
*/
|
||||
BrowseItem(
|
||||
Ptr<LiveSupport::GLiveSupport::GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<Glib::ustring>::Ref metadata,
|
||||
Ptr<SearchCriteria>::Ref parentCriteria,
|
||||
const Glib::ustring & metadata,
|
||||
Ptr<ResourceBundle>::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<SearchCriteria::SearchConditionType>::Ref
|
||||
getSearchCondition(void) throw (std::invalid_argument);
|
||||
Ptr<SearchCriteria>::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<void>
|
||||
signalSelectionChanged(void) throw ()
|
||||
{
|
||||
return signalSelectionChangedObject;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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,26 +202,18 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
|
|||
Gtk::VBox*
|
||||
SearchWindow :: constructBrowseView(void) throw ()
|
||||
{
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
// set up the browse input fields
|
||||
browseEntry = Gtk::manage(new BrowseEntry(gLiveSupport, getBundle()));
|
||||
|
||||
// FIXME
|
||||
Ptr<Glib::ustring>::Ref metadata(new Glib::ustring("Title"));
|
||||
Ptr<SearchCriteria>::Ref criteria(new SearchCriteria);
|
||||
|
||||
// set up the selection panel
|
||||
// FIXME
|
||||
BrowseItem * browsePanel = Gtk::manage(new BrowseItem(
|
||||
gLiveSupport,
|
||||
metadata,
|
||||
criteria,
|
||||
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(*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.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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" }
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue