added PlaylistListWindow
This commit is contained in:
parent
b5d3b9290a
commit
9f3b6e0f0a
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: maroy $
|
||||||
# Version : $Revision: 1.9 $
|
# Version : $Revision: 1.10 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -143,7 +143,8 @@ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \
|
||||||
${TMP_DIR}/UiTestMainWindow.o \
|
${TMP_DIR}/UiTestMainWindow.o \
|
||||||
${TMP_DIR}/GtkLocalizedObject.o \
|
${TMP_DIR}/GtkLocalizedObject.o \
|
||||||
${TMP_DIR}/LoginWindow.o \
|
${TMP_DIR}/LoginWindow.o \
|
||||||
${TMP_DIR}/AudioClipListWindow.o
|
${TMP_DIR}/AudioClipListWindow.o \
|
||||||
|
${TMP_DIR}/PlaylistListWindow.o
|
||||||
|
|
||||||
G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \
|
G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \
|
||||||
${TMP_DIR}/${PACKAGE_NAME}_en.res \
|
${TMP_DIR}/${PACKAGE_NAME}_en.res \
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/AudioClipListWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/AudioClipListWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -131,7 +131,6 @@ AudioClipListWindow :: AudioClipListWindow (
|
||||||
void
|
void
|
||||||
AudioClipListWindow :: showAllAudioClips(void) throw ()
|
AudioClipListWindow :: showAllAudioClips(void) throw ()
|
||||||
{
|
{
|
||||||
// list all audio clips
|
|
||||||
Ptr<SessionId>::Ref sessionId;
|
Ptr<SessionId>::Ref sessionId;
|
||||||
Ptr<StorageClientInterface>::Ref storage;
|
Ptr<StorageClientInterface>::Ref storage;
|
||||||
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClips;
|
Ptr<std::vector<Ptr<AudioClip>::Ref> >::Ref audioClips;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/AudioClipListWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/AudioClipListWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -67,7 +67,7 @@ using namespace LiveSupport::Core;
|
||||||
* A window, showing and handling audio clips.
|
* A window, showing and handling audio clips.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
class AudioClipListWindow : public Gtk::Window, public GtkLocalizedObject
|
class AudioClipListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ class AudioClipListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
* Lists one clip per row.
|
* Lists one clip per row.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ class AudioClipListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
onCloseButtonClicked(void) throw ();
|
onCloseButtonClicked(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the window contents, with all the video clips.
|
* Update the window contents, with all the audio clips.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
showAllAudioClips(void) throw ();
|
showAllAudioClips(void) throw ();
|
||||||
|
|
|
@ -0,0 +1,321 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include "PlaylistListWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace Glib;
|
||||||
|
using namespace Gtk;
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Constructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
PlaylistListWindow :: PlaylistListWindow (
|
||||||
|
Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
Ptr<ResourceBundle>::Ref bundle)
|
||||||
|
throw ()
|
||||||
|
: GtkLocalizedObject(bundle)
|
||||||
|
{
|
||||||
|
this->gLiveSupport = gLiveSupport;
|
||||||
|
|
||||||
|
try {
|
||||||
|
set_title(*getResourceUstring("windowTitle"));
|
||||||
|
closeButton.reset(new Button(
|
||||||
|
*getResourceUstring("closeButtonLabel")));
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set up the close button
|
||||||
|
closeButton->set_name("closeButton");
|
||||||
|
closeButton->set_flags(CAN_FOCUS|CAN_DEFAULT|HAS_DEFAULT);
|
||||||
|
closeButton->set_relief(RELIEF_NORMAL);
|
||||||
|
// Register the signal handler for the button getting clicked.
|
||||||
|
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&PlaylistListWindow::onCloseButtonClicked));
|
||||||
|
|
||||||
|
|
||||||
|
set_border_width(5);
|
||||||
|
set_default_size(400, 200);
|
||||||
|
|
||||||
|
add(vBox);
|
||||||
|
vBox.pack_start(hBox);
|
||||||
|
vBox.pack_start(buttonBox, PACK_SHRINK);
|
||||||
|
|
||||||
|
listScrolledWindow.add(listTreeView);
|
||||||
|
listScrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||||
|
detailScrolledWindow.add(detailTreeView);
|
||||||
|
detailScrolledWindow.set_policy(POLICY_AUTOMATIC,
|
||||||
|
POLICY_AUTOMATIC);
|
||||||
|
|
||||||
|
hBox.pack_start(listScrolledWindow);
|
||||||
|
hBox.pack_start(detailScrolledWindow);
|
||||||
|
|
||||||
|
buttonBox.pack_start(*closeButton, PACK_SHRINK);
|
||||||
|
buttonBox.set_border_width(5);
|
||||||
|
buttonBox.set_layout(BUTTONBOX_END);
|
||||||
|
|
||||||
|
// create the list tree view, and add its columns
|
||||||
|
listTreeModel = ListStore::create(modelColumns);
|
||||||
|
listTreeView.set_model(listTreeModel);
|
||||||
|
try {
|
||||||
|
listTreeView.append_column(*getResourceUstring("idColumnLabel"),
|
||||||
|
modelColumns.idColumn);
|
||||||
|
listTreeView.append_column(*getResourceUstring("lengthColumnLabel"),
|
||||||
|
modelColumns.lengthColumn);
|
||||||
|
listTreeView.append_column(*getResourceUstring("uriColumnLabel"),
|
||||||
|
modelColumns.uriColumn);
|
||||||
|
listTreeView.append_column(*getResourceUstring("tokenColumnLabel"),
|
||||||
|
modelColumns.tokenColumn);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// attach the event handler for the user selecting a playlist from
|
||||||
|
// the list of playlists
|
||||||
|
listTreeSelection = listTreeView.get_selection();
|
||||||
|
listTreeSelection->signal_changed().connect(
|
||||||
|
sigc::mem_fun(*this, &PlaylistListWindow::onPlaylistListSelection));
|
||||||
|
|
||||||
|
// create the detail tree view, and add its columns
|
||||||
|
detailTreeModel = ListStore::create(modelColumns);
|
||||||
|
detailTreeView.set_model(detailTreeModel);
|
||||||
|
try {
|
||||||
|
detailTreeView.append_column(*getResourceUstring("idColumnLabel"),
|
||||||
|
modelColumns.idColumn);
|
||||||
|
detailTreeView.append_column(*getResourceUstring("lengthColumnLabel"),
|
||||||
|
modelColumns.lengthColumn);
|
||||||
|
detailTreeView.append_column(*getResourceUstring("uriColumnLabel"),
|
||||||
|
modelColumns.uriColumn);
|
||||||
|
detailTreeView.append_column(*getResourceUstring("tokenColumnLabel"),
|
||||||
|
modelColumns.tokenColumn);
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
showAllPlaylists();
|
||||||
|
|
||||||
|
show_all_children();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Show all playlists
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: showAllPlaylists(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
Ptr<StorageClientInterface>::Ref storage;
|
||||||
|
Ptr<std::vector<Ptr<Playlist>::Ref> >::Ref playlists;
|
||||||
|
std::vector<Ptr<Playlist>::Ref>::iterator it;
|
||||||
|
std::vector<Ptr<Playlist>::Ref>::iterator end;
|
||||||
|
Ptr<Playlist>::Ref playlist;
|
||||||
|
TreeModel::Row row;
|
||||||
|
std::string lengthStr;
|
||||||
|
|
||||||
|
sessionId = gLiveSupport->getSessionId();
|
||||||
|
storage = gLiveSupport->getStorage();
|
||||||
|
playlists = storage->getAllPlaylists(sessionId);
|
||||||
|
it = playlists->begin();
|
||||||
|
end = playlists->end();
|
||||||
|
while (it < end) {
|
||||||
|
playlist = *it;
|
||||||
|
row = *(listTreeModel->append());
|
||||||
|
lengthStr = boost::posix_time::to_simple_string(
|
||||||
|
*playlist->getPlaylength());
|
||||||
|
|
||||||
|
row[modelColumns.idColumn] = playlist->getId()->getId();
|
||||||
|
row[modelColumns.lengthColumn] = lengthStr;
|
||||||
|
row[modelColumns.uriColumn] = playlist->getUri().get()
|
||||||
|
? *playlist->getUri()
|
||||||
|
: "";
|
||||||
|
row[modelColumns.tokenColumn] = playlist->getToken().get()
|
||||||
|
? *playlist->getUri()
|
||||||
|
: "";
|
||||||
|
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Destructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
PlaylistListWindow :: ~PlaylistListWindow (void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the close button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: onCloseButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for a row being selected in the playlist list tree view.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: onPlaylistListSelection(void) throw ()
|
||||||
|
{
|
||||||
|
TreeModel::iterator iter = listTreeSelection->get_selected();
|
||||||
|
if (iter) {
|
||||||
|
TreeModel::Row row = *iter;
|
||||||
|
Ptr<UniqueId>::Ref playlistId(new UniqueId(row[modelColumns.idColumn]));
|
||||||
|
|
||||||
|
showPlaylistDetails(playlistId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Show the details of a playlist
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: showPlaylistDetails(
|
||||||
|
Ptr<UniqueId>::Ref playlistId)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
Ptr<SessionId>::Ref sessionId;
|
||||||
|
Ptr<StorageClientInterface>::Ref storage;
|
||||||
|
Ptr<Playlist>::Ref playlist;
|
||||||
|
Playlist::const_iterator it;
|
||||||
|
Playlist::const_iterator end;
|
||||||
|
Ptr<PlaylistElement>::Ref playlistElement;
|
||||||
|
TreeModel::Row row;
|
||||||
|
|
||||||
|
sessionId = gLiveSupport->getSessionId();
|
||||||
|
storage = gLiveSupport->getStorage();
|
||||||
|
try {
|
||||||
|
playlist = storage->getPlaylist(sessionId, playlistId);
|
||||||
|
} catch (std::logic_error &e) {
|
||||||
|
// just don't do anything if there is no such playlist.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
detailTreeModel->clear();
|
||||||
|
it = playlist->begin();
|
||||||
|
end = playlist->end();
|
||||||
|
while (it != end) {
|
||||||
|
playlistElement = it->second;
|
||||||
|
|
||||||
|
switch (playlistElement->getType()) {
|
||||||
|
case PlaylistElement::AudioClipType:
|
||||||
|
row = *(detailTreeModel->append());
|
||||||
|
displayAudioClipDetails(playlistElement->getAudioClip(), row);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlaylistElement::PlaylistType:
|
||||||
|
row = *(detailTreeModel->append());
|
||||||
|
displayPlaylistDetails(playlistElement->getPlaylist(), row);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Display audio clip info in a row of the detail tree view.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: displayAudioClipDetails(
|
||||||
|
Ptr<AudioClip>::Ref audioClip,
|
||||||
|
Gtk::TreeModel::Row & row)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
std::string lengthStr = boost::posix_time::to_simple_string(
|
||||||
|
*audioClip->getPlaylength());
|
||||||
|
|
||||||
|
row[modelColumns.idColumn] = audioClip->getId()->getId();
|
||||||
|
row[modelColumns.lengthColumn] = lengthStr;
|
||||||
|
row[modelColumns.uriColumn] = audioClip->getUri().get()
|
||||||
|
? *audioClip->getUri()
|
||||||
|
: "";
|
||||||
|
row[modelColumns.tokenColumn] = audioClip->getToken().get()
|
||||||
|
? *audioClip->getUri()
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Display playlist info in a row of the detail tree view.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
PlaylistListWindow :: displayPlaylistDetails(
|
||||||
|
Ptr<Playlist>::Ref playlist,
|
||||||
|
Gtk::TreeModel::Row & row)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
std::string lengthStr = boost::posix_time::to_simple_string(
|
||||||
|
*playlist->getPlaylength());
|
||||||
|
|
||||||
|
row[modelColumns.idColumn] = playlist->getId()->getId();
|
||||||
|
row[modelColumns.lengthColumn] = lengthStr;
|
||||||
|
row[modelColumns.uriColumn] = playlist->getUri().get()
|
||||||
|
? *playlist->getUri()
|
||||||
|
: "";
|
||||||
|
row[modelColumns.tokenColumn] = playlist->getToken().get()
|
||||||
|
? *playlist->getUri()
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,273 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef PlaylistListWindow_h
|
||||||
|
#define PlaylistListWindow_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <unicode/resbund.h>
|
||||||
|
|
||||||
|
#include <gtkmm.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
#include "GtkLocalizedObject.h"
|
||||||
|
#include "GLiveSupport.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace GLiveSupport {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A window, showing and handling playlists.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class PlaylistListWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display audio clip info in a row of the detail tree view.
|
||||||
|
*
|
||||||
|
* @param audioClip the audio clip to display
|
||||||
|
* @param row the row in the detail tree view to display in.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
displayAudioClipDetails(Ptr<AudioClip>::Ref audioClip,
|
||||||
|
Gtk::TreeModel::Row & row)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display playlist info in a row of the detail tree view.
|
||||||
|
*
|
||||||
|
* @param playlist the playlist to display
|
||||||
|
* @param row the row in the detail tree view to display in.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
displayPlaylistDetails(Ptr<Playlist>::Ref playlist,
|
||||||
|
Gtk::TreeModel::Row & row)
|
||||||
|
throw ();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model columns, for the playlist window.
|
||||||
|
* Lists one playlist per row.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* The column for the id of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<unsigned int> idColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the length of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> lengthColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the URI of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> uriColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column for the token of the playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> tokenColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
ModelColumns(void) throw ()
|
||||||
|
{
|
||||||
|
add(idColumn);
|
||||||
|
add(lengthColumn);
|
||||||
|
add(uriColumn);
|
||||||
|
add(tokenColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The GLiveSupport object, holding the state of the application.
|
||||||
|
*/
|
||||||
|
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column model.
|
||||||
|
*/
|
||||||
|
ModelColumns modelColumns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main container in the window.
|
||||||
|
*/
|
||||||
|
Gtk::VBox vBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The container holding the two tables for playlist viewing:
|
||||||
|
* one lists the playlist, the other the details of the selected
|
||||||
|
* playlist.
|
||||||
|
*/
|
||||||
|
Gtk::HBox hBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A scrolled window holding the list of playlists
|
||||||
|
* so that the list can be scrolled.
|
||||||
|
*/
|
||||||
|
Gtk::ScrolledWindow listScrolledWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A tree view, showing rows only, the list of playlists.
|
||||||
|
*/
|
||||||
|
Gtk::TreeView listTreeView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree model, as a GTK reference, holding the list of
|
||||||
|
* playlists.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::ListStore> listTreeModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree selection, as a GTK reference, holding info on
|
||||||
|
* what's selected from the playlist list.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::TreeSelection> listTreeSelection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A scrolled window holding the details of a playlist
|
||||||
|
* so that the details can be scrolled.
|
||||||
|
*/
|
||||||
|
Gtk::ScrolledWindow detailScrolledWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A tree view, showing rows only, the details of the selected
|
||||||
|
* playlist.
|
||||||
|
*/
|
||||||
|
Gtk::TreeView detailTreeView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tree model, as a GTK reference, holding the details of a
|
||||||
|
* playlist.
|
||||||
|
*/
|
||||||
|
Glib::RefPtr<Gtk::ListStore> detailTreeModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The box containing the close button.
|
||||||
|
*/
|
||||||
|
Gtk::HButtonBox buttonBox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The close button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref closeButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal to catch the event of the user selecting a row
|
||||||
|
* in the playlist list tree view.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onPlaylistListSelection(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the close button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onCloseButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the window contents, with all the playlists.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
showAllPlaylists(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the details of a playlist in the detailTreeView.
|
||||||
|
*
|
||||||
|
* @param playlistId the id of the playlist to display.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
showPlaylistDetails(Ptr<UniqueId>::Ref playlistId) throw ();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param gLiveSupport the GLiveSupport, application object.
|
||||||
|
* @param bundle the resource bundle holding the localized
|
||||||
|
* resources for this window
|
||||||
|
*/
|
||||||
|
PlaylistListWindow(Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
Ptr<ResourceBundle>::Ref bundle) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual destructor.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~PlaylistListWindow(void) throw ();
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace GLiveSupport
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // PlaylistListWindow_h
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include "LiveSupport/Core/TimeConversion.h"
|
#include "LiveSupport/Core/TimeConversion.h"
|
||||||
#include "LoginWindow.h"
|
#include "LoginWindow.h"
|
||||||
#include "AudioClipListWindow.h"
|
#include "AudioClipListWindow.h"
|
||||||
|
#include "PlaylistListWindow.h"
|
||||||
#include "UiTestMainWindow.h"
|
#include "UiTestMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,10 +88,15 @@ UiTestMainWindow :: UiTestMainWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
logoutButton->signal_clicked().connect(sigc::mem_fun(*this,
|
logoutButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&UiTestMainWindow::onLogoutButtonClicked));
|
&UiTestMainWindow::onLogoutButtonClicked));
|
||||||
|
|
||||||
// set up the audio clip button
|
// set up the audio clip list button
|
||||||
audioClipButton.reset(new Gtk::Button("audioClips"));
|
audioClipListButton.reset(new Gtk::Button("audioClipList"));
|
||||||
audioClipButton->signal_clicked().connect(sigc::mem_fun(*this,
|
audioClipListButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
&UiTestMainWindow::onAudioClipButtonClicked));
|
&UiTestMainWindow::onAudioClipListButtonClicked));
|
||||||
|
|
||||||
|
// set up the playlist list button
|
||||||
|
playlistListButton.reset(new Gtk::Button("playlistList"));
|
||||||
|
playlistListButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&UiTestMainWindow::onPlaylistListButtonClicked));
|
||||||
|
|
||||||
// set up the quit button
|
// set up the quit button
|
||||||
quitButton.reset(new Gtk::Button("quit"));
|
quitButton.reset(new Gtk::Button("quit"));
|
||||||
|
@ -105,7 +111,8 @@ UiTestMainWindow :: UiTestMainWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
layout->add(*statusLabel);
|
layout->add(*statusLabel);
|
||||||
layout->add(*timeLabel);
|
layout->add(*timeLabel);
|
||||||
layout->add(*loginButton);
|
layout->add(*loginButton);
|
||||||
layout->add(*audioClipButton);
|
layout->add(*audioClipListButton);
|
||||||
|
layout->add(*playlistListButton);
|
||||||
layout->add(*logoutButton);
|
layout->add(*logoutButton);
|
||||||
layout->add(*quitButton);
|
layout->add(*quitButton);
|
||||||
add(*layout);
|
add(*layout);
|
||||||
|
@ -236,23 +243,44 @@ UiTestMainWindow :: onUpdateTime(int dummy) throw ()
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Event handler for the audio clip button getting clicked.
|
* Event handler for the audio clip list button getting clicked.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
UiTestMainWindow :: onAudioClipButtonClicked (void) throw ()
|
UiTestMainWindow :: onAudioClipListButtonClicked (void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<ResourceBundle>::Ref bundle;
|
Ptr<ResourceBundle>::Ref bundle;
|
||||||
try {
|
try {
|
||||||
bundle = getBundle("audioClipWindow");
|
bundle = getBundle("audioClipListWindow");
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<AudioClipListWindow>::Ref audioClipWindow(
|
Ptr<AudioClipListWindow>::Ref audioClipListWindow(
|
||||||
new AudioClipListWindow(gLiveSupport, bundle));
|
new AudioClipListWindow(gLiveSupport, bundle));
|
||||||
|
|
||||||
Gtk::Main::run(*audioClipWindow);
|
Gtk::Main::run(*audioClipListWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the audio clip list button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UiTestMainWindow :: onPlaylistListButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<ResourceBundle>::Ref bundle;
|
||||||
|
try {
|
||||||
|
bundle = getBundle("playlistListWindow");
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ptr<PlaylistListWindow>::Ref playlistListWindow(
|
||||||
|
new PlaylistListWindow(gLiveSupport, bundle));
|
||||||
|
|
||||||
|
Gtk::Main::run(*playlistListWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -66,7 +66,7 @@ using namespace LiveSupport::Core;
|
||||||
* A window, enabling interactive testing of UI components.
|
* A window, enabling interactive testing of UI components.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.6 $
|
* @version $Revision: 1.7 $
|
||||||
*/
|
*/
|
||||||
class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
|
class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
{
|
{
|
||||||
|
@ -108,9 +108,14 @@ class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
Ptr<Gtk::Button>::Ref logoutButton;
|
Ptr<Gtk::Button>::Ref logoutButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The button to that brings up the audio clip window.
|
* The button to that brings up the audio clip list window.
|
||||||
*/
|
*/
|
||||||
Ptr<Gtk::Button>::Ref audioClipButton;
|
Ptr<Gtk::Button>::Ref audioClipListButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The button to that brings up the playlist list window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref playlistListButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The gLiveSupport object, handling the logic of the application.
|
* The gLiveSupport object, handling the logic of the application.
|
||||||
|
@ -133,13 +138,19 @@ class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
|
||||||
* Signal handler for the logout button clicked.
|
* Signal handler for the logout button clicked.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
onLogoutButtonClicked(void) throw ();
|
onLogoutButtonClicked(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for the audio clip button clicked.
|
* Signal handler for the audio clip list button clicked.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
onAudioClipButtonClicked(void) throw ();
|
onAudioClipListButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the playlist list button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onPlaylistListButtonClicked(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that updates timeLabel with the current time.
|
* Function that updates timeLabel with the current time.
|
||||||
|
|
|
@ -13,7 +13,7 @@ hu:table
|
||||||
okButtonLabel:string { "Belépés" }
|
okButtonLabel:string { "Belépés" }
|
||||||
}
|
}
|
||||||
|
|
||||||
audioClipWindow:table
|
audioClipListWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Hang Anyag Ablak" }
|
windowTitle:string { "LiveSupport Hang Anyag Ablak" }
|
||||||
|
|
||||||
|
@ -24,5 +24,17 @@ hu:table
|
||||||
|
|
||||||
closeButtonLabel:string { "Bezár" }
|
closeButtonLabel:string { "Bezár" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playlistListWindow:table
|
||||||
|
{
|
||||||
|
windowTitle:string { "LiveSupport Playlist Ablak" }
|
||||||
|
|
||||||
|
idColumnLabel:string { "azonositó" }
|
||||||
|
lengthColumnLabel:string { "hossz" }
|
||||||
|
uriColumnLabel:string { "URI" }
|
||||||
|
tokenColumnLabel:string { "token" }
|
||||||
|
|
||||||
|
closeButtonLabel:string { "Bezár" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ root:table
|
||||||
okButtonLabel:string { "OK" }
|
okButtonLabel:string { "OK" }
|
||||||
}
|
}
|
||||||
|
|
||||||
audioClipWindow:table
|
audioClipListWindow:table
|
||||||
{
|
{
|
||||||
windowTitle:string { "LiveSupport Audio Clip Window" }
|
windowTitle:string { "LiveSupport Audio Clip Window" }
|
||||||
|
|
||||||
|
@ -24,5 +24,17 @@ root:table
|
||||||
|
|
||||||
closeButtonLabel:string { "close" }
|
closeButtonLabel:string { "close" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playlistListWindow:table
|
||||||
|
{
|
||||||
|
windowTitle:string { "LiveSupport Playlist Window" }
|
||||||
|
|
||||||
|
idColumnLabel:string { "id" }
|
||||||
|
lengthColumnLabel:string { "length" }
|
||||||
|
uriColumnLabel:string { "URI" }
|
||||||
|
tokenColumnLabel:string { "token" }
|
||||||
|
|
||||||
|
closeButtonLabel:string { "close" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue