diff --git a/livesupport/etc/doxygen.config b/livesupport/etc/doxygen.config index de6c4d5da..4798a4ede 100644 --- a/livesupport/etc/doxygen.config +++ b/livesupport/etc/doxygen.config @@ -20,8 +20,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # -# Author : $Author: maroy $ -# Version : $Revision: 1.11 $ +# Author : $Author: fgerlits $ +# Version : $Revision: 1.12 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/etc/doxygen.config,v $ #------------------------------------------------------------------------------- @@ -1003,7 +1003,7 @@ TAGFILES = \ # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. -GENERATE_TAGFILE = +GENERATE_TAGFILE = ./doc/doxygen/liveSupport.tag # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes diff --git a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h index 364755847..a191178d5 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h +++ b/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.23 $ + Version : $Revision: 1.24 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/AudioClip.h,v $ ------------------------------------------------------------------------------*/ @@ -130,7 +130,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.23 $ + * @version $Revision: 1.24 $ */ class AudioClip : public Configurable, public Playable @@ -479,6 +479,8 @@ class AudioClip : public Configurable, /** * Return the value of a metadata field in this audio clip. + * If the audio clip does not have this metadata field, returns a null + * pointer. * * @param key the name of the metadata field * @return the value of the metadata field; 0 if there is diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playable.h b/livesupport/modules/core/include/LiveSupport/Core/Playable.h index b6a8b8568..e11c7c41d 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playable.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playable.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playable.h,v $ ------------------------------------------------------------------------------*/ @@ -73,7 +73,7 @@ using namespace boost::posix_time; * It contains the methods which are common to these classes. * * @author $Author: fgerlits $ - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ class Playable : public boost::enable_shared_from_this { @@ -192,6 +192,8 @@ class Playable : public boost::enable_shared_from_this /** * Return the value of a metadata field in this audio clip or playlist. + * If the playable does not have this metadata field, returns a null + * pointer. * * @param key the name of the metadata field * @return the value of the metadata field; 0 if there is diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index 00023fd3f..c1ea6eac7 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.33 $ + Version : $Revision: 1.34 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -128,7 +128,7 @@ using namespace boost::posix_time; * * * @author $Author: fgerlits $ - * @version $Revision: 1.33 $ + * @version $Revision: 1.34 $ */ class Playlist : public Configurable, public Playable @@ -663,6 +663,8 @@ class Playlist : public Configurable, /** * Return the value of a metadata field in this playlist. + * If the playlist does not have this metadata field, returns a null + * pointer. * * @param key the name of the metadata field * @return the value of the metadata field; 0 if there is diff --git a/livesupport/modules/core/src/AudioClip.cxx b/livesupport/modules/core/src/AudioClip.cxx index e763389ab..cf7c36d82 100644 --- a/livesupport/modules/core/src/AudioClip.cxx +++ b/livesupport/modules/core/src/AudioClip.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.23 $ + Version : $Revision: 1.24 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/AudioClip.cxx,v $ ------------------------------------------------------------------------------*/ @@ -416,7 +416,7 @@ AudioClip :: getMetadata(const string &key) const if (rootList.size() == 0) { return value; } - + xmlpp::Node* metadata = rootList.front(); xmlpp::Node::NodeList nodeList = metadata->get_children(name); xmlpp::Node::NodeList::iterator it = nodeList.begin(); @@ -424,9 +424,13 @@ AudioClip :: getMetadata(const string &key) const while (it != nodeList.end()) { xmlpp::Node* node = *it; if (node->get_namespace_prefix() == prefix) { - xmlpp::Element* element = dynamic_cast (node); - value.reset(new Glib::ustring(element->get_child_text() - ->get_content())); + xmlpp::Element* element = dynamic_cast (node); + xmlpp::TextNode* textNode = element->get_child_text(); + if (textNode) { + value.reset(new Glib::ustring(textNode->get_content())); + } else { + value.reset(new Glib::ustring("")); + } return value; } ++it; diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index 382859ad2..0b1c0ba00 100644 --- a/livesupport/modules/core/src/Playlist.cxx +++ b/livesupport/modules/core/src/Playlist.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.33 $ + Version : $Revision: 1.34 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -605,9 +605,13 @@ Playlist :: getMetadata(const string &key) const while (it != nodeList.end()) { xmlpp::Node* node = *it; if (node->get_namespace_prefix() == prefix) { - xmlpp::Element* element = dynamic_cast (node); - value.reset(new Glib::ustring(element->get_child_text() - ->get_content())); + xmlpp::Element* element = dynamic_cast (node); + xmlpp::TextNode* textNode = element->get_child_text(); + if (textNode) { + value.reset(new Glib::ustring(textNode->get_content())); + } else { + value.reset(new Glib::ustring("")); + } return value; } ++it; diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/AdvancedSearchEntry.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/AdvancedSearchEntry.h index 3072713d8..c7e8d7385 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/AdvancedSearchEntry.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/AdvancedSearchEntry.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/Attic/AdvancedSearchEntry.h,v $ ------------------------------------------------------------------------------*/ @@ -66,7 +66,7 @@ using namespace LiveSupport::Core; * A Gtk::VBox with one or more search input fields in it. * * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class AdvancedSearchEntry : public Gtk::VBox, public LocalizedObject @@ -118,6 +118,14 @@ class AdvancedSearchEntry : public Gtk::VBox, */ Ptr::Ref getSearchCriteria(void) throw (); + + /** + * Connect a callback to the "enter key pressed" event. + * + * @param callback the function to execute when enter is pressed. + */ + void + connectCallback(const sigc::slot & callback) throw (); }; diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h index ebee49db4..feb9a74f5 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h @@ -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/include/LiveSupport/Widgets/EntryBin.h,v $ ------------------------------------------------------------------------------*/ @@ -65,7 +65,7 @@ using namespace LiveSupport::Core; * A container, holding a Gtk::Entry as its only child. * * @author $Author: fgerlits $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class EntryBin : public BlueBin { @@ -114,6 +114,17 @@ class EntryBin : public BlueBin { return getEntry()->get_text(); } + + /** + * The signal proxy for pressing enter in the entry field. + * + * @return the signal_activate() proxy of the Gtk::Entry. + */ + Glib::SignalProxy0 + signal_activate(void) throw () + { + return getEntry()->signal_activate(); + } }; diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraCellRenderer.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraCellRenderer.h index 0b8a0bc6e..650f8fa7b 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraCellRenderer.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraCellRenderer.h @@ -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/include/LiveSupport/Widgets/ZebraCellRenderer.h,v $ ------------------------------------------------------------------------------*/ @@ -56,9 +56,11 @@ namespace Widgets { /** * A custom cell renderer for blue-gray striped TreeView's. + * This is not used anywhere at the moment, but it's left in here because + * we will probably need (something like) this later. * * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class ZebraCellRenderer : public Gtk::CellRendererText { diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h index 6af40ccd5..b4d68e191 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h,v $ ------------------------------------------------------------------------------*/ @@ -91,7 +91,7 @@ using namespace LiveSupport::Core; * 3) connected with a TreeModelColumn using set_renderer(). * * @author $Author: fgerlits $ - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ class ZebraTreeView : public Gtk::TreeView { @@ -129,7 +129,7 @@ class ZebraTreeView : public Gtk::TreeView ~ZebraTreeView(void) throw (); /** - * Add a column to the TreeView. + * Add a text column to the TreeView. * * @param title the title of the column * @param modelColumn the model column this view will display diff --git a/livesupport/modules/widgets/src/AdvancedSearchEntry.cxx b/livesupport/modules/widgets/src/AdvancedSearchEntry.cxx index f5f3fb61a..2334dff99 100644 --- a/livesupport/modules/widgets/src/AdvancedSearchEntry.cxx +++ b/livesupport/modules/widgets/src/AdvancedSearchEntry.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/Attic/AdvancedSearchEntry.cxx,v $ ------------------------------------------------------------------------------*/ @@ -144,3 +144,14 @@ AdvancedSearchEntry :: getSearchCriteria(void) throw () return criteria; } + +/*------------------------------------------------------------------------------ + * Connect a callback to the "enter key pressed" event. + *----------------------------------------------------------------------------*/ +void +AdvancedSearchEntry :: connectCallback(const sigc::slot & callback) + throw () +{ + entryBin->signal_activate().connect(callback); +} + diff --git a/livesupport/modules/widgets/src/ZebraTreeView.cxx b/livesupport/modules/widgets/src/ZebraTreeView.cxx index 07427e806..9cfa38d93 100644 --- a/livesupport/modules/widgets/src/ZebraTreeView.cxx +++ b/livesupport/modules/widgets/src/ZebraTreeView.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.6 $ + Version : $Revision: 1.7 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ZebraTreeView.cxx,v $ ------------------------------------------------------------------------------*/ @@ -83,13 +83,18 @@ ZebraTreeView :: appendColumn( const Gtk::TreeModelColumn& modelColumn) throw () { +/* ZebraCellRenderer* renderer = Gtk::manage(new ZebraCellRenderer); // the constructor packs the renderer into the TreeViewColumn Gtk::TreeViewColumn* viewColumn = Gtk::manage(new Gtk::TreeViewColumn(title, *renderer) ); // and then we associate this renderer with the model column viewColumn->set_renderer(*renderer, modelColumn); + return append_column(*viewColumn); +*/ + // instead of the above, we just do the simple-minded thing, for now + return append_column(title, modelColumn); } @@ -121,9 +126,9 @@ ZebraTreeView :: cellDataFunction(Gtk::CellRenderer* cell, throw () { ZebraTreeModelColumnRecord model; - Colors::ColorName colorName = (*iter)[model.rowNumberColumn] ? - Colors::Gray : - Colors::LightBlue; + Colors::ColorName colorName = (*iter)[model.rowNumberColumn] % 2 + ? Colors::Gray + : Colors::LightBlue; cell->property_cell_background_gdk() = Colors::getColor(colorName); } diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index d82ff9af2..1e8ea665d 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.29 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.30 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ ------------------------------------------------------------------------------*/ @@ -510,13 +510,24 @@ GLiveSupport :: getPlaylength(Ptr::Ref uri) *----------------------------------------------------------------------------*/ void LiveSupport :: GLiveSupport :: -GLiveSupport :: uploadFile(Ptr::Ref audioClip) +GLiveSupport :: uploadFile(Ptr::Ref audioClip) throw (XmlRpcException) { storage->storeAudioClip(sessionId, audioClip); - // add the uploaded file to the Scratchpad, and update it - scratchpadContents->push_front(audioClip); + addToScratchPad(audioClip); +} + + +/*------------------------------------------------------------------------------ + * Add a file to the Scratchpad, and update it. + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: addToScratchPad(Ptr::Ref playable) + throw () +{ + scratchpadContents->push_front(playable); masterPanel->updateScratchpadWindow(); } @@ -745,3 +756,33 @@ GLiveSupport :: stopAudio(void) audioPlayerIsPaused = false; } + +/*------------------------------------------------------------------------------ + * Search in the local storage. + *----------------------------------------------------------------------------*/ +Ptr::Ref +LiveSupport :: GLiveSupport :: +GLiveSupport :: search(Ptr::Ref criteria) + throw (XmlRpcException) +{ + Ptr::Ref + results(new PlayableList); + + storage->search(sessionId, criteria); + + Ptr::Ref> >::Ref + audioClipIds = storage->getAudioClipIds(); + std::vector::Ref>::const_iterator it; + for (it = audioClipIds->begin(); it != audioClipIds->end(); ++it) { + results->push_back(storage->getAudioClip(sessionId, *it)); + } + + Ptr::Ref> >::Ref + playlistIds = storage->getPlaylistIds(); + for (it = playlistIds->begin(); it != playlistIds->end(); ++it) { + results->push_back(storage->getPlaylist(sessionId, *it)); + } + + return results; +} + diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index 6962cd049..3f68edca7 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.25 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.26 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -99,8 +99,8 @@ class MasterPanelWindow; * schedulerClientFactory elements see their * respective documentation. * - * @author $Author: maroy $ - * @version $Revision: 1.25 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.26 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -409,6 +409,14 @@ class GLiveSupport : public LocalizedConfigurable, uploadFile(Ptr::Ref audioClip) throw (XmlRpcException); + /** + * Add a file to the Scratchpad, and update it. + * + * @param playable the audio clip or playlist to be added + */ + void + addToScratchPad(Ptr::Ref playable) throw (); + /** * Return the Scratchpad contents. * @@ -575,6 +583,17 @@ class GLiveSupport : public LocalizedConfigurable, pauseAudio(void) throw (std::logic_error); + /** + * Search in the local storage. + * + * @param criteria the search conditions to use. + * @return the list of audio clips and playlists found. + * @exception XmlRpcException passed on from Storage::search() + */ + Ptr::Ref + search(Ptr::Ref criteria) + throw (XmlRpcException); + }; /* ================================================= external data structures */ diff --git a/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx b/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx index 6295e8f8c..5a25658db 100644 --- a/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -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/ScratchpadWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -126,7 +126,7 @@ ScratchpadWindow :: ScratchpadWindow (Ptr::Ref gLiveSupport, std::exit(1); } - // color the columns blue + // color the rows blue and gray treeView->setCellDataFunction(); // register the signal handler for treeview entries being clicked diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.cxx b/livesupport/products/gLiveSupport/src/SearchWindow.cxx index 3d9f07188..4e84915d9 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.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -35,6 +35,7 @@ #include #include +#include #include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/Notebook.h" @@ -45,6 +46,7 @@ using namespace Glib; +using namespace boost::posix_time; using namespace LiveSupport::Core; using namespace LiveSupport::Widgets; @@ -94,7 +96,7 @@ SearchWindow :: SearchWindow (Ptr::Ref gLiveSupport, // show set_name("searchWindow"); -// set_default_size(300, 300); + set_default_size(450, 350); set_modal(false); property_window_position().set_value(Gtk::WIN_POS_NONE); @@ -126,6 +128,28 @@ SearchWindow :: constructAdvancedSearchView(void) throw () ZebraTreeView * searchResults = Gtk::manage(wf->createTreeView( treeModel )); + // set up the callback function for the entry field + advancedSearchOptions->connectCallback(sigc::mem_fun(*this, + &SearchWindow::onSearch)); + + // add the TreeView's view columns + try { + searchResults->appendColumn(*getResourceUstring("typeColumnLabel"), + modelColumns.typeColumn); + searchResults->appendColumn(*getResourceUstring("titleColumnLabel"), + modelColumns.titleColumn); + searchResults->appendColumn(*getResourceUstring("creatorColumnLabel"), + modelColumns.creatorColumn); + searchResults->appendColumn(*getResourceUstring("lengthColumnLabel"), + modelColumns.lengthColumn); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + std::exit(1); + } + + // color the rows blue and gray + searchResults->setCellDataFunction(); + // make a new box, and pack the main components into it Gtk::VBox * view = Gtk::manage(new Gtk::VBox); view->pack_start(*advancedSearchOptions, Gtk::PACK_SHRINK, 5); @@ -149,17 +173,60 @@ SearchWindow :: constructAdvancedSearchView(void) throw () } -#include - /*------------------------------------------------------------------------------ - * Event handler for the Search button getting clicked + * Event handler for the Search button getting clicked. *----------------------------------------------------------------------------*/ void SearchWindow :: onSearchButtonClicked(void) throw () { - XmlRpc::XmlRpcValue xmlRpcValue(*advancedSearchOptions - ->getSearchCriteria()); - std::cerr << xmlRpcValue << std::endl; + onSearch(); } +/*------------------------------------------------------------------------------ + * Do the searching. + *----------------------------------------------------------------------------*/ +void +SearchWindow :: onSearch(void) throw () +{ + Ptr::Ref criteria = advancedSearchOptions + ->getSearchCriteria(); + Ptr::Ref> >::Ref + searchResults = gLiveSupport->search(criteria); + std::list::Ref>::const_iterator it; + + treeModel->clear(); + int rowNumber = 0; + + for (it = searchResults->begin(); it != searchResults->end(); + ++it, ++rowNumber) { + Ptr::Ref playable = *it; + Gtk::TreeModel::Row row = *treeModel->append(); + + row[modelColumns.rowNumberColumn] = rowNumber; + + row[modelColumns.playableColumn] = playable; + + switch (playable->getType()) { + case Playable::AudioClipType: + row[modelColumns.typeColumn] = "audioclip"; + break; + case Playable::PlaylistType: + row[modelColumns.typeColumn] = "playlist"; + break; + default: + break; + } + + Ptr::Ref title = playable->getTitle(); + row[modelColumns.titleColumn] = title ? *title : ""; + + Ptr::Ref creator = playable->getMetadata("dc:creator"); + row[modelColumns.creatorColumn] = creator ? *creator : ""; + + Ptr::Ref length = playable->getPlaylength(); + row[modelColumns.lengthColumn] = length ? to_simple_string(*length) + : ""; + } +} + diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.h b/livesupport/products/gLiveSupport/src/SearchWindow.h index 9780bc827..70bda75c7 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.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -44,7 +44,6 @@ #include #include -#include #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/LocalizedObject.h" @@ -57,7 +56,6 @@ namespace LiveSupport { namespace GLiveSupport { -using namespace boost::posix_time; using namespace LiveSupport::Core; using namespace LiveSupport::Widgets; @@ -73,7 +71,7 @@ using namespace LiveSupport::Widgets; * The Search/Browse window. * * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ class SearchWindow : public WhiteWindow, public LocalizedObject { @@ -98,12 +96,18 @@ class SearchWindow : public WhiteWindow, public LocalizedObject void onSearchButtonClicked(void) throw (); + /** + * Do the searching. + */ + void + onSearch(void) throw (); + /** * The columns model needed by Gtk::TreeView. * Lists one clip per row. * * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ class ModelColumns : public ZebraTreeModelColumnRecord { @@ -131,7 +135,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject /** * The column for the length of the audio clip or playlist. */ - Gtk::TreeModelColumn lengthColumn; + Gtk::TreeModelColumn lengthColumn; /** * Constructor. diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index a0437df5a..8cd1aaf98 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -139,6 +139,11 @@ hu:table searchByTextLabel:string { "Keresési feltétel:" } searchButtonLabel:string { "Keress!" } + + typeColumnLabel:string { "" } + titleColumnLabel:string { "Cím" } + creatorColumnLabel:string { "Előadó" } + lengthColumnLabel:string { "Hossz" } } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index e1d74c8c0..eda296560 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -141,6 +141,11 @@ root:table searchByTextLabel:string { "Search by" } searchButtonLabel:string { "Search" } + + typeColumnLabel:string { "" } + titleColumnLabel:string { "Title" } + creatorColumnLabel:string { "Creator" } + lengthColumnLabel:string { "Length" } } }