added ability to select a playlist from the detailed view
This commit is contained in:
parent
bae10ac014
commit
e7c5fe3756
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -153,6 +153,12 @@ PlaylistListWindow :: PlaylistListWindow (
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// attach the event handler for the user selecting an entry from
|
||||||
|
// the list of playlist details
|
||||||
|
detailTreeSelection = detailTreeView.get_selection();
|
||||||
|
detailTreeSelection->signal_changed().connect(
|
||||||
|
sigc::mem_fun(*this, &PlaylistListWindow::onDetailSelection));
|
||||||
|
|
||||||
// set up the button box
|
// set up the button box
|
||||||
buttonBox.pack_start(*closeButton, PACK_SHRINK);
|
buttonBox.pack_start(*closeButton, PACK_SHRINK);
|
||||||
buttonBox.set_border_width(5);
|
buttonBox.set_border_width(5);
|
||||||
|
@ -184,7 +190,7 @@ PlaylistListWindow :: showAllPlaylists(void) throw ()
|
||||||
playlists = storage->getAllPlaylists(sessionId);
|
playlists = storage->getAllPlaylists(sessionId);
|
||||||
it = playlists->begin();
|
it = playlists->begin();
|
||||||
end = playlists->end();
|
end = playlists->end();
|
||||||
while (it < end) {
|
while (it != end) {
|
||||||
playlist = *it;
|
playlist = *it;
|
||||||
row = *(listTreeModel->append());
|
row = *(listTreeModel->append());
|
||||||
lengthStr = boost::posix_time::to_simple_string(
|
lengthStr = boost::posix_time::to_simple_string(
|
||||||
|
@ -238,6 +244,38 @@ PlaylistListWindow :: onPlaylistListSelection(void) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for a row being selected in the detail tree view.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: onDetailSelection(void) throw ()
|
||||||
|
{
|
||||||
|
TreeModel::iterator iter = detailTreeSelection->get_selected();
|
||||||
|
if (iter) {
|
||||||
|
TreeModel::Row row = *iter;
|
||||||
|
Ptr<UniqueId>::Ref selectedId(new UniqueId(row[modelColumns.idColumn]));
|
||||||
|
|
||||||
|
// TODO: only proceed if the selected item is a playlist,
|
||||||
|
// not an audio clip
|
||||||
|
|
||||||
|
// find the item in listTreeModel with the same id, and select it
|
||||||
|
// TODO: find a more efficient way of doing this
|
||||||
|
TreeModel::iterator it = listTreeModel->children().begin();
|
||||||
|
TreeModel::iterator end = listTreeModel->children().end();
|
||||||
|
|
||||||
|
while (it != end) {
|
||||||
|
row = *it;
|
||||||
|
Ptr<UniqueId>::Ref id(new UniqueId(row[modelColumns.idColumn]));
|
||||||
|
if (*id == *selectedId) {
|
||||||
|
listTreeSelection->select(row);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Show the details of a playlist
|
* Show the details of a playlist
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -84,7 +84,7 @@ using namespace LiveSupport::Core;
|
||||||
* </pre></code>
|
* </pre></code>
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
class PlaylistListWindow : public Gtk::Window, public GtkLocalizedObject
|
class PlaylistListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ class PlaylistListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
* Lists one playlist per row.
|
* Lists one playlist per row.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||||
{
|
{
|
||||||
|
@ -214,6 +214,12 @@ class PlaylistListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
*/
|
*/
|
||||||
Glib::RefPtr<Gtk::TreeSelection> listTreeSelection;
|
Glib::RefPtr<Gtk::TreeSelection> listTreeSelection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree selection, as a GTK reference, holding info on
|
||||||
|
* what's selected from the detail view.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::TreeSelection> detailTreeSelection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The container holding the playlist detail tree view and accompanying
|
* The container holding the playlist detail tree view and accompanying
|
||||||
* label.
|
* label.
|
||||||
|
@ -260,6 +266,13 @@ class PlaylistListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
virtual void
|
virtual void
|
||||||
onPlaylistListSelection(void) throw ();
|
onPlaylistListSelection(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal to catch the event of the user selecting a row
|
||||||
|
* in the detail tree view.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onDetailSelection(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for the close button clicked.
|
* Signal handler for the close button clicked.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue