fixed CuePlayer to support multiple selections

This commit is contained in:
fgerlits 2005-05-24 16:58:30 +00:00
parent 783e0092b5
commit c01fabbd1a

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/CuePlayer.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/CuePlayer.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -111,21 +111,22 @@ CuePlayer :: ~CuePlayer(void) throw ()
void void
CuePlayer :: onPlayItem(void) throw () CuePlayer :: onPlayItem(void) throw ()
{ {
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = Glib::RefPtr<Gtk::TreeView::Selection>
treeView->get_selection(); selection = treeView->get_selection();
std::vector<Gtk::TreePath>
selectedRows = selection->get_selected_rows();
if (refSelection) { if (selectedRows.size() == 1) {
Gtk::TreeModel::iterator iter = refSelection->get_selected(); Gtk::TreePath path = selectedRows.front();
Gtk::TreeIter iter = treeView->get_model()->get_iter(path);
if (iter) { if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn]; Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
try { try {
gLiveSupport->playCueAudio(playable); gLiveSupport->playCueAudio(playable);
} catch (std::logic_error &e) { } catch (std::logic_error &e) {
std::cerr << "GLiveSupport::playCueAudio() error:" std::cerr << "GLiveSupport::playCueAudio() error:"
<< std::endl << e.what() << std::endl; << std::endl << e.what() << std::endl;
} }
audioState = playingState; audioState = playingState;
remove(*playButton); remove(*playButton);
pack_end(*pauseButton, Gtk::PACK_SHRINK, 3); pack_end(*pauseButton, Gtk::PACK_SHRINK, 3);